| 1 | package BioX::Workflow::WriteMeta; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 2 | ▶ | use Moose::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | =head1 BioX::Workflow::WriteMeta | ||||||||||||||
| 6 | |||||||||||||||
| 7 | Debug information containing metadata per rule. | ||||||||||||||
| 8 | |||||||||||||||
| 9 | Useful for tracking the evolution of an analysis | ||||||||||||||
| 10 | |||||||||||||||
| 11 | =head2 Variables | ||||||||||||||
| 12 | |||||||||||||||
| 13 | =head3 verbose | ||||||||||||||
| 14 | |||||||||||||||
| 15 | Output some more things | ||||||||||||||
| 16 | |||||||||||||||
| 17 | =cut | ||||||||||||||
| 18 | |||||||||||||||
| 19 | 2 | has 'verbose' => ( | |||||||||||||
| 20 | is => 'rw', | ||||||||||||||
| 21 | isa => 'Bool', | ||||||||||||||
| 22 | default => 1, | ||||||||||||||
| 23 | clearer => 'clear_verbose', | ||||||||||||||
| 24 | predicate => 'has_verbose', | ||||||||||||||
| 25 | ); | ||||||||||||||
| 26 | |||||||||||||||
| 27 | =head3 wait | ||||||||||||||
| 28 | |||||||||||||||
| 29 | Print "wait" at the end of each rule | ||||||||||||||
| 30 | |||||||||||||||
| 31 | This is useful for running with the HPC::Runner libraries. | ||||||||||||||
| 32 | |||||||||||||||
| 33 | =cut | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 2 | has 'wait' => ( | |||||||||||||
| 36 | is => 'rw', | ||||||||||||||
| 37 | isa => 'Bool', | ||||||||||||||
| 38 | default => 1, | ||||||||||||||
| 39 | documentation => | ||||||||||||||
| 40 | q(Print 'wait' at the end of each rule. If you are running as a plain bash script you probably don't need this.), | ||||||||||||||
| 41 | clearer => 'clear_wait', | ||||||||||||||
| 42 | predicate => 'has_wait', | ||||||||||||||
| 43 | ); | ||||||||||||||
| 44 | |||||||||||||||
| 45 | =head2 Subroutines | ||||||||||||||
| 46 | |||||||||||||||
| 47 | =cut | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 6 | ▶ | sub write_workflow_meta { | ||||||||||||
|
Subroutine
write_workflow_meta: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||
| 50 | 6 | my $self = shift; | |||||||||||||
| 51 | 6 | my $type = shift; | |||||||||||||
| 52 | |||||||||||||||
| 53 | 6 | ▶ | return unless $self->verbose; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 54 | |||||||||||||||
| 55 | 6 | ▶ | if ( $type eq "start" ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 56 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 57 | 3 | print "$self->{comment_char} Starting Workflow\n"; | |||||||||||||
| 58 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 59 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 60 | 3 | print "$self->{comment_char} Global Variables:\n"; | |||||||||||||
| 61 | |||||||||||||||
| 62 | 3 | my @keys = $self->global_attr->get_keys(); | |||||||||||||
| 63 | |||||||||||||||
| 64 | 3 | foreach my $k (@keys) { | |||||||||||||
| 65 | 45 | ▶ | next unless $k; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 66 | 45 | my ($v) = $self->global_attr->get_values($k); | |||||||||||||
| 67 | 45 | print "$self->{comment_char}\t$k: " . $v . "\n"; | |||||||||||||
| 68 | } | ||||||||||||||
| 69 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 70 | } | ||||||||||||||
| 71 | elsif ( $type eq "end" ) { | ||||||||||||||
| 72 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 73 | 3 | print "$self->{comment_char} Ending Workflow\n"; | |||||||||||||
| 74 | 3 | print "$self->{comment_char}\n"; | |||||||||||||
| 75 | } | ||||||||||||||
| 76 | } | ||||||||||||||
| 77 | |||||||||||||||
| 78 | =head2 write_rule_meta | ||||||||||||||
| 79 | |||||||||||||||
| 80 | =cut | ||||||||||||||
| 81 | |||||||||||||||
| 82 | 18 | ▶ | sub write_rule_meta { | ||||||||||||
|
Subroutine
write_rule_meta: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||
| 83 | 18 | my ( $self, $meta ) = @_; | |||||||||||||
| 84 | |||||||||||||||
| 85 | 18 | print "\n$self->{comment_char}\n"; | |||||||||||||
| 86 | |||||||||||||||
| 87 | 18 | ▶ | if ( $meta eq "after_meta" ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 88 | 9 | print "$self->{comment_char} Ending $self->{key}\n"; | |||||||||||||
| 89 | } | ||||||||||||||
| 90 | |||||||||||||||
| 91 | 18 | print "$self->{comment_char}\n\n"; | |||||||||||||
| 92 | |||||||||||||||
| 93 | 18 | ▶ | return unless $meta eq "before_meta"; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 94 | 9 | print "$self->{comment_char} Starting $self->{key}\n"; | |||||||||||||
| 95 | 9 | print "$self->{comment_char}\n\n"; | |||||||||||||
| 96 | |||||||||||||||
| 97 | 9 | ▶ | return unless $self->verbose; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 98 | |||||||||||||||
| 99 | 9 | print "\n\n$self->{comment_char}\n"; | |||||||||||||
| 100 | 9 | print "$self->{comment_char} Variables \n"; | |||||||||||||
| 101 | 9 | print "$self->{comment_char} Indir: " . $self->indir . "\n"; | |||||||||||||
| 102 | 9 | print "$self->{comment_char} Outdir: " . $self->outdir . "\n"; | |||||||||||||
| 103 | |||||||||||||||
| 104 | 9 | ▶ | if ( exists $self->local_rule->{ $self->key }->{local} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 105 | |||||||||||||||
| 106 | 2 | print "$self->{comment_char} Local Variables:\n"; | |||||||||||||
| 107 | |||||||||||||||
| 108 | 2 | my @keys = $self->local_attr->get_keys(); | |||||||||||||
| 109 | |||||||||||||||
| 110 | 2 | foreach my $k (@keys) { | |||||||||||||
| 111 | 7 | my ($v) = $self->local_attr->get_values($k); | |||||||||||||
| 112 | 7 | print "$self->{comment_char}\t$k: " . $v . "\n"; | |||||||||||||
| 113 | } | ||||||||||||||
| 114 | } | ||||||||||||||
| 115 | |||||||||||||||
| 116 | 9 | ▶ | $self->write_sample_meta if $self->resample; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 117 | |||||||||||||||
| 118 | 9 | print "$self->{comment_char}\n\n"; | |||||||||||||
| 119 | } | ||||||||||||||
| 120 | |||||||||||||||
| 121 | 2 | 1; | |||||||||||||