Separate Bed File To Each 60Kb Bins
2
0
Entering edit mode
10.8 years ago
filipzembol ▴ 180

Dear all, Could you help me please with my problem? I would lie to separate one bed file for chr1 to bins, which have 60 kb. For example: First bed file for the first 60kb bin will have all reads from chr1 bed file from 0 - 60000 position Second bed file for another 60 kb will have all reads from chr1 bed file from 60000 - 120 000 position etc.....

I think I can use the bedtools, but how. And if it is possible to do this awk, I will be happy... Tahnk you so much. Best Filip

bed • 7.7k views
ADD COMMENT
5
Entering edit mode
10.8 years ago
bedtools makewindows -g hg19.genome -w 60000 > hg19.60K.windows.bed

Or, if you want one file per interval:

bedtools makewindows -g hg19.genome -w 60000 | awk '{print $0 >> $1":"$2"-"$3".bed"}'

You should end up with many files named. e.g., chr1:0-60000.bed, chr1:60000-120000.bed, etc. I am not certain this is the best approach, as you will generate many, many files.

ADD COMMENT
0
Entering edit mode

I have one question, I would like to separate to each bed files. I think If I have some reads from 0-60k position I receive one bed file, from 60k-120k I receive another one etc... And this beedtools command can't do this..

ADD REPLY
0
Entering edit mode

Do you really want that - it will generate thousands of files (assuming a fairly large eukaryotic genome)? If so, I have edited the answer.

ADD REPLY
1
Entering edit mode
10.8 years ago
sjneph ▴ 690

Here is a straightforward way to do it with awk: A: Does bedops have a command similar to the bedtools makewindows?

ADD COMMENT

Login before adding your answer.

Traffic: 2264 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6