annotate strelka2/libexec/filterSomaticVariants.pl @ 0:7a9f20ca4ad5

Uploaded
author mini
date Thu, 25 Sep 2014 11:59:08 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
1 #!/usr/bin/env perl
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
2
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
3 =head1 LICENSE
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
4
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
5 Strelka Workflow Software
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
6 Copyright (c) 2009-2013 Illumina, Inc.
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
7
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
8 This software is provided under the terms and conditions of the
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
9 Illumina Open Source Software License 1.
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
10
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
11 You should have received a copy of the Illumina Open Source
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
12 Software License 1 along with this program. If not, see
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
13 <https://github.com/downloads/sequencing/licenses/>.
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
14
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
15 =head1 SYNOPSIS
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
16
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
17 filterSomaticVariants.pl [options] | --help
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
18
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
19 =head2 SUMMARY
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
20
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
21 Aggregate and filter the variant caller results by chromosome
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
22
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
23 =cut
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
24
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
25 use warnings FATAL => 'all';
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
26 use strict;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
27
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
28 use Carp;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
29 $SIG{__DIE__} = \&Carp::confess;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
30
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
31 use File::Spec;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
32 use Getopt::Long;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
33 use Pod::Usage;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
34
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
35 my $baseDir;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
36 my $libDir;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
37 #my $vcftDir;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
38 BEGIN {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
39 my $thisDir=(File::Spec->splitpath($0))[1];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
40 $baseDir=File::Spec->catdir($thisDir,File::Spec->updir());
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
41 $libDir=File::Spec->catdir($baseDir,'lib');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
42 #my $optDir=File::Spec->catdir($baseDir,'opt');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
43 #$vcftDir=File::Spec->catdir($optDir,'vcftools','lib','perl5','site_perl');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
44 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
45 use lib $libDir;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
46 use Utils;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
47 #use lib $vcftDir;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
48 #use Vcf;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
49
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
50
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
51 my $scriptName=(File::Spec->splitpath($0))[2];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
52 my $argCount=scalar(@ARGV);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
53 my $cmdline = join(' ',$0,@ARGV);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
54
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
55
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
56 my ($chrom, $configFile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
57 my $help;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
58
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
59 GetOptions( "chrom=s" => \$chrom,
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
60 "config=s" => \$configFile,
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
61 "help|h" => \$help) or pod2usage(2);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
62
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
63 pod2usage(2) if($help);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
64 pod2usage(2) unless(defined($chrom));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
65 pod2usage(2) unless(defined($configFile));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
66
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
67
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
68
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
69 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
70 # read config and validate values
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
71 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
72 checkFile($configFile,"configuration ini");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
73 my $config = parseConfigIni($configFile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
74
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
75 my $chromSizeKey = "chrom_" . $chrom . "_size";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
76 my $chromKnownSizeKey = "chrom_" . $chrom . "_knownSize";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
77
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
78 for (("outDir", $chromSizeKey, $chromKnownSizeKey)) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
79 errorX("Undefined configuration option: '$_'") unless(defined($config->{derived}{$_}));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
80 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
81 for (qw(binSize ssnvQuality_LowerBound sindelQuality_LowerBound
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
82 isSkipDepthFilters depthFilterMultiple
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
83 snvMaxFilteredBasecallFrac snvMaxSpanningDeletionFrac
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
84 indelMaxRefRepeat indelMaxWindowFilteredBasecallFrac
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
85 indelMaxIntHpolLength)) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
86 errorX("Undefined configuration option: '$_'") unless(defined($config->{user}{$_}));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
87 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
88
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
89 my $outDir = $config->{derived}{outDir};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
90 my $chromDir = File::Spec->catdir($outDir,'chromosomes',$chrom);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
91 checkDir($outDir,"output");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
92 checkDir($chromDir,"output chromosome");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
93
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
94 my $userconfig = $config->{user};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
95
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
96 my $binList = getBinList($config->{derived}{$chromSizeKey},$userconfig->{binSize});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
97 for my $binId (@$binList) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
98 my $dir = File::Spec->catdir($chromDir,'bins',$binId);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
99 checkDir($dir,"input bin");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
100 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
101
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
102 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
103 # parameters from user config file:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
104 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
105
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
106 # minimum passed ssnv_nt Q-score:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
107 my $minQSSNT=$userconfig->{ssnvQuality_LowerBound};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
108 # minimum passed sindel_nt Q-score:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
109 my $minQSINT=$userconfig->{sindelQuality_LowerBound};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
110
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
111 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
112 # filtration parameters from user config file:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
113 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
114
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
115 # skip depth filters for targeted resequencing:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
116 my $isUseDepthFilter=(! $userconfig->{isSkipDepthFilters});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
117 # multiple of the normal mean coverage to filter snvs and indels
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
118 my $depthFilterMultiple=$userconfig->{depthFilterMultiple};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
119 # max filtered basecall fraction for any sample
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
120 my $snvMaxFilteredBasecallFrac=$userconfig->{snvMaxFilteredBasecallFrac};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
121 # max snv spanning-deletion fraction for any sample
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
122 my $snvMaxSpanningDeletionFrac=$userconfig->{snvMaxSpanningDeletionFrac};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
123 # max indel reference repeat length
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
124 my $indelMaxRefRepeat=$userconfig->{indelMaxRefRepeat};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
125 # max indel window filter fraction
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
126 my $indelMaxWindowFilteredBasecallFrac=$userconfig->{indelMaxWindowFilteredBasecallFrac};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
127 # max indel interupted hompolymer length:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
128 my $indelMaxIntHpolLength=$userconfig->{indelMaxIntHpolLength};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
129
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
130
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
131 # first we want the normal sample mean chromosome depth:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
132 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
133 my $filterCoverage;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
134 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
135 my $totalCoverage = 0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
136 for my $binId (@$binList) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
137 my $sFile = File::Spec->catfile($chromDir,'bins',$binId,'strelka.stats');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
138 checkFile($sFile,"strelka bin stats");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
139 open(my $sFH, '<', $sFile)
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
140 || errorX("Can't open file: '$sFile' $!");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
141
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
142 my $is_found=0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
143 while(<$sFH>) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
144 next unless(/^NORMAL_NO_REF_N_COVERAGE\s/);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
145 my $is_bad = 0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
146 if(not /sample_size:\s*(\d+)\s+/) { $is_bad=1; }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
147 my $ss=$1;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
148 # leave the regex for mean fairly loose to pick up scientific notation, etc..
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
149 if(not /mean:\s*(\d[^\s]*|nan)\s+/) { $is_bad=1; }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
150 my $mean=$1;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
151 errorX("Unexpected format in file: '$sFile'") if($is_bad);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
152
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
153 my $coverage = ( $ss==0 ? 0 : int($ss*$mean) );
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
154
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
155 $totalCoverage += $coverage;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
156 $is_found=1;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
157 last;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
158 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
159 close($sFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
160 errorX("Unexpected format in file: '$sFile'") unless($is_found);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
161 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
162
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
163 my $chromKnownSize = $config->{derived}{$chromKnownSizeKey};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
164 my $normalMeanCoverage = ($totalCoverage/$chromKnownSize);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
165 $filterCoverage = $normalMeanCoverage*$depthFilterMultiple;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
166 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
167
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
168
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
169 # add filter description to vcf header unless it already exists
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
170 # return 1 if filter id already exists, client can decide if this is an error
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
171 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
172 sub add_vcf_filter($$$) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
173 my ($vcf,$id,$desc) = @_;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
174 return 1 if(scalar(@{$vcf->get_header_line(key=>'FILTER', ID=>$id)}));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
175 $vcf->add_header_line({key=>'FILTER', ID=>$id,Description=>$desc});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
176 return 0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
177 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
178
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
179
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
180 sub check_vcf_for_sample($$$) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
181 my ($vcf,$sample,$file) = @_;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
182 my $is_found=0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
183 for ($vcf->get_samples()) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
184 $is_found=1 if($_ eq $sample);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
185 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
186 errorX("Failed to find sample '$sample' in vcf file '$file'") unless($is_found);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
187 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
188
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
189
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
190
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
191 my $depthFiltId="DP";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
192
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
193
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
194 # Runs all post-call vcf filters:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
195 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
196 sub filterSnvFileList(\@$$$) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
197 my ($ifiles,$depthFilterVal,$acceptFileName,$isUseDepthFilter) = @_;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
198
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
199 my $baseFiltId="BCNoise";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
200 my $spanFiltId="SpanDel";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
201 my $qFiltId="QSS_ref";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
202
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
203 open(my $aFH,'>',$acceptFileName)
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
204 or errorX("Failed to open file: '$acceptFileName'");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
205
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
206 my $is_first=1;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
207 for my $ifile (@$ifiles) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
208 open(my $iFH,'<',"$ifile")
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
209 or errorX("Failed to open file: '$ifile'");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
210 my $vcf = Vcf->new(fh=>$iFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
211
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
212 # run some simple header validation on each vcf:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
213 $vcf->parse_header();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
214 check_vcf_for_sample($vcf,'NORMAL',$ifile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
215 check_vcf_for_sample($vcf,'TUMOR',$ifile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
216
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
217 if($is_first) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
218 # TODO: update vcf meta-data for chromosome-level filtered files
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
219 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
220 $vcf->remove_header_line(key=>"cmdline");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
221 $vcf->add_header_line({key=>"cmdline",value=>$cmdline});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
222 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
223 $vcf->add_header_line({key=>"maxDepth_$chrom",value=>$depthFilterVal});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
224 add_vcf_filter($vcf,$depthFiltId,"Greater than ${depthFilterMultiple}x chromosomal mean depth in Normal sample");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
225 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
226 add_vcf_filter($vcf,$baseFiltId,"Fraction of basecalls filtered at this site in either sample is at or above $snvMaxFilteredBasecallFrac");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
227 add_vcf_filter($vcf,$spanFiltId,"Fraction of reads crossing site with spanning deletions in either sample exceeeds $snvMaxSpanningDeletionFrac");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
228 add_vcf_filter($vcf,$qFiltId,"Normal sample is not homozygous ref or ssnv Q-score < $minQSSNT, ie calls with NT!=ref or QSS_NT < $minQSSNT");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
229 print $aFH $vcf->format_header();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
230 $is_first=0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
231 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
232
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
233 while(my $x=$vcf->next_data_hash()) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
234 my $norm=$x->{gtypes}->{NORMAL};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
235 my $tumr=$x->{gtypes}->{TUMOR};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
236
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
237 my %filters;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
238
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
239 # normal depth filter:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
240 my $normalDP=$norm->{DP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
241 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
242 $filters{$depthFiltId} = ($normalDP > $depthFilterVal);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
243 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
244
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
245 # filtered basecall fraction:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
246 my $normal_filt=($normalDP>0 ? $norm->{FDP}/$normalDP : 0);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
247
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
248 my $tumorDP=$tumr->{DP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
249 my $tumor_filt=($tumorDP>0 ? $tumr->{FDP}/$tumorDP : 0);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
250
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
251 $filters{$baseFiltId}=(($normal_filt >= $snvMaxFilteredBasecallFrac) or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
252 ($tumor_filt >= $snvMaxFilteredBasecallFrac));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
253
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
254 # spanning deletion fraction:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
255 my $normalSDP=$norm->{SDP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
256 my $normalSpanTot=($normalDP+$normalSDP);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
257 my $normalSpanDelFrac=($normalSpanTot>0 ? ($normalSDP/$normalSpanTot) : 0);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
258
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
259 my $tumorSDP=$tumr->{SDP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
260 my $tumorSpanTot=($tumorDP+$tumorSDP);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
261 my $tumorSpanDelFrac=($tumorSpanTot>0 ? ($tumorSDP/$tumorSpanTot) : 0);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
262
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
263 $filters{$spanFiltId}=(($normalSpanDelFrac > $snvMaxSpanningDeletionFrac) or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
264 ($tumorSpanDelFrac > $snvMaxSpanningDeletionFrac));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
265
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
266 # Q-val filter:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
267 $filters{$qFiltId}=(($x->{INFO}->{NT} ne "ref") or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
268 ($x->{INFO}->{QSS_NT} < $minQSSNT));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
269
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
270 $x->{FILTER} = $vcf->add_filter($x->{FILTER},%filters);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
271
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
272 print $aFH $vcf->format_line($x);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
273 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
274
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
275 $vcf->close();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
276 close($iFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
277 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
278
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
279 close($aFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
280 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
281
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
282
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
283
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
284 sub updateA2(\@$) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
285 my ($a2,$FH) = @_;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
286 my $line=<$FH>;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
287 unless(defined($line)) { errorX("Unexpected end of somatic indel window file"); }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
288 chomp $line;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
289 @$a2 = split("\t",$line);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
290 unless(scalar(@$a2)) { errorX("Unexpected format in somatic indel window file"); }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
291 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
292
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
293
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
294
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
295 sub filterIndelFileList(\@$$$) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
296 my ($ifiles,$depthFilterVal,$acceptFileName,$isUseDepthFilter) = @_;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
297
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
298 my $repeatFiltId="Repeat";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
299 my $iHpolFiltId="iHpol";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
300 my $baseFiltId="BCNoise";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
301 my $qFiltId="QSI_ref";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
302
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
303 open(my $aFH,'>',$acceptFileName)
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
304 or errorX("Failed to open file: '$acceptFileName'");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
305
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
306 my $is_first=1;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
307 for my $ifile (@$ifiles) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
308 open(my $iFH,'<',"$ifile")
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
309 or errorX("Failed to open somatic indel file: '$ifile'");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
310
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
311 my $iwfile = $ifile . ".window";
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
312 open(my $iwFH,'<',"$iwfile")
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
313 or errorX("Failed to open somatic indel window file: '$iwfile'");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
314
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
315 my @a2; # hold window file data for one line in case we overstep...
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
316
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
317 my $vcf = Vcf->new(fh=>$iFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
318
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
319 # run some simple header validation on each vcf:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
320 $vcf->parse_header();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
321 check_vcf_for_sample($vcf,'NORMAL',$ifile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
322 check_vcf_for_sample($vcf,'TUMOR',$ifile);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
323
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
324 if($is_first) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
325 # TODO: update all vcf meta-data for chromosome-level filtered files
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
326 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
327 $vcf->remove_header_line(key=>"cmdline");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
328 $vcf->add_header_line({key=>"cmdline",value=>$cmdline});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
329 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
330 $vcf->add_header_line({key=>"maxDepth_$chrom",value=>$depthFilterVal});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
331 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
332 $vcf->add_header_line({key=>'FORMAT', ID=>'DP50',Number=>1,Type=>'Float',Description=>'Average tier1 read depth within 50 bases'});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
333 $vcf->add_header_line({key=>'FORMAT', ID=>'FDP50',Number=>1,Type=>'Float',Description=>'Average tier1 number of basecalls filtered from original read depth within 50 bases'});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
334 $vcf->add_header_line({key=>'FORMAT', ID=>'SUBDP50',Number=>1,Type=>'Float',Description=>'Average number of reads below tier1 mapping quality threshold aligned across sites within 50 bases'});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
335 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
336 add_vcf_filter($vcf,$depthFiltId,"Greater than ${depthFilterMultiple}x chromosomal mean depth in Normal sample");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
337 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
338 add_vcf_filter($vcf,$repeatFiltId,"Sequence repeat of more than ${indelMaxRefRepeat}x in the reference sequence");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
339 add_vcf_filter($vcf,$iHpolFiltId,"Indel overlaps an interupted homopolymer longer than ${indelMaxIntHpolLength}x in the reference sequence");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
340 add_vcf_filter($vcf,$baseFiltId,"Average fraction of filtered basecalls within 50 bases of the indel exceeds $indelMaxWindowFilteredBasecallFrac");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
341 add_vcf_filter($vcf,$qFiltId,"Normal sample is not homozygous ref or sindel Q-score < $minQSINT, ie calls with NT!=ref or QSI_NT < $minQSINT");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
342 print $aFH $vcf->format_header();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
343 $is_first=0;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
344 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
345
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
346 while(my $x=$vcf->next_data_hash()) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
347 $vcf->add_format_field($x,'DP50');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
348 $vcf->add_format_field($x,'FDP50');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
349 $vcf->add_format_field($x,'SUBDP50');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
350
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
351 my $norm=$x->{gtypes}->{NORMAL};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
352 my $tumr=$x->{gtypes}->{TUMOR};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
353
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
354 my $chrom=$x->{CHROM};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
355 my $pos=int($x->{POS});
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
356
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
357 # get matching line from window file:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
358 while((scalar(@a2)<2) or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
359 (($a2[0] le $chrom) and (int($a2[1]) < $pos))) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
360 updateA2(@a2,$iwFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
361 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
362 unless(scalar(@a2) and ($a2[0] eq $chrom) and (int($a2[1]) == $pos))
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
363 { errorX("Can't find somatic indel window position.\nIndel line: " . $vcf->format_line($x) ); }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
364
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
365 # add window data to vcf record:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
366 #
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
367 $norm->{DP50} = $a2[2]+$a2[3];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
368 $norm->{FDP50} = $a2[3];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
369 $norm->{SUBDP50} = $a2[4];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
370 $tumr->{DP50} = $a2[5]+$a2[6];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
371 $tumr->{FDP50} = $a2[6];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
372 $tumr->{SUBDP50} = $a2[7];
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
373
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
374 my %filters;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
375
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
376 # normal depth filter:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
377 my $normalDP=$norm->{DP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
378 if($isUseDepthFilter) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
379 $filters{$depthFiltId}=($normalDP > $depthFilterVal);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
380 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
381
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
382 # ref repeat
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
383 my $refRep=$x->{INFO}->{RC};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
384 $filters{$repeatFiltId}=(defined($refRep) and
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
385 ($refRep > $indelMaxRefRepeat));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
386
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
387 # ihpol
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
388 my $iHpol=$x->{INFO}->{IHP};
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
389 $filters{$iHpolFiltId}=(defined($iHpol) and
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
390 ($iHpol > $indelMaxIntHpolLength));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
391
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
392 # base filt:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
393 my $normWinFrac=( $norm->{DP50} ? $norm->{FDP50}/$norm->{DP50} : 0 );
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
394 my $tumrWinFrac=( $tumr->{DP50} ? $tumr->{FDP50}/$tumr->{DP50} : 0 );
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
395 $filters{$baseFiltId}=( ($normWinFrac >= $indelMaxWindowFilteredBasecallFrac) or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
396 ($tumrWinFrac >= $indelMaxWindowFilteredBasecallFrac) );
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
397
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
398 # Q-val filter:
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
399 $filters{$qFiltId}=(($x->{INFO}->{NT} ne "ref") or
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
400 ($x->{INFO}->{QSI_NT} < $minQSINT));
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
401
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
402 $x->{FILTER} = $vcf->add_filter($x->{FILTER},%filters);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
403
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
404 print $aFH $vcf->format_line($x);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
405 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
406
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
407 $vcf->close();
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
408 close($iFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
409 close($iwFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
410 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
411
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
412 close($aFH);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
413 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
414
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
415
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
416
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
417 my @ssnvFiles;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
418 my @sindelFiles;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
419 for my $binId (@$binList) {
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
420 my $ssnvFile = File::Spec->catfile($chromDir,'bins',$binId,'somatic.snvs.unfiltered.vcf');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
421 my $sindelFile = File::Spec->catfile($chromDir,'bins',$binId,'somatic.indels.unfiltered.vcf');
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
422 checkFile($ssnvFile,"bin snv file");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
423 checkFile($sindelFile,"bin indel file");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
424 push @ssnvFiles,$ssnvFile;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
425 push @sindelFiles,$sindelFile;
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
426 }
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
427
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
428 my $ssnvOutFile = File::Spec->catfile($chromDir,"somatic.snvs.vcf");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
429 filterSnvFileList(@ssnvFiles,$filterCoverage,$ssnvOutFile,$isUseDepthFilter);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
430
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
431 my $sindelOutFile = File::Spec->catfile($chromDir,"somatic.indels.vcf");
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
432 filterIndelFileList(@sindelFiles,$filterCoverage,$sindelOutFile,$isUseDepthFilter);
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
433
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
434
7a9f20ca4ad5 Uploaded
mini
parents:
diff changeset
435 1;