forked from ding-lab/somaticwrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_final_report.pl
executable file
·59 lines (48 loc) · 1.35 KB
/
generate_final_report.pl
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
#!/usr/bin/perl
### for example,
## tumor >= 5% and normal <=1%
use strict;
use warnings;
die unless @ARGV == 2;
my ($run_dir, $s_exonic)=@ARGV;
my $working_name= (split(/\//,$run_dir))[-1];
my $f_sum=$run_dir."/".$working_name.".withmutect.maf\n";
my $f_status=$run_dir."/".$working_name.".withmutect.status\n";
open(OUT1,">$f_sum");
open(OUT2,">$f_status");
my $head_w=0;
foreach my $d (`ls $run_dir`)
{
my $dtr=$d;
chomp($dtr);
# my $f_maf=$run_dir."/".$dtr."/".$dtr.".checked.maf";
my $f_maf=$run_dir."/".$dtr."/".$dtr.".withmutect.maf";
if(-e $f_maf)
{
my $count=0;
foreach my $l (`cat $f_maf`)
{
my $ltr=$l;
chomp($ltr);
if(($ltr=~/version/ || $ltr=~/^Hugo/) && $head_w==1) { next; }
else {
if($ltr=~/^Hugo/) { $head_w=1; print OUT1 $ltr,"\n"; }
else {
my @temp=split("\t",$ltr);
my $annot=$temp[8];
my $af=$temp[99];
if($annot=~/Frame_Shift_Del/ || $annot=~/Frame_Shift_Ins/ || $annot=~/Missense_Mutation/ || $annot=~/Nonsense_Mutation/ || $annot=~/Nonstop_Mutation/ || $annot=~/Silent/ || $annot=~/Splice_Site/ || $annot=~/In_Frame_Ins/ || $annot=~/In_Frame_Del/ || $s_exonic==0) {
#if($af eq "" || (($af ne "") && $af<0.005))
#{
print OUT1 $ltr,"\n";
$count++;
#}
}
}
}
}
print OUT2 $count,"\t",$f_maf,"\n";
}
} ##
close OUT1;
close OUT2;