Question: How to convert bedgraph to wig
0
gravatar for ferbecneu
6 months ago by
ferbecneu0
ferbecneu0 wrote:

Hi, i would like to convert a bedgraph document to wig format for downstream data analyisis for which I require a wig file. 

I have it in the format:

track name=CD6_1_RPMs description="read per million" type=bedGraph
chr1 3005880 3006265 0.788085378200589
chr1 3006269 3014101 0.788085378200589

 

Its from a 4c-seq RPM normalized counts and the coordinates represent fragments generated from RE digestion.

Is it possible to do this with Bioconductor?

Thank you very much!

rtracklayer genomicranges • 342 views
ADD COMMENTlink modified 6 months ago by Michael Lawrence11k • written 6 months ago by ferbecneu0
Answer: How to convert bedgraph to wig
1
gravatar for Michael Lawrence
6 months ago by
United States
Michael Lawrence11k wrote:

bedGraph used to be a variant of WIG, so it might work as-is. But if not, then the ranges all need to be the same width, so in general they will all need to be length one. The GPos object is an efficient way to represent that, so you could load the data, convert to a GPos, and export.

Something like:

library(rtracklayer)
bg <- import("foo.bedGraph")
gp <- GPos(bg) # unfortunately need to carry over metadata manually
score(gp) <- rep(score(bg), width(bg))
export(gp, "foo.wig")

 

ADD COMMENTlink written 6 months ago by Michael Lawrence11k

Thank you very much! It was very helpful!

ADD REPLYlink written 6 months ago by ferbecneu0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 255 users visited in the last hour