blib/lib/Bio/Tools/Run/Simprot.pm

filter: Statementstmt 33.3% 52 / 156 Branchbran 17.6% 12 / 68 Conditioncond 3.4% 1 / 29 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 65.2% 15 / 23 Podpod 91.6% 11 / 12 totaltotal 29.7% 91 / 306 CC 45 SCAR 36.0
CC
45
Cov
26%
run
110.0
prepare
72.0
set_parameter
56.0
CRAP 36.7
« blib/lib/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Proda.pm »
1 # $Id$
2 #
3 # BioPerl module for Bio::Tools::Run::Simprot
4 #
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 #
7 # Cared for by Albert Vilella <avilella-at-gmail-dot-com>
8 #
9 # Copyright Albert Vilella
10 #
11 # You may distribute this module under the same terms as perl itself
12  
13 # POD documentation - main docs before the code
14  
15 =head1 NAME
16  
17 Bio::Tools::Run::Simprot - Wrapper around the Simprot program. Wrapper for the calculation of a multiple sequence alignment from a phylogenetic tree
18  
19 =head1 SYNOPSIS
20  
21 use Bio::Tools::Run::Simprot;
22 use Bio::TreeIO;
23  
24 my $treeio = Bio::TreeIO->new(
25 -format => 'nh', -file => 't/data/tree.nh');
26  
27 my $tree = $treeio->next_tree;
28  
29 my $simprot = Bio::Tools::Run::Simprot->new();
30 $simprot->tree($tree);
31 my ($rc,$aln,$seq) = $simprot->run();
32  
33 =head1 DESCRIPTION
34  
35 This is a wrapper around the Simprot program by Andy Pang, Andrew D
36 Smith, Paulo AS Nuin and Elisabeth RM Tillier.
37  
38 Simprot allows for several models of amino acid substitution (PAM, JTT
39 and PMB), allows for gamma distributed sites rates according to Yang's
40 model, and implements a parameterised Qian and Goldstein distribution
41 model for insertion and deletion.
42  
43 See http://www.uhnres.utoronto.ca/labs/tillier/software.htm for more
44 information.
45  
46  
47 =head2 Helping the module find your executable
48  
49 You will need to enable SIMPROTDIR to find the simprot program. This can be
50 done in (at least) three ways:
51  
52 1. Make sure the simprot executable is in your path (i.e.
53 'which simprot' returns a valid program
54 2. define an environmental variable SIMPROTDIR which points to a
55 directory containing the 'simprot' app:
56 In bash
57 export SIMPROTDIR=/home/progs/simprot or
58 In csh/tcsh
59 setenv SIMPROTDIR /home/progs/simprot
60  
61 3. include a definition of an environmental variable SIMPROTDIR
62 in every script that will
63 BEGIN {$ENV{SIMPROTDIR} = '/home/progs/simprot'; }
64 use Bio::Tools::Run::Simprot;
65  
66 =head1 FEEDBACK
67  
68 =head2 Mailing Lists
69  
70 User feedback is an integral part of the evolution of this and other
71 Bioperl modules. Send your comments and suggestions preferably to one
72 of the Bioperl mailing lists. Your participation is much appreciated.
73  
74 bioperl-l@bioperl.org - General discussion
75 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
76  
77 =head2 Support
78  
79 Please direct usage questions or support issues to the mailing list:
80  
81 I<bioperl-l@bioperl.org>
82  
83 rather than to the module maintainer directly. Many experienced and
84 reponsive experts will be able look at the problem and quickly
85 address it. Please include a thorough description of the problem
86 with code and data examples if at all possible.
87  
88 =head2 Reporting Bugs
89  
90 Report bugs to the Bioperl bug tracking system to help us keep track
91 the bugs and their resolution. Bug reports can be submitted via the web:
92  
93 http://redmine.open-bio.org/projects/bioperl/
94  
95 =head1 AUTHOR - Albert Vilella
96  
97 Email avilella-at-gmail-dot-com
98  
99 =head1 APPENDIX
100  
101 The rest of the documentation details each of the object
102 methods. Internal methods are usually preceded with a _
103  
104 =cut
105  
106 package Bio::Tools::Run::Simprot;
107  
108 1 ▶use vars qw(@ISA %VALIDVALUES $PROGRAMNAME $PROGRAM);
Subroutine BEGIN: called CC=1 SCAR=0.0
109  
110 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
111 1 ▶use Bio::SimpleAlign;
Subroutine BEGIN: called CC=1 SCAR=0.0
112 1 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
113 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
114 1 ▶use Bio::TreeIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
115 1 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
116 1 ▶use Bio::Root::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
117 1 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
118 1 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
119  
120 # valid values for parameters, the default one is always
121 # the first one in the array
122 BEGIN {
123 1 ▶ %VALIDVALUES = (
Subroutine BEGIN: called CC=1 SCAR=0.0
124 'branch' => '1',
125 'eFactor' => '3',
126 'indelFrequncy' => '0.03',
127 'maxIndel' => '2048',
128 'subModel' => [ 2,0,1], # 0:PAM, 1:JTT, 2:PMB
129 'rootLength' => '50',
130 'alpha' => '1',
131 'Benner' => '0',
132 'interleaved' => '1',
133 'variablegamma' => '0',
134 'bennerk' => '-2',
135 );
136 }
137  
138 =head2 program_name
139  
140 Title : program_name
141 Usage : $factory->program_name()
142 Function: holds the program name
143 Returns: string
144 Args : None
145  
146 =cut
147  
148 sub program_name {
149 6 ▶ return 'simprot';
Subroutine program_name: called CC=1 SCAR=0.0
Pod documented
150 }
151  
152 =head2 program_dir
153  
154 Title : program_dir
155 Usage : $factory->program_dir(@params)
156 Function: returns the program directory, obtained from ENV variable.
157 Returns: string
158 Args :
159  
160 =cut
161  
162 sub program_dir {
163 3 ▶ return Bio::Root::IO->catfile($ENV{SIMPROTDIR}) if $ENV{SIMPROTDIR};
Subroutine program_dir: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"SIMPROTDIR"} 0 3 3
164 }
165  
166  
167 =head2 new
168  
169 Title : new
170 Usage : my $simprot = Bio::Tools::Run::Simprot->new();
171 Function: Builds a new Bio::Tools::Run::Simprot
172 Returns : Bio::Tools::Run::Simprot
173 Args : -alignment => the Bio::Align::AlignI object
174 -tree => the Bio::Tree::TreeI object
175 -save_tempfiles => boolean to save the generated tempfiles and
176 NOT cleanup after onesself (default FALSE)
177 -executable => where the simprot executable resides
178 -params => A reference to a hash where keys are parameter names
179 and hash values are the associated parameter values
180  
181 See also: L<Bio::Tree::TreeI>, L<Bio::Align::AlignI>
182  
183 =cut
184  
185 sub new {
186 1 ▶ my($class,@args) = @_;
Subroutine new: called CC=6 SCAR=21.9
Pod documented
187  
188 1 my $self = $class->SUPER::new(@args);
189 1 my ($aln, $tree, $st, $params, $exe,
190 $ubl) = $self->_rearrange([qw(TREE SAVE_TEMPFILES PARAMS EXECUTABLE)],
191 @args);
192 1 ▶ defined $tree && $self->tree($tree);
Branch: 1 branch
BranchTrueFalseTotal
defined $tree and $self->tree($tree) 0 1 1
193 1 ▶ defined $st && $self->save_tempfiles($st);
Branch: 1 branch
BranchTrueFalseTotal
defined $st and $self->save_tempfiles($st) 0 1 1
194 1 ▶ defined $exe && $self->executable($exe);
Branch: 1 branch
BranchTrueFalseTotal
defined $exe and $self->executable($exe) 0 1 1
195  
196 1 $self->set_default_parameters();
197 1 ▶ if( defined $params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params) 0 1 1
198 0 ▶ if( ref($params) !~ /HASH/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref($params) =~ /HASH/i) { } 0 0 0
199 0 $self->warn("Must provide a valid hash ref for parameter -FLAGS");
200 } else {
201 0 map { $self->set_parameter($_, $$params{$_}) } keys %$params;
202 }
203 }
204 1 return $self;
205 }
206  
207 =head2 set_parameters
208  
209 Title : set_parameters
210 Usage : $codeml->set_parameters($parameter, $value);
211 Function: (Re)set the SimProt parameters
212 Returns : none
213 Args : First argument is the parameter name
214 Second argument is the parameter value
215  
216 =cut
217  
218 sub set_parameter{
219 0 ▶ my ($self,$param,$value) = @_;
Subroutine set_parameter: not called CC=7 SCAR=40.3
Pod undocumented
220 0 ▶ unless (defined $self->{'no_param_checks'} && $self->{'no_param_checks'} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"no_param_checks"} and $self->{"no_param_checks"} == 1) 0 0 0
Condition0%0/3
defined $self->{"no_param_checks"} and $self->{"no_param_checks"} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"no_param_checks"} and $self->{"no_param_checks"} == 1
defined $self->{"no_param_checks"} $self->{"no_param_checks"} == 1
Truth table0%0/3
A and B
A= defined $self->{"no_param_checks"}B= $self->{"no_param_checks"} == 1
ABresult
0X0
100
111
221 0 ▶ if ( ! defined $VALIDVALUES{$param} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $Bio::Tools::Run::Simprot::VALIDVALUES{$param}) 0 0 0
222 0 $self->warn("unknown parameter $param will not be set unless you force by setting no_param_checks to true");
223 0 return 0;
224 }
225 0 ▶ if ( ref( $VALIDVALUES{$param}) =~ /ARRAY/i &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref($Bio::Tools::Run::Simprot::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};} > 0) 0 0 0
Condition0%0/3
ref($Bio::Tools::Run::Simprot::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};} > 0
!ll&&!rl&&r
000
MC/DC0%0/2
ref($Bio::Tools::Run::Simprot::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};} > 0
ref($Bio::Tools::Run::Simprot::VALIDVALUES{$param}) =~ /ARRAY/i scalar @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};} > 0
Truth table0%0/3
A and B
A= ref($Bio::Tools::Run::Simprot::VALIDVALUES{$param}) =~ /ARRAY/iB= scalar @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};} > 0
ABresult
0X0
100
111
226 0 scalar @{$VALIDVALUES{$param}} > 0 ) {
227
228 0 ▶ unless ( grep { $value eq $_ } @{ $VALIDVALUES{$param} } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$value eq $_;} @{$Bio::Tools::Run::Simprot::VALIDVALUES{$param};}) 0 0 0
229 0 $self->warn("parameter $param specified value $value is not recognized, please see the documentation and the code for this module or set the no_param_checks to a true value");
230 0 return 0;
231 }
232 }
233 }
234 0 $self->{'_simprotparams'}->{$param} = $value;
235 0 return 1;
236 }
237  
238  
239  
240 =head2 set_default_parameters
241  
242 Title : set_default_parameters
243 Usage : $codeml->set_default_parameters(0);
244 Function: (Re)set the default parameters from the defaults
245 (the first value in each array in the
246 %VALIDVALUES class variable)
247 Returns : none
248 Args : boolean: keep existing parameter values
249  
250  
251 =cut
252  
253 sub set_default_parameters{
254 1 ▶ my ($self,$keepold) = @_;
Subroutine set_default_parameters: called CC=6 SCAR=18.6
Pod documented
255 1 ▶ $keepold = 0 unless defined $keepold;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $keepold 1 0 1
256
257 1 ▶ while( my ($param,$val) = each %VALIDVALUES ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %Bio::Tools::Run::Simprot::VALIDVALUES) 11 1 12
258 # skip if we want to keep old values and it is already set
259 11 ▶ next if( defined $self->{'_simprotparams'}->{$param} && $keepold);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"_simprotparams"}{$param} and $keepold 0 11 11
Condition33%1/3
defined $self->{"_simprotparams"}{$param} and $keepold
!ll&&!rl&&r
1100
MC/DC0%0/2
defined $self->{"_simprotparams"}{$param} and $keepold
defined $self->{"_simprotparams"}{$param} $keepold
Truth table33%1/3
A and B
A= defined $self->{"_simprotparams"}{$param}B= $keepold
ABresult
0X0
100
111
260 11 ▶ if(ref($val)=~/ARRAY/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($val) =~ /ARRAY/i) { } 1 10 11
261 1 $self->{'_simprotparams'}->{$param} = $val->[0];
262 } else {
263 10 $self->{'_simprotparams'}->{$param} = $val;
264 }
265 }
266 }
267  
268  
269 =head2 get_parameters
270  
271 Title : get_parameters
272 Usage : my %params = $self->get_parameters();
273 Function: returns the list of parameters as a hash
274 Returns : associative array keyed on parameter names
275 Args : none
276  
277  
278 =cut
279  
280 sub get_parameters{
281 0 ▶ my ($self) = @_;
Subroutine get_parameters: not called CC=1 SCAR=6.9
Pod documented
282 # we're returning a copy of this
283 0 return %{ $self->{'_simprotparams'} };
284 }
285  
286  
287  
288 =head2 prepare
289  
290 Title : prepare
291 Usage : my $rundir = $simprot->prepare();
292 Function: prepare the simprot analysis using the default or updated parameters
293 the alignment parameter and species tree must have been set
294 Returns : value of rundir
295 Args : L<Bio::Align::AlignI> object,
296 L<Bio::Tree::TreeI> object [optional]
297  
298 =cut
299  
300 sub prepare {
301 0 ▶ my ($self,$tree) = @_;
Subroutine prepare: not called CC=8 SCAR=42.8
Pod documented
302  
303 0 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 0 0 0
304 # brush so we don't get plaque buildup ;)
305 0 $self->cleanup();
306 }
307 0 ▶ $tree = $self->tree unless $tree;
Branch: 1 branch
BranchTrueFalseTotal
unless $tree 0 0 0
308 0 ▶ if( ! $tree ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($tree) 0 0 0
309 0 $self->warn("must have supplied a valid species tree file in order to run simprot");
310 0 return 0;
311 }
312 0 my ($tempdir) = $self->tempdir();
313  
314 0 my ($temptreeFH);
315 0 ▶ if( ! ref($tree) && -e $tree ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $tree and -e $tree) { } 0 0 0
Condition0%0/3
not ref $tree and -e $tree
!ll&&!rl&&r
000
MC/DC0%0/2
not ref $tree and -e $tree
not ref $tree -e $tree
Truth table0%0/3
not(A) and B
A= not ref $treeB= -e $tree
ABresult
0X0
100
111
316 0 $self->{_temptreefile} = $tree;
317 } else {
318 0 ▶ ($temptreeFH,$self->{_temptreefile}) = $self->io->tempfile
Branch: 1 branch
BranchTrueFalseTotal
$self->save_tempfiles ? : 0 0 0
319 ('-dir' => $tempdir,
320 UNLINK => ($self->save_tempfiles ? 0 : 1));
321  
322 0 my $treeout = Bio::TreeIO->new('-format' => 'newick',
323 '-fh' => $temptreeFH);
324 0 $treeout->write_tree($tree);
325 0 $treeout->close();
326 0 close($temptreeFH);
327 }
328 0 $self->{_prepared} = 1;
329  
330 0 my %params = $self->get_parameters;
331 0 ▶ while( my ($param,$val) = each %params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %params) 0 0 0
332 0 $self->{_simprot_params} .=" \-\-$param\=$val";
333 }
334  
335 0 return $tempdir;
336 }
337  
338  
339 =head2 run
340  
341 Title : run
342 Usage : my $nhx_tree = $simprot->run();
343 Function: run the simprot analysis using the default or updated parameters
344 the alignment parameter must have been set
345 Returns : L<Bio::Tree::TreeI> object [optional]
346 Args : L<Bio::Align::AlignI> object
347 L<Bio::Tree::TreeI> object
348  
349  
350 =cut
351  
352 sub run {
353 0 ▶ my ($self,$tree) = @_;
Subroutine run: not called CC=10 SCAR=47.0
Pod documented
354  
355 0 ▶ $self->prepare($tree) unless (defined($self->{_prepared}));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_prepared"} 0 0 0
356 0 my ($rc,$aln,$seq) = (1);
357 0 my ($tmpdir) = $self->tempdir();
358 0 my $outfile;
359 {
360 0 my $commandstring;
361 my $exit_status;
362 0 my $simprot_executable = $self->executable;
363 0 $commandstring .= $simprot_executable;
364 0 $commandstring .= $self->{_simprot_params};
365 0 $commandstring .= " --tree=". $self->{_temptreefile} . " ";
366 0 my ($tfh, $outfile) = $self->io->tempfile(-dir=>$self->tempdir());
367 0 close($tfh);
368 0 undef $tfh;
369 0 $self->outfile_name($outfile);
370 0 my $seqfile;
371 0 ($tfh, $seqfile) = $self->io->tempfile(-dir=>$self->tempdir());
372 0 close($tfh);
373 0 undef $tfh;
374  
375 0 $commandstring .= "--alignment=". $self->outfile_name . " ";
376 0 $commandstring .= "--sequence=". $seqfile . " ";
377  
378 0 ▶ $self->throw("unable to find or run executable for 'simprot'")
Branch: 1 branch
BranchTrueFalseTotal
unless $simprot_executable and -e $simprot_executable and -x _ 0 0 0
Condition0%0/6
$simprot_executable and -e $simprot_executable and -x _
!ll&&!rl&&r
000
$simprot_executable and -e $simprot_executable
!ll&&!rl&&r
000
MC/DC0%0/3
$simprot_executable and -e $simprot_executable and -x _
$simprot_executable -e $simprot_executable -x _
Truth table0%0/4
A and B and C
A= $simprot_executableB= -e $simprot_executableC= -x _
ABCresult
0XX0
10X0
1100
1111
379 unless $simprot_executable && -e $simprot_executable && -x _;
380  
381 0 ▶ open(RUN, "$commandstring |")
Branch: 1 branch
BranchTrueFalseTotal
open RUN, "$commandstring |" or $self->throw("Cannot run $commandstring") 0 0 0
382 or $self->throw("Cannot run $commandstring");
383  
384 0 my @output = <RUN>;
385 0 $exit_status = close(RUN);
386 0 $self->error_string(join('',@output));
387 0 ▶ if( (grep { /^\[ /io } @output) || !$exit_status) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {/^\[ /io;} @output or not $exit_status) 0 0 0
Condition0%0/3
grep {/^\[ /io;} @output or not $exit_status
l!l&&r!l&&!r
000
MC/DC0%0/2
grep {/^\[ /io;} @output or not $exit_status
grep {/^\[ /io;} @output not $exit_status
Truth table0%0/3
A or not(B)
A= grep {/^\[ /io;} @outputB= not $exit_status
ABresult
1X1
011
000
388 0 $self->warn("There was an error - see error_string for the program output");
389 0 $rc = 0;
390 }
391 0 eval {
392 0 $aln = Bio::AlignIO->new(-file => "$outfile",-format => 'fasta');
393 0 $seq = Bio::SeqIO->new(-file => "$seqfile", -format => 'fasta');
394 };
395 0 ▶ if( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
396 0 $self->warn($self->error_string);
397 }
398 }
399 0 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 0 0 0
400 0 $self->cleanup();
401 }
402 0 return ($rc,$aln,$seq);
403 }
404  
405  
406 =head2 error_string
407  
408 Title : error_string
409 Usage : $obj->error_string($newval)
410 Function: Where the output from the last analysus run is stored.
411 Returns : value of error_string
412 Args : newvalue (optional)
413  
414  
415 =cut
416  
417 sub error_string {
418 0 ▶ my ($self,$value) = @_;
Subroutine error_string: not called CC=2 SCAR=17.9
Pod documented
419 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
420 0 $self->{'error_string'} = $value;
421 }
422 0 return $self->{'error_string'};
423  
424 }
425  
426  
427 =head2 version
428  
429 Title : version
430 Usage : exit if $prog->version() < 1.8
431 Function: Determine the version number of the program
432 Example :
433 Returns : float or undef
434 Args : none
435  
436 =cut
437  
438 sub version {
439 0 ▶ my ($self) = @_;
Subroutine version: not called CC=3 SCAR=24.8
Pod documented
440 0 my $exe;
441 0 ▶ return undef unless $exe = $self->executable;
Branch: 1 branch
BranchTrueFalseTotal
unless $exe = $self->executable 0 0 0
442 0 my $string = `$exe 2>&1` ;
443  
444 0 $string =~ /Version\:\s+(\d+.\d+.\d+)/m;
445 0 ▶ return $1 || undef;
Condition0%0/2
$1 || undef
l!l
00
MC/DC0%0/1
$1 || undef
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
446 }
447  
448  
449 =head2 alignment
450  
451 Title : alignment
452 Usage : $simprot->align($aln);
453 Function: Get/Set the L<Bio::Align::AlignI> object
454 Returns : L<Bio::Align::AlignI> object
455 Args : [optional] L<Bio::Align::AlignI>
456 Comment : We could potentially add support for running directly on a file
457 but we shall keep it simple
458 See also: L<Bio::SimpleAlign>
459  
460 =cut
461  
462 sub alignment {
463 0 ▶ my ($self,$aln) = @_;
Subroutine alignment: not called CC=5 SCAR=34.0
Pod documented
464  
465 0 ▶ if( defined $aln ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $aln) 0 0 0
466 0 ▶ if( -e $aln ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-e $aln) { } 0 0 0
elsif (not ref $aln && $aln->isa('Bio::Align::AlignI')) { } 0 0 0
467 0 $self->{'_alignment'} = $aln;
468 ▶ } elsif( !ref($aln) || ! $aln->isa('Bio::Align::AlignI') ) {
Condition0%0/3
ref $aln && $aln->isa('Bio::Align::AlignI')
!ll&&!rl&&r
000
MC/DC0%0/2
ref $aln && $aln->isa('Bio::Align::AlignI')
ref $aln $aln->isa('Bio::Align::AlignI')
Truth table0%0/3
A && B
A= ref $alnB= $aln->isa('Bio::Align::AlignI')
ABresult
0X0
100
111
469 0 $self->warn("Must specify a valid Bio::Align::AlignI object to the alignment function not $aln");
470 0 return undef;
471 } else {
472 0 $self->{'_alignment'} = $aln;
473 }
474 }
475 0 return $self->{'_alignment'};
476 }
477  
478 =head2 tree
479  
480 Title : tree
481 Usage : $simprot->tree($tree, %params);
482 Function: Get/Set the L<Bio::Tree::TreeI> object
483 Returns : L<Bio::Tree::TreeI>
484 Args : [optional] $tree => L<Bio::Tree::TreeI>,
485 [optional] %parameters => hash of tree-specific parameters
486  
487 Comment : We could potentially add support for running directly on a file
488 but we shall keep it simple
489 See also: L<Bio::Tree::Tree>
490  
491 =cut
492  
493 sub tree {
494 0 ▶ my ($self, $tree, %params) = @_;
Subroutine tree: not called CC=4 SCAR=30.0
Pod documented
495 0 ▶ if( defined $tree ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tree) 0 0 0
496 0 ▶ if( ! ref($tree) || ! $tree->isa('Bio::Tree::TreeI') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $tree and $tree->isa("Bio::Tree::TreeI")) 0 0 0
Condition0%0/3
ref $tree and $tree->isa("Bio::Tree::TreeI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $tree and $tree->isa("Bio::Tree::TreeI")
ref $tree $tree->isa("Bio::Tree::TreeI")
Truth table0%0/3
A and B
A= ref $treeB= $tree->isa("Bio::Tree::TreeI")
ABresult
0X0
100
111
497 0 $self->warn("Must specify a valid Bio::Tree::TreeI object to the alignment function");
498 }
499 0 $self->{'_tree'} = $tree;
500 }
501 0 return $self->{'_tree'};
502 }
503  
504  
505  
506 =head1 Bio::Tools::Run::BaseWrapper methods
507  
508 =cut
509  
510 =head2 save_tempfiles
511  
512 Title : save_tempfiles
513 Usage : $obj->save_tempfiles($newval)
514 Function:
515 Returns : value of save_tempfiles
516 Args : newvalue (optional)
517  
518  
519 =cut
520  
521 =head2 outfile_name
522  
523 Title : outfile_name
524 Usage : my $outfile = $simprot->outfile_name();
525 Function: Get/Set the name of the output file for this run
526 (if you wanted to do something special)
527 Returns : string
528 Args : [optional] string to set value to
529  
530  
531 =cut
532  
533  
534 =head2 tempdir
535  
536 Title : tempdir
537 Usage : my $tmpdir = $self->tempdir();
538 Function: Retrieve a temporary directory name (which is created)
539 Returns : string which is the name of the temporary directory
540 Args : none
541  
542  
543 =cut
544  
545 =head2 cleanup
546  
547 Title : cleanup
548 Usage : $simprot->cleanup();
549 Function: Will cleanup the tempdir directory
550 Returns : none
551 Args : none
552  
553  
554 =cut
555  
556 =head2 io
557  
558 Title : io
559 Usage : $obj->io($newval)
560 Function: Gets a L<Bio::Root::IO> object
561 Returns : L<Bio::Root::IO>
562 Args : none
563  
564  
565 =cut
566  
567 sub DESTROY {
568 1 ▶ my $self= shift;
Subroutine DESTROY: called CC=2 SCAR=7.0
569 1 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 1 0 1
570 1 $self->cleanup();
571 }
572 1 $self->SUPER::DESTROY();
573 }
574  
575 1 1; # Needed to keep compiler happy
« blib/lib/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Proda.pm »