line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::Workflow::Plugin::FileExists; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12483
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
15
|
use 5.008_005; |
|
1
|
|
|
|
|
2
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
475
|
use Data::Dumper; |
|
1
|
|
|
|
|
6115
|
|
|
1
|
|
|
|
|
45
|
|
9
|
1
|
|
|
1
|
|
424
|
use Data::Pairs; |
|
1
|
|
|
|
|
1553
|
|
|
1
|
|
|
|
|
35
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
373
|
use Moose::Role; |
|
1
|
|
|
|
|
291914
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
before 'write_process' => sub{ |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $process = $self->process; |
17
|
|
|
|
|
|
|
chomp($process); |
18
|
|
|
|
|
|
|
$process = $process." && \\\n"; |
19
|
|
|
|
|
|
|
my @input = $self->local_attr->get_values('INPUT') if $self->local_attr->exists('INPUT'); |
20
|
|
|
|
|
|
|
my @output = $self->local_attr->get_values('OUTPUT') if $self->local_attr->exists('OUTPUT'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my($input, $output) = ($input[0], $output[0]); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $tprocess = ""; |
25
|
|
|
|
|
|
|
if($input){ |
26
|
|
|
|
|
|
|
$tprocess .=<<EOF; |
27
|
|
|
|
|
|
|
[ -f "$input" ] || \\{>&2 echo "INPUT: $input not found" ; exit 256; \\} && \\ |
28
|
|
|
|
|
|
|
[ -s "$input" ] || \\{>&2 echo "INPUT: $input is empty"; \\} && \\ |
29
|
|
|
|
|
|
|
touch $input || {>&2 echo "INPUT: $input could not be touched. Please check your file permissions!"; exit 1;\\} && \\ |
30
|
|
|
|
|
|
|
touch $output || {>&2 echo "OUTPUT: $output could not be touched. Please check your file permissions!"; exit 1;\\} && \\ |
31
|
|
|
|
|
|
|
EOF |
32
|
|
|
|
|
|
|
$tprocess .= $process; |
33
|
|
|
|
|
|
|
$process = $tprocess; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
if($output){ |
36
|
|
|
|
|
|
|
$tprocess =<<EOF; |
37
|
|
|
|
|
|
|
[ -f "$output" ] || \\{>&2 echo "OUTPUT $output not found" ; \\} && \\ |
38
|
|
|
|
|
|
|
[ -s "$output" ] || \\{>&2 echo "OUTPUT $output is empty"; \\} |
39
|
|
|
|
|
|
|
EOF |
40
|
|
|
|
|
|
|
$process .= $tprocess; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
$self->process($process); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=encoding utf-8 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
BioX::Workflow::Plugin::FileExists - a plugin to BioX::Workflow |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SYNOPSIS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
biox-workflow.pl --plugins FileExists |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
BioX::Workflow::Plugin::FileExists is a plugin of BioX::Workflow that first checks that your local INPUT exists. |
62
|
|
|
|
|
|
|
If it doesn't exist it will exit with 256. |
63
|
|
|
|
|
|
|
If INPUT is empty it will give a warning. |
64
|
|
|
|
|
|
|
If OUTPUT is empty or doesn't exist it will give a warning. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Jillian Rowe E<lt>jillian.e.rowe@gmail.comE<gt> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Copyright 2016- Jillian Rowe |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
78
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |