File Coverage

blib/lib/BioX/Workflow/Command/run.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 17 19 89.4


line stmt bran cond sub pod time code
1             package BioX::Workflow::Command::run;
2              
3 1     1   582150 use v5.10;
  1         4  
4 1     1   261 use MooseX::App::Command;
  1         1917  
  1         4  
5              
6 1     1   111248 use File::Path qw(make_path);
  1         3  
  1         66  
7              
8             extends 'BioX::Workflow::Command';
9 1     1   347 use BioSAILs::Utils::Traits qw(ArrayRefOfStrs);
  1         22113  
  1         6  
10 1     1   1218 use BioX::Workflow::Command::run::Rules::Directives;
  0            
  0            
11              
12             with 'BioX::Workflow::Command::run::Utils::Samples';
13             with 'BioX::Workflow::Command::run::Utils::Attributes';
14             with 'BioX::Workflow::Command::run::Rules::Rules';
15             with 'BioX::Workflow::Command::run::Utils::WriteMeta';
16             with 'BioX::Workflow::Command::run::Utils::Files::TrackChanges';
17             with 'BioX::Workflow::Command::run::Utils::Files::ResolveDeps';
18             with 'BioX::Workflow::Command::Utils::Files';
19             with 'BioSAILs::Utils::Files::CacheDir';
20             with 'BioSAILs::Utils::CacheUtils';
21              
22             command_short_description 'Run your workflow';
23             command_long_description
24             'Run your workflow, process the variables, and create all your directories.';
25              
26             =head1 BioX::Workflow::Command::run
27              
28             biox run -h
29             biox run -w variant_calling.yml
30              
31             =cut
32              
33             =head2 Attributes
34              
35             =cut
36              
37             =head2 Subroutines
38              
39             =cut
40              
41             sub execute {
42             my $self = shift;
43              
44             if ( !$self->load_yaml_workflow ) {
45             $self->app_log->warn('Exiting now.');
46             return;
47             }
48              
49             $self->print_opts;
50              
51             $self->app_log->info("Your cached workflow is available at\n\t".$self->cached_workflow."\n");
52             $self->apply_global_attributes;
53             $self->get_global_keys;
54             $self->get_samples;
55              
56             $self->write_workflow_meta('start');
57              
58             $self->iterate_rules;
59             }
60              
61              
62             before 'BUILD' => sub {
63             my $self = shift;
64              
65             make_path( $self->cache_dir );
66             make_path( File::Spec->catdir( $self->cache_dir, '.biox-cache', 'logs' ) );
67             make_path( File::Spec->catdir( $self->cache_dir, '.biox-cache', 'workflows' ) );
68             };
69              
70             no Moose;
71              
72             __PACKAGE__->meta->make_immutable;
73              
74             1;