File: vcfqualfilter

package info (click to toggle)
libvcflib 1.0.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 70,520 kB
  • sloc: cpp: 39,837; python: 532; perl: 474; ansic: 317; ruby: 295; sh: 254; lisp: 148; makefile: 123; javascript: 94
file content (32 lines) | stat: -rwxr-xr-x 705 bytes parent folder | download | duplicates (3)
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 $_;
    }
}