File: vcfqualfilter

package info (click to toggle)
libvcflib 1.0.0~rc2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 51,048 kB
  • sloc: cpp: 30,004; perl: 474; sh: 247; makefile: 206; python: 200; ansic: 148
file content (32 lines) | stat: -rwxr-xr-x 690 bytes parent folder | download
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
#
#

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 $_;
    }
}