how to convert 5 column .bed file to 4 column bed file

1,608 views
Skip to first unread message

Tomaszewicz, Keith

unread,
Dec 17, 2013, 10:28:01 AM12/17/13
to gen...@soe.ucsc.edu
I have a .bed file that has 5 columns.  I need to convert it to a 4 column .bed file and then upload that file to give me the exons and exon location of my amplicons in my design.  I tried to convert it but after I converted it, I did get 4 columns so I saved as a txt file and then changed the extension to .bed and tried to import it, but it says it’s still a 5 column file when it looked like it only had 4 columns in the txt file.  Attached is the .bed file. 
 
Thanks for any help
 

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, transmission, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
IAD50966_124_Designed.bed

Matthew Speir

unread,
Dec 17, 2013, 4:40:36 PM12/17/13
to Tomaszewicz, Keith, gen...@soe.ucsc.edu
Hello Keith,

Thank you for your question about converting your 5 column bed file to a 4 column bed file. To start, it appears the file that you attached to your email is actually a six column BED detail file. There are two ways in which you can convert the file that you have sent us into a four column BED file. The first involves using the Table Browser tool, which Pauline previously provided instructions for.

If you have access to a LINUX/UNIX command line interface, this option might be easier. First, you must remove the track line at the beginning of your file, this is the line that begins with 'track'. Next, open your terminal and change into the directory in which your bed file is located. You should then be able to use the following command to pull the first four columns out of your original file and place them into another file:

cat IAD50966_124_Designed.bed | awk '{print $1 "\t" $2 "\t" $3 "\t" $4}' > output.bed

You can replace 'output.bed' with whatever you would like to name your output file.

I hope this is helpful. If you have any further questions, please reply to gen...@soe.ucsc.edu. All messages sent to that address are archived on a publicly-accessible Google Groups forum. If your question includes sensitive data, you may send it instead to genom...@soe.ucsc.edu.

Matthew Speir
UCSC Genome Bioinformatics Group
--
 

Reply all
Reply to author
Forward
0 new messages