Entering edit mode
The bedtools makewindows
command can do this (and other useful "stuff") as well:
bedtools makewindows -b test.bed -w 1
chr1 10 11
chr1 11 12
chr1 12 13
chr2 100 101
chr2 101 102
chr2 102 103
That said, you can't deny general utility of the nice awk
approach that Alex describes - easy to adjust...
Not with BEDOPS, but you can run your BED file through awk
:
$ awk ' \
{ \
regionChromosome = $1; \
regionStart = $2; \
regionStop = $3; \
for (baseStart = regionStart; baseStart < regionStop; baseStart++) { \
baseStop = baseStart + 1; \
print regionChromosome"\t"baseStart"\t"baseStop; \
} \
}' regions.bed > bases.bed
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
This one is also clean, thanks!