Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

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

    Comment


    • #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


      • #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


        • #5
          Yes please, that would be great!

          Thank you! :-)

          Rebecca

          Comment


          • #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


            • #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

              • seqadmin
                Current Approaches to Protein Sequencing
                by seqadmin


                Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                04-04-2024, 04:25 PM
              • seqadmin
                Strategies for Sequencing Challenging Samples
                by seqadmin


                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                03-22-2024, 06:39 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              30 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              32 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 09:21 AM
              0 responses
              28 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-04-2024, 09:00 AM
              0 responses
              53 views
              0 likes
              Last Post seqadmin  
              Working...
              X