How to convert bedgraph to wig
1
0
Entering edit mode
ferbecneu • 0
@ferbecneu-16188
Last seen 4.2 years ago

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 • 3.1k views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

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 COMMENT
0
Entering edit mode

Thank you very much! It was very helpful!

ADD REPLY

Login before adding your answer.

Traffic: 1009 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6