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

              • kinpict.com
                Reply to 16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                by kinpict.com
                The part about this topic feels surprisingly grounded, and the details on the page is the bit that made me slow down. I’d keep <a href="https://kinpict.com/">ai family photo generator</a> bookmarked for later.
                Today, 06:37 PM
              • SEQadmin2
                16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                by SEQadmin2





                NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
                10-30-2026, 06:46 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 11-12-2026, 07:59 AM
              0 responses
              25 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 11-05-2026, 09:25 AM
              0 responses
              35 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 11-03-2026, 11:54 AM
              2 responses
              53 views
              0 reactions
              Last Post kinpict.com  
              Started by SEQadmin2, 10-28-2026, 09:57 AM
              0 responses
              175 views
              0 reactions
              Last Post SEQadmin2  
              Working...