The question is a bit confusing to me, at it's core I understand you want non-overlapping windows across chromosomes.
One way to achieve is to use GenomicRanges::tileGenome
function, which needs the chromosome lengths as input, e.g.
library(Biostrings)
mygenome <- readDNAStringSet(list.files(mypath,"mygenome.fa$",full=TRUE))
chrSizes <- width(mygenome)
names(chrSizes) <- names(mygenome)
print(chrSizes)
# Chr1 Chr2 Chr3 Chr4 Chr5
# 18585056 19698289 23459830 26975502 30427671
This can than be fed into tileGenomes:
library(GenomicRanges)
bins <- tileGenome(chrSizes, tilewidth=5e5, cut.last.tile.in.chrom=T)
This creates a GenomicRangeGRange object which gives you a whole repertoire of post processing options, i.e. overlapping with SNPs or NGS reads (I use the latter for genome wide coverage plots):
print(bins)
# GRanges object with 240 ranges and 0 metadata columns:
# seqnames ranges strand
# <Rle> <IRanges> <Rle>
# [1] Chr1 [ 1, 500000] *
# [2] Chr1 [ 500001, 1000000] *
# [3] Chr1 [1000001, 1500000] *
# [4] Chr1 [1500001, 2000000] *
# [5] Chr1 [2000001, 2500000] *
# ... ... ... ...
# [236] Chr5 [28000001, 28500000] *
# [237] Chr5 [28500001, 29000000] *
# [238] Chr5 [29000001, 29500000] *
# [239] Chr5 [29500001, 30000000] *
# [240] Chr5 [30000001, 30427671] *
# -------
# seqinfo: 5 sequences from an unspecified genome