allow alignment to be specified in run()
[bioperl-run.git] / Bio / Tools / Run / Phylo / PAML / Codeml.pm
blob6e46c841100975c2ed1567b0287c730ec96e20f1
1 # $Id$
3 # BioPerl module for Bio::Tools::Run::Phylo::PAML::Codeml
5 # Cared for by Jason Stajich <jason-at-bioperl-dot-org>
7 # Copyright Jason Stajich
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
13 =head1 NAME
15 Bio::Tools::Run::Phylo::PAML::Codeml - Wrapper aroud the PAML program codeml
17 =head1 SYNOPSIS
19 use Bio::Tools::Run::Phylo::PAML::Codeml;
20 use Bio::AlignIO;
22 my $alignio = new Bio::AlignIO(-format => 'phylip',
23 -file => 't/data/gf-s85.phylip');
25 my $aln = $alignio->next_aln;
27 my $codeml = new Bio::Tools::Run::Phylo::PAML::Codeml();
28 $codeml->alignment($aln);
29 my ($rc,$parser) = $codeml->run();
30 my $result = $parser->next_result;
31 my $MLmatrix = $result->get_MLmatrix();
32 print "Ka = ", $MLmatrix->[0]->[1]->{'dN'},"\n";
33 print "Ks = ", $MLmatrix->[0]->[1]->{'dS'},"\n";
34 print "Ka/Ks = ", $MLmatrix->[0]->[1]->{'omega'},"\n";
36 =head1 DESCRIPTION
38 This is a wrapper around the codeml program of PAML (Phylogenetic
39 Analysis by Maximum Likelihood) package of Ziheng Yang. See
40 http://abacus.gene.ucl.ac.uk/software/paml.html for more information.
42 This module is more about generating the properl codeml.ctl file and
43 will run the program in a separate temporary directory to avoid
44 creating temp files all over the place.
46 =head1 FEEDBACK
48 =head2 Mailing Lists
50 User feedback is an integral part of the evolution of this and other
51 Bioperl modules. Send your comments and suggestions preferably to
52 the Bioperl mailing list. Your participation is much appreciated.
54 bioperl-l@bioperl.org - General discussion
55 http://bioperl.org/MailList.shtml - About the mailing lists
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 of the bugs and their resolution. Bug reports can be submitted via the
61 web:
63 http://bioperl.org/bioperl-bugs/
65 =head1 AUTHOR - Jason Stajich
67 Email jason-at-bioperl-dot-org
69 =head1 CONTRIBUTORS
71 Additional contributors names and emails here
73 =head1 APPENDIX
75 The rest of the documentation details each of the object methods.
76 Internal methods are usually preceded with a _
78 =cut
81 # Let the code begin...
84 package Bio::Tools::Run::Phylo::PAML::Codeml;
85 use vars qw(@ISA %VALIDVALUES $MINNAMELEN $PROGRAMNAME $PROGRAM);
86 use strict;
87 use Bio::Root::Root;
88 use Bio::AlignIO;
89 use Bio::TreeIO;
90 use Bio::Tools::Run::WrapperBase;
91 use Bio::Tools::Phylo::PAML;
92 use Cwd;
94 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
96 =head2 Default Values
98 Valid and default values for codeml programs are listed below. The
99 default values are always the first one listed. These descriptions
100 are essentially lifted from the example codeml.ctl file and pamlDOC
101 documentation provided by the author.
103 B<CodonFreq> specifies the equilibrium codon frequencies in codon
104 substitution model. These frequencies can be assumed to be equal (1/61
105 each for the standard genetic code, B<CodonFreq> = 0), calculated from
106 the average nucleotide frequencies (B<CodonFreq> = 1), from the average
107 nucleotide frequencies at the three codon positions (B<CodonFreq> = 2),
108 or used as free parameters (B<CodonFreq> = 3). The number of parameters
109 involved in those models of codon frequencies is 0, 3, 9, and 60
110 (under the universal code), for B<CodonFreq> = 0, 1, 2, and 3
111 respectively.
113 B<aaDist> specifies whether equal amino acid distances are assumed (=
114 0) or Grantham's matrix is used (= 1) (Yang et al. 1998).
116 B<runmode> = -2 performs ML estimation of dS and dN in pairwise
117 comparisons. The program will collect estimates of dS and dN into the
118 files 2ML.dS and 2ML.dN. Since many users seem interested in looking
119 at dN /dS ratios among lineages, examination of the tree shapes
120 indicated by branch lengths calculated from the two rates may be
121 interesting although the analysis is ad hoc. If your species names
122 have no more than 10 characters, you can use the output distance
123 matrices as input to Phylip programs such as neighbor without
124 change. Otherwise you need to edit the files to cut the names short.
126 B<model> concerns assumptions about the dN/dS rate ratios among
127 branches (Yang 1998; Yang and Nielsen 1998). B<model> =0 means a single
128 dN/dS ratio for all lineages (branches), 1 means one ratio for each
129 branch (free ratio model), and 2 means arbitrary number of rations
130 (such as the 2-ratios or 3-ratios models. with B<model> =2, you may
131 specify the omega ratios for the branches using branch labels (read
132 about the tree structure file in the document). This option seems
133 rather easy to use. Otherwise, the program will ask the user to input
134 a branch mark for the dN/dS ratio assumed for each branch. This should
135 be an integral number between 0 to k - 1 if k different dN/dS ratios
136 (omega_0 - omega_k - 1) are assumed for the branches of the
137 tree. B<Bioperl note basically, doing this interactively is not going
138 to work very well, so this module is really focused around using the 0
139 or 1 parameters. Read the program documentation if you'd like some more detail instructions>.
141 B<NSsites> specifies models that allow the dN/dS ratio (omega) to vary
142 among sites (Nielsen and Yang 1998, Yang et al. 2000) B<Nssites> = m
143 corresponds to model Mm in Yang et al (2000). The variable B<ncatG>
144 is used to specify the number of categories in the omega distribution
145 under some models. The values of ncatG() used to perform our
146 analyses are 3 for M3 (discrete), 5 for M4 (freq), 10 for the
147 continuous distributions (M5: gamma, M6: 2gamma, M7: beta, M8:beta&amp;w,
148 M9:beta&amp;gamma, M10: beta&gamma+1, M11:beta&amp;normal&gt;1, and
149 M12:0&amp;2normal&gt;1, M13:3normal&gt;0). This means M8 will have 11 site
150 classes (10 from the beta distribution plus 1 additional class). The
151 posterior probabilities for site classes as well as the expected omega
152 values for sites are listed in the file rst, which may be useful to
153 pinpoint sites under positive selection, if they exist.
155 To make it easy to run several B<Nssites> models in one go, the
156 executable L<Bio::Tools::Run::Phylo::PAML::Codemlsites> can be used,
157 which asks you how many and which models to run at the start of the
158 program. The number of categories used will then match those used in
159 Yang et al(2000).
161 As noted in that paper, some of the models are hard to use, in
162 particular, M12 and M13. Recommended models are 0 (one-ratio), 1
163 (neutral), 2 (selection), 3 (discrete), 7 (beta), and 8
164 (beta&amp;omega ). Some of the models like M2 and M8 are noted to be
165 prone to the problem of multiple local optima. You are advised to run
166 the program at least twice, once with a starting omega value E<lt>1 and a
167 second time with a value E<gt>1, and use the results corresponding to the
168 highest likelihood. The continuous neutral and selection models of
169 Nielsen and Yang (1998) are not implemented in the program.
172 B<icode> for genetic code and these correspond to 1-11 in the genbank
173 transl table.
174 0:universal code
175 1:mamalian mt
176 2:yeast mt
177 3:mold mt,
178 4:invertebrate mt
179 5:ciliate nuclear
180 6:echinoderm mt
181 7:euplotid mt
182 8:alternative yeast nu.
183 9:ascidian mt
184 10:blepharisma nu
186 B<RateAncestor> For codon sequences, ancestral reconstruction is not
187 implemented for the models of variable dN/dS ratios among sites. The
188 output under codon-based models usually shows the encoded amino acid
189 for each codon. The output under "Prob of best character at each node,
190 listed by site" has two posterior probabilities for each node at each
191 codon (amino acid) site. The first is for the best codon. The second,
192 in parentheses, is for the most likely amino acid under the codon
193 substitution model. This is a sum of posterior probabilities across
194 synonymous codons. In theory it is possible although rare for the most
195 likely amino acid not to match the most likely codon.
197 B<Output> for codon sequences (seqtype = 1): The codon frequencies in
198 each sequence are counted and listed in a genetic code table, together
199 with their sums across species. Each table contains six or fewer
200 species. For data of multiple genes (option G in the sequence file),
201 codon frequencies in each gene (summed over species) are also
202 listed. The nucleotide distributions at the three codon positions are
203 also listed. The method of Nei and Gojobori (1986) is used to
204 calculate the number of synonymous substitutions per synonymous site
205 (dS ) and the number of nonsynonymous substitutions per nonsynonymous
206 site (dN ) and their ratio (dN /dS ). These are used to construct
207 initial estimates of branch lengths for the likelihood analysis but
208 are not MLEs themselves. Note that the estimates of these quantities
209 for the a- and b-globin genes shown in Table 2 of Goldman and Yang
210 (1994), calculated using the MEGA package (Kumar et al., 1993), are
211 not accurate.
213 Results of ancestral reconstructions (B<RateAncestor> = 1) are collected in the file rst. Under models of variable dN/dS ratios among sites (NSsites models), the posterior probabilities for site classes as well as positively selected sites are listed in rst.
215 INCOMPLETE DOCUMENTATION OF ALL METHODS
217 =cut
219 BEGIN {
221 $MINNAMELEN = 25;
222 $PROGRAMNAME = 'codeml' . ($^O =~ /mswin/i ?'.exe':'');
223 if( defined $ENV{'PAMLDIR'} ) {
224 $PROGRAM = Bio::Root::IO->catfile($ENV{'PAMLDIR'},$PROGRAMNAME). ($^O =~ /mswin/i ?'.exe':'');;
227 # valid values for parameters, the default one is always
228 # the first one in the array
229 # much of the documentation here is lifted directly from the codeml.ctl
230 # example file provided with the package
231 %VALIDVALUES = (
232 'noisy' => [ 0..3,9],
233 'verbose' => [ 0,1,2], # 0:concise, 1:detailed, 2:too much
235 # (runmode) 0:user tree, 1:semi-autmatic, 2:automatic
236 # 3:stepwise addition, 4,5:PerturbationNNI
237 # -2:pairwise
238 'runmode' => [ -2, 0..5],
240 'seqtype' => [ 1..3], # 1:codons, 2:AAs, 3:codons->AAs
242 'CodonFreq' => [ 2, 0,1,3], # 0:1/61 each, 1:F1X4,
243 # 2:F3X4, 3:codon table
245 # (aaDist) 0:equal, +:geometric, -:linear,
246 # 1-6:G1974,Miyata, c,p,v,a
247 'aaDist' => [ 0,'+','-', 1..6],
249 # (aaRatefile) only used for aa seqs
250 # with model=empirical(_F)
251 # default is usually 'wag.dat', also
252 # dayhoff.dat, jones.dat, mtmam.dat, or your own
253 'aaRatefile' => 'wag.dat',
255 # (model) models for codons
256 # 0: one, 1:b, 2:2 or more dN/dS ratios for branches
257 'model' => [0..2,7],
259 # (NSsites) number of S sites
260 # 0: one w;1:neutral;2:selection; 3:discrete;4:freqs;
261 # 5:gamma;6:2gamma;7:beta;8:beta&w;9:beta&gamma;
262 # 10:beta&gamma+1; 11:beta&normal>1; 12:0&2normal>1;
263 # 13:3normal>0
264 'NSsites' => [0..13],
266 # (icode) genetic code
267 # 0:universal code
268 # 1:mamalian mt
269 # 2:yeast mt
270 # 3:mold mt,
271 # 4:invertebrate mt
272 # 5:ciliate nuclear
273 # 6:echinoderm mt
274 # 7:euplotid mt
275 # 8:alternative yeast nu.
276 # 9:ascidian mt
277 #10:blepharisma nu
278 # these correspond to 1-11 in the genbank transl table
280 'icode' => [ 0..10],
282 'Mgene' => [0,1], # 0:rates, 1:separate
284 'fix_kappa'=> [0,1], # 0:estimate kappa, 1:fix kappa
285 'kappa' => '2', # initial or fixed kappa
286 'fix_omega'=> [0,1], # 0: estimate omega, 1: fix omega
287 'omega' => [0.4,1], # initial or fixed omega for
288 # codons or codon-base AAs
289 'fix_alpha'=> [1,0], # 0: estimate gamma shape param
290 # 1: fix it at alpha
291 'alpha' => '0', # initial of fixed alpha
292 # 0: infinity (constant rate)
293 'Malpha' => [0], # different alphas for genes
294 'ncatG' => [1..10], # number of categories in
295 # dG of NSsites models
297 # (clock)
298 # 0: no clock, 1: global clock, 2: local clock
299 # 3: TipDate
300 'clock' => [0..3],
301 # (getSE) Standard Error:
302 # 0:don't want them, 1: want S.E.
303 'getSE' => [0,1],
304 # (RateAncestor)
305 # 0,1,2 rates (alpha>0) or
306 # ancestral states (1 or 2)
307 'RateAncestor' => [1,0,2],
308 'Small_Diff' => '.5e-6',
309 # (cleandata) remove sites with ambiguity data
310 # 1: yes, 0:no
311 'cleandata' => [0,1],
312 # this is the number of datasets in
313 # the file - we would need to change
314 # our api to allow >1 alignment object
315 # to be referenced at time
316 'ndata' => 1,
317 # (method)
318 # 0: simultaneous,1: 1 branch at a time
319 'method' => [0,1],
323 =head2 program_name
325 Title : program_name
326 Usage : $factory->program_name()
327 Function: holds the program name
328 Returns: string
329 Args : None
331 =cut
333 sub program_name {
334 return 'codeml';
337 =head2 program_dir
339 Title : program_dir
340 Usage : ->program_dir()
341 Function: returns the program directory, obtiained from ENV variable.
342 Returns: string
343 Args :
345 =cut
347 sub program_dir {
348 return Bio::Root::IO->catfile($ENV{PAMLDIR}) if $ENV{PAMLDIR};
352 =head2 new
354 Title : new
355 Usage : my $obj = new Bio::Tools::Run::Phylo::PAML::Codeml();
356 Function: Builds a new Bio::Tools::Run::Phylo::PAML::Codeml object
357 Returns : Bio::Tools::Run::Phylo::PAML::Codeml
358 Args : -alignment => the Bio::Align::AlignI object
359 -save_tempfiles => boolean to save the generated tempfiles and
360 NOT cleanup after onesself (default FALSE)
361 -tree => the Bio::Tree::TreeI object
362 -branchlengths => 0: ignore any branch lengths found on the tree
363 1: use as initial values
364 2: fix branch lengths
365 -params => a hashref of PAML parameters (all passed to set_parameter)
366 -executable => where the codeml executable resides
368 See also: L<Bio::Tree::TreeI>, L<Bio::Align::AlignI>
369 =cut
371 sub new {
372 my($class,@args) = @_;
374 my $self = $class->SUPER::new(@args);
375 $self->{'_branchLengths'} = 0;
376 my ($aln, $tree, $st, $params, $exe,
377 $ubl) = $self->_rearrange([qw(ALIGNMENT TREE SAVE_TEMPFILES
378 PARAMS EXECUTABLE BRANCHLENGTHS)],
379 @args);
380 defined $aln && $self->alignment($aln);
381 defined $tree && $self->tree($tree, branchLengths => ($ubl || 0) );
382 defined $st && $self->save_tempfiles($st);
383 defined $exe && $self->executable($exe);
385 $self->set_default_parameters();
386 if( defined $params ) {
387 if( ref($params) !~ /HASH/i ) {
388 $self->warn("Must provide a valid hash ref for parameter -FLAGS");
389 } else {
390 map { $self->set_parameter($_, $$params{$_}) } keys %$params;
393 return $self;
396 =head2 run
398 Title : run
399 Usage : $codeml->run();
400 Function: run the codeml analysis using the default or updated parameters
401 the alignment parameter must have been set
402 Returns :
403 Args :
406 =cut
408 sub run{
409 my ($self,$aln,$tree) = @_;
410 unless ( $self->save_tempfiles ) {
411 # brush so we don't get plaque buildup ;)
412 $self->cleanup();
414 $tree = $self->tree unless $tree;
415 $aln = $self->alignment unless $aln;
416 if( ! $aln ) {
417 $self->warn("must have supplied a valid aligment file in order to run codeml");
418 return 0;
420 my ($tmpdir) = $self->tempdir();
421 my ($tempseqFH,$tempseqfile);
422 if( ! ref($aln) && -e $aln ) {
423 $tempseqfile = $aln;
424 } else {
425 ($tempseqFH,$tempseqfile) = $self->io->tempfile
426 ('-dir' => $tmpdir,
427 UNLINK => ($self->save_tempfiles ? 0 : 1));
428 my $alnout = new Bio::AlignIO('-format' => 'phylip',
429 '-fh' => $tempseqFH,
430 '-interleaved' => 0,
431 '-idlength' => $MINNAMELEN > $aln->maxdisplayname_length() ? $MINNAMELEN : $aln->maxdisplayname_length() +1);
433 $alnout->write_aln($aln);
434 $alnout->close();
435 undef $alnout;
436 close($tempseqFH);
438 # now let's print the codeml.ctl file.
439 # many of the these programs are finicky about what the filename is
440 # and won't even run without the properly named file. Ack
442 my $codeml_ctl = "$tmpdir/codeml.ctl";
443 open(CODEML, ">$codeml_ctl") or $self->throw("cannot open $codeml_ctl for writing");
444 print CODEML "seqfile = $tempseqfile\n";
446 my $outfile = $self->outfile_name;
448 if( $tree ) {
449 my ($temptreeFH,$temptreefile) = $self->io->tempfile
450 ('-dir' => $tmpdir,
451 UNLINK => ($self->save_tempfiles ? 0 : 1));
453 my $treeout = new Bio::TreeIO('-format' => 'newick',
454 '-fh' => $temptreeFH);
455 $treeout->write_tree($tree);
456 $treeout->close();
457 close($temptreeFH);
458 print CODEML "treefile = $temptreefile\n";
460 print CODEML "outfile = $outfile\n";
461 my %params = $self->get_parameters;
462 while( my ($param,$val) = each %params ) {
463 print CODEML "$param = $val\n";
465 close(CODEML);
466 my ($rc,$parser) = (1);
468 my $cwd = cwd();
469 my $exit_status;
470 chdir($tmpdir);
471 my $codemlexe = $self->executable();
472 $self->throw("unable to find or run executable for 'codeml'") unless $codemlexe && -e $codemlexe && -x _;
473 if( $self->{'_branchLengths'} ) {
474 open(RUN, "echo $self->{'_branchLengths'} | $codemlexe |") or $self->throw("Cannot open exe $codemlexe");
475 } else {
476 open(RUN, "$codemlexe |") or $self->throw("Cannot open exe $codemlexe");
478 my @output = <RUN>;
479 $exit_status = close(RUN);
480 $self->error_string(join('',@output));
481 if( (grep { /\berr(or)?: /io } @output) || !$exit_status) {
482 $self->warn("There was an error - see error_string for the program output");
483 $rc = 0;
485 eval {
486 $parser = new Bio::Tools::Phylo::PAML(-file => "$tmpdir/mlc",
487 -dir => "$tmpdir");
490 if( $@ ) {
491 $self->warn($self->error_string);
493 chdir($cwd);
495 unless ( $self->save_tempfiles ) {
496 unlink("$codeml_ctl");
497 $self->cleanup();
499 return ($rc,$parser);
502 =head2 error_string
504 Title : error_string
505 Usage : $obj->error_string($newval)
506 Function: Where the output from the last analysus run is stored.
507 Returns : value of error_string
508 Args : newvalue (optional)
511 =cut
513 sub error_string{
514 my ($self,$value) = @_;
515 if( defined $value) {
516 $self->{'error_string'} = $value;
518 return $self->{'error_string'};
522 =head2 alignment
524 Title : alignment
525 Usage : $codeml->align($aln);
526 Function: Get/Set the L<Bio::Align::AlignI> object
527 Returns : L<Bio::Align::AlignI> object
528 Args : [optional] L<Bio::Align::AlignI>
529 Comment : We could potentially add support for running directly on a file
530 but we shall keep it simple
531 See also: L<Bio::SimpleAlign>
533 =cut
535 sub alignment{
536 my ($self,$aln) = @_;
538 if( defined $aln ) {
539 if( -e $aln ) {
540 $self->{'_alignment'} = $aln;
541 } elsif( !ref($aln) || ! $aln->isa('Bio::Align::AlignI') ) {
542 $self->warn("Must specify a valid Bio::Align::AlignI object to the alignment function not $aln");
543 return undef;
544 } else {
545 $self->{'_alignment'} = $aln;
548 return $self->{'_alignment'};
551 =head2 tree
553 Title : tree
554 Usage : $codeml->tree($tree, %params);
555 Function: Get/Set the L<Bio::Tree::TreeI> object
556 Returns : L<Bio::Tree::TreeI>
557 Args : [optional] $tree => L<Bio::Tree::TreeI>,
558 [optional] %parameters => hash of tree-specific parameters:
559 branchLengths: 0, 1 or 2
562 Comment : We could potentially add support for running directly on a file
563 but we shall keep it simple
564 See also: L<Bio::Tree::Tree>
566 =cut
568 sub tree {
569 my ($self, $tree, %params) = @_;
570 if( defined $tree ) {
571 if( ! ref($tree) || ! $tree->isa('Bio::Tree::TreeI') ) {
572 $self->warn("Must specify a valid Bio::Tree::TreeI object to the alignment function");
574 $self->{'_tree'} = $tree;
575 if ( defined $params{'_branchLengths'} ) {
576 my $ubl = $params{'_branchLengths'};
577 if ($ubl !~ m/^(0|1|2)$/) {
578 $self->throw("The branchLengths parameter to tree() must be 0 (ignore), 1 (initial values) or 2 (fixed values) only");
580 $self->{'_branchLengths'} = $ubl;
583 return $self->{'_tree'};
586 =head2 get_parameters
588 Title : get_parameters
589 Usage : my %params = $self->get_parameters();
590 Function: returns the list of parameters as a hash
591 Returns : associative array keyed on parameter names
592 Args : none
595 =cut
597 sub get_parameters{
598 my ($self) = @_;
599 # we're returning a copy of this
600 return %{ $self->{'_codemlparams'} };
604 =head2 set_parameter
606 Title : set_parameter
607 Usage : $codeml->set_parameter($param,$val);
608 Function: Sets a codeml parameter, will be validated against
609 the valid values as set in the %VALIDVALUES class variable.
610 The checks can be ignored if one turns off param checks like this:
611 $codeml->no_param_checks(1)
612 Returns : boolean if set was success, if verbose is set to -1
613 then no warning will be reported
614 Args : $param => name of the parameter
615 $value => value to set the parameter to
616 See also: L<no_param_checks()>
618 =cut
620 sub set_parameter{
621 my ($self,$param,$value) = @_;
622 if( ! defined $VALIDVALUES{$param} ) {
623 $self->warn("unknown parameter $param will not be set unless you force by setting no_param_checks to true");
624 return 0;
626 if( ref( $VALIDVALUES{$param}) =~ /ARRAY/i &&
627 scalar @{$VALIDVALUES{$param}} > 0 ) {
629 unless ( grep { $value eq $_ } @{ $VALIDVALUES{$param} } ) {
630 $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");
631 return 0;
634 $self->{'_codemlparams'}->{$param} = $value;
635 return 1;
638 =head2 set_default_parameters
640 Title : set_default_parameters
641 Usage : $codeml->set_default_parameters(0);
642 Function: (Re)set the default parameters from the defaults
643 (the first value in each array in the
644 %VALIDVALUES class variable)
645 Returns : none
646 Args : boolean: keep existing parameter values
649 =cut
651 sub set_default_parameters{
652 my ($self,$keepold) = @_;
653 $keepold = 0 unless defined $keepold;
655 while( my ($param,$val) = each %VALIDVALUES ) {
656 # skip if we want to keep old values and it is already set
657 next if( defined $self->{'_codemlparams'}->{$param} && $keepold);
658 if(ref($val)=~/ARRAY/i ) {
659 $self->{'_codemlparams'}->{$param} = $val->[0];
660 } else {
661 $self->{'_codemlparams'}->{$param} = $val;
667 =head1 Bio::Tools::Run::WrapperBase methods
669 =cut
671 =head2 no_param_checks
673 Title : no_param_checks
674 Usage : $obj->no_param_checks($newval)
675 Function: Boolean flag as to whether or not we should
676 trust the sanity checks for parameter values
677 Returns : value of no_param_checks
678 Args : newvalue (optional)
681 =cut
683 =head2 save_tempfiles
685 Title : save_tempfiles
686 Usage : $obj->save_tempfiles($newval)
687 Function:
688 Returns : value of save_tempfiles
689 Args : newvalue (optional)
692 =cut
694 =head2 outfile_name
696 Title : outfile_name
697 Usage : my $outfile = $codeml->outfile_name();
698 Function: Get/Set the name of the output file for this run
699 (if you wanted to do something special)
700 Returns : string
701 Args : [optional] string to set value to
704 =cut
707 =head2 tempdir
709 Title : tempdir
710 Usage : my $tmpdir = $self->tempdir();
711 Function: Retrieve a temporary directory name (which is created)
712 Returns : string which is the name of the temporary directory
713 Args : none
716 =cut
718 =head2 cleanup
720 Title : cleanup
721 Usage : $codeml->cleanup();
722 Function: Will cleanup the tempdir directory after a PAML run
723 Returns : none
724 Args : none
727 =cut
729 =head2 io
731 Title : io
732 Usage : $obj->io($newval)
733 Function: Gets a L<Bio::Root::IO> object
734 Returns : L<Bio::Root::IO>
735 Args : none
738 =cut
740 sub DESTROY {
741 my $self= shift;
742 unless ( $self->save_tempfiles ) {
743 $self->cleanup();
745 $self->SUPER::DESTROY();