a really minor point : bed is 0 based but samtools use 1-based coordinates. So it's should be something like:
bedtools makewindows -g hg19.chrom.sizes -w 1000000 | awk -F '\t' '{printf("%s:%d-%s\n",$1,int($2)+1,$3);}'
• 0 views
•
link
in addition to the good answers provided, might be useful/helpful to look at tabix. Basically, for a one time cost, tabix will index a file, making subsequent searches for a range of data ultra fast.