Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Bed file conversion doubts

    I have used BEDtools to convert bam file into bed format.
    How to convert bed to wig file? Thanks.

  • #2
    use genomeCoverageBed (with the -bg option) from bed tools to convert bed->bedgraph
    then use bedGraphToBigWig from UCSC to convert bedgraph->bigWig

    Comment


    • #3
      Perl script for .bed to .wig

      Disclaimer: I started doing Chip-seq analysis about 3 weeks ago, and have a 2 week class and about 2 months experience using Perl. Nevertheless, here is my attempt at a Perl script that converts .bed files to .wig. It uses single end 51bp reads.

      I'd appreciate any advice, particularly if anyone can point out if this isn't doing what I think it's doing

      Code:
      #!/usr/bin/perl -w
      use strict;
      
      #This script takes in a standard .bed file (chromstart in column 2, chromend in column 3) and converts it to a .wig file
      
      my $file = $ARGV[0]; my $file2 = substr($file, 0, - 4); my $outfile = "$file2.wig";	#get input filename, replace extension
      my $bp = 0;
      my @data = 0;
      my $read = 0;
      my @hits = ();
      
      
      open (IN, "<$file") || die "the file $file did not open $!\n";		#open file specified by user
      open (OUT, ">> $outfile") || die " $!\n";				#open the output file
      	
      while(<IN>){					#for each line
      	my @column = split("\t");  		#split on tab
      	my $start = $column[1];			#start bp is column 2
      	my $end = $column[2];			#end bp is column 3
      	chomp($end);
      	my $length = $end-$start;		#determinet length of read
      	$read++;				#increase counter by 1
      
      #	print "Read $read starts at $start and ends at $end and is $length bp long.\n";		#troubleshooting line to make sure each line is being read correctly
      
      	for(my $bp = $start; $bp <= $end; $bp++){		#from first to last bp of read
      		$hits[$bp]++;					#increment corresponding position by one
      #		print "bp $bp now has @hits[$bp] hit(s)\n";	#troubleshooting line to monitor hits at each bp
      	}
      }
      
      close IN;
      
      my $count = 0;
      my $item = 0;
      my $site = 0;
      
      foreach $item (@hits){				#for each line of hits
      	$site++;				#increase the count at that site
      	if (defined $item){			#will print out for all non-zero sites
      		print OUT "$site\t$item\n";
      		$count++;
      	}
      }
      
      print "There were $read reads.\n$count sites (individual bp's) had at least one hit.\n";
      
      close OUT;
      Last edited by biznatch; 11-22-2010, 05:18 PM.

      Comment


      • #4
        Is there any way to convert from *.wig* to *.bed*?
        Sameet Mehta (Ph.D.),
        Visiting Fellow,
        National Cancer Insitute,
        Bethesda,
        US.

        Comment


        • #5
          Originally posted by sameet View Post
          Is there any way to convert from *.wig* to *.bed*?
          bigWigToBedGraph

          Comment

          Latest Articles

          Collapse

          • 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
          • seqadmin
            Techniques and Challenges in Conservation Genomics
            by seqadmin



            The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

            Avian Conservation
            Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
            03-08-2024, 10:41 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, Yesterday, 06:37 PM
          0 responses
          10 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, Yesterday, 06:07 PM
          0 responses
          9 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 03-22-2024, 10:03 AM
          0 responses
          51 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 03-21-2024, 07:32 AM
          0 responses
          67 views
          0 likes
          Last Post seqadmin  
          Working...
          X