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!
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!
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).
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
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
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.
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.
(+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!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...
this shouldnt be assumed but rather proven.
Your are correct ! I figure out. Thanks for your reply.
I want to convert this BED file to BigWig file using bedGraphToBigWig. But it failed owing to the labbled line with the incorrect format.
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
I learm something new from you . Thanks for you reply.