1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#!/usr/bin/env perl
# Quality filter
#
use Getopt::Long;
my $cutoff = -1;
my $max = -1;
my $indel = 0;
my $snp = 0;
$result = GetOptions ("c|cutoff=i" => \$cutoff,
"m|max=i" => \$max,
"i|indel=i" => \$indel,
"s|snp=i" => \$snp);
while (<STDIN>) {
if ($_ =~ /^#/) {
print $_;
next;
}
if ($_ =~ /^(.*?\t){6}(.*?)\t/) {
$qual = $1;
}
if ($cutoff ne -1 and $qual >= $cutoff and ($max eq -1 or $qual <= $max)) {
print $_;
} elsif ($snp and $_ =~ "SNP" and $qual >= $snp) {
print $_;
} elsif ($indel and $_ =~ "INS\|DEL" and $qual >= $indel) {
print $_;
}
}
|