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