User Tools

Site Tools


read_depth.pl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

read_depth.pl [2016/11/08 09:45] (current)
hyjeong created
Line 1: Line 1:
 +  #​!/​usr/​bin/​perl
 +  ​
 +  $sum = $pos = 0;
 +  ​
 +  while (<>) {
 +      chomp;
 +      my @data = split /\t/, $_;
 +      if (!exists $seen{$data[0]} && $pos > 0) {
 +        print $data[0], "​\t",​ $sum / $pos, "​\n";​
 +        $sum = $pos = 0;
 +      } elsif (exists $seen{$data[0]}) {
 +          $sum += $data[2];
 +          $pos++;
 +      } elsif (!exists $seen{$data[0]}) {
 +          print STDERR "​Processing $data[0]...\n";​
 +          $seen{$data[0]} = '';​
 +      } 
 +  }
 +  print "​\t",​ $sum / $pos, "​\n";​
  
read_depth.pl.txt ยท Last modified: 2016/11/08 09:45 by hyjeong