Unconfigured Ad

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

    #1

    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

              • SEQadmin2
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 11:13 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, Yesterday, 10:48 AM
              0 responses
              18 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-15-2026, 10:52 AM
              0 responses
              36 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              42 views
              0 reactions
              Last Post SEQadmin2  
              Working...