line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::Workflow::Command::Utils::Create; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
612
|
use MooseX::App::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
4
|
1
|
|
|
1
|
|
7375
|
use BioX::Workflow::Command::Utils::Traits qw(ArrayRefOfStrs); |
|
1
|
|
|
|
|
23920
|
|
|
1
|
|
|
|
|
9
|
|
5
|
1
|
|
|
1
|
|
1702
|
use Storable qw(dclone); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
337
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
option 'rules' => ( |
8
|
|
|
|
|
|
|
traits => ['Array'], |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
required => 0, |
11
|
|
|
|
|
|
|
isa => ArrayRefOfStrs, |
12
|
|
|
|
|
|
|
documentation => 'Add rules', |
13
|
|
|
|
|
|
|
default => sub { ['rule1'] }, |
14
|
|
|
|
|
|
|
cmd_split => qr/,/, |
15
|
|
|
|
|
|
|
handles => { |
16
|
|
|
|
|
|
|
all_rules => 'elements', |
17
|
|
|
|
|
|
|
has_rules => 'count', |
18
|
|
|
|
|
|
|
join_rules => 'join', |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
cmd_aliases => ['r'], |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_rules { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $rules = []; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my @process = ( |
29
|
|
|
|
|
|
|
'INDIR: {$self->indir}', |
30
|
|
|
|
|
|
|
'INPUT: {$self->INPUT}', |
31
|
|
|
|
|
|
|
'outdir: {$self->outdir} ', |
32
|
|
|
|
|
|
|
'OUTPUT: {$self->OUTPUT->[0]}', |
33
|
|
|
|
|
|
|
); |
34
|
0
|
|
|
|
|
|
my $pr = join( "\n", @process ); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $rule_template = { |
37
|
|
|
|
|
|
|
'local' => [ |
38
|
|
|
|
|
|
|
{ INPUT => '{$self->root_dir}/some_input_rule1' }, |
39
|
|
|
|
|
|
|
{ OUTPUT => ['some_output_rule1'] }, |
40
|
|
|
|
|
|
|
], |
41
|
|
|
|
|
|
|
process => $pr |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
foreach my $rule ( $self->all_rules ) { |
45
|
0
|
|
|
|
|
|
my $href = { $rule => dclone($rule_template) }; |
46
|
0
|
|
|
|
|
|
push( @{$rules}, $href ); |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $rules; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |