From ececa9f899791ea15517092f0bacffa98ca6512c Mon Sep 17 00:00:00 2001 From: Heng Li Date: Tue, 14 Apr 2009 21:10:46 +0000 Subject: [PATCH] * samtools.pl-0.1.1 * improve indelFilter to avoid filtering true indels. The new filter relies on the new pileup indel line implemented in samtools-0.1.2-25 --- misc/samtools.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/misc/samtools.pl b/misc/samtools.pl index 0b77782..8f109e0 100755 --- a/misc/samtools.pl +++ b/misc/samtools.pl @@ -6,7 +6,7 @@ use strict; use warnings; use Getopt::Std; -my $version = '0.1.0'; +my $version = '0.1.1'; &usage if (@ARGV < 1); my $command = shift(@ARGV); @@ -36,8 +36,8 @@ sub showALEN { # sub indelFilter { - my %opts = (D=>100, m=>10, r=>undef); - getopts('D:m:r', \%opts); + my %opts = (D=>100, m=>10, r=>undef, s=>100); + getopts('D:m:rs:', \%opts); # -s for scaling factor in score calculation die(qq/ Usage: samtools.pl indelFilter [options] \n @@ -56,7 +56,11 @@ Options: -D INT maximum read depth [$opts{D}] next if ($t[5] == 0); } next if ($t[7] > $opts{D}); - @$curr = ($t[0], $t[1], $t[5], $_); + # calculate indel score + my $score = $t[5]; + $score += $opts{s} * $t[10] if ($t[8] ne '*'); + $score += $opts{s} * $t[11] if ($t[9] ne '*'); + @$curr = ($t[0], $t[1], $score, $_); my $do_swap = 1; if (defined $last->[0]) { if ($curr->[0] eq $last->[0] && $last->[1] + $opts{m} > $curr->[1]) { -- 2.39.5