I need to split my bed file into files with the same sequence length, but my original input file is not the whole chromosome, but a list of annotations with variable lengths and gaps between them. BedTools windowMaker will split the fragments into the requested windows size only if the original fragment is larger than the window, but in my case it does not work as I want.
For instance, suppose I have as an input the following:
chr1 0 90
chr1 149 200
chr1 249 300
chr1 310 510
And want a bed files with 100bp such as
File 1:
chr1 0 90
chr1 149 159
File 2:
chr1 159 200
chr1 249 300
chr1 310 318
And so on...
Or something like:
chr1 0 90 block1
chr1 149 159 block1
chr1 159 200 block2
chr1 249 300 block2
chr1 310 318 block2
Bedtools outputs this instead:
chr1 0 90
chr1 149 200
chr1 249 300
chr1 310 410
chr1 410 510
Is there a way to define the output based on sequence length instead of windows?
Sorry, but I don't get what you want to achieve. In file1 there are coordinates from 0 to 159 and there lengths are 90,10. In file2 coordinates are from 159 to 318 and lengths are: 41,51,8. So where is this "100bp"?
90+10=100
41+51+8=100
What I want to achieve is to have always 100bp in each file, whatever the number of line is.