Reference Code backup Executable files
Merge together multiple bigWigs into a single output bedGraph.
bigWigMerge in1.bw in2.bw .. inN.bw out.bedGraph
This tool is part of UCSC Genome Browser's utilities.
bigWigMerge
merge bigWig files by adding together the signal values.
After running this command, you will have to run bedGraphToBigWig
to make the output bigWig.
If there are negative values in any of your bigWig files, bigWigMerge will ignore these loci with non-positive values. To avoid this behavior, you need to set -threshold=-10000.0
(replace -10000.0 with a value you think is smaller than the smallest value in your file). One caveat is that loci with no signal will also be dumped; if you want to remove these records, consider using awk
to do a quick filtering. Alternatively, you can use wiggletools sum
to merge bigwig files, which directly handles negative values.
# first use bigWigMerge to merge files # remember to override the default value of -threshold to a negative number bigWigMerge -threshold=-10000.0 file1_with_negative_values.bw file2_with_negative_values.bw merged.bg # use awk to remove loci with 0 signal awk 'BEGIN{FS="\t"}{if ($4!=0) print $0}' merged.bg > merged.filtered.bg