How To Combine Multiple Wig/Bigwig Files Into One
4
6
Entering edit mode
13.4 years ago
Yuan ▴ 60

Hi,

I have wiggle files for each chromosome generated from MACS peak calling. Instead create a custom track for each chromosome from these wiggle files, is there a way to combine them into a single wig/bigwig so that I can look at them on UCSC genome browser? Thanks in advance!

chip-seq wiggle format ucsc conversion • 17k views
ADD COMMENT
0
Entering edit mode

Please accept one of the many good answers to your question.

ADD REPLY
6
Entering edit mode
13.4 years ago

Thanks alot, this was very helpfull to me aswell. To remove heades and combine the wig files in a bigwig file i used:

zcat *.wig.gz | grep -v ^track | wigToBigWig -clip stdin genome.table output.bigwig

Mvh Anders

ADD COMMENT
0
Entering edit mode

What is genome.table exactly, please?

ADD REPLY
0
Entering edit mode

that would be a list of chromosome names and lengths (two columns, tab separated, often called chrom.sizes at ucsc)

ADD REPLY
3
Entering edit mode
13.4 years ago

If there is only one chromosome per file, you can just concatenate those wig:

cat chr*.wig > genome.wig
ADD COMMENT
0
Entering edit mode

I was wondering why they were using -clip. But your answer seems to suggest that -clip is not necessary

ADD REPLY
3
Entering edit mode
13.4 years ago
Dawe ▴ 270

If you have multiple wig files (and MACS wig are gzipped) you should concatenate:

zcat *.wig.gz | wigToBigWig -clip stdin chromsizes.tab output.bigwig

If you have only one file (and macs14 allows this) you can directly go with

wigToBigWig -clip stdin chromsizes.tab output.bigwig

As recent wigToBigWig support gziped input.

ADD COMMENT
0
Entering edit mode

Where do I get chromsizes.tab, please?

ADD REPLY
1
Entering edit mode
13.4 years ago
Ian 6.0k

In case you didn't already know MACS 1.4 beta has a function to create a single WIG file, use '--wig --single-wig'.

The important point is that you MUST remove the track header from the top of each WIG file before you merge them and convert them to bigWig. I like to keep a copy of the header.

Keep header:

head -n 1 *chr1.wig > header

Remove first line (track header):

sed -i '1d' *wig

Hope this helps!

ADD COMMENT

Login before adding your answer.

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