SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Raw counts of 12 column bed file (against multiple BAM) swaraj Bioinformatics 8 09-27-2013 06:02 AM
Is there a BED file format validator? Does a BED file have to be sorted position? LauraSmith Bioinformatics 3 05-21-2013 12:54 PM
Comparing Multiple junctions.bed files from Tophat fongchun Bioinformatics 0 03-26-2013 10:03 AM
find overlaps/common in multiple bed file epi Bioinformatics 11 02-05-2013 06:47 AM
finding common genomic regions from multiple (>2) BED files a_mt Bioinformatics 4 01-31-2013 04:00 PM

Reply
 
Thread Tools
Old 05-20-2013, 03:35 AM   #1
albireo
Member
 
Location: Europe

Join Date: Sep 2012
Posts: 39
Default Splitting a bed file in multiple bed files by track

Hi

I have a large combined bed files with several tracks (peaks called for several experiments) of the form

track name="track name 1" description="description1" visibility=2
chr1 1580180 1580696 3 12
chr1 1645419 1645941 4 19
chr1 1700177 1700614 5 10
...
track name="track name 2" description="description1" visibility=2
chr1...
chr2...
chrX


etc

is there a quick way to split this file into multiple beds (one for eack track)?

Thanks a lot for your help
albireo is offline   Reply With Quote
Old 05-20-2013, 07:50 AM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,079
Default

See if this works.

Code:
awk '/^track/{x="Track"++i".bed";}{print > x;}' your_bed_file
This should produce multiple files (one for each track) with names like "Track1.bed Track2.bed" etc. Modify the word highlighted in red to get corresponding file names.

Last edited by GenoMax; 05-20-2013 at 07:55 AM.
GenoMax is offline   Reply With Quote
Old 05-21-2013, 05:51 AM   #3
albireo
Member
 
Location: Europe

Join Date: Sep 2012
Posts: 39
Default

works like a charm thanks a lot!!
albireo is offline   Reply With Quote
Old 12-18-2014, 12:58 PM   #4
zgtmann
Member
 
Location: Czech Republic

Join Date: Feb 2013
Posts: 13
Default

awk '{print $0 >> $1".bed"}' in_bed
zgtmann is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 06:04 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO