I want to have a bigwig file converted into gff after having the genome coordinates and genome annotation files converted from Hg19 to Hg18. One way, would be to convert bigwig into BED, use the liftover tool and then have the BED file converted into gff. Could someone please suggest a method to convert bigwig to BED, nothing available on the net.
3 answers
Instead of bigWigToBedGraph, you might use bigWigToWig, instead, as bedgraph is BED-like but isn't exactly BED, which may affect use of UCSC's liftover tool. In any case, both binaries are available from the UCSC executables download page.
Once you have the file in WIG format, you can convert it to a UCSC BED file with the BEDOPS wig2bed conversion utility.
Alternatively, you could take the bedgraph output and convert it to BED with an added GNU awk step:
$ awk '{ \
if ($1 ~ /^chr/) { \
print $1"\t"$2"\t"$3"\tid-"NR"\t"$4; \
} \
}' foo.bedgraph \
> foo.bed
You should be able to safely run it through liftover at that point.
bigWigToBedGraph might be what you're looking for.
Follow up to Alex's reply, here is an example:
wget http://genome.ucsc.edu/goldenPath/help/examples/bigWigExample.bw
## convert to intermediate wig format
bigWigToWig bigWigExample.bw out.wig
## convert wig to bed
wig2bed < out.wig > out.bed
bigWigToWig executable is from UCSC Kent utilities. Also, make sure to read manpage for wig2bed for details, particularly on 0- vs 1-based index and preserving header data.
Log in to answer this question.
Hi there,
Any help on how to solve this error
Thanks in advance!
cheers
CN
Clear the cache and check if the file is empty