How to use pybedtools bedgraph to bigwig using Ensembl genomes
0
0
Entering edit mode
3.8 years ago
frymor2 ▴ 10

I would like to know if there is a way to convert bedgraph files into bigwig using the pybedtools package (or any other).

I am running a script to analyze some normalized bedgraph files and would like to One of the steps is this

   for i in range(len(bg_names)):
      bedgraph_to_bigwig(BedTool(bg_names[i]), chrom_sizes, bw_names[i])

but my genome is from Ensembl (so without the chr prefix of the UCSC genome) The bedgraph files look like that:

$head avenorm.bg
1   3138098 3138099 159.292
1   3138282 3138283 159.292
1   3178161 3178162 318.585
1   3178369 3178370 318.585

When running my script I get though this error message,, which makes sense, as my bed file doesn't have chr1 but 1 as chromosome name.

bedgraph_to_bigwig(BedTool(bg_names[i]), chrom_sizes, bw_names[i])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/fs/home/yeroslaviz/miniconda3/envs/py2/lib/python2.7/site-packages/pybedtools/contrib/bigwig.py", line 55, in bedgraph_to_bigwig
    "cmds: %s\nstderr:%s\nstdout:%s" % (" ".join(cmds), stderr, stdout)
ValueError: cmds: bedGraphToBigWig WK38.avenorm.bg /tmp/pybedtools.xAwgug.tmp WK38.avenorm.bw
stderr:1 is not found in chromosome sizes file

Is there any way to run bedGraphToBigWig wiht the ensembl genome, or would it be easier to convert the bed file to _chr1_?

thanks

pybedtools bigwig.py ensembl bedgraph python2 • 837 views
ADD COMMENT
0
Entering edit mode

bedGraphToBigWig is a generic tool, all you need is a genome file that lists the chromosome name and then length of the chromosome. You do not need pybedtools here.

ADD REPLY

Login before adding your answer.

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