blib/lib/Bio/Tools/Run/Phylo/PAML/Evolver.pm untested

filter: Statementstmt 0.0% 0 / 164 Branchbran 0.0% 0 / 58 Conditioncond 0.0% 0 / 41 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 26 Podpod 0.0% 0 / 17 totaltotal 0.0% 0 / 306 CC 30 SCAR 25.7
CC
30
Cov
0%
set_parameter
30.0
BEGIN
20.0
prepare
20.0
CRAP 13.1
1 # $Id$
2 #
3 # BioPerl module for Bio::Tools::Run::Phylo::PAML::Evolver
4 #
5 # based on the Bio::Tools::Run::Phylo::PAML::Codeml
6 # by Jason Stajich <jason-at-bioperl.org>
7 #
8 # Please direct questions and support issues to <bioperl-l@bioperl.org>
9 #
10 # Cared for by Albert Vilella <avilella-AT-gmail-DOT-com>
11 #
12 # Copyright Albert Vilella
13 #
14 # You may distribute this module under the same terms as perl itself
15  
16 # POD documentation - main docs before the code
17  
18 =head1 NAME
19  
20 Bio::Tools::Run::Phylo::PAML::Evolver - Wrapper aroud the PAML program evolver
21  
22 =head1 SYNOPSIS
23  
24 use Bio::Tools::Run::Phylo::PAML::Evolver;
25  
26 my $evolver = Bio::Tools::Run::Phylo::PAML::Evolver->new();
27  
28 # Get a $tree object somehow
29 $evolver->tree($tree);
30  
31 # FIXME: evolver generates a tree (first run with option 1 or 2)?
32  
33 # One or more alns are created
34 my @alns = $evolver->run();
35  
36 ####
37  
38 # Or with all the data coming from a previous PAML run
39 my $parser = Bio::Tools::Phylo::PAML->new
40 (
41 -file => "$inputfile",
42 );
43 my $result = $parser->next_result();
44 my $tree = $result->next_tree;
45 $evolver->tree($tree);
46 my @codon_freqs = $result->get_CodonFreqs();
47 $evolver->set_CodonFreqs(\@codon_freqs);
48  
49 my $val = $evolver->prepare();
50  
51 # FIXME: something similar for nucleotide frequencies:
52 # Option (5) Simulate nucleotide data sets (use MCbase.dat)?
53  
54 # FIXME: something similar for aa parameters:
55 # Option (7) Simulate amino acid data sets (use MCaa.dat)?
56  
57 # FIXME: With an initial RootSeq.txt
58  
59 =head1 DESCRIPTION
60  
61 This is a wrapper around the evolver program of PAML (Phylogenetic
62 Analysis by Maximum Likelihood) package of Ziheng Yang. See
63 http://abacus.gene.ucl.ac.uk/software/paml.html for more information.
64  
65 This module is more about generating the properl MCmodel.ctl file and
66 will run the program in a separate temporary directory to avoid
67 creating temp files all over the place.
68  
69 =head1 FEEDBACK
70  
71 =head2 Mailing Lists
72  
73 User feedback is an integral part of the evolution of this and other
74 Bioperl modules. Send your comments and suggestions preferably to
75 the Bioperl mailing list. Your participation is much appreciated.
76  
77 bioperl-l@bioperl.org - General discussion
78 http://bioperl.org/MailList.shtml - About the mailing lists
79  
80 =head2 Support
81  
82 Please direct usage questions or support issues to the mailing list:
83  
84 I<bioperl-l@bioperl.org>
85  
86 rather than to the module maintainer directly. Many experienced and
87 reponsive experts will be able look at the problem and quickly
88 address it. Please include a thorough description of the problem
89 with code and data examples if at all possible.
90  
91 =head2 Reporting Bugs
92  
93 Report bugs to the Bioperl bug tracking system to help us keep track
94 of the bugs and their resolution. Bug reports can be submitted via the
95 web:
96  
97 http://bioperl.org/bioperl-bugs/
98  
99 =head1 AUTHOR - Albert Vilella
100  
101 Email avilella-AT-gmail-DOT-com
102  
103 =head1 CONTRIBUTORS
104  
105 Additional contributors names and emails here
106  
107 =head1 APPENDIX
108  
109 The rest of the documentation details each of the object methods.
110 Internal methods are usually preceded with a _
111  
112 =cut
113  
114  
115 # Let the code begin...
116  
117  
118 package Bio::Tools::Run::Phylo::PAML::Evolver;
119 use vars qw(@ISA %VALIDVALUES $MINNAMELEN $PROGRAMNAME $PROGRAM);
120 use strict;
121 use Bio::Root::Root;
122 use Bio::AlignIO;
123 use Bio::SeqIO;
124 use Bio::TreeIO;
125 use Bio::Tools::Run::WrapperBase;
126 use Bio::Tools::Phylo::PAML;
127 use Cwd;
128  
129 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
130  
131 =head2 Default Values
132  
133 Valid and default values for evolver programs are listed below. The
134 default values are always the first one listed. These descriptions
135 are essentially lifted from the example MCcodon.dat file and pamlDOC
136 documentation provided by the author.
137  
138 Stub:
139  
140 B<option1> specifies something.
141  
142 B<option2> specifies something else.
143  
144  
145 INCOMPLETE DOCUMENTATION OF ALL METHODS
146  
147 =cut
148  
149 BEGIN {
150  
151 $MINNAMELEN = 25;
152 $PROGRAMNAME = 'evolver' . ($^O =~ /mswin/i ?'.exe':'');
153 if( defined $ENV{'PAMLDIR'} ) {
154 $PROGRAM = Bio::Root::IO->catfile($ENV{'PAMLDIR'},$PROGRAMNAME). ($^O =~ /mswin/i ?'.exe':'');;
155 }
156
157 # valid values for parameters, the default one is always
158 # the first one in the array
159 # much of the documentation here is lifted directly from the MCcodon.dat
160 # example file provided with the package
161  
162 # Evolver calls time for seed: SetSeed(i==-1?(int)time(NULL):i);
163 my $rand = int(time);
164 # my $rand = int(rand(999999));
165 %VALIDVALUES =
166 (
167  
168 # FIXME: there should be a 6-7-8 option that fits MCcodon or MCbase or MCaa
169 'outfmt' => [0,1],
170 # 0 * 0:paml format (mc.paml); 1:paup format (mc.paup)
171 # random number seed (odd number)
172 # FIXME: set seed to null here and ask for it later?
173 'seed' => "$rand",
174 # numseq can actually be calculated from the tree external nodes
175 # nucleotide sites
176 'nuclsites' => '1000',
177 # replicates
178 'replicates' => '1',
179 # tree length; use -1 if tree has absolute branch lengths
180 # Note that tree length and branch lengths under the codon model are
181 # measured by the expected number of nucleotide substitutions per codon
182 # (see Goldman & Yang 1994). For amino acid models, they are defined as
183 # the expected number of amino acid changes per amino acid site.
184 'tree_length' => '1.5',
185 # omega
186 # FIXME: if one wants to call for different omegas (NSsites),
187 # right now it has to be done like:
188 # $evolver->set_parameter(omega,"3\n0.2\t0.3\t0.5\n0.5\t0.9\t3.2\n");
189 # 3 * number of site classes, followed by frequencies and omega's.
190 # 0.6 0.3 0.1 # Freqs
191 # 0.1 0.8 3.2 # Omegas
192 'omega' => '0.3',
193 # kappa
194 'kappa' => '5',
195 # FIXME: this only for MCbase.dat ?
196 # model: 0:JC69, 1:K80, 2:F81, 3:F84, 4:HKY85, 5:T92, 6:TN93, 7:REV
197 # FIXME: this applies to only some models?
198 # 10 5 1 2 3 * kappa or rate parameters in model
199 # FIXME: this applies to only MCbase.dat ?
200 # 0.5 4 * <alpha> <#categories for discrete gamma>
201 ); # end of validvalues
202 }
203  
204 =head2 program_name
205  
206 Title : program_name
207 Usage : $factory->program_name()
208 Function: holds the program name
209 Returns: string
210 Args : None
211  
212 =cut
213  
214 sub program_name {
215 return 'evolver';
216 }
217  
218 =head2 program_dir
219  
220 Title : program_dir
221 Usage : ->program_dir()
222 Function: returns the program directory, obtained from ENV variable.
223 Returns: string
224 Args :
225  
226 =cut
227  
228 sub program_dir {
229 return Bio::Root::IO->catfile($ENV{PAMLDIR}) if $ENV{PAMLDIR};
230 }
231  
232  
233 =head2 new
234  
235 Title : new
236 Usage : my $obj = Bio::Tools::Run::Phylo::PAML::Evolver->new();
237 Function: Builds a new Bio::Tools::Run::Phylo::PAML::Evolver object
238 Returns : Bio::Tools::Run::Phylo::PAML::Evolver
239 -save_tempfiles => boolean to save the generated tempfiles and
240 NOT cleanup after onesself (default FALSE)
241 -tree => the Bio::Tree::TreeI object (FIXME: optional if this is done in a first run)
242 -params => a hashref of PAML parameters (all passed to set_parameter)
243 -executable => where the evolver executable resides
244  
245 See also: L<Bio::Tree::TreeI>
246  
247 =cut
248  
249 sub new {
250 my($class,@args) = @_;
251  
252 my $self = $class->SUPER::new(@args);
253 # $self->{'_branchLengths'} = 0;
254 my ($tree, $st, $params, $exe)
255 = $self->_rearrange([qw(TREE SAVE_TEMPFILES PARAMS EXECUTABLE)],
256 @args);
257 defined $tree && $self->tree($tree);
258 defined $st && $self->save_tempfiles($st);
259 defined $exe && $self->executable($exe);
260  
261 $self->set_default_parameters();
262 if( defined $params ) {
263 if( ref($params) !~ /HASH/i ) {
264 $self->warn("Must provide a valid hash ref for parameter -FLAGS");
265 } else {
266 map { $self->set_parameter($_, $$params{$_}) } keys %$params;
267 }
268 }
269 return $self;
270 }
271  
272  
273 =head2 prepare
274  
275 Title : prepare
276 Usage : my $rundir = $evolver->prepare($aln);
277 Function: prepare the evolver analysis using the default or updated parameters
278 the alignment parameter must have been set
279 Returns : value of rundir
280 Args : L<Bio::Align::AlignI> object,
281 L<Bio::Tree::TreeI> object [optional]
282  
283 =cut
284  
285 sub prepare {
286 my ($self,$aln,$tree) = @_;
287 # FIXME: To consider: to have save_tempfiles always TRUE by default
288 # or simply never delete
289 unless ( $self->save_tempfiles ) {
290 # brush so we don't get plaque buildup ;)
291 $self->cleanup();
292 }
293 $tree = $self->tree unless $tree;
294 my ($tempdir) = $self->tempdir();
295  
296 # FIXME:
297 # If multiple replicates, evolver gives:
298 # A file with a concatenation of sequential phylips separated by a
299 # double return which gets correctly parsed by AlignIO next_aln
300  
301 # Or a concatenation of paup entries with tags separating them which
302 # wont get correctly parsed with current AlignIO (failed with
303 # nexus)
304  
305 # FIXME: To consider: force phylip outfmt and split the files if
306 # replicates > 1
307  
308 # if( ! ref($aln) && -e $aln ) {
309 # $tempseqfile = $aln;
310 # } else {
311 # ($tempseqFH,$tempseqfile) = $self->io->tempfile
312 # ('-dir' => $tempdir,
313 # UNLINK => ($self->save_tempfiles ? 0 : 1));
314 # my $alnout = Bio::AlignIO->new('-format' => 'phylip',
315 # '-fh' => $tempseqFH,
316 # '-interleaved' => 0,
317 # '-idlength' => $MINNAMELEN > $aln->maxdisplayname_length() ? $MINNAMELEN : $aln->maxdisplayname_length() +1);
318 # $alnout->write_aln($aln);
319 # $alnout->close();
320 # undef $alnout;
321 # close($tempseqFH);
322 # }
323 # now let's print the MCcodon.dat file.
324 # many of the these programs are finicky about what the filename is
325 # and won't even run without the properly named file. Ack
326
327 # FIXME: we should do the appropriate here if we are simulating codons, nts o aa.
328 my $evolver_ctl = "$tempdir/MCcodon.dat";
329 my $evolverfh;
330 open($evolverfh, ">$evolver_ctl") or $self->throw("cannot open $evolver_ctl for writing");
331 # FIXME: params follow an order in the control file, they are not a hash. Do we have an
332 # clean example of this in bioperl-run?
333 my %params = $self->get_parameters;
334 print $evolverfh "$params{outfmt}\n";
335 print $evolverfh "$params{seed}\n";
336 # FIXME: call get_leaf_nodes to count only leafs - relates to newick onlyleafids bug
337 # my $numseq = scalar($tree->get_nodes);
338 my $numseq = scalar($tree->get_leaf_nodes);
339 print $evolverfh "$numseq ";
340 print $evolverfh "$params{nuclsites} ";
341 print $evolverfh "$params{replicates}\n\n";
342 print $evolverfh "$params{tree_length}\n";
343 # FIXME: do #1:#n branch tagging magic here
344 # FIXME: this pre flush stuff is for appending mode
345 my $treeout = Bio::TreeIO->new
346 ('-format' => 'newick',
347 '-fh' => $evolverfh,
348 -PRE =>'>>',
349 '-flush',
350 );
351 # $treeout->bootstrap_style('nointernalids');
352 $treeout->write_tree($tree);
353 # Appending mode to add more control file contents here
354 open($evolverfh, ">>$evolver_ctl") or $self->throw("cannot open $evolver_ctl for writing");
355 print $evolverfh "\n$params{omega}\n";
356 print $evolverfh "$params{kappa}\n";
357 # Print codon freqs here or defaults (below)
358 my @codon_freqs = $self->get_CodonFreqs();
359 foreach my $firstbase (@codon_freqs) {
360 foreach my $element (@$firstbase) {
361 print $evolverfh " $element";
362 }
363 print $evolverfh "\n";
364 }
365  
366 # FIXME: codon freqs or nt freqs should always come from an object?
367 # Silly printing the default codonfreqs in the default
368 # MCcodon.dat provided by PAML
369 unless (@codon_freqs) {
370 print $evolverfh
371 "0.00983798 0.01745548 0.00222048 0.01443315\n",
372 "0.00844604 0.01498576 0.00190632 0.01239105\n",
373 "0.01064012 0.01887870 0 0\n",
374 "0.00469486 0.00833007 0 0.00688776\n",
375 "0.01592816 0.02826125 0.00359507 0.02336796\n",
376 "0.01367453 0.02426265 0.00308642 0.02006170\n",
377 "0.01722686 0.03056552 0.00388819 0.02527326\n",
378 "0.00760121 0.01348678 0.00171563 0.01115161\n",
379 "0.01574077 0.02792876 0.00355278 0.02309304\n",
380 "0.01351366 0.02397721 0.00305010 0.01982568\n",
381 "0.01702419 0.03020593 0.00384245 0.02497593\n",
382 "0.00751178 0.01332811 0.00169545 0.01102042\n",
383 "0.02525082 0.04480239 0.00569924 0.03704508\n",
384 "0.02167816 0.03846344 0.00489288 0.03180369\n",
385 "0.02730964 0.04845534 0.00616393 0.04006555\n",
386 "0.01205015 0.02138052 0.00271978 0.01767859\n";
387 }
388 print $evolverfh "\n// end of file.\n";
389 close($evolverfh);
390 # FIXME: what do we return in prepare?
391 # return
392 }
393  
394  
395 =head2 run
396  
397 Title : run
398 Usage : my ($rc,$parser) = $evolver->run();
399 Function: run the evolver analysis using the default or updated parameters
400 the alignment parameter must have been set
401 Returns : Return code, L<Bio::Tools::Phylo::PAML>
402 Args : L<Bio::Align::AlignI> object,
403 L<Bio::Tree::TreeI> object [optional]
404  
405 =cut
406  
407  
408 sub run {
409  
410 my $self = shift;
411 # FIXME: We should look for the stuff we prepared in the prepare method here
412 my $rc = (1);
413 {
414 my $exit_status;
415 my ($tmpdir) = $self->tempdir();
416 chdir($tmpdir);
417 my $evolverexe = $self->executable();
418 $self->throw("unable to find or run executable for 'evolver'") unless $evolverexe && -e $evolverexe && -x _;
419 open(RUN, "$evolverexe 6 MCcodon.dat |") or $self->throw("Cannot open exe $evolverexe");
420 my @output = <RUN>;
421 $exit_status = close(RUN);
422 $self->error_string(join('',@output));
423 if ( (grep { /\berr(or)?: /io } @output) || !$exit_status) {
424 $self->warn("There was an error - see error_string for the program output");
425 $rc = 0;
426 }
427 # FIXME - hardcoded mc.paml
428 unless ($self->indel) {
429 my $in = Bio::AlignIO->new('-file' => "$tmpdir/mc.paml",
430 '-format' => 'phylip');
431 my $aln = $in->next_aln();
432 $self->alignment($aln);
433 }
434 }
435 return $rc;
436 }
437  
438 =head2 error_string
439  
440 Title : error_string
441 Usage : $obj->error_string($newval)
442 Function: Where the output from the last analysis run is stored.
443 Returns : value of error_string
444 Args : newvalue (optional)
445  
446  
447 =cut
448  
449 sub error_string{
450 my ($self,$value) = @_;
451 if( defined $value) {
452 $self->{'error_string'} = $value;
453 }
454 return $self->{'error_string'};
455  
456 }
457  
458 =head2 alignment
459  
460 Title : alignment
461 Usage : $evolver->align($aln);
462 Function: Get/Set the L<Bio::Align::AlignI> object
463 Returns : L<Bio::Align::AlignI> object
464 Args : [optional] L<Bio::Align::AlignI>
465 Comment : We could potentially add support for running directly on a file
466 but we shall keep it simple
467 See also: L<Bio::SimpleAlign>
468  
469 =cut
470  
471 sub alignment{
472 my ($self,$aln) = @_;
473  
474 if( defined $aln ) {
475 if( -e $aln ) {
476 $self->{'_alignment'} = $aln;
477 } elsif( !ref($aln) || ! $aln->isa('Bio::Align::AlignI') ) {
478 $self->warn("Must specify a valid Bio::Align::AlignI object to the alignment function not $aln");
479 return undef;
480 } else {
481 $self->{'_alignment'} = $aln;
482 }
483 }
484 return $self->{'_alignment'};
485 }
486  
487  
488 =head2 tree
489  
490 Title : tree
491 Usage : $evolver->tree($tree, %params);
492 Function: Get/Set the L<Bio::Tree::TreeI> object
493 Returns : L<Bio::Tree::TreeI>
494 Args : [optional] $tree => L<Bio::Tree::TreeI>,
495 [optional] %parameters => hash of tree-specific parameters:
496 branchLengths: 0, 1 or 2
497 out
498  
499 Comment : We could potentially add support for running directly on a file
500 but we shall keep it simple
501 See also: L<Bio::Tree::Tree>
502  
503 =cut
504  
505 sub tree {
506 my ($self, $tree, %params) = @_;
507 if( defined $tree ) {
508 if( ! ref($tree) || ! $tree->isa('Bio::Tree::TreeI') ) {
509 $self->warn("Must specify a valid Bio::Tree::TreeI object to the alignment function");
510 }
511 $self->{'_tree'} = $tree;
512 # FIXME: I think we dont need this in Evolver
513 # if ( defined $params{'_branchLengths'} ) {
514 # my $ubl = $params{'_branchLengths'};
515 # if ($ubl !~ m/^(0|1|2)$/) {
516 # $self->throw("The branchLengths parameter to tree() must be 0 (ignore), 1 (initial values) or 2 (fixed values) only");
517 # }
518 # $self->{'_branchLengths'} = $ubl;
519 # }
520 }
521 return $self->{'_tree'};
522 }
523  
524 =head2 get_parameters
525  
526 Title : get_parameters
527 Usage : my %params = $self->get_parameters();
528 Function: returns the list of parameters as a hash
529 Returns : associative array keyed on parameter names
530 Args : none
531  
532  
533 =cut
534  
535 sub get_parameters{
536 my ($self) = @_;
537 # we're returning a copy of this
538 return %{ $self->{'_evolverparams'} };
539 }
540  
541  
542 =head2 set_parameter
543  
544 Title : set_parameter
545 Usage : $evolver->set_parameter($param,$val);
546 Function: Sets a evolver parameter, will be validated against
547 the valid values as set in the %VALIDVALUES class variable.
548 The checks can be ignored if one turns off param checks like this:
549 $evolver->no_param_checks(1)
550 Returns : boolean if set was success, if verbose is set to -1
551 then no warning will be reported
552 Args : $param => name of the parameter
553 $value => value to set the parameter to
554 See also: L<no_param_checks()>
555  
556 =cut
557  
558 sub set_parameter{
559 my ($self,$param,$value) = @_;
560 unless ($self->{'no_param_checks'} == 1) {
561 if ( ! defined $VALIDVALUES{$param} ) {
562 $self->warn("unknown parameter $param will not be set unless you force by setting no_param_checks to true");
563 return 0;
564 }
565 if ( ref( $VALIDVALUES{$param}) =~ /ARRAY/i &&
566 scalar @{$VALIDVALUES{$param}} > 0 ) {
567
568 unless ( grep { $value eq $_ } @{ $VALIDVALUES{$param} } ) {
569 $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");
570 return 0;
571 }
572 }
573 }
574 $self->{'_evolverparams'}->{$param} = $value;
575 return 1;
576 }
577  
578 =head2 set_default_parameters
579  
580 Title : set_default_parameters
581 Usage : $evolver->set_default_parameters(0);
582 Function: (Re)set the default parameters from the defaults
583 (the first value in each array in the
584 %VALIDVALUES class variable)
585 Returns : none
586 Args : boolean: keep existing parameter values
587  
588  
589 =cut
590  
591 sub set_default_parameters{
592 my ($self,$keepold) = @_;
593 $keepold = 0 unless defined $keepold;
594
595 while( my ($param,$val) = each %VALIDVALUES ) {
596 # skip if we want to keep old values and it is already set
597 next if( defined $self->{'_evolverparams'}->{$param} && $keepold);
598 if(ref($val)=~/ARRAY/i ) {
599 $self->{'_evolverparams'}->{$param} = $val->[0];
600 } else {
601 $self->{'_evolverparams'}->{$param} = $val;
602 }
603 }
604 }
605  
606  
607 =head1 Bio::Tools::Run::WrapperBase methods
608  
609 =cut
610  
611 =head2 no_param_checks
612  
613 Title : no_param_checks
614 Usage : $obj->no_param_checks($newval)
615 Function: Boolean flag as to whether or not we should
616 trust the sanity checks for parameter values
617 Returns : value of no_param_checks
618 Args : newvalue (optional)
619  
620  
621 =cut
622  
623 sub no_param_checks{
624 my ($self,$value) = @_;
625 if( defined $value) {
626 $self->{'no_param_checks'} = $value;
627 }
628 return $self->{'no_param_checks'};
629 }
630  
631 =head2 set_CodonFreqs
632  
633 Title : set_CodonFreqs
634 Usage : $obj->set_CodonFreqs($newval)
635 Function: Get/Set the Codon Frequence table
636 Returns : value of set_CodonFreqs (a scalar)
637 Args : on set, new value (a scalar or undef, optional)
638  
639  
640 =cut
641  
642 sub set_CodonFreqs{
643 my $self = shift;
644  
645 return $self->{'_codonfreqs'} = shift if @_;
646 return $self->{'_codonfreqs'};
647 }
648  
649 =head2 get_CodonFreqs
650  
651 Title : get_CodonFreqs
652 Usage : my @codon_freqs = $evolver->get_CodonFreqs()
653 Function: Get the Codon freqs
654 Returns : Array
655 Args : none
656  
657  
658 =cut
659  
660 sub get_CodonFreqs{
661 my ($self) = @_;
662 return @{$self->{'_codonfreqs'} || []};
663 }
664  
665  
666 =head2 save_tempfiles
667  
668 Title : save_tempfiles
669 Usage : $obj->save_tempfiles($newval)
670 Function:
671 Returns : value of save_tempfiles
672 Args : newvalue (optional)
673  
674  
675 =cut
676  
677 =head2 outfile_name
678  
679 Title : outfile_name
680 Usage : my $outfile = $evolver->outfile_name();
681 Function: Get/Set the name of the output file for this run
682 (if you wanted to do something special)
683 Returns : string
684 Args : [optional] string to set value to
685  
686  
687 =cut
688  
689  
690 =head2 tempdir
691  
692 Title : tempdir
693 Usage : my $tmpdir = $self->tempdir();
694 Function: Retrieve a temporary directory name (which is created)
695 Returns : string which is the name of the temporary directory
696 Args : none
697  
698  
699 =cut
700  
701 =head2 cleanup
702  
703 Title : cleanup
704 Usage : $evolver->cleanup();
705 Function: Will cleanup the tempdir directory after a PAML run
706 Returns : none
707 Args : none
708  
709  
710 =cut
711  
712 =head2 io
713  
714 Title : io
715 Usage : $obj->io($newval)
716 Function: Gets a L<Bio::Root::IO> object
717 Returns : L<Bio::Root::IO>
718 Args : none
719  
720  
721 =cut
722  
723 sub DESTROY {
724 my $self= shift;
725 unless ( $self->save_tempfiles ) {
726 $self->cleanup();
727 }
728 $self->SUPER::DESTROY();
729 }
730  
731  
732 =head2 indel
733  
734 Title : indel
735 Usage : $obj->indel($newval)
736 Function: this is only useful if using evolver_indel instead of main
737 evolver package:
738 Exploring the Relationship between Sequence Similarity and
739 Accurate Phylogenetic Trees Brandi L. Cantarel, Hilary
740 G. Morrison and William Pearson
741 Example :
742 Returns : value of indel (a scalar)
743 Args : on set, new value (a scalar or undef, optional)
744  
745  
746 =cut
747  
748 sub indel{
749 my $self = shift;
750  
751 return $self->{'indel'} = shift if @_;
752 return $self->{'indel'};
753 }
754  
755  
756 1;