Tools/Run/Phylo/PAML/Codeml.pm

filter: Statementstmt 68.6% 125 / 182 Branchbran 41.8% 41 / 98 Conditioncond 18.7% 6 / 32 MC/DCmcdc 5.0% 1 / 20 Subroutinesub 92.0% 23 / 25 Podpod 100% 13 / 13 totaltotal 56.4% 209 / 370 SCAR 59.8
CC
61
Cov
55%
run
63.6
prepare
35.3
tree
25.7
CRAP 397.2
« Tools/Run/Phylo/PAML/Yn00.pm ↑ Summary Tools/Phylo/PAML/Result.pm »
1 package Bio::Tools::Run::Phylo::PAML::Codeml;
2 2 $Bio::Tools::Run::Phylo::PAML::Codeml::VERSION = '1.7.2';
3 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use vars qw(@ISA %VALIDVALUES $MINNAMELEN $PROGRAMNAME $PROGRAM);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Bio::TreeIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Bio::Tools::Phylo::PAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase);
16  
17 # ABSTRACT: Wrapper aroud the PAML program codeml
18 # AUTHOR: Jason Stajich <jason@bioperl.org>
19 # OWNER: Jason Stajich <jason@bioperl.org>
20 # LICENSE: Perl_5
21  
22  
23  
24 BEGIN {
25  
26 2 ▶ $MINNAMELEN = 25;
Subroutine BEGIN: called CC=4 SCAR=17.1
27 2 ▶ $PROGRAMNAME = 'codeml' . ($^O =~ /mswin/i ?'.exe':'');
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 2 2
28 2 ▶ if( defined $ENV{'PAMLDIR'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{"PAMLDIR"}) 0 2 2
29 0 ▶ $PROGRAM = Bio::Root::IO->catfile($ENV{'PAMLDIR'},$PROGRAMNAME). ($^O =~ /mswin/i ?'.exe':'');;
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 0 0
30 }
31  
32 # valid values for parameters, the default one is always
33 # the first one in the array
34 # much of the documentation here is lifted directly from the codeml.ctl
35 # example file provided with the package
36 %VALIDVALUES = (
37 2 'outfile' => 'mlc',
38 'noisy' => [ 0..3,9],
39 'verbose' => [ 1,0,2], # 0:concise, 1:detailed, 2:too much
40  
41 # (runmode) 0:user tree, 1:semi-autmatic, 2:automatic
42 # 3:stepwise addition, 4,5:PerturbationNNI
43 # -2:pairwise
44 'runmode' => [ -2, 0..5],
45  
46 'seqtype' => [ 1..3], # 1:codons, 2:AAs, 3:codons->AAs
47  
48 'CodonFreq' => [ 2, 0,1,3,4,5,6,7], # 0:1/61 each, 1:F1X4,
49 # 2:F3X4, 3:codon table
50  
51 # (aaDist) 0:equal, +:geometric, -:linear,
52 # 1-6:G1974,Miyata, c,p,v,a
53 'aaDist' => [ 0,'+','-', 1..6],
54  
55 # (aaRatefile) only used for aa seqs
56 # with model=empirical(_F)
57 # default is usually 'wag.dat', also
58 # dayhoff.dat, jones.dat, mtmam.dat, or your own
59 'aaRatefile' => 'wag.dat',
60  
61 # (model) models for codons
62 # 0: one, 1:b, 2:2 or more dN/dS ratios for branches
63 'model' => [0..3,7],
64  
65 # (NSsites) number of S sites
66 # 0: one w;1:neutral;2:selection; 3:discrete;4:freqs;
67 # 5:gamma;6:2gamma;7:beta;8:beta&w;9:beta&gamma;
68 # 10:beta&gamma+1; 11:beta&normal>1; 12:0&2normal>1;
69 # 13:3normal>0
70 'NSsites' => [0..13],
71  
72 # (icode) genetic code
73 # 0:universal code
74 # 1:mamalian mt
75 # 2:yeast mt
76 # 3:mold mt,
77 # 4:invertebrate mt
78 # 5:ciliate nuclear
79 # 6:echinoderm mt
80 # 7:euplotid mt
81 # 8:alternative yeast nu.
82 # 9:ascidian mt
83 #10:blepharisma nu
84 # these correspond to 1-11 in the genbank transl table
85  
86 'icode' => [ 0..10],
87  
88 'Mgene' => [0,1], # 0:rates, 1:separate
89  
90 'fix_kappa'=> [0,1], # 0:estimate kappa, 1:fix kappa
91 'kappa' => '2', # initial or fixed kappa
92 'fix_omega'=> [0,1], # 0: estimate omega, 1: fix omega
93 'omega' => '1', # initial or fixed omega for
94 # codons or codon-base AAs
95 'fix_alpha'=> [1,0], # 0: estimate gamma shape param
96 # 1: fix it at alpha
97 'alpha' => '0.', # initial or fixed alpha
98 # 0: infinity (constant rate)
99 'Malpha' => [0,1], # different alphas for genes
100 'ncatG' => [1..10], # number of categories in
101 # dG of NSsites models
102  
103 # (clock)
104 # 0: no clock, 1: global clock, 2: local clock
105 # 3: TipDate
106 'clock' => [0..3],
107 # (getSE) Standard Error:
108 # 0:don't want them, 1: want S.E.
109 'getSE' => [0,1],
110 # (RateAncestor)
111 # 0,1,2 rates (alpha>0) or
112 # ancestral states (1 or 2)
113 'RateAncestor' => [1,0,2],
114 'Small_Diff' => '.5e-6',
115 # (cleandata) remove sites with ambiguity data
116 # 1: yes, 0:no
117 'cleandata' => [0,1],
118 # this is the number of datasets in
119 # the file - we would need to change
120 # our api to allow >1 alignment object
121 # to be referenced at time
122 'ndata' => 1,
123 # (method)
124 # 0: simultaneous,1: 1 branch at a time
125 'method' => [0,1],
126  
127 # allow branch lengths to be fixed
128 # 0 ignore
129 # -1 use random starting points
130 # 1 use the branch lengths in initial ML iteration
131 # 2 branch lengths are fixed
132 'fix_blength' => [0,-1,1,2],
133 );
134 }
135  
136  
137 sub program_name {
138 6 ▶ return 'codeml';
Subroutine program_name: called CC=1 SCAR=0.0
Pod documented
139 }
140  
141  
142 sub program_dir {
143 3 ▶ return Bio::Root::IO->catfile($ENV{PAMLDIR}) if $ENV{PAMLDIR};
Subroutine program_dir: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PAMLDIR"} 0 3 3
144 }
145  
146  
147  
148 sub new {
149 1 ▶ my($class,@args) = @_;
Subroutine new: called CC=8 SCAR=22.9
Pod documented
150  
151 1 my $self = $class->SUPER::new(@args);
152 1 $self->{'_branchLengths'} = 0;
153 1 my ($aln, $tree, $st, $params, $exe,
154 $ubl) = $self->_rearrange([qw(ALIGNMENT TREE SAVE_TEMPFILES
155 PARAMS EXECUTABLE BRANCHLENGTHS)],
156 @args);
157 1 ▶ defined $aln && $self->alignment($aln);
Branch: 1 branch
BranchTrueFalseTotal
defined $aln and $self->alignment($aln) 0 1 1
158 1 ▶ defined $tree && $self->tree($tree, branchLengths => ($ubl || 0) );
Branch: 1 branch
BranchTrueFalseTotal
defined $tree and $self->tree($tree, "branchLengths", $ubl || 0) 0 1 1
Condition0%0/2
$ubl || 0
l!l
00
MC/DC0%0/1
$ubl || 0
$ubl
Truth table0%0/2
A
A= $ubl
Aresult
11
00
159 1 ▶ defined $st && $self->save_tempfiles($st);
Branch: 1 branch
BranchTrueFalseTotal
defined $st and $self->save_tempfiles($st) 0 1 1
160 1 ▶ defined $exe && $self->executable($exe);
Branch: 1 branch
BranchTrueFalseTotal
defined $exe and $self->executable($exe) 0 1 1
161  
162 1 $self->set_default_parameters();
163 1 ▶ if( defined $params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params) 1 0 1
164 1 ▶ if( ref($params) !~ /HASH/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref($params) =~ /HASH/i) { } 0 1 1
165 0 $self->warn("Must provide a valid hash ref for parameter -FLAGS");
166 } else {
167 1 map { $self->set_parameter($_, $$params{$_}) } keys %$params;
168 }
169 }
170 1 return $self;
171 }
172  
173  
174  
175 sub prepare{
176 1 ▶ my ($self,$aln,$tree) = @_;
Subroutine prepare: called CC=16 SCAR=35.6
Pod documented
177 1 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 1 0 1
178 # brush so we don't get plaque buildup ;)
179 1 $self->cleanup();
180 }
181 1 ▶ $tree = $self->tree unless $tree;
Branch: 1 branch
BranchTrueFalseTotal
unless $tree 1 0 1
182 1 ▶ $aln = $self->alignment unless $aln;
Branch: 1 branch
BranchTrueFalseTotal
unless $aln 1 0 1
183 1 ▶ if( ! $aln ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($aln) 0 1 1
184 0 $self->warn("must have supplied a valid alignment file in order to run codeml");
185 0 return 0;
186 }
187 1 my ($tempdir) = $self->tempdir();
188 1 my ($tempseqFH,$tempseqfile);
189 1 ▶ if( ! ref($aln) && -e $aln ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $aln and -e $aln) { } 0 1 1
Condition33%1/3
not ref $aln and -e $aln
!ll&&!rl&&r
100
MC/DC0%0/2
not ref $aln and -e $aln
not ref $aln -e $aln
Truth table33%1/3
not(A) and B
A= not ref $alnB= -e $aln
ABresult
0X0
100
111
190 0 $tempseqfile = $aln;
191 } else {
192 1 ▶ ($tempseqFH,$tempseqfile) = $self->io->tempfile
Branch: 1 branch
BranchTrueFalseTotal
$self->save_tempfiles ? : 0 1 1
193 ('-dir' => $tempdir,
194 UNLINK => ($self->save_tempfiles ? 0 : 1));
195 1 ▶ my $alnout = Bio::AlignIO->new('-format' => 'phylip',
Branch: 1 branch
BranchTrueFalseTotal
$Bio::Tools::Run::Phylo::PAML::Codeml::MINNAMELEN > $aln->maxdisplayname_length ? : 1 0 1
196 '-fh' => $tempseqFH,
197 '-interleaved' => 0,
198 '-idlength' => $MINNAMELEN > $aln->maxdisplayname_length() ? $MINNAMELEN : $aln->maxdisplayname_length() +1);
199  
200 1 $alnout->write_aln($aln);
201 1 $alnout->close();
202 1 undef $alnout;
203 1 close($tempseqFH);
204 }
205 # now let's print the codeml.ctl file.
206 # many of the these programs are finicky about what the filename is
207 # and won't even run without the properly named file. Ack
208  
209 1 my $codeml_ctl = "$tempdir/codeml.ctl";
210 1 ▶ open(CODEML, ">$codeml_ctl") or $self->throw("cannot open $codeml_ctl for writing");
Branch: 1 branch
BranchTrueFalseTotal
open CODEML, ">$codeml_ctl" or $self->throw("cannot open $codeml_ctl for writing") 0 1 1
211 1 print CODEML "seqfile = $tempseqfile\n";
212 1 my $outfile = $self->outfile_name;
213 1 print CODEML "outfile = $outfile\n";
214  
215 1 ▶ if( $tree ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tree) 0 1 1
216 0 my ($temptreeFH,$temptreefile);
217 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
218 0 $temptreefile = $tree;
219 } else {
220 0 ▶ ($temptreeFH,$temptreefile) = $self->io->tempfile
Branch: 1 branch
BranchTrueFalseTotal
$self->save_tempfiles ? : 0 0 0
221 ('-dir' => $tempdir,
222 UNLINK => ($self->save_tempfiles ? 0 : 1));
223  
224 0 my $treeout = Bio::TreeIO->new('-format' => 'newick',
225 '-fh' => $temptreeFH);
226 0 $treeout->write_tree($tree);
227 0 $treeout->close();
228 0 close($temptreeFH);
229 }
230 0 print CODEML "treefile = $temptreefile\n";
231 }
232  
233 1 my %params = $self->get_parameters;
234 1 ▶ while( my ($param,$val) = each %params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %params) 28 1 29
235 28 ▶ next if $param eq 'outfile';
Branch: 1 branch
BranchTrueFalseTotal
if $param eq "outfile" 1 27 28
236 27 print CODEML "$param = $val\n";
237 }
238 1 close(CODEML);
239 # my ($rc,$parser) = (1);
240 # {
241 # my $cwd = cwd();
242 # my $exit_status;
243 # chdir($tempdir);
244 # }
245 1 return $tempdir;
246 }
247  
248  
249  
250  
251 sub run {
252 1 ▶ my ($self) = shift;;
Subroutine run: called CC=10 SCAR=41.5
Pod documented
253 1 my $outfile = $self->outfile_name;
254 1 my $tmpdir = $self->prepare(@_);
255  
256 1 my ($rc,$parser) = (1);
257 {
258 1 my $cwd = cwd();
259 1 my $exit_status;
260 1 chdir($tmpdir);
261 1 my $codemlexe = $self->executable();
262 0 ▶ $self->throw("unable to find or run executable for 'codeml'") unless $codemlexe && -e $codemlexe && -x _;
Branch: 1 branch
BranchTrueFalseTotal
unless $codemlexe and -e $codemlexe and -x _ 0 0 0
Condition0%0/6
$codemlexe and -e $codemlexe and -x _
!ll&&!rl&&r
000
$codemlexe and -e $codemlexe
!ll&&!rl&&r
000
MC/DC0%0/3
$codemlexe and -e $codemlexe and -x _
$codemlexe -e $codemlexe -x _
Truth table0%0/4
A and B and C
A= $codemlexeB= -e $codemlexeC= -x _
ABCresult
0XX0
10X0
1100
1111
263 0 my $run;
264 0 ▶ if( $self->{'_branchLengths'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_branchLengths'}) { } 0 0 0
265 0 ▶ open($run, "echo $self->{'_branchLengths'} | $codemlexe |") or $self->throw("Cannot open exe $codemlexe");
Branch: 1 branch
BranchTrueFalseTotal
open $run, qq[echo $self->{"_branchLengths"} | $codemlexe |] or $self->throw("Cannot open exe $codemlexe") 0 0 0
266 } else {
267 0 ▶ open($run, "$codemlexe |") or $self->throw("Cannot open exe $codemlexe");
Branch: 1 branch
BranchTrueFalseTotal
open $run, "$codemlexe |" or $self->throw("Cannot open exe $codemlexe") 0 0 0
268 }
269 0 my @output = <$run>;
270 0 $exit_status = close($run);
271 0 $self->error_string(join('',@output));
272 0 ▶ if( (grep { /\berr(or)?: /io } @output) || !$exit_status) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {/\berr(or)?: /io;} @output or not $exit_status) 0 0 0
Condition0%0/3
grep {/\berr(or)?: /io;} @output or not $exit_status
l!l&&r!l&&!r
000
MC/DC0%0/2
grep {/\berr(or)?: /io;} @output or not $exit_status
grep {/\berr(or)?: /io;} @output not $exit_status
Truth table0%0/3
A or not(B)
A= grep {/\berr(or)?: /io;} @outputB= not $exit_status
ABresult
1X1
011
000
273 0 $self->warn("There was an error - see error_string for the program output");
274 0 $rc = 0;
275 }
276 0 eval {
277 0 $parser = Bio::Tools::Phylo::PAML->new(-file => "$tmpdir/$outfile",
278 -verbose => $self->verbose,
279 -dir => "$tmpdir");
280 };
281 0 ▶ if( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
282 0 $self->warn($self->error_string);
283 }
284 0 chdir($cwd);
285 }
286 0 return ($rc,$parser);
287 }
288  
289  
290 sub error_string{
291 0 ▶ my ($self,$value) = @_;
Subroutine error_string: not called CC=2 SCAR=17.9
Pod documented
292 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
293 0 $self->{'error_string'} = $value;
294 }
295 0 return $self->{'error_string'};
296  
297 }
298  
299  
300 sub alignment{
301 2 ▶ my ($self,$aln) = @_;
Subroutine alignment: called CC=5 SCAR=19.1
Pod documented
302  
303 2 ▶ if( defined $aln ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $aln) 1 1 2
304 1 ▶ if( -e $aln ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-e $aln) { } 0 1 1
elsif (not ref $aln && $aln->isa('Bio::Align::AlignI')) { } 0 1 1
305 0 $self->{'_alignment'} = $aln;
306 ▶ } elsif( !ref($aln) || ! $aln->isa('Bio::Align::AlignI') ) {
Condition33%1/3
ref $aln && $aln->isa('Bio::Align::AlignI')
!ll&&!rl&&r
001
MC/DC0%0/2
ref $aln && $aln->isa('Bio::Align::AlignI')
ref $aln $aln->isa('Bio::Align::AlignI')
Truth table33%1/3
A && B
A= ref $alnB= $aln->isa('Bio::Align::AlignI')
ABresult
0X0
100
111
307 0 $self->warn("Must specify a valid Bio::Align::AlignI object to the alignment function not $aln");
308 0 return undef;
309 } else {
310 1 $self->{'_alignment'} = $aln;
311 }
312 }
313 2 return $self->{'_alignment'};
314 }
315  
316  
317 sub tree {
318 1 ▶ my ($self, $tree, %params) = @_;
Subroutine tree: called CC=6 SCAR=32.5
Pod documented
319 1 ▶ if( defined $tree ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tree) 0 1 1
320 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
321 0 $self->warn("Must specify a valid Bio::Tree::TreeI object to the alignment function");
322 }
323 0 $self->{'_tree'} = $tree;
324 0 ▶ if ( defined $params{'_branchLengths'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params{"_branchLengths"}) 0 0 0
325 0 my $ubl = $params{'_branchLengths'};
326 0 ▶ if ($ubl !~ m/^(0|1|2)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ubl =~ /^(0|1|2)$/) 0 0 0
327 0 $self->throw("The branchLengths parameter to tree() must be 0 (ignore), 1 (initial values) or 2 (fixed values) only");
328 }
329 0 $self->{'_branchLengths'} = $ubl;
330 }
331 }
332 1 return $self->{'_tree'};
333 }
334  
335  
336 sub get_parameters{
337 1 ▶ my ($self) = @_;
Subroutine get_parameters: called CC=1 SCAR=0.0
Pod documented
338 # we're returning a copy of this
339 1 return %{ $self->{'_codemlparams'} };
340 }
341  
342  
343  
344 sub set_parameter{
345 8 ▶ my ($self,$param,$value) = @_;
Subroutine set_parameter: called CC=7 SCAR=22.2
Pod documented
346 8 ▶ 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) 8 0 8
Condition33%1/3
defined $self->{"no_param_checks"} and $self->{"no_param_checks"} == 1
!ll&&!rl&&r
800
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 table33%1/3
A and B
A= defined $self->{"no_param_checks"}B= $self->{"no_param_checks"} == 1
ABresult
0X0
100
111
347 8 ▶ if ( ! defined $VALIDVALUES{$param} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) 0 8 8
348 0 $self->warn("unknown parameter $param will not be set unless you force by setting no_param_checks to true");
349 0 return 0;
350 }
351 8 ▶ if ( ref( $VALIDVALUES{$param}) =~ /ARRAY/i &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref($Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};} > 0) 5 3 8
Condition66%2/3
ref($Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};} > 0
!ll&&!rl&&r
305
MC/DC50%1/2
ref($Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) =~ /ARRAY/i and scalar @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};} > 0
ref($Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) =~ /ARRAY/i scalar @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};} > 0
Truth table66%2/3
A and B
A= ref($Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param}) =~ /ARRAY/iB= scalar @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};} > 0
ABresult
0X0
100
111
352 5 scalar @{$VALIDVALUES{$param}} > 0 ) {
353  
354 5 ▶ unless ( grep { $value eq $_ } @{ $VALIDVALUES{$param} } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$value eq $_;} @{$Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES{$param};}) 0 5 5
355 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");
356 0 return 0;
357 }
358 }
359 }
360 8 $self->{'_codemlparams'}->{$param} = $value;
361 8 return 1;
362 }
363  
364  
365 sub set_default_parameters{
366 1 ▶ my ($self,$keepold) = @_;
Subroutine set_default_parameters: called CC=6 SCAR=18.6
Pod documented
367 1 ▶ $keepold = 0 unless defined $keepold;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $keepold 1 0 1
368  
369 1 ▶ while( my ($param,$val) = each %VALIDVALUES ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %Bio::Tools::Run::Phylo::PAML::Codeml::VALIDVALUES) 28 1 29
370 # skip if we want to keep old values and it is already set
371 28 ▶ next if( defined $self->{'_codemlparams'}->{$param} && $keepold);
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"_codemlparams"}{$param} and $keepold 0 28 28
Condition33%1/3
defined $self->{"_codemlparams"}{$param} and $keepold
!ll&&!rl&&r
2800
MC/DC0%0/2
defined $self->{"_codemlparams"}{$param} and $keepold
defined $self->{"_codemlparams"}{$param} $keepold
Truth table33%1/3
A and B
A= defined $self->{"_codemlparams"}{$param}B= $keepold
ABresult
0X0
100
111
372 28 ▶ if(ref($val)=~/ARRAY/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($val) =~ /ARRAY/i) { } 21 7 28
373 21 $self->{'_codemlparams'}->{$param} = $val->[0];
374 } else {
375 7 $self->{'_codemlparams'}->{$param} = $val;
376 }
377 }
378 }
379  
380  
381  
382  
383 sub no_param_checks{
384 0 ▶ my ($self,$value) = @_;
Subroutine no_param_checks: not called CC=2 SCAR=17.9
Pod documented
385 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
386 0 $self->{'no_param_checks'} = $value;
387 }
388 0 return $self->{'no_param_checks'};
389 }
390  
391  
392  
393  
394 sub outfile_name {
395 2 ▶ my $self = shift;
Subroutine outfile_name: called CC=3 SCAR=12.7
Pod documented
396 2 ▶ if( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
397 0 return $self->{'_codemlparams'}->{'outfile'} = shift @_;
398 }
399 2 ▶ unless (defined $self->{'_codemlparams'}->{'outfile'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_codemlparams"}{"outfile"}) 0 2 2
400 0 $self->{'_codemlparams'}->{'outfile'} = 'mlc';
401 }
402 2 return $self->{'_codemlparams'}->{'outfile'};
403 }
404  
405  
406  
407  
408 sub DESTROY {
409 1 ▶ my $self= shift;
Subroutine DESTROY: called CC=2 SCAR=7.0
410 1 ▶ unless ( $self->save_tempfiles ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->save_tempfiles) 1 0 1
411 1 $self->cleanup();
412 }
413 1 $self->SUPER::DESTROY();
414 }
415  
416 2 1;
417  
418 __END__
« Tools/Run/Phylo/PAML/Yn00.pm ↑ Summary Tools/Phylo/PAML/Result.pm »