-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfinalFiltration.pl
More file actions
executable file
·67 lines (60 loc) · 1.91 KB
/
finalFiltration.pl
File metadata and controls
executable file
·67 lines (60 loc) · 1.91 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use strict;
use Data::Dumper;
my @name;
my %colnames;
my %found;
my $file = shift;
my $type = "snv";
open IN, "$file";
while ( <IN> ) {
chomp;
my @cols = split /\t/;
if ($_ =~ /^[\#]?chr\t/) {
@name = @cols;
for (my $i = 0; $i <= $#name; $i++){
$colnames{$name[$i]} = $i;
}
print "$_\tscore\n";
next;
} else {
my $junc = 0;
my $coor = $cols[0].':'.$cols[1];
my $cmean = $cols[$colnames{'cmeanav'}]; #consecutive mismatch mean
my $cmedian = $cols[$colnames{'cmedianav'}]; #consecutive mismatch median
next if ($cmean == 0 and $cmedian == 0); #skip consecutive mismatch == 0 things
my $ref = $cols[$colnames{'ref'}];
my $alt = $cols[$colnames{'alt'}];
if ($ref !~ /^[ACGTN]$/ or $alt !~ /^[ACGTN]$/){ #indel
$type = "indel";
}
my $rep = $cols[$colnames{'rep'}];
my $sc = $cols[$colnames{'sc'}];
my $segdupScore = 0;
unless ($cmean < 2 and $cmedian < 2) {
$junc += ($cmean + $cmedian)/2; #good ones
}
for (my $i = 0; $i <= $#cols; $i++) {
if ($name[$i] =~ /func/){
if ($cols[$i] =~ /seg(d)?up\.score\=([\d\.]+)/) {
$segdupScore = $2;
}
} elsif ($name[$i] =~ /\.bam\.out\.bad/) {
$junc += 4*$cols[$i];
} elsif ($name[$i] eq 'rep') {
$junc += 2*$cols[$i];
} elsif ($name[$i] eq 'sc') {
$junc += (($segdupScore + $cols[$i]) > 0) ? 2:0;
}
} #iterator
if ($type eq 'indel' and $rep == 0 and $sc == 0 and $segdupScore == 0) {
if ($junc < 4.3) {
print "$_\t$junc\n";
}
} else {
if ($junc < 4) {
print "$_\t$junc\n";
}
}
} #else
} #while
close IN;