-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathscafe.workflow.cm.aggregate
604 lines (485 loc) · 24.2 KB
/
scafe.workflow.cm.aggregate
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
#!/usr/bin/env perl
# This chunk of stuff was generated by App::FatPacker. To find the original
# file's code, look for the end of this BEGIN block or the string 'FATPACK'
BEGIN {
my %fatpacked;
s/^ //mg for values %fatpacked;
my $class = 'FatPacked::'.(0+\%fatpacked);
no strict 'refs';
*{"${class}::files"} = sub { keys %{$_[0]} };
if ($] < 5.008) {
*{"${class}::INC"} = sub {
if (my $fat = $_[0]{$_[1]}) {
my $pos = 0;
my $last = length $fat;
return (sub {
return 0 if $pos == $last;
my $next = (1 + index $fat, "\n", $pos) || $last;
$_ .= substr $fat, $pos, $next - $pos;
$pos = $next;
return 1;
});
}
};
}
else {
*{"${class}::INC"} = sub {
if (my $fat = $_[0]{$_[1]}) {
open my $fh, '<', \$fat
or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
return $fh;
}
return;
};
}
unshift @INC, bless \%fatpacked, $class;
} # END OF FATPACK CODE
#====================================================================================================================================================#
#<use>
$|++; #---turn on the auto flush for the progress bar
no warnings 'utf8';
use warnings;
use strict;
use Getopt::Long 'HelpMessage';
use Time::HiRes qw( time );
use File::Spec::Functions qw(rel2abs abs2rel);
use Cwd 'abs_path';
#<\use>
#====================================================================================================================================================#
#====================================================================================================================================================#
#<doc>
=head1 SYNOPSIS
5'-O~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~AAA-3'
O~~~AA O~~ O~ O~~~~~~~AO~~~~~~~~A
O~~ O~~ O~~ O~~ O~O~~ O~~ O~~
O~~ O~~ O~ O~~ O~~ O~~
O~~ O~~ O~~ O~~ O~~~~~AA O~~~~~~A
O~~ O~~ O~~~~~A O~~ O~~ O~~
O~~ O~~ O~~ O~~ O~~ O~~ O~~ O~~
O~~~~A O~~~ O~~ O~~O~~ O~~~~~~~AA
┌─ᐅ 5'-O~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-3'
...===┴========================================================================================...
Single Cell Analysis of Five-prime End (SCAFE) Tool Suite
---> scafe.workflow.cm.aggregate <---
<--- workflow, commond mode, aggregate ctss of multiple samples to define CRE --->
Description:
This workflow process a multiple samples from scafe.workflow.sc.solo or scafe.workflow.bk.solo to define CRE using aggregated signal
Usage:
scafe.workflow.cm.aggregate [options] --lib_list_path --genome --run_tag --run_outDir
--lib_list_path <required> [string] a list of libraries, in formation of
<lib_ID><\t><collapse_ctss><\t><unencoded_G_collapse_ctss>
lib_ID = Unique ID of the lib
collapse_ctss = *.collapse.ctss.bed.gz from scafe.tool.sc.bam_to_ctss or scafe.tool.bk.bam_to_ctss
or *.pass.ctss.bed.gz from scafe.tool.cm.remove_strand_invader
unencoded_G_collapse_ctss = *unencoded_G.collapse.ctss.bed.gz from
scafe.tool.sc.bam_to_ctss or scafe.tool.bk.bam_to_ctss
--genome <required> [string] name of genome reference, e.g. hg19.gencode_v32lift37
--run_tag <required> [string] prefix for the output files
--run_outDir <required> [string] directory for the output files
--training_signal_path (optional) [string] quantitative signal (e.g. ATAC -logP, in bigwig format), or binary genomic
regions (e.g. annotated CRE, in bed format) used for training of logical
regression model If null, $usr_glm_model_path must be supplied for
pre-built logical regression model. It overrides usr_glm_model_path
(default=null)
--testing_signal_path (optional) [string] quantitative signal (e.g. ATAC -logP, in bigwig format), or binary genomic
regions (e.g. annotated CRE, in bed format) used for testing the performance
of the logical regression model. If null, annotated TSS from $genome will be
used as binary genomic regions. (default=null)
--max_thread (optional) [integer] maximum number of parallel threads, capped at 10 to
avoid memory overflow (default=5)
--overwrite (optional) [yes/no] erase run_outDir before running (default=no)
Dependencies:
R packages: 'ROCR','PRROC', 'caret', 'e1071', 'ggplot2', 'scales', 'reshape2'
bigWigAverageOverBed
bedGraphToBigWig
bedtools
samtools
paraclu
paraclu-cut.sh
tabix
bgzip
For demo, cd to SCAFE dir and run,
scafe.workflow.cm.aggregate \
--overwrite=yes \
--lib_list_path=./demo/input/cm.aggregate/lib_list_path.txt \
--genome=hg19.gencode_v32lift37 \
--run_tag=demo \
--run_outDir=./demo/output/cm.aggregate/
=head1 VERSION
v0.9.0-beta [March 20, 2021]
-Exists as scafe.workflow.sc.pool and scafe.workflow.bk.pool
v1.0.0 [June 6, 2022]
-Initial release
-added directionality
=cut
#<\doc>
#====================================================================================================================================================#
#====================================================================================================================================================#
#<lastCmdCalled>
#
# notCalledBefore
#
# notCalledBefore
#
#<\lastCmdCalled>
#====================================================================================================================================================#
#====================================================================================================================================================#
#<global>
#<\global>
#====================================================================================================================================================#
#====================================================================================================================================================#
{ #Main sections lexical scope starts
#====================================================================================================================================================#
#====================================================================================================================================================#
# section 0_startTasks
#
#<section ID="startTasks" num="0">
my $ARGV_ary_ref = [@ARGV];
my ($lib_list_path, $genome, $training_signal_path, $testing_signal_path, $max_thread, $run_tag, $run_outDir, $overwrite) = &readParameters();#->383
my ($scafe_dir, $script_dir, $result_script_dir, $ARGVStr, $scriptAbsPath) = &prepDir($run_outDir, $ARGV_ary_ref);#->355
&logCalledCMDAndScript($ARGVStr, $result_script_dir, $scriptAbsPath);#->330
#<\section>
#====================================================================================================================================================#
#====================================================================================================================================================#
# section 1_run
#
#<section ID="run" num="1">
my ($path_hsh_ref) = &define_path($run_outDir, $run_tag, $lib_list_path, $training_signal_path, $testing_signal_path, $script_dir);#->171
my ($task_info_hsh_ref) = &define_task($genome, $path_hsh_ref, $max_thread, $run_tag, $run_outDir);#->216
&run_task($task_info_hsh_ref, $path_hsh_ref, $result_script_dir);#->433
#<\section>
#====================================================================================================================================================#
#====================================================================================================================================================#
} #Main sections lexical scope ends
#====================================================================================================================================================#
#====================================================================================================================================================#
#List of subroutines by category
#
# general [n=3]:
# currentTime, logCalledCMDAndScript, readParameters
#
# unassigned [n=4]:
# define_path, define_task, prepDir
# run_task
#
#====================================================================================================================================================#
sub currentTime {
#....................................................................................................................................................#
# subroutineCategory: general
# dependOnSub: >none
# appearInSub: prepDir|355, run_task|433
# primaryAppearInSection: >none
# secondaryAppearInSection: 0_startTasks|116, 1_run|127
# input: none
# output: $runTime
# toCall: my ($runTime) = ¤tTime();
# calledInLine: 369, 448, 463, 487, 489, 490, 509
#....................................................................................................................................................#
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
my $runTime = sprintf "%04d-%02d-%02d %02d:%02d", $year+1900, $mon+1,$mday,$hour,$min;
return $runTime;
}
sub define_path {
#....................................................................................................................................................#
# subroutineCategory: unassigned
# dependOnSub: >none
# appearInSub: >none
# primaryAppearInSection: 1_run|127
# secondaryAppearInSection: >none
# input: $lib_list_path, $run_outDir, $run_tag, $script_dir, $testing_signal_path, $training_signal_path
# output: $path_hsh_ref
# toCall: my ($path_hsh_ref) = &define_path($run_outDir, $run_tag, $lib_list_path, $training_signal_path, $testing_signal_path, $script_dir);
# calledInLine: 130
#....................................................................................................................................................#
my ($run_outDir, $run_tag, $lib_list_path, $training_signal_path, $testing_signal_path, $script_dir) = @_;
my $path_hsh_ref = {
'script_dir' => $script_dir,
'lib_list_path' => $lib_list_path,
'training_signal_path' => $training_signal_path,
'testing_signal_path' => $testing_signal_path,
'collapse_ctss_bed_path' => $run_outDir."/aggregate/".$run_tag."/bed/".$run_tag.".aggregate.collapse.ctss.bed.gz",
'ung_ctss_bed_path' => $run_outDir."/aggregate/".$run_tag."/bed/".$run_tag.".aggregate.unencoded_G.collapse.ctss.bed.gz",
'raw_tssCluster_bed_path' => $run_outDir."/cluster/".$run_tag."/bed/".$run_tag.".tssCluster.bed.gz",
'bw_cpm_rev_path' => $run_outDir."/ctss_to_bigwig/".$run_tag."/wig/".$run_tag.".cpm.rev.bw",
'bw_cpm_fwd_path' => $run_outDir."/ctss_to_bigwig/".$run_tag."/wig/".$run_tag.".cpm.fwd.bw",
'bw_count_rev_path' => $run_outDir."/ctss_to_bigwig/".$run_tag."/wig/".$run_tag.".count.rev.bw",
'bw_count_fwd_path' => $run_outDir."/ctss_to_bigwig/".$run_tag."/wig/".$run_tag.".count.fwd.bw",
'default.filtered_tssCluster_bed_path' => $run_outDir."/filter/".$run_tag."/bed/".$run_tag.".tssCluster.default.filtered.bed.gz",
'filtered_tssCluster_info_path' => $run_outDir."/filter/".$run_tag."/log/".$run_tag.".tssCluster.log.tsv",
'tCRE_bed_path' => $run_outDir."/annotate/".$run_tag."/bed/".$run_tag.".CRE.coord.bed.gz",
'tCRE_info_path' => $run_outDir."/annotate/".$run_tag."/log/".$run_tag.".CRE.info.tsv.gz",
'tssCluster_bed_path' => $run_outDir."/annotate/".$run_tag."/bed/".$run_tag.".cluster.coord.bed.gz",
'tssCluster_info_path' => $run_outDir."/annotate/".$run_tag."/log/".$run_tag.".cluster.info.tsv.gz",
'directionality_info_path' => $run_outDir."/directionality/".$run_tag."/log/".$run_tag.".directionality.log.tsv.gz",
};
return ($path_hsh_ref);
}
sub define_task {
#....................................................................................................................................................#
# subroutineCategory: unassigned
# dependOnSub: >none
# appearInSub: >none
# primaryAppearInSection: 1_run|127
# secondaryAppearInSection: >none
# input: $genome, $max_thread, $path_hsh_ref, $run_outDir, $run_tag
# output: $task_info_hsh_ref
# toCall: my ($task_info_hsh_ref) = &define_task($genome, $path_hsh_ref, $max_thread, $run_tag, $run_outDir);
# calledInLine: 131
#....................................................................................................................................................#
my ($genome, $path_hsh_ref, $max_thread, $run_tag, $run_outDir) = @_;
my $task_info_hsh_ref = {
1 => {
'task_name' => 'aggregate',
'script_name' => 'scafe.tool.cm.aggregate',
'param' => [
['lib_list_path', $path_hsh_ref->{'lib_list_path'}],
['max_thread', $max_thread],
['genome', $genome],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/aggregate"],
],
'check' => [
$path_hsh_ref->{'collapse_ctss_bed_path'},
$path_hsh_ref->{'ung_ctss_bed_path'},
]
},
2 => {
'task_name' => 'cluster',
'script_name' => 'scafe.tool.cm.cluster',
'param' => [
['cluster_ctss_bed_path', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['count_ctss_bed_path_list', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['count_scope_bed_path', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/cluster"],
],
'check' => [
$path_hsh_ref->{'raw_tssCluster_bed_path'},
]
},
3 => {
'task_name' => 'filter',
'script_name' => 'scafe.tool.cm.filter',
'param' => [
['genome', $genome],
['training_signal_path', $path_hsh_ref->{'training_signal_path'}],
['testing_signal_path', $path_hsh_ref->{'testing_signal_path'}],
['ung_ctss_bed_path', $path_hsh_ref->{'ung_ctss_bed_path'}],
['tssCluster_bed_path', $path_hsh_ref->{'raw_tssCluster_bed_path'}],
['ctss_bed_path', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/filter"],
],
'check' => [
$path_hsh_ref->{'default.filtered_tssCluster_bed_path'},
]
},
4 => {
'task_name' => 'ctss_to_bigwig',
'script_name' => 'scafe.tool.cm.ctss_to_bigwig',
'param' => [
['genome', $genome],
['ctss_bed_path', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/ctss_to_bigwig"],
],
'check' => [
$path_hsh_ref->{'bw_cpm_rev_path'},
$path_hsh_ref->{'bw_cpm_fwd_path'},
$path_hsh_ref->{'bw_count_rev_path'},
$path_hsh_ref->{'bw_count_fwd_path'},
]
},
5 => {
'task_name' => 'annotate',
'script_name' => 'scafe.tool.cm.annotate',
'param' => [
['genome', $genome],
['tssCluster_bed_path', $path_hsh_ref->{'default.filtered_tssCluster_bed_path'}],
['tssCluster_info_path', $path_hsh_ref->{'filtered_tssCluster_info_path'}],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/annotate"],
],
'check' => [
$path_hsh_ref->{"tCRE_bed_path"},
$path_hsh_ref->{"tCRE_info_path"},
$path_hsh_ref->{"tssCluster_bed_path"},
$path_hsh_ref->{"tssCluster_info_path"},
]
},
6 => {
'task_name' => 'directionality',
'script_name' => 'scafe.tool.cm.directionality',
'param' => [
['CRE_bed_path', $path_hsh_ref->{'tCRE_bed_path'}],
['CRE_info_path', $path_hsh_ref->{'tCRE_info_path'}],
['ctss_bed_path', $path_hsh_ref->{'collapse_ctss_bed_path'}],
['outputPrefix', $run_tag],
['outDir', $run_outDir."/directionality"],
],
'check' => [
$path_hsh_ref->{"directionality_info_path"},
]
},
};
return($task_info_hsh_ref);
}
sub logCalledCMDAndScript {
#....................................................................................................................................................#
# subroutineCategory: general
# dependOnSub: >none
# appearInSub: >none
# primaryAppearInSection: 0_startTasks|116
# secondaryAppearInSection: >none
# input: $ARGVStr, $result_script_dir, $scriptAbsPath
# output:
# toCall: &logCalledCMDAndScript($ARGVStr, $result_script_dir, $scriptAbsPath);
# calledInLine: 122
#....................................................................................................................................................#
my ($ARGVStr, $result_script_dir, $scriptAbsPath) = @_;
my $cpScriptPath = "$result_script_dir/script.ran.pl";
my $calledCMDPath = "$result_script_dir/called.cmd.txt";
system "cp -f $scriptAbsPath $cpScriptPath";
system "chmod 0444 $cpScriptPath"; #---[07/03/2014 18:02] make it read-only to make sure there'll be accodental change of parameters
open CALLEDCMD, ">", $calledCMDPath;
print CALLEDCMD join "", ($ARGVStr), "\n";
close CALLEDCMD;
return ();
}
sub prepDir {
#....................................................................................................................................................#
# subroutineCategory: unassigned
# dependOnSub: currentTime|153
# appearInSub: >none
# primaryAppearInSection: 0_startTasks|116
# secondaryAppearInSection: >none
# input: $ARGV_ary_ref, $run_outDir
# output: $ARGVStr, $result_script_dir, $scafe_dir, $scriptAbsPath, $script_dir
# toCall: my ($scafe_dir, $script_dir, $result_script_dir, $ARGVStr, $scriptAbsPath) = &prepDir($run_outDir, $ARGV_ary_ref);
# calledInLine: 121
#....................................................................................................................................................#
my ($run_outDir, $ARGV_ary_ref) = @_;
my $scriptAbsPath = abs_path($0);
my $ARGVStr = join "\n", (¤tTime(), $scriptAbsPath, @{$ARGV_ary_ref});#->153
my @path_split = split /\//, $scriptAbsPath;
my $scafe_dir_index = $#path_split-2;
my $script_dir_index = $#path_split-1;
my $scafe_dir = join "/", @path_split[0..$scafe_dir_index];
my $script_dir = join "/", @path_split[0..$script_dir_index];
my @mkDirAry;
my $result_script_dir = "$run_outDir/script/"; push @mkDirAry, $result_script_dir;
foreach my $dir (@mkDirAry) {system ("mkdir -pm 755 $dir");}
return ($scafe_dir, $script_dir, $result_script_dir, $ARGVStr, $scriptAbsPath);
}
sub readParameters {
#....................................................................................................................................................#
# subroutineCategory: general
# dependOnSub: >none
# appearInSub: >none
# primaryAppearInSection: 0_startTasks|116
# secondaryAppearInSection: >none
# input: none
# output: $genome, $lib_list_path, $max_thread, $overwrite, $run_outDir, $run_tag, $testing_signal_path, $training_signal_path
# toCall: my ($lib_list_path, $genome, $training_signal_path, $testing_signal_path, $max_thread, $run_tag, $run_outDir, $overwrite) = &readParameters();
# calledInLine: 120
#....................................................................................................................................................#
my ($lib_list_path, $genome, $training_signal_path, $testing_signal_path, $max_thread, $run_tag, $run_outDir, $overwrite);
$overwrite = 'no';
$max_thread = 5;
GetOptions (
"lib_list_path=s" => \$lib_list_path,
"genome=s" => \$genome,
"max_thread:i" => \$max_thread,
"training_signal_path:s" => \$training_signal_path,
"testing_signal_path:s" => \$testing_signal_path,
"run_tag=s" => \$run_tag,
"run_outDir=s" => \$run_outDir,
"overwrite:s" => \$overwrite,
'help' => sub { HelpMessage(0) },
) or HelpMessage(1);
HelpMessage(1) unless $lib_list_path;
#---check file
my $file_check_hsh_ref = {
'lib_list_path' => $lib_list_path,
};
foreach my $option_name (keys %{$file_check_hsh_ref}) {
my $file_path = $file_check_hsh_ref->{$option_name};
die "Quitting: File $option_name does not exists at $file_path" if not -s $file_path;
}
system "rm -rf $run_outDir" if ($overwrite eq 'yes');
chop $run_outDir if ($run_outDir =~ m/\/$/); #---remove the last slash
system "mkdir -p -m 755 $run_outDir/";
return($lib_list_path, $genome, $training_signal_path, $testing_signal_path, $max_thread, $run_tag, $run_outDir, $overwrite);
}
sub run_task {
#....................................................................................................................................................#
# subroutineCategory: unassigned
# dependOnSub: currentTime|153
# appearInSub: >none
# primaryAppearInSection: 1_run|127
# secondaryAppearInSection: >none
# input: $path_hsh_ref, $result_script_dir, $task_info_hsh_ref
# output: none
# toCall: &run_task($task_info_hsh_ref, $path_hsh_ref, $result_script_dir);
# calledInLine: 132
#....................................................................................................................................................#
my ($task_info_hsh_ref, $path_hsh_ref, $result_script_dir) = @_;
open TASKLOG, ">", "$result_script_dir/task.log.txt";
print TASKLOG join "", (join "\t", ('0', 'workflow', 'manager', 'started', ¤tTime())), "\n";#->153
foreach my $task_num (sort {$a <=> $b} keys %{$task_info_hsh_ref}) {
my $task_name = $task_info_hsh_ref->{$task_num}{'task_name'};
my $script_name = $task_info_hsh_ref->{$task_num}{'script_name'};
my $result_found = 'yes';
foreach my $check_path (@{$task_info_hsh_ref->{$task_num}{'check'}}) {
$result_found = 'no' if not -s $check_path;
}
if ($result_found eq 'no') {
print "\n";
print "#===========================#\n";
print "Start running $task_name\n";
print "#===========================#\n";
print TASKLOG join "", (join "\t", ($task_num, $task_name, $script_name, 'started', ¤tTime())), "\n";#->153
my $script_path = $path_hsh_ref->{'script_dir'}.'/'.$script_name;
die "script of $task_name does not exist at $script_path\n" if not -s $script_path;
my @cmd_param_ary = ($script_path);
foreach my $indiv_param_ary_ref (@{$task_info_hsh_ref->{$task_num}{'param'}}) {
my ($param_name, $param_val) = @{$indiv_param_ary_ref};
if (defined $param_val) {#---[2020/10/07 20:32] specifically for skipping training_signal_path if not input
push @cmd_param_ary, "--$param_name=$param_val";
}
}
my $cmd = join " ", @cmd_param_ary;
system "$cmd";
$result_found = 'yes';
foreach my $check_path (@{$task_info_hsh_ref->{$task_num}{'check'}}) {
$result_found = 'no' if not -s $check_path;
}
if ($result_found eq 'yes') {
print "\n";
print "#============================================#\n";
print "Results of $task_name found. Run successfully.\n";
print "#============================================#\n";
print TASKLOG join "", (join "\t", ($task_num, $task_name, $script_name, 'successful', ¤tTime())), "\n";#->153
} else {
print TASKLOG join "", (join "\t", ($task_num, $task_name, $script_name, 'failed', ¤tTime())), "\n";#->153
print TASKLOG join "", (join "\t", ('0', 'workflow', 'workflow', 'failed', ¤tTime())), "\n";#->153
print "\n";
print "#========================================#\n";
print "Results of $task_name not found. Quitting.\n";
print "#========================================#\n";
die;
}
} else {
print "#=====================================#\n";
print "Results of $task_name found. Skipping.\n";
print "#=====================================#\n";
}
}
print "\n";
print "#=====================================================#\n";
print "Results of all tasks found. All tasks run successfully.\n";
print "#=====================================================#\n";
print TASKLOG join "", (join "\t", ('0', 'workflow', 'manager', 'successful', ¤tTime())), "\n";#->153
close TASKLOG;
}
exit;