This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merge two bigwig(+/- strand) files from RNA-seq

Hi all,

I am working on expression data from EpigeneticRoadmap and wanted to generate an expression track.(Link here)

Since the cell line expression data only has bigwig file in two separate files. One from positive strand; the other from negative strand and has negative values. UCSC BigWigMerge may not be useful since it would only add up the values of signal.

Anyone know how to merge these two bigwig files together? Thanks for the input!

rna-seq next-gen sequencing

If there's not a premade program then I can show you how to do it with a bit of python and the pyBigWig package.

Emmm. I am not that familiar with python. By a quick browse at the pyBigWig package, I need to first convert all the signal value in the negative strand to positive value, and then generate a new bigwig file with header and new value. Then I can use other tools like BigWigMerge from UCSC to merge my bigwig file?

How do I create a new bigwig file using that package?

  1. Open a new file (fp = pyBigWig.open("some_new_file.bw", "w"))
  2. Add a header (just use the .chroms() function on one of the bigWig files you want to merge).
  3. Get values at whatever resolution you want from your current files (base pair if you'd like) and average/sum/whatever them.
  4. Write them to the new file.
  5. Make sure to close the new file (fp.close()).

Did you ever get this working? I'm about to write up a script to do this myself, but it would be great if you could save me some time.

2 answers

WiggleTools which provides "Basic operations on the space of numerical functions defined on the genome using lazy evaluators for flexibility and efficiency" should handle this swimmingly

Looks promising, but the installation is a pain. I am still trying to get it installed.

If you're using conda (I highly recommend this), the conda install -c bioconda wiggletools.

could you share the snipped of code you use with wiggletools?

I think the question is not really about merging the files, which is not really possible since bigwig only allows one signal per file

Therefore we really want to display multiple bigwigs on a single track. This can be done via jbrowse with the multibigwig plugin (https://github.com/elsiklab/multibigwig/). Other genome browsers may have something similar

Log in to answer this question.