Convert Wiggle File From Hg18 To Hg19
5
1
Entering edit mode
10.6 years ago
zhouchan99 ▴ 10

Hi,

I would like to convert the wiggle file from hg18 to hg19 version. LifeOver can do that conversation for BED but not wiggle file. Could you pls let me know if any tools can do that conversion? Many thanks!

Chan

wiggle conversion hg19 • 13k views
ADD COMMENT
3
Entering edit mode

it's called LiftOver btw, much less dramatic than LifeOver ;)

ADD REPLY
9
Entering edit mode
10.6 years ago

Using the ucsc tools:http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/

  • convert wig to bigwig if needed with wigToBigWig
  • convert the bigwig to bed using bigwigToBedGraph
  • lift over the bed
  • convert the bed back to wig using bedGraphToBigWig
ADD COMMENT
2
Entering edit mode

wig2bed will do the work of steps 1 and 2: http://code.google.com/p/bedops/wiki/wig2bed

ADD REPLY
6
Entering edit mode
3.4 years ago
Qiongyi ▴ 180

I am currently doing the similar task (liftover a bigwig file from mm9 to mm10). The above answers are helpful, but I think they are not comprehensive enough for beginners to work with. So, I listed my pipeline below. Hopefully, it can help some people.

# My task: liftover from mm9 to mm10 for a big wig file. 
# All tools used below can be found @ https://genome.ucsc.edu/util.html

# 0) If you start with the wiggle file, you will need "wigToBigWig" to convert wig to bigwig;
e.g.  wigToBigWig in.wig chrom.sizes out.bw

# 1) Convert bigwig to bedGraph
bigWigToBedGraph H3K27ac.mm9.bw H3K27ac.mm9.bedGraph

# 2) Liftover from mm9 to mm10
liftOver H3K27ac.mm9.bedGraph mm9ToMm10.over.chain H3K27ac.mm10.bedGraph unMapped

# 3) Sort the bed file
sort -k1,1 -k2,2n H3K27ac.mm10.bedGraph > H3K27ac.mm10.sort.bedGraph

# 4) Fix the overlapping intervals
# The bed file from liftover might have overlapping intervals. You will hit error if directly using bedGraphToBigWig for file conversion. In this case, you need to split the overlapping intervals and assign mean signal to a new bed file.
awk -vOFS="\t" '{ print $1, $2, $3, ".", $4 }'  H3K27ac.mm10.sort.bedGraph > tmp.bed
bedops --partition tmp.bed | bedmap --echo --mean --delim '\t' - tmp.bed >  H3K27ac.mm10.split.bedGraph

# 5) Convert bedGraph to bigwig 
bedGraphToBigWig H3K27ac.mm10.split.bedGraph mm10.sizes.genome H3K27ac.mm10.bw

Done! Have fun!

ADD COMMENT
2
Entering edit mode
5.7 years ago
Shicheng Guo ★ 9.4k

hg38bwTohg19bw.pl

use strict;
use Cwd;
use POSIX;
my $dir = getcwd;
my @file=glob("*.hg38.bw");
foreach my $file(@file){
open OUT,">$file.job";
my ($fn)=split/.hg38.bw/,$file;
print OUT "#PBS -N $fn\n";
print OUT "#PBS -l nodes=1:ppn=1\n";
print OUT "cd /gpfs/home/run/blueprint\n";
#print OUT "bigWigToBedGraph $file $fn.hg38.bedgraph\n";
#print OUT "liftOver $fn.hg38.bedgraph hg38ToHg19.over.chain.gz  $fn.hg19.bedgraph unmap\n";
print OUT "bedtools sort -i $fn.hg19.bedgraph > $fn.hg19.bedgraph.sort\n";
print OUT "bedGraphToBigWig $fn.hg19.bedgraph.sort hg19.chrom.sizes $fn.hg19.bw\n";
}
close OUT;

Possible problem:

  1. repeat loci might be come out when transfer bw to bedgraph
  2. might need sort -u before bedtools sort
  3. unique regions in raw file might have duplicated and overlapped new regions.
  4. and therefore you need unqiue and interact operation
ADD COMMENT
2
Entering edit mode
5.7 years ago

This is an old question, but if you're using UCSC liftOver, you may want to do a lift-over (map) operation in both directions, to get those intervals that map between genomes in a consistent manner:

  1. Lift-over intervals from genome A to genome B (e.g., hg18 to hg19).
  2. Lift-over genome B intervals back to genome A.
  3. Use bedmap --exact to filter for intervals that started in genome A and mapped back to the same location in genome A.
  4. Lift-over those unambiguous intervals back to genome B (or use IDs or other hash table or dictionary-based approaches to keep a mapping of genome A to genome B, to avoid the third lift-over).

The wig2bed tool can be used to convert wiggle files to BED format.

ADD COMMENT
0
Entering edit mode
10.6 years ago
Ian 6.0k

For the record Cistrome.org have tool for doing this via a GALAXY like interface. However, their site is not working at the time of writing this.

ADD COMMENT

Login before adding your answer.

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