Do you know any way to convert easily (either by R, or with other program) a BED file to WIG?
Can you give me some guidelines?
Do you know any way to convert easily (either by R, or with other program) a BED file to WIG?
Can you give me some guidelines?
Here is a specific example of how I would convert .bed
to .wig
. As @Paolo implied, it's a straight-forward procedure:
library(rtracklayer) #bioconductor
bed_loaded <- import(con="~/Downloads/my_bed.bed.gz", format="bed") #no need to unzip .gz
# bed_loaded <- import.bed(con="~/Downloads/my_bed.bed") #if you unzip
export.wig(object=bed_loaded, con="~/Downloads/bed2wig.wig")
Note that you import
and export
both have methods (wig, bed, bigwig or bw, etc.). You may directly use them without specifying the method but specifying format
argument.
This GitHub tutorial will be helpful.
Take a look at the rtracklayer package and specifically at the following man pages: