@@ -156,7 +156,12 @@ sub runCopyNumberTools {
156
156
my $qdnaseq_job = runqDNAseq($sample , $sample_out_dir , $sample_job_dir , $sample_log_dir , $sample_bam , \@running_jobs , \%opt );
157
157
if ($qdnaseq_job ){push (@cnv_jobs , $qdnaseq_job )};
158
158
}
159
-
159
+ if ($opt {CNV_EXOMEDEPTH } eq " yes" ){
160
+ print " \n ###SCHEDULING EXOMEDEPTH####\n " ;
161
+ my $exomedepth_job = runExomedepth($sample , $sample_out_dir , $sample_job_dir , $sample_log_dir , $sample_bam , \@running_jobs , \%opt );
162
+ if ($exomedepth_job ){push (@cnv_jobs , $exomedepth_job )};
163
+ }
164
+
160
165
161
166
# # Check copy number analysis
162
167
my $job_id = " CHECK_" .$sample ." _" .get_job_id();
@@ -165,12 +170,20 @@ sub runCopyNumberTools {
165
170
open CHECK_SH, " >$bash_file " or die " cannot open file $bash_file \n " ;
166
171
print CHECK_SH " #!/bin/bash\n\n " ;
167
172
print CHECK_SH " echo \" Start Check\t\" `date` `uname -n` >> $sample_log_dir /check.log\n\n " ;
168
- if ($opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_FREEC } eq " yes" ){
173
+ if ($opt {CNV_FREEC } eq " yes" && $opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_EXOMEDEPTH } eq " yes" ){
174
+ print CHECK_SH " if [ -f $sample_log_dir /freec.done -a -f $sample_log_dir /qdnaseq.done -a -f $sample_log_dir /exomedepth.done ]\n " ;
175
+ } elsif ($opt {CNV_FREEC } eq " yes" && $opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_EXOMEDEPTH } eq " no" ){
169
176
print CHECK_SH " if [ -f $sample_log_dir /freec.done -a -f $sample_log_dir /qdnaseq.done ]\n " ;
170
- } elsif ($opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_FREEC } eq " no" ) {
171
- print CHECK_SH " if [ -f $sample_log_dir /qdnaseq.done ]\n " ;
172
- } elsif ($opt {CNV_QDNASEQ } eq " no" && $opt {CNV_FREEC } eq " yes" ) {
177
+ } elsif ($opt {CNV_FREEC } eq " yes" && $opt {CNV_QDNASEQ } eq " no" && $opt {CNV_EXOMEDEPTH } eq " yes" ){
178
+ print CHECK_SH " if [ -f $sample_log_dir /freec.done -a -f $sample_log_dir /exomedepth.done ]\n " ;
179
+ } elsif ($opt {CNV_FREEC } eq " no" && $opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_EXOMEDEPTH } eq " yes" ){
180
+ print CHECK_SH " if [ -f $sample_log_dir /qdnaseq.done -a -f $sample_log_dir /exomedepth.done ]\n " ;
181
+ } elsif ($opt {CNV_FREEC } eq " yes" && $opt {CNV_QDNASEQ } eq " no" && $opt {CNV_EXOMEDEPTH } eq " no" ){
173
182
print CHECK_SH " if [ -f $sample_log_dir /freec.done ]\n " ;
183
+ } elsif ($opt {CNV_FREEC } eq " no" && $opt {CNV_QDNASEQ } eq " yes" && $opt {CNV_EXOMEDEPTH } eq " no" ){
184
+ print CHECK_SH " if [ -f $sample_log_dir /qdnaseq.done ]\n " ;
185
+ } elsif ($opt {CNV_FREEC } eq " no" && $opt {CNV_QDNASEQ } eq " no" && $opt {CNV_EXOMEDEPTH } eq " yes" ){
186
+ print CHECK_SH " if [ -f $sample_log_dir /exomedepth.done ]\n " ;
174
187
}
175
188
print CHECK_SH " then\n " ;
176
189
print CHECK_SH " \t touch $sample_log_dir /$sample .done\n " ;
@@ -245,6 +258,62 @@ sub runqDNAseq {
245
258
return $job_id ;
246
259
}
247
260
261
+ sub runExomedepth {
262
+ # ##
263
+ # Run exomedepth
264
+ # ##
265
+ my ($sample_name , $out_dir , $job_dir , $log_dir , $sample_bam , $running_jobs , $opt ) = (@_ );
266
+ my @running_jobs = @{$running_jobs };
267
+ my %opt = %{$opt };
268
+
269
+ # Skip Exomedepth if done file exists
270
+ if (-e " $log_dir /exomedepth.done" ){
271
+ print " WARNING: $log_dir /exomedepth.done exists, skipping \n " ;
272
+ return ;
273
+ }
274
+
275
+ # # Create ExomeDepth output directory
276
+ my $exomedepth_out_dir = " $opt {OUTPUT_DIR}/ExomeDepth/" ;
277
+
278
+ if (! -e $exomedepth_out_dir ){
279
+ make_path($exomedepth_out_dir ) or die " Couldn't create directory: $exomedepth_out_dir \n " ;
280
+ }
281
+
282
+ my $command = " python $opt {EXOMEDEPTH_PATH} -c -m $opt {MAIL} " ;
283
+ $command .= " --ib=$sample_bam " ;
284
+ $command .= " -o $exomedepth_out_dir " ;
285
+
286
+ # # Create EXOMEDEPTH bash script
287
+ my $job_id = " EXOMEDEPTH_" .$sample_name ." _" .get_job_id();
288
+ my $bash_file = $job_dir ." /" .$job_id ." .sh" ;
289
+
290
+ open EXOMEDEPTH_SH, " >$bash_file " or die " cannot open file $bash_file \n " ;
291
+ print EXOMEDEPTH_SH " #!/bin/bash\n\n " ;
292
+ print EXOMEDEPTH_SH " if [ -s $sample_bam ]\n " ;
293
+ print EXOMEDEPTH_SH " then\n " ;
294
+ print EXOMEDEPTH_SH " \t echo \" Start EXOMEDEPTH\t\" `date` \"\t $sample_bam \t\" `uname -n` >> $log_dir /exomedepth.log\n " ;
295
+ print EXOMEDEPTH_SH " \t cd $exomedepth_out_dir \n " ;
296
+ print EXOMEDEPTH_SH " \t $command \n " ;
297
+ print EXOMEDEPTH_SH " \t if [ -f $exomedepth_out_dir /logs/$sample_name *.done ]\n " ;
298
+ print EXOMEDEPTH_SH " \t then\n " ;
299
+ print EXOMEDEPTH_SH " \t\t touch $log_dir /exomedepth.done\n " ;
300
+ print EXOMEDEPTH_SH " \t fi\n " ;
301
+ print EXOMEDEPTH_SH " \t echo \" End EXOMEDEPTH\t\" `date` \"\t $sample_bam \t\" `uname -n` >> $log_dir /exomedepth.log\n " ;
302
+ print EXOMEDEPTH_SH " else\n " ;
303
+ print EXOMEDEPTH_SH " \t echo \" ERROR: Input bam files do not exist.\" >> $log_dir /exomedepth.log\n " ;
304
+ print EXOMEDEPTH_SH " fi\n " ;
305
+ close EXOMEDEPTH_SH;
306
+
307
+ # # Run job
308
+ my $qsub = &qsubTemplate(\%opt ," EXOMEDEPTH" );
309
+ if ( @running_jobs ){
310
+ system " $qsub -o $log_dir -e $log_dir -N $job_id -hold_jid " .join (" ," ,@running_jobs )." $bash_file " ;
311
+ } else {
312
+ system " $qsub -o $log_dir -e $log_dir -N $job_id $bash_file " ;
313
+ }
314
+ return $job_id ;
315
+ }
316
+
248
317
249
318
sub runFreec {
250
319
# ##
0 commit comments