Some lines are not well organized in BED file, how to correct them ? Thanks a lot !
1
0
Entering edit mode
10 months ago
Tom • 0

A BED file was downloaded online.

When I checked it, a few lines were not well organized.

How can I correct them?

Thanks a lot!

enter image description here

BED • 2.0k views
ADD COMMENT
1
Entering edit mode

Whatever may be wrong with your BED file, it is not in the area you highlighted. BED files are tab-separated. Because the string in column 4 is shorter in your highlighted row, everything gets shifted to the left. However, that part would look normal if you imported the file.

ADD REPLY
1
Entering edit mode

Your bed file looks fine. I guess you mean the line is not aligned with others, but this is how it is displayed. All columns are separated by tabular ("\t"), but sometimes some display looks like space.

ADD REPLY
0
Entering edit mode

(+1) and a couple of tips: use column -t my.bed | less -S for nicer display of tabular file. Even better use tableview, one of the most useful and little-known programs I've come across!

ADD REPLY
0
Entering edit mode

i think the original comment is predicated on an unproven assumption.

the awk one liner i provided is meant to prove this, only then would i make the comment matthewp made...

ADD REPLY
0
Entering edit mode

this shouldnt be assumed but rather proven.

ADD REPLY
0
Entering edit mode

Your are correct ! I figure out. Thanks for your reply.

ADD REPLY
0
Entering edit mode
Which BED file is this? How do you define 'organized'?
ADD REPLY
0
Entering edit mode

I want to convert this BED file to BigWig file using bedGraphToBigWig. But it failed owing to the labbled line with the incorrect format.

ADD REPLY
0
Entering edit mode

it doesnt look like anything is wrong, necessarily.

can you try the following command:

awk -F'\t' '{print NF}' myfile.bed | sort | uniq -c

and then tell us the output

ADD REPLY
0
Entering edit mode

I learm something new from you . Thanks for you reply.

ADD REPLY
1
Entering edit mode
10 months ago

I want to convert this BED file to BigWig file using bedGraphToBigWig

Your input file could also be called BED4+4.

The first four columns follow UCSC BED specification. The remaining four columns are just a grabbag of whatever.

In any case, you don't have a bedGraph file. A bedGraph file can also be called BED3+1. In a bedGraph file, the fourth column is the score column, instead of an identifier as is normally found in a BED4+n file.

If you try to feed a non-bedGraph file into bedGraphToBigWig then that won't work. You need an extra step to make the bedGraph file.

To potentially turn your BED4+4 into a BED3+1/bedGraph file:

sort-bed in.bed | cut -f1-3,6 > out.bedGraph

This uses BEDOPS sort-bed to sort the file in.bed, passes the sorted result to cut to cleave off the first three columns and the sixth column, and then writes a sorted bedGraph file to out.bedGraph.

I am presuming that your score data are in the sixth column. I could be wrong. Adjust this number in the cut statement depending on which field the score data of interest is coming from, if it is not the sixth column.

You should then be able to feed out.bedGraph into bedGraphToBigWig to make a bigWig file (assuming you have a chromSizes file via fetchChromSizes or other for your assembly).

ADD COMMENT
0
Entering edit mode

A good document to read on the BED specification and the terminology I am using to describe your problem and its fix is located here: https://github.com/samtools/hts-specs/blob/master/BEDv1.pdf

ADD REPLY
0
Entering edit mode

Thank you very much for your detailed reply ! Very helpful.

Now I would like to visualize the bedgrpah file to check the peaks.

But I find the range of scores is really big like the attached picture (1st chrom, 2nd start, 3rd end, 4th score).

How can I normalize it or modify it ?

Thank you again

ADD REPLY
0
Entering edit mode

What do you know about the score data? You could log-transform it, perhaps, or load it into a UCSC genome browser track, which provides different ways to render the track peaks, such as normalization or cutoffs.

ADD REPLY

Login before adding your answer.

Traffic: 1642 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