Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • rlh60
    Junior Member
    • Jul 2010
    • 4

    Wig liftover and conversion

    Hi,

    I am just wondering if there is a way to liftover wig files? Or alternatively, is it possible to convert wig files to bed so that I could liftover using UCSC and then create a new wig file?

    Thanks,
    Rebecca
    Last edited by rlh60; 07-30-2010, 04:27 AM.
  • mgogol
    Senior Member
    • Mar 2008
    • 197

    #2
    Sure, you can liftover a bedgraph or a bed file. Galaxy can do this.

    Comment

    • rlh60
      Junior Member
      • Jul 2010
      • 4

      #3
      Thanks for that, but I don't have the bed files, only .wig files, so do you know how to first convert from wig back to bed so that I can then use Galaxy?

      Thanks,
      Rebecca

      Comment

      • mgogol
        Senior Member
        • Mar 2008
        • 197

        #4
        If you have variable step wig, I have a perl script that will convert it to bed graph. If you want it, I'll clean it up and post it.

        Comment

        • rlh60
          Junior Member
          • Jul 2010
          • 4

          #5
          Yes please, that would be great!

          Thank you! :-)

          Rebecca

          Comment

          • mgogol
            Senior Member
            • Mar 2008
            • 197

            #6
            Okay, this is kind of old code and actually reads in the entire file, which isn't really necessary, but that's how I used to always do things. It also doesn't print out the track line. Right now it just adds one to every variableStep position to get the end, that should probably be changed to be based on span. Hope it helps.

            Code:
            #! /usr/bin/perl
            ####################
            # vstep_to_bedgraph.pl - convert variable step wig to bed-style wig
            # By Madelaine Gogol 
            # 11/2008 
            ####################
            
            use strict;
            
            my ($start,$value,$end,$current_chrom,@lines,$filename, $contents, @chunks);
            $filename = $ARGV[0];
            
            #read in file
            $contents = get_file_data($filename);
            
            #split file at "variableStep lines"
            @chunks = split(/\nvariableStep/,$contents);
            
            #for each chromosome
            foreach my $chunk (@chunks)
            {
            	@lines = split('\n',$chunk);
            	foreach my $line (@lines)
            	{
            		#if the line starts with a number
            		if($line =~ /^\d/)
            		{
            			($start,$value) = split(/\s+/,$line);
            			$end = $start+1;
            
            			#print out bedgraph format
            			print "$current_chrom\t$start\t$end\t$value\n";
            		}
            		
            		#otherwise, the line is a variableStep chrom=chr line
            		elsif($line =~ /\schrom=(chr\S+)/)
            		{
            			$current_chrom = $1; #define current chromosome
            		}
            	}
            }
            
            ######################################################    
            # subroutine get_file_data
            # arguments: filename
            # purpose: gets data from file given filename;
            # returns file contents
            ######################################################
            
            sub get_file_data
            {
                    my($filename) = @_;
            
                    my @filedata = ();
            
                    unless( open(GET_FILE_DATA, $filename))
                    {
                            print STDERR "Cannot open file \"$filename\": $!\n\n";
                            exit;
                    }
                    @filedata = <GET_FILE_DATA>;
                    close GET_FILE_DATA;
                    return join('',@filedata);
            }
            Last edited by mgogol; 07-30-2010, 07:57 AM.

            Comment

            • AndyP
              Junior Member
              • Nov 2013
              • 2

              #7
              It's been a long time, but I'll mention anyway I made a program that lifts bigWig files from one assembly to another in one command:

              A tool for bigWig files. Contribute to CRG-Barcelona/bwtool development by creating an account on GitHub.


              Maybe it's useful. bigWig is an easy conversion from wig and is a better format in some ways.

              Comment

              Latest Articles

              Collapse

              • GATTACAT
                Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by GATTACAT
                Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
                07-01-2026, 11:43 AM
              • SEQadmin2
                Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by SEQadmin2


                I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

                Here are nine questions we think about, in roughly the order they matter, before...
                06-18-2026, 07:11 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 11:08 AM
              0 responses
              7 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 06-30-2026, 05:37 AM
              0 responses
              11 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 06-26-2026, 11:10 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 06-17-2026, 06:09 AM
              0 responses
              53 views
              0 reactions
              Last Post SEQadmin2  
              Working...