Change my bedgraph file to wig in R
1
0
Entering edit mode
margo • 0
@4769e097
Last seen 6 weeks ago
United Kingdom

I have a bedgraph file which I have loaded up into R and I am wanting to convert it to a wig file for further analysis. In R, my bedgraph file looks like this:

1   0
2   0
3   0
4   0

I am wanting to add the header variableStep chrom=1 as the first line. I then want to convert this bedgraph file to wig. Does anyone know how to do this? I want my output file to look like this:

variableStep chrom=1
1   0
2   0
3   0
4   0
bedgraph R wig • 110 views
ADD COMMENT
0
Entering edit mode
ATpoint ★ 1.6k
@atpoint-13662
Last seen 22 hours ago
Germany

Check the rtracklayer package documentation if you really want to do this in R. Or check the kentUtils set of command line tools for conversion utilities from and to the bedGraph/Wig/bigWig formats. I am not sure if you can directly go from bg to Wig with them but for sure from bg to bigWig and then there is a tool to go from bigWig to Wig. It's quite uncommon these days to use Wig anyway, check if you really need that.

ADD COMMENT

Login before adding your answer.

Traffic: 237 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