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?
Take a look at the rtracklayer package and specifically at the following man pages:
?import
?export
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.