Question: Separate Bed File To Each 60Kb Bins
0
gravatar for filipzembol
5.1 years ago by
filipzembol100
filipzembol100 wrote:

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 • 3.6k views
ADD COMMENTlink modified 5.1 years ago by sjneph600 • written 5.1 years ago by filipzembol100
5
gravatar for Aaronquinlan
5.1 years ago by
Aaronquinlan10k
United States
Aaronquinlan10k wrote:
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 COMMENTlink modified 5.1 years ago • written 5.1 years ago by Aaronquinlan10k

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 REPLYlink written 5.1 years ago by filipzembol100

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 REPLYlink written 5.1 years ago by Aaronquinlan10k
1
gravatar for sjneph
5.1 years ago by
sjneph600
sjneph600 wrote:

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

ADD COMMENTlink written 5.1 years ago by sjneph600
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1781 users visited in the last hour