Created
July 30, 2011 22:34
-
-
Save mjclark/1116086 to your computer and use it in GitHub Desktop.
Create a BED file of windows of any size from another BED file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Command: cat in.bed | perl windowize-bed.pl <windowsize> > out.bed | |
$windowsize=shift; | |
$ctr=0; | |
print STDERR "$ctr"; | |
while($line=<STDIN>) { | |
$ctr++; | |
print STDERR "\r$ctr"; | |
chomp($line); | |
@line=split(/\t/, $line); | |
for($i=$line[1]; $i<$line[2]-$windowsize+1; $i+=$windowsize) { | |
$end=$i+$windowsize; | |
print STDOUT "$line[0]\t$i\t$end\n"; | |
} | |
} | |
print STDERR "\r$ctr\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment