This one is also clean, thanks!
• 0 views
•
link
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...
This one is also clean, thanks!
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
Didn't realize it can be that simple with awk, thanks so much Alex!
Log in to answer this question.