Average bigwig files (not sum)
1
0
Entering edit mode
4.1 years ago
srhic ▴ 60

Hello,

I have bigwig (RPKM) files of a chip-seq experiment for treatment and control conditions which I am trying to compare. I have 3 replicates for control and 5 replicates for treatment condition. To show the average difference in signal, I merged the replicates for each condition using ucsc bigWigMerge command.

However, if my understanding is correct this command simply adds the signal of all replicates and so the merged treatment file is no longer comparable to the merged control file. The treatment condition has more replicates and so shows higher values than control even when the actual signal shouldn't be different. Is my understanding correct? If yes, is there a way to merge bigwig files using average instead of sum of replicates and does this make sense? (preferably without merging bam files and recreating bigwigs)

Thanks

ChIP-Seq bigwig • 8.7k views
ADD COMMENT
6
Entering edit mode
4.1 years ago
ATpoint 82k

Wiggletools has a mean command that can do it. It will accept BigWig files and output Wig files. Wig can then either be formatted into bigwig or into bedGraph. Note though that the bigwig files that e.g. WigToBigWig creates from these Wig files will be very large in size, in my experience 40-50% larger than if you first transform that Wig back to bedGraph and then to BigWig with bedGraphToBigWig. I never found out why that is but I always go Bigwigs => Wiggletools Mean => bedGraph => Bigwig to avoid these very large files.

ADD COMMENT
0
Entering edit mode

Thanks. That looks perfect.

ADD REPLY
0
Entering edit mode

how did you merge your replicates bigwig format file? did you use bigWigMerge from UCSC tools? Now ,I also average my bigwig files.Thank you!

ADD REPLY
0
Entering edit mode

I averaged them with the tool described in my answer.

ADD REPLY
0
Entering edit mode

Hi,

I have used wiggletools to average several bigwig files, but I get a "weird" format wig file (it looks like a mix of WIG and bedgraph) and I cannot convert it to bedGraph. You can see more info here: https://github.com/bedops/bedops/issues/273

I can convert that directly to a bigwig file, but as you said, the size is huge.

How do you convert wiggletools output to a proper bedGraph so I can convert it to Bigwig and "save" space?

Thanks!

ADD REPLY
1
Entering edit mode

wigToBedGraph from kentUtils

ADD REPLY
0
Entering edit mode

Thanks! I could not find that tool on the UCSC Utils... I will try to install it and see if it works.

ADD REPLY
1
Entering edit mode

I was wrong, sorry. wigToBedGraph does not exist. I just checked some old code of mine and what I did was to do first wigToBigWig, then bigWigToBedGraph and then finally bedGraphToBigWig -- these tools exist, e.g. https://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/

ADD REPLY
0
Entering edit mode

Actually there is an outdated wigToBedGraph in kent utils (https://github.com/ENCODE-DCC/kentUtils/blob/master/src/utils/wigToBedGraph/wigToBedGraph.c) that does not seem to be supported by UCSC anymore.

I tried your suggested wigToBigWig -> bigWigToBedGraph -> bedGraphToBigWig and indeed the size of the averaged bigwig file was reduced by 66% !

ADD REPLY
0
Entering edit mode

You can use WiggleTools to export the bedGraph directly and then use bedGraphToBigWig. I found that the averaged bigwig file sizes were the same by either method.

wiggletools write_bg Average.bedGraph mean Rep1.bigwig Rep2.bigwig Rep3.bigwig
bedGraphToBigWig Average.bedGraph <link/to/chrom.sizes> Average.bigwig
ADD REPLY

Login before adding your answer.

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