Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seq_GA
    Senior Member
    • Feb 2009
    • 124

    #1

    Bed file conversion doubts

    I have used BEDtools to convert bam file into bed format.
    How to convert bed to wig file? Thanks.
  • adamdeluca
    Member
    • Jul 2010
    • 95

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

    Comment

    • biznatch
      Senior Member
      • Nov 2010
      • 124

      #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

      • sameet
        Member
        • Apr 2010
        • 34

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

        Comment

        • adamdeluca
          Member
          • Jul 2010
          • 95

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

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