Question: bigwig to wig conversion, getting bedgraph
0
gravatar for mehran.karimzade
4.8 years ago by
Canada
mehran.karimzade160 wrote:

Hello,

I am using ucsc bigWigToWig conversion tool to get a wiggle format file.

However the output format I get is:

#bedGraph section chr1:10458-717292
chr1    10458    10459    7.7
chr1    10459    10460    7.8
chr1    10460    10461    7.9
chr1    10461    10462    8
chr1    10462    10464    8.1
chr1    10464    10465    8.2
chr1    10465    10467    8.3

 

I tried redownloading the tool from ucsc, checking if this is not a file name issue with ./<executable>

I tried using another bigwig file from ENCODE, same issue.

Because using ucsc bigwig to bedgraph conversion tool, I get a proper bedgraph, I decided to go backwards.

I converted bedgraph to bigwig to wig, again same thing.

The only difference that this file has compared to a usual bedgraph file is the section part added that describes schema of the following sequences(line 1 of table scheme above). While for a wiggle file format, I expect a one chromosomal position per unit output without chromosome name: http://genome.ucsc.edu/goldenpath/help/wiggle.html

I even tried using an older version of the tool from ucsc, same issue.

Any help would be much appreciated.

 

Mehran

ucsc bigwig wiggle • 3.1k views
ADD COMMENTlink modified 4.8 years ago • written 4.8 years ago by mehran.karimzade160
2
gravatar for Devon Ryan
4.8 years ago by
Devon Ryan92k
Freiburg, Germany
Devon Ryan92k wrote:

I have no clue why that's outputting bedGraph rather than wiggle format, but you can convert that to wiggle with awk:

awk '{if(NR>1) {if($1!=lastChrom){printf("variableStep chrom=%s\n",$1);lastChrom=$1;}print $2,$4}}' foo.bedGraph > foo.wig

This assumes that the first line of the bedGraph file should be ignored. This also assumes that wiggle is a 0-based format. I don't actually know if that's true or not. If it's 1-based, then just use $2+1 or $3 rather than $2. Finally, this assumes that each entry in the bedGraph file describes a single position. While one could change the code to deal with that not being the case, it'd be better to do just write a perl or python script at that point.

ADD COMMENTlink written 4.8 years ago by Devon Ryan92k
1
gravatar for mehran.karimzade
4.8 years ago by
Canada
mehran.karimzade160 wrote:

Thanks a lot Devon. The problem with this is that when we have regions not covered by bedgraph for various reasons, it will simply jump without an extra section line. This would make a problem in downstream tools using wig format.

I made this in python if someone has the similar problem and wants to solve it manually:

https://github.com/mehrankr/slow_bedGraph_to_wig/

ADD COMMENTlink written 4.8 years ago by mehran.karimzade160

Hy. I have got similar problems. Did you figure out the problem? Can you show me how to run your python script? Thanks for any help.

ADD REPLYlink written 3.1 years ago by h.botond40
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 2.3.0
Traffic: 1151 users visited in the last hour