Bio/Tools/Run/WrapperBase.pm

filter: Statementstmt 11.3% 14 / 123 Branchbran 0.0% 0 / 88 Conditioncond 0.0% 0 / 41 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 19.0% 4 / 21 Podpod 100% 15 / 15 totaltotal 10.5% 33 / 312 CC 61 SCAR 54.4
CC
61
Cov
6%
_setparams
650.0
executable
156.0
no_param_checks
20.0
CRAP 230.9
« Bio/Search/BlastUtils.pm ↑ Summary Bio/Tree/DistanceFactory.pm »
1 #
2 # BioPerl module for Bio::Tools::Run::WrapperBase
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Jason Stajich <jason@bioperl.org>
7 #
8 # Copyright Jason Stajich
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 Bio::Tools::Run::WrapperBase - A Base object for wrappers around executables
17  
18 =head1 SYNOPSIS
19  
20 # do not use this object directly, it provides the following methods
21 # for its subclasses
22  
23 my $errstr = $obj->error_string();
24 my $exe = $obj->executable();
25 $obj->save_tempfiles($booleanflag)
26 my $outfile= $obj->outfile_name();
27 my $tempdir= $obj->tempdir(); # get a temporary dir for executing
28 my $io = $obj->io; # Bio::Root::IO object
29 my $cleanup= $obj->cleanup(); # remove tempfiles
30  
31 $obj->run({-arg1 => $value});
32  
33 =head1 DESCRIPTION
34  
35 This is a basic module from which to build executable wrapper modules.
36 It has some basic methods to help when implementing new modules.
37  
38 =head1 FEEDBACK
39  
40 =head2 Mailing Lists
41  
42 User feedback is an integral part of the evolution of this and other
43 Bioperl modules. Send your comments and suggestions preferably to
44 the Bioperl mailing list. Your participation is much appreciated.
45  
46 bioperl-l@bioperl.org - General discussion
47 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
48  
49 =head2 Support
50  
51 Please direct usage questions or support issues to the mailing list:
52  
53 I<bioperl-l@bioperl.org>
54  
55 rather than to the module maintainer directly. Many experienced and
56 reponsive experts will be able look at the problem and quickly
57 address it. Please include a thorough description of the problem
58 with code and data examples if at all possible.
59  
60 =head2 Reporting Bugs
61  
62 Report bugs to the Bioperl bug tracking system to help us keep track of
63 the bugs and their resolution. Bug reports can be submitted via the
64 web:
65  
66 https://github.com/bioperl/bioperl-live/issues
67  
68 =head1 AUTHOR - Jason Stajich
69  
70 Email jason-at-bioperl.org
71  
72 =head1 CONTRIBUTORS
73  
74 Sendu Bala, bix@sendu.me.uk
75  
76 =head1 APPENDIX
77  
78 The rest of the documentation details each of the object methods.
79 Internal methods are usually preceded with a _
80  
81 =cut
82  
83  
84 # Let the code begin...
85  
86  
87 package Bio::Tools::Run::WrapperBase;
88 2 $Bio::Tools::Run::WrapperBase::VERSION = '1.7.8';
89 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 # Object preamble - inherits from Bio::Root::Root
92  
93 2 ▶use base qw(Bio::Root::Root);
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 2 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
96 2 ▶use File::Path qw(); # don't import anything
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 =head2 run
99  
100 Title : run
101 Usage : $wrapper->run({ARGS HERE});
102 Function: Support generic running with args passed in
103 as a hashref
104 Returns : Depends on the implementation, status OR data
105 Args : hashref of named arguments
106  
107  
108 =cut
109  
110 0 ▶sub run {
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
111 0 my ($self,@args) = @_;
112 0 $self->throw_not_implemented();
113 }
114  
115  
116 =head2 error_string
117  
118 Title : error_string
119 Usage : $obj->error_string($newval)
120 Function: Where the output from the last analysis run is stored.
121 Returns : value of error_string
122 Args : newvalue (optional)
123  
124  
125 =cut
126  
127 0 ▶sub error_string{
Subroutine error_string: not called CC=3 SCAR=24.8
Pod documented
128 0 my ($self,$value) = @_;
129 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
130 0 $self->{'_error_string'} = $value;
131 }
132 0 ▶ return $self->{'_error_string'} || '';
Condition0%0/2
$self->{'_error_string'} || ''
l!l
00
MC/DC0%0/1
$self->{'_error_string'} || ''
$self->{'_error_string'}
Truth table0%0/2
A
A= $self->{'_error_string'}
Aresult
11
00
133 }
134  
135 =head2 arguments
136  
137 Title : arguments
138 Usage : $obj->arguments($newval)
139 Function: Commandline parameters
140 Returns : value of arguments
141 Args : newvalue (optional)
142  
143  
144 =cut
145  
146 0 ▶sub arguments {
Subroutine arguments: not called CC=3 SCAR=24.8
Pod documented
147 0 my ($self,$value) = @_;
148 0 ▶ if(defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
149 0 $self->{'_arguments'} = $value;
150 }
151 0 ▶ return $self->{'_arguments'} || '';
Condition0%0/2
$self->{'_arguments'} || ''
l!l
00
MC/DC0%0/1
$self->{'_arguments'} || ''
$self->{'_arguments'}
Truth table0%0/2
A
A= $self->{'_arguments'}
Aresult
11
00
152 }
153  
154  
155 =head2 no_param_checks
156  
157 Title : no_param_checks
158 Usage : $obj->no_param_checks($newval)
159 Function: Boolean flag as to whether or not we should
160 trust the sanity checks for parameter values
161 Returns : value of no_param_checks
162 Args : newvalue (optional)
163  
164  
165 =cut
166  
167 0 ▶sub no_param_checks{
Subroutine no_param_checks: not called CC=4 SCAR=30.0
Pod documented
168 0 my ($self,$value) = @_;
169 0 ▶ if( defined $value || ! defined $self->{'no_param_checks'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value or not defined $self->{"no_param_checks"}) 0 0 0
Condition0%0/3
defined $value or not defined $self->{"no_param_checks"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $value or not defined $self->{"no_param_checks"}
defined $value not defined $self->{"no_param_checks"}
Truth table0%0/3
A or not(B)
A= defined $valueB= not defined $self->{"no_param_checks"}
ABresult
1X1
011
000
170 0 ▶ $value = 0 unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
171 0 $self->{'no_param_checks'} = $value;
172 }
173 0 return $self->{'no_param_checks'};
174 }
175  
176 =head2 save_tempfiles
177  
178 Title : save_tempfiles
179 Usage : $obj->save_tempfiles($newval)
180 Function: Get/set the choice of if tempfiles in the temp dir (see tempdir())
181 are kept or cleaned up. Default is '0', ie. delete temp files.
182 NB: This must be set to the desired value PRIOR to first creating
183 a temp dir with tempdir(). Any attempt to set this after tempdir creation will get a warning.
184 Returns : boolean
185 Args : none to get, boolean to set
186  
187 =cut
188  
189 0 ▶sub save_tempfiles{
Subroutine save_tempfiles: not called CC=3 SCAR=24.8
Pod documented
190 0 my $self = shift;
191 0 my @args = @_;
192 0 ▶ if (($args[0]) && (exists ($self->{'_tmpdir'}))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[0] and exists $self->{"_tmpdir"}) 0 0 0
Condition0%0/3
$args[0] and exists $self->{"_tmpdir"}
!ll&&!rl&&r
000
MC/DC0%0/2
$args[0] and exists $self->{"_tmpdir"}
$args[0] exists $self->{"_tmpdir"}
Truth table0%0/3
A and B
A= $args[0]B= exists $self->{"_tmpdir"}
ABresult
0X0
100
111
193 0 $self->warn ("Tempdir already created; setting save_tempfiles will not affect cleanup behavior.");
194 }
195 0 return $self->io->save_tempfiles(@_);
196 }
197  
198 =head2 outfile_name
199  
200 Title : outfile_name
201 Usage : my $outfile = $wrapper->outfile_name();
202 Function: Get/Set the name of the output file for this run
203 (if you wanted to do something special)
204 Returns : string
205 Args : [optional] string to set value to
206  
207  
208 =cut
209  
210 0 ▶sub outfile_name{
Subroutine outfile_name: not called CC=4 SCAR=30.0
Pod documented
211 0 my ($self,$nm) = @_;
212 0 ▶ if( defined $nm || ! defined $self->{'_outfilename'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nm or not defined $self->{"_outfilename"}) 0 0 0
Condition0%0/3
defined $nm or not defined $self->{"_outfilename"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $nm or not defined $self->{"_outfilename"}
defined $nm not defined $self->{"_outfilename"}
Truth table0%0/3
A or not(B)
A= defined $nmB= not defined $self->{"_outfilename"}
ABresult
1X1
011
000
213 0 ▶ $nm = 'mlc' unless defined $nm;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $nm 0 0 0
214 0 $self->{'_outfilename'} = $nm;
215 }
216 0 return $self->{'_outfilename'};
217 }
218  
219  
220 =head2 tempdir
221  
222 Title : tempdir
223 Usage : my $tmpdir = $self->tempdir();
224 Function: Retrieve a temporary directory name (which is created)
225 Returns : string which is the name of the temporary directory
226 Args : none
227  
228  
229 =cut
230  
231 0 ▶sub tempdir{
Subroutine tempdir: not called CC=4 SCAR=30.0
Pod documented
232 0 my ($self) = shift;
233  
234 0 ▶ $self->{'_tmpdir'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
235 0 ▶ unless( $self->{'_tmpdir'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_tmpdir"}) 0 0 0
236 0 $self->{'_tmpdir'} = $self->io->tempdir(CLEANUP => ! $self->save_tempfiles );
237 }
238 0 ▶ unless( -d $self->{'_tmpdir'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $self->{"_tmpdir"}) 0 0 0
239 0 mkdir($self->{'_tmpdir'},0777);
240 }
241 0 return $self->{'_tmpdir'};
242 }
243  
244 =head2 cleanup
245  
246 Title : cleanup
247 Usage : $wrapper->cleanup();
248 Function: Will cleanup the tempdir directory
249 Returns : none
250 Args : none
251  
252  
253 =cut
254  
255 0 ▶sub cleanup{
Subroutine cleanup: not called CC=4 SCAR=30.0
Pod documented
256 0 my ($self) = @_;
257 0 $self->io->_io_cleanup();
258 0 ▶ if( defined $self->{'_tmpdir'} && -d $self->{'_tmpdir'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_tmpdir"} and -d $self->{"_tmpdir"}) 0 0 0
Condition0%0/3
defined $self->{"_tmpdir"} and -d $self->{"_tmpdir"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"_tmpdir"} and -d $self->{"_tmpdir"}
defined $self->{"_tmpdir"} -d $self->{"_tmpdir"}
Truth table0%0/3
A and B
A= defined $self->{"_tmpdir"}B= -d $self->{"_tmpdir"}
ABresult
0X0
100
111
259 0 ▶ my $verbose = ($self->verbose >= 1) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->verbose >= 1 ? : 0 0 0
260 0 File::Path::rmtree( $self->{'_tmpdir'}, $verbose);
261 }
262 }
263  
264 =head2 io
265  
266 Title : io
267 Usage : $obj->io($newval)
268 Function: Gets a Bio::Root::IO object
269 Returns : Bio::Root::IO object
270 Args : none
271  
272  
273 =cut
274  
275 0 ▶sub io{
Subroutine io: not called CC=2 SCAR=17.9
Pod documented
276 0 my ($self) = @_;
277 0 ▶ unless( defined $self->{'io'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"io"}) 0 0 0
278 0 $self->{'io'} = Bio::Root::IO->new(-verbose => $self->verbose);
279 }
280 0 return $self->{'io'};
281 }
282  
283 =head2 version
284  
285 Title : version
286 Usage : $version = $wrapper->version()
287 Function: Returns the program version (if available)
288 Returns : string representing version of the program
289 Args : [Optional] value to (re)set version string
290  
291  
292 =cut
293  
294 0 ▶sub version{
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
295 0 my ($self,@args) = @_;
296 0 return;
297 }
298  
299 =head2 executable
300  
301 Title : executable
302 Usage : my $exe = $factory->executable();
303 Function: Finds the full path to the executable
304 Returns : string representing the full path to the exe
305 Args : [optional] name of executable to set path to
306 [optional] boolean flag whether or not warn when exe is not found
307  
308 =cut
309  
310 0 ▶sub executable {
Subroutine executable: not called CC=12 SCAR=50.5
Pod documented
311 0 my ($self, $exe, $warn) = @_;
312  
313 0 ▶ if (defined $exe) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $exe) 0 0 0
314 0 $self->{'_pathtoexe'} = $exe;
315 }
316  
317 0 ▶ unless( defined $self->{'_pathtoexe'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_pathtoexe"}) 0 0 0
318 0 my $prog_path = $self->program_path;
319  
320 0 ▶ if ($prog_path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prog_path) 0 0 0
321 0 ▶ if (-f $prog_path && -x $prog_path) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $prog_path and -x $prog_path) { } 0 0 0
elsif ($self->program_dir) { } 0 0 0
Condition0%0/3
-f $prog_path and -x $prog_path
!ll&&!rl&&r
000
MC/DC0%0/2
-f $prog_path and -x $prog_path
-f $prog_path -x $prog_path
Truth table0%0/3
A and B
A= -f $prog_pathB= -x $prog_path
ABresult
0X0
100
111
322 0 $self->{'_pathtoexe'} = $prog_path;
323 }
324 elsif ($self->program_dir) {
325 0 ▶ $self->warn("executable not found in $prog_path, trying system path...") if $warn;
Branch: 1 branch
BranchTrueFalseTotal
if $warn 0 0 0
326 }
327 }
328 0 ▶ unless ($self->{'_pathtoexe'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_pathtoexe"}) 0 0 0
329 0 my $exe;
330 0 ▶ if ( $exe = $self->io->exists_exe($self->program_name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exe = $self->io->exists_exe($self->program_name)) { } 0 0 0
331 0 $self->{'_pathtoexe'} = $exe;
332 }
333 else {
334 0 ▶ $self->warn("Cannot find executable for ".$self->program_name) if $warn;
Branch: 1 branch
BranchTrueFalseTotal
if $warn 0 0 0
335 0 $self->{'_pathtoexe'} = undef;
336 }
337 }
338 }
339  
340 # bail if we never found the executable
341 0 ▶ unless ( defined $self->{'_pathtoexe'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_pathtoexe"}) 0 0 0
342 0 $self->throw("Cannot find executable for ".$self->program_name .
343 ". path=\"".$self->program_path."\"");
344 }
345 0 return $self->{'_pathtoexe'};
346 }
347  
348 =head2 program_path
349  
350 Title : program_path
351 Usage : my $path = $factory->program_path();
352 Function: Builds path for executable
353 Returns : string representing the full path to the exe
354 Args : none
355  
356 =cut
357  
358 0 ▶sub program_path {
Subroutine program_path: not called CC=4 SCAR=30.0
Pod documented
359 0 my ($self) = @_;
360 0 my @path;
361 0 ▶ push @path, $self->program_dir if $self->program_dir;
Branch: 1 branch
BranchTrueFalseTotal
if $self->program_dir 0 0 0
362 0 ▶ push @path, $self->program_name.($^O =~ /mswin/i ? '.exe' : '') if $self->program_name;
Branch: 2 branches
BranchTrueFalseTotal
if $self->program_name 0 0 0
$^O =~ /mswin/i ? : 0 0 0
363 0 return File::Spec->catfile(@path);
364 }
365  
366 =head2 program_dir
367  
368 Title : program_dir
369 Usage : my $dir = $factory->program_dir();
370 Function: Abstract get method for dir of program. To be implemented
371 by wrapper.
372 Returns : string representing program directory
373 Args : none
374  
375 =cut
376  
377 0 ▶sub program_dir {
Subroutine program_dir: not called CC=1 SCAR=6.9
Pod documented
378 0 my ($self) = @_;
379 0 $self->throw_not_implemented();
380 }
381  
382 =head2 program_name
383  
384 Title : program_name
385 Usage : my $name = $factory->program_name();
386 Function: Abstract get method for name of program. To be implemented
387 by wrapper.
388 Returns : string representing program name
389 Args : none
390  
391 =cut
392  
393 0 ▶sub program_name {
Subroutine program_name: not called CC=1 SCAR=6.9
Pod documented
394 0 my ($self) = @_;
395 0 $self->throw_not_implemented();
396 }
397  
398 =head2 quiet
399  
400 Title : quiet
401 Usage : $factory->quiet(1);
402 if ($factory->quiet()) { ... }
403 Function: Get/set the quiet state. Can be used by wrappers to control if
404 program output is printed to the console or not.
405 Returns : boolean
406 Args : none to get, boolean to set
407  
408 =cut
409  
410 0 ▶sub quiet {
Subroutine quiet: not called CC=3 SCAR=24.8
Pod documented
411 0 my $self = shift;
412 0 ▶ if (@_) { $self->{quiet} = shift }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
413 0 ▶ return $self->{quiet} || 0;
Condition0%0/2
$self->{'quiet'} || 0
l!l
00
MC/DC0%0/1
$self->{'quiet'} || 0
$self->{'quiet'}
Truth table0%0/2
A
A= $self->{'quiet'}
Aresult
11
00
414 }
415  
416 =head2 _setparams()
417  
418 Title : _setparams
419 Usage : $params = $self->_setparams(-params => [qw(window evalue_cutoff)])
420 Function: For internal use by wrapper modules to build parameter strings
421 suitable for sending to the program being wrapped. For each method
422 name supplied, calls the method and adds the method name (as modified
423 by optional things) along with its value (unless a switch) to the
424 parameter string
425 Example : $params = $self->_setparams(-params => [qw(window evalue_cutoff)],
426 -switches => [qw(simple large all)],
427 -double_dash => 1,
428 -underscore_to_dash => 1);
429 If window() and simple() had not been previously called, but
430 evalue_cutoff(0.5), large(1) and all(0) had been called, $params
431 would be ' --evalue-cutoff 0.5 --large'
432 Returns : parameter string
433 Args : -params => [] or {} # array ref of method names to call,
434 or hash ref where keys are method names and
435 values are how those names should be output
436 in the params string
437 -switches => [] or {}# as for -params, but no value is printed for
438 these methods
439 -join => string # define how parameters and their values are
440 joined, default ' '. (eg. could be '=' for
441 param=value)
442 -lc => boolean # lc() method names prior to output in string
443 -dash => boolean # prefix all method names with a single dash
444 -double_dash => bool # prefix all method names with a double dash
445 -mixed_dash => bool # prefix single-character method names with a
446 # single dash, and multi-character method names
447 # with a double-dash
448 -underscore_to_dash => boolean # convert all underscores in method
449 names to dashes
450  
451 =cut
452  
453 0 ▶sub _setparams {
Subroutine _setparams: not called CC=25 SCAR=64.8
454 0 my ($self, @args) = @_;
455  
456 0 my ($params, $switches, $join, $lc, $d, $dd, $md, $utd) =
457 $self->_rearrange([qw(PARAMS
458 SWITCHES
459 JOIN
460 LC
461 DASH
462 DOUBLE_DASH
463 MIXED_DASH
464 UNDERSCORE_TO_DASH)], @args);
465 0 ▶ $self->throw('at least one of -params or -switches is required') unless ($params || $switches);
Branch: 1 branch
BranchTrueFalseTotal
unless $params or $switches 0 0 0
Condition0%0/3
$params or $switches
l!l&&r!l&&!r
000
MC/DC0%0/2
$params or $switches
$params $switches
Truth table0%0/3
A or B
A= $paramsB= $switches
ABresult
1X1
011
000
466 0 ▶ $self->throw("-dash, -double_dash and -mixed_dash are mutually exclusive") if (defined($d) + defined($dd) + defined($md) > 1);
Branch: 1 branch
BranchTrueFalseTotal
if defined($d) + defined($dd) + defined($md) > 1 0 0 0
467 0 ▶ $join ||= ' ';
Condition0%0/2
$join ||= " "
l!l
00
MC/DC0%0/1
$join ||= " "
$join
Truth table0%0/2
A
A= $join
Aresult
11
00
468  
469 0 ▶ my %params = ref($params) eq 'HASH' ? %{$params} : map { $_ => $_ } @{$params};
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'HASH' ? : 0 0 0
470 0 ▶ my %switches = ref($switches) eq 'HASH' ? %{$switches} : map { $_ => $_ } @{$switches};
Branch: 1 branch
BranchTrueFalseTotal
ref $switches eq 'HASH' ? : 0 0 0
471  
472 0 my $param_string = '';
473 0 for my $hash_ref (\%params, \%switches) {
474 0 ▶ while (my ($method, $method_out) = each %{$hash_ref}) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$hash_ref;}) 0 0 0
475 0 my $value = $self->$method();
476 0 ▶ next unless (defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
477 0 ▶ next if (exists $switches{$method} && ! $value);
Branch: 1 branch
BranchTrueFalseTotal
if exists $switches{$method} and not $value 0 0 0
Condition0%0/3
exists $switches{$method} and not $value
!ll&&!rl&&r
000
MC/DC0%0/2
exists $switches{$method} and not $value
exists $switches{$method} not $value
Truth table0%0/3
A and not(B)
A= exists $switches{$method}B= not $value
ABresult
0X0
100
111
478  
479 0 ▶ $method_out = lc($method_out) if $lc;
Branch: 1 branch
BranchTrueFalseTotal
if $lc 0 0 0
480 0 ▶ my $method_length = length($method_out) if $md;
Branch: 1 branch
BranchTrueFalseTotal
if $md 0 0 0
481 0 ▶ $method_out = '-'.$method_out if ($d || ($md && ($method_length == 1)));
Branch: 1 branch
BranchTrueFalseTotal
if $d or $md and $method_length == 1 0 0 0
Condition0%0/6
$d or $md and $method_length == 1
l!l&&r!l&&!r
000
$md and $method_length == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$d or $md and $method_length == 1
$d $md $method_length == 1
Truth table0%0/4
A or B and C
A= $dB= $mdC= $method_length == 1
ABCresult
1XX1
0111
00X0
0100
482 0 ▶ $method_out = '--'.$method_out if ($dd || ($md && ($method_length > 1)));
Branch: 1 branch
BranchTrueFalseTotal
if $dd or $md and $method_length > 1 0 0 0
Condition0%0/6
$dd or $md and $method_length > 1
l!l&&r!l&&!r
000
$md and $method_length > 1
!ll&&!rl&&r
000
MC/DC0%0/3
$dd or $md and $method_length > 1
$dd $md $method_length > 1
Truth table0%0/4
A or B and C
A= $ddB= $mdC= $method_length > 1
ABCresult
1XX1
0111
00X0
0100
483 0 ▶ $method_out =~ s/_/-/g if $utd;
Branch: 1 branch
BranchTrueFalseTotal
if $utd 0 0 0
484  
485 0 ▶ if ( exists $params{$method} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params{$method}) 0 0 0
486 # if value are quoted with " or ', re-quote it
487 0 ▶ if ( $value =~ m{^[\'\"]+(.+)[\'\"]+$} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($value =~ /^[\'\"]+(.+)[\'\"]+$/) { } 0 0 0
elsif ($value =~ /\s+/) { } 0 0 0
488 0 $value = '"'. $1 . '"';
489 }
490 # quote values that contain spaces
491 elsif ( $value =~ m{\s+} ) {
492 0 $value = '"'. $value . '"';
493 }
494 }
495  
496 0 ▶ $param_string .= ' '.$method_out.(exists $switches{$method} ? '' : $join.$value);
Branch: 1 branch
BranchTrueFalseTotal
exists $switches{$method} ? : 0 0 0
497 }
498 }
499  
500 0 return $param_string;
501 }
502  
503 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=2 SCAR=17.9
504 0 my $self= shift;
505 0 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 0 0 0
506 0 $self->cleanup();
507 }
508 0 $self->SUPER::DESTROY();
509 }
510  
511  
512 2 1;
« Bio/Search/BlastUtils.pm ↑ Summary Bio/Tree/DistanceFactory.pm »