« lib/BioX/Workflow/Command/run/Rules/Directives/Interpolate/Mustache.pm
↑ Summary
lib/BioX/Workflow/Command/run/Utils/WriteMeta.pm »
| 1 | package BioX::Workflow::Command::run::Utils::Samples; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use MooseX::App::Role; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 1 | with 'BioX::Workflow::Command::run::Rules::Directives::Sample'; | |||||||||||||||||||||||||||||||
| 7 | 1 | with 'BioX::Workflow::Command::run::Rules::Rules'; | |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Find::Rule; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use File::Glob; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use List::Util qw(uniq); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | =head1 BioX::Workflow::Command::run::Utils::Samples | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | =head2 Variables | ||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | =head2 Subroutines | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | =head3 get_samples | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | Get basename of the files. Can add optional rules. | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | sample.vcf.gz and sample.vcf would be sample if the sample_rule is (.vcf)$|(.vcf.gz)$ | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | Also gets the full path to infiles | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | Instead of doing | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | foreach my $sample (@$self->samples){ | ||||||||||||||||||||||||||||||||
| 35 | dostuff | ||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | Could have | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | foreach my $infile (@$self->infiles){ | ||||||||||||||||||||||||||||||||
| 41 | dostuff | ||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub get_samples { | ||||||||||||||||||||||||||||||
|
Subroutine
get_samples: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 47 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | #Stupid resample | ||||||||||||||||||||||||||||||||
| 50 | 0 | $self->get_global_keys; | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | 0 | my $exists = $self->check_sample_exist; | |||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | return if $exists; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | #We need to evaluate the global_dirs incase the indir has a var | ||||||||||||||||||||||||||||||||
| 56 | #But we don't keep it around, because that would be madness | ||||||||||||||||||||||||||||||||
| 57 | 0 | my $attr = dclone( $self->global_attr ); | |||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ( $attr->indir =~ m/\{\$/ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 59 | 0 | $attr->walk_process_data( $self->global_keys ); | |||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 0 | my $text = $self->get_sample_rule; | |||||||||||||||||||||||||||||||
| 63 | 0 | $self->find_sample_glob( $attr, $text ); | |||||||||||||||||||||||||||||||
| 64 | 0 | $self->find_sample_file_find_rule( $attr, $text ); | |||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if ( $self->has_no_samples ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 67 | 0 | $self->app_log->warn('No samples were found!'); | |||||||||||||||||||||||||||||||
| 68 | 0 | $self->app_log->warn( | |||||||||||||||||||||||||||||||
| 69 | "Indir: " . $attr->indir . "\tSearch: " . $text . "\n" ); | ||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | $self->remove_excluded_samples; | |||||||||||||||||||||||||||||||
| 73 | 0 | $self->write_sample_meta; | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub remove_excluded_samples { | ||||||||||||||||||||||||||||||
|
Subroutine
remove_excluded_samples: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | return unless $self->has_samples; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | return unless $self->has_exclude_samples; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | 0 | my %sample_hash = (); | |||||||||||||||||||||||||||||||
| 83 | 0 | map { $sample_hash{$_} = 1 } @{ $self->samples }; | |||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 0 | foreach my $sample ( $self->all_exclude_samples ) { | |||||||||||||||||||||||||||||||
| 86 | 0 | delete $sample_hash{$sample}; | |||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | 0 | my @new_samples = keys %sample_hash; | |||||||||||||||||||||||||||||||
| 90 | 0 | @new_samples = sort(@new_samples); | |||||||||||||||||||||||||||||||
| 91 | 0 | $self->samples( \@new_samples ); | |||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub find_sample_glob { | ||||||||||||||||||||||||||||||
|
Subroutine
find_sample_glob: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 96 | 0 | my $attr = shift; | |||||||||||||||||||||||||||||||
| 97 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return if $self->has_samples; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | return unless $attr->has_sample_glob; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | 0 | my @sample_files = glob( $attr->sample_glob ); | |||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ( !@sample_files ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | 0 | $self->app_log->warn( "No samples were found with the glob pattern '" | |||||||||||||||||||||||||||||||
| 105 | . $attr->sample_glob | ||||||||||||||||||||||||||||||||
| 106 | . "'" ); | ||||||||||||||||||||||||||||||||
| 107 | 0 | return; | |||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | 0 | @sample_files = sort(@sample_files); | |||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | $self->sample_files( \@sample_files ) if @sample_files; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 0 | my @basename = map { $self->match_samples( $_, $text ) } @sample_files; | |||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if (@basename) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 115 | 0 | @basename = uniq(@basename); | |||||||||||||||||||||||||||||||
| 116 | 0 | @basename = sort(@basename); | |||||||||||||||||||||||||||||||
| 117 | 0 | $self->samples( \@basename ); | |||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | 0 | $self->global_attr->samples( dclone( $self->samples ) ); | |||||||||||||||||||||||||||||||
| 121 | 0 | $self->global_attr->sample_files( dclone( $self->sample_files ) ); | |||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub get_sample_rule { | ||||||||||||||||||||||||||||||
|
Subroutine
get_sample_rule: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 126 | 0 | my $text; | |||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | #Backwards compatibility | ||||||||||||||||||||||||||||||||
| 129 | #For both file_rule and sample_rule | ||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if ( $self->first_index_global_keys( sub { $_ eq 'file_rule' } ) != -1 ) { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 131 | 0 | $text = $self->global_attr->sample_rule; | |||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | elsif ( | ||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $self->first_index_global_keys( sub { $_ eq 'sample_rule' } ) != -1 ) | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 135 | { | ||||||||||||||||||||||||||||||||
| 136 | 0 | $text = $self->global_attr->sample_rule; | |||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||
| 138 | else { | ||||||||||||||||||||||||||||||||
| 139 | 0 | $text = $self->sample_rule; | |||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub find_sample_file_find_rule { | ||||||||||||||||||||||||||||||
|
Subroutine
find_sample_file_find_rule: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 144 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 145 | 0 | my $attr = shift; | |||||||||||||||||||||||||||||||
| 146 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | return if $self->has_samples; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||
| 150 | 0 | my ( @whole, @basename, @sample_files, $find_sample_bydir ); | |||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | 0 | $find_sample_bydir = 0; | |||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if ( $attr->find_sample_bydir ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 155 | 0 | @whole = find( | |||||||||||||||||||||||||||||||
| 156 | directory => name => qr/$text/, | ||||||||||||||||||||||||||||||||
| 157 | maxdepth => $attr->maxdepth, | ||||||||||||||||||||||||||||||||
| 158 | in => $attr->indir, | ||||||||||||||||||||||||||||||||
| 159 | extras => { follow => 1 }, | ||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if (@whole) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ( $whole[0] eq $attr->indir ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 164 | 0 | shift(@whole); | |||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||||||
| 169 | 0 | @whole = find( | |||||||||||||||||||||||||||||||
| 170 | file => name => qr/$text/, | ||||||||||||||||||||||||||||||||
| 171 | maxdepth => $attr->maxdepth, | ||||||||||||||||||||||||||||||||
| 172 | extras => { follow => 1 }, | ||||||||||||||||||||||||||||||||
| 173 | in => $attr->indir | ||||||||||||||||||||||||||||||||
| 174 | ); | ||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||
| 176 | 0 | @basename = map { $self->match_samples( $_, $text ) } @whole; | |||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | 0 | @sample_files = map { path($_)->absolute } @whole; | |||||||||||||||||||||||||||||||
| 179 | 0 | @sample_files = sort(@sample_files); | |||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | if (@basename) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 182 | 0 | @basename = uniq(@basename); | |||||||||||||||||||||||||||||||
| 183 | 0 | @basename = sort(@basename); | |||||||||||||||||||||||||||||||
| 184 | 0 | $self->samples( \@basename ); | |||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $self->sample_files( \@sample_files ) if @sample_files; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||
| 188 | 0 | $self->global_attr->samples( dclone( $self->samples ) ); | |||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub check_sample_exist { | ||||||||||||||||||||||||||||||
|
Subroutine
check_sample_exist: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 192 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | 0 | my $exists = 0; | |||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ( $self->has_samples && !$self->resample ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$self->has_samples and not $self->resample
MC/DC0%0/2
$self->has_samples and not $self->resample
$self->has_samples
not $self->resample
Truth table0%0/3
A and not(B)
A= $self->has_samplesB= not $self->resample
| |||||||||||||||||||||||||||||||||
| 196 | 0 | my (@samples) = $self->sorted_samples; | |||||||||||||||||||||||||||||||
| 197 | 0 | $self->samples( \@samples ); | |||||||||||||||||||||||||||||||
| 198 | ## Fixes Issue #19 | ||||||||||||||||||||||||||||||||
| 199 | 0 | $self->global_attr->samples( \@samples ); | |||||||||||||||||||||||||||||||
| 200 | 0 | $self->app_log->info('Samples passed in on command line.'); | |||||||||||||||||||||||||||||||
| 201 | 0 | $exists = 1; | |||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||
| 203 | elsif ( $self->global_attr->has_samples ) { | ||||||||||||||||||||||||||||||||
| 204 | 0 | my (@samples) = @{ $self->global_attr->samples }; | |||||||||||||||||||||||||||||||
| 205 | 0 | @samples = sort(@samples); | |||||||||||||||||||||||||||||||
| 206 | 0 | $self->samples( \@samples ); | |||||||||||||||||||||||||||||||
| 207 | 0 | $self->app_log->info('Samples were defined in the global key.'); | |||||||||||||||||||||||||||||||
| 208 | 0 | $exists = 1; | |||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | $self->write_sample_meta if $exists; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 212 | 0 | return $exists; | |||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | =head2 match_samples | ||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | Match samples based on regex written in sample_rule | ||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub match_samples { | ||||||||||||||||||||||||||||||
|
Subroutine
match_samples: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 222 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 223 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||
| 224 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if ( $text =~ m/\(/ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 227 | 0 | my @tmp = fileparse($file); | |||||||||||||||||||||||||||||||
| 228 | 0 | my ($m) = $tmp[0] =~ qr/$text/; | |||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||
| 230 | 0 | return $m; | |||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||||||
| 233 | 0 | my @tmp = fileparse($file); | |||||||||||||||||||||||||||||||
| 234 | 0 | return $tmp[0]; | |||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||
| 238 | =head3 process_by_sample_outdir | ||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||
| 240 | Make sure indir/outdirs are named appropriated for samples when using by | ||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||
| 242 | =cut | ||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub process_by_sample_outdir { | ||||||||||||||||||||||||||||||
|
Subroutine
process_by_sample_outdir: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 246 | 0 | my $sample = shift; | |||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||
| 248 | 0 | my ( $tt, $key ); | |||||||||||||||||||||||||||||||
| 249 | 0 | $tt = $self->outdir; | |||||||||||||||||||||||||||||||
| 250 | 0 | $key = $self->key; | |||||||||||||||||||||||||||||||
| 251 | 0 | $tt =~ s/$key/$sample\/$key/; | |||||||||||||||||||||||||||||||
| 252 | 0 | $self->outdir($tt); | |||||||||||||||||||||||||||||||
| 253 | 0 | $self->make_outdir; | |||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||
| 255 | 0 | $tt = $self->indir; | |||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if ( $tt =~ m/\{\$self/ ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 257 | 0 | $tt = "$tt/{\$sample}"; | |||||||||||||||||||||||||||||||
| 258 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||
| 260 | elsif ( $self->has_pkey ) { | ||||||||||||||||||||||||||||||||
| 261 | 0 | $key = $self->pkey; | |||||||||||||||||||||||||||||||
| 262 | 0 | $tt =~ s/$key/$sample\/$key/; | |||||||||||||||||||||||||||||||
| 263 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||
| 265 | else { | ||||||||||||||||||||||||||||||||
| 266 | 0 | $tt = "$tt/$sample"; | |||||||||||||||||||||||||||||||
| 267 | 0 | $self->indir($tt); | |||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||
| 271 | 1 | 1; | |||||||||||||||||||||||||||||||