Tools/Run/Phylo/Phylip/ProtDist.pm

filter: Statementstmt 35.8% 58 / 162 Branchbran 11.8% 9 / 76 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 61.9% 13 / 21 Podpod 100% 6 / 6 totaltotal 29.3% 86 / 293 CC 49 SCAR 55.2
CC
49
Cov
26%
_setparams
650.0
_run
72.0
_setinput
42.0
CRAP 249.2
« Tools/Run/TribeMCL.pm ↑ Summary Tools/Run/Primer3.pm »
1 # BioPerl module for Bio::Tools::Run::Phylo::Phylip::ProtDist
2 #
3 # Created by
4 #
5 # Shawn Hoon
6 #
7 # You may distribute this module under the same terms as perl itself
8  
9 # POD documentation - main docs before the code
10  
11 =head1 NAME
12  
13 Bio::Tools::Run::Phylo::Phylip::ProtDist - Wrapper for the phylip
14 program protdist
15  
16 =head1 SYNOPSIS
17  
18 #Create a SimpleAlign object
19 @params = ('ktuple' => 2, 'matrix' => 'BLOSUM');
20 $factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
21 $inputfilename = 't/data/cysprot.fa';
22 $aln = $factory->run($inputfilename); # $aln is a SimpleAlign object.
23  
24  
25 # Create the Distance Matrix using a default PAM matrix and id name
26 # lengths limit of 30 note to use id name length greater than the
27 # standard 10 in protdist, you will need to modify the protdist source
28 # code
29  
30 @params = ('MODEL' => 'PAM');
31 $protdist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new(@params);
32  
33 my ($matrix) = $protdist_factory->run($aln); # an array of Bio::Matrix::PhylipDist matrix
34  
35 #finding the distance between two sequences
36 my $distance = $matrix->get_entry('protein_name_1','protein_name_2');
37 my @column = $matrix->get_column('protein_name_1');
38 my @row = $martrix->get_row('protein_name_1');
39 my @diag = $matrix->get_diagonal();
40 print $matrix->print_matrix;
41  
42  
43 #Alternatively, one can create the matrix by passing in a file
44 #name containing a multiple alignment in phylip format
45 $protdist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new(@params);
46 my ($matrix) = $protdist_factory->run('/home/shawnh/prot.phy');
47  
48 # To prevent PHYLIP from truncating sequence names:
49 # Step 1. Shelf the original names:
50 my ($aln_safe, $ref_name)= # $aln_safe has serial names
51 $aln->set_displayname_safe(); # $ref_name holds original names
52 # Step 2. Run ProtDist and Neighbor:
53 ($matrix) = $protdist_factory->
54 create_distance_matrix($aln_safe); # Use $aln_safe instead of $aln
55 ($tree) = $neighbor_factory->run($matrix);
56 # Step 3. Retrieve orgininal OTU names:
57 use Bio::Tree::Tree;
58 my @nodes=$tree->get_nodes();
59 foreach my $nd (@nodes){
60 $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
61 }
62  
63 =head1 DESCRIPTION
64  
65 Wrapper for protdist Joseph Felsentein for creating a distance matrix
66 comparing protein sequences from a multiple alignment file or a
67 L<Bio::SimpleAlign> object and returns a L<Bio::Matrix::PhylipDist> object;
68  
69 VERSION Support
70  
71 This wrapper currently supports v3.5 of phylip. There is also support
72 for v3.6.
73  
74 =head1 PARAMETERS FOR PROTDIST COMPUTATION
75  
76 =head2 MODEL
77  
78 Title : MODEL
79 Description : (optional)
80  
81 This sets the model of amino acid substitution used
82 in the calculation of the distances. 3 different
83 models are supported:
84 PAM Dayhoff PAM Matrix(default)
85 KIMURA Kimura's Distance CAT
86  
87 Categories Distance Usage: @params =
88 ('model'=>'X');#where X is one of the values above
89  
90 Defaults to PAM For more information on the usage of
91 the different models, please refer to the
92 documentation
93 defaults to Equal
94 (0.25,0.25,0.25,0.25) found in the phylip package.
95  
96 Additional models in PHYLIP 3.6
97 PMB - Henikoff/Tillier PMB matrix
98 JTT - Jones/Taylor/Thornton
99  
100 =head2 MULTIPLE
101  
102 Title : MULTIPLE
103 Description: (optional)
104  
105 This allows multiple distance matrices to be generated from multiple
106 MSA.
107  
108 Usage: @params = ('MULTIPLE'=>100) where the value specifyies the
109 number of aligments given.
110  
111 =head2 ALL SUBSEQUENT PARAMETERS WILL ONLY WORK IN CONJUNCTION WITH
112  
113 THE Categories Distance MODEL*
114  
115 =head2 GENCODE
116  
117 Title : GENCODE
118 Description : (optional)
119  
120 This option allows the user to select among various
121 nuclear and mitochondrial genetic codes.
122  
123 Acceptable Values:
124 U Universal
125 M Mitochondrial
126 V Vertebrate mitochondrial
127 F Fly mitochondrial
128 Y Yeast mitochondrial
129 Usage : @params = ('gencode'=>'X');
130 where X is one of the letters above
131 Defaults to U
132  
133 =head2 CATEGORY
134  
135 Title : CATEGORY
136 Description : (optional)
137  
138 This option sets the categorization of amino acids
139 all have groups: (Glu Gln Asp Asn), (Lys Arg His),
140 (Phe Tyr Trp) plus:
141 G George/Hunt/Barker:
142 (Cys), (Met Val Leu Ileu),
143 (Gly Ala Ser Thr Pro)
144 C Chemical:
145 (Cys Met), (Val Leu Ileu Gly Ala Ser Thr),
146 (Pro)
147 H Hall:
148 (Cys), (Met Val Leu Ileu), (Gly Ala Ser Thr),
149 (Pro)
150  
151 Usage : @params = ('category'=>'X');
152 where X is one of the letters above
153 Defaults to G
154  
155 =head2 PROBCHANGE
156  
157 Title : PROBCHANGE
158 Description : (optional)
159 This option sets the ease of changing category of amino
160 acid. (1.0 if no difficulty of changing,less if less
161 easy. Can't be negative)
162  
163 Usage : @params = ('probchange'=>X) where 0<=X<=1
164 Defaults to 0.4570
165  
166 =head2 TRANS
167  
168 Title : TRANS
169 Description : (optional)
170 This option sets transition/transversion ratio can be
171 any positive number
172  
173 Usage : @params = ('trans'=>X) where X >= 0
174 Defaults to 2
175  
176 =head2 FREQ
177  
178 Title : FREQ
179 Description : (optional)
180 This option sets the frequency of each base (A,C,G,T)
181 The sum of the frequency must sum to 1.
182 For example A,C,G,T = (0.25,0.5,0.125,0.125)
183  
184 Usage : @params = ('freq'=>('W','X','Y','Z')
185 where W + X + Y + Z = 1
186 Defaults to Equal (0.25,0.25,0.25,0.25)
187  
188  
189 =head1 FEEDBACK
190  
191 =head2 Mailing Lists
192  
193 User feedback is an integral part of the evolution of this and other
194 Bioperl modules. Send your comments and suggestions preferably to one
195 of the Bioperl mailing lists. Your participation is much appreciated.
196  
197 bioperl-l@bioperl.org - General discussion
198 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
199  
200 =head2 Support
201  
202 Please direct usage questions or support issues to the mailing list:
203  
204 I<bioperl-l@bioperl.org>
205  
206 rather than to the module maintainer directly. Many experienced and
207 reponsive experts will be able look at the problem and quickly
208 address it. Please include a thorough description of the problem
209 with code and data examples if at all possible.
210  
211 =head2 Reporting Bugs
212  
213 Report bugs to the Bioperl bug tracking system to help us keep track
214 the bugs and their resolution. Bug reports can be submitted via the
215 web:
216  
217 http://redmine.open-bio.org/projects/bioperl/
218  
219 =head1 AUTHOR - Shawn Hoon
220  
221 Email shawnh@fugu-sg.org
222  
223 =head1 APPENDIX
224  
225 The rest of the documentation details each of the object
226 methods. Internal methods are usually preceded with a _
227  
228 =cut
229  
230 #'
231  
232
233 package Bio::Tools::Run::Phylo::Phylip::ProtDist;
234  
235 2 ▶use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR $PROGRAMNAME
Subroutine BEGIN: called CC=1 SCAR=0.0
236 @PROTDIST_PARAMS @OTHER_SWITCHES
237 2 %OK_FIELD);
238 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
239 2 ▶use Bio::SimpleAlign;
Subroutine BEGIN: called CC=1 SCAR=0.0
240 2 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
241 2 ▶use Bio::TreeIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
242 2 ▶use Bio::Tools::Run::Phylo::Phylip::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
243 2 ▶use Bio::Tools::Run::Phylo::Phylip::PhylipConf qw(%Menu);
Subroutine BEGIN: called CC=1 SCAR=0.0
244 2 ▶use Bio::Tools::Phylo::Phylip::ProtDist;
Subroutine BEGIN: called CC=1 SCAR=0.0
245 2 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
246  
247  
248 # inherit from Phylip::Base which has some methods for dealing with
249 # Phylip specifics
250 2 @ISA = qw(Bio::Tools::Run::Phylo::Phylip::Base);
251  
252 # You will need to enable the protdist program. This
253 # can be done in (at least) 3 ways:
254 #
255 # 1. define an environmental variable PHYLIPDIR:
256 # export PHYLIPDIR=/home/shawnh/PHYLIP/bin
257 #
258 # 2. include a definition of an environmental variable CLUSTALDIR in
259 # every script that will use Clustal.pm.
260 # $ENV{PHYLIPDIR} = '/home/shawnh/PHYLIP/bin';
261 #
262 # 3. You can set the path to the program through doing:
263 # my @params('program'=>'/usr/local/bin/protdist');
264 # my $protdist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new(@params);
265 #
266  
267  
268 2 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
269 2 @PROTDIST_PARAMS = qw(MODEL GENCODE CATEGORY PROBCHANGE TRANS WEIGHTS FREQ MULTIPLE);
270 2 @OTHER_SWITCHES = qw(QUIET);
271 2 foreach my $attr(@PROTDIST_PARAMS,@OTHER_SWITCHES) {
272 18 $OK_FIELD{$attr}++;
273 }
274 }
275  
276 =head2 program_name
277  
278 Title : program_name
279 Usage : >program_name()
280 Function: holds the program name
281 Returns: string
282 Args : None
283  
284 =cut
285  
286 0 ▶sub program_name {
Subroutine program_name: not called CC=1 SCAR=6.9
Pod documented
287 0 return 'protdist';
288 }
289  
290 =head2 program_dir
291  
292 Title : program_dir
293 Usage : ->program_dir()
294 Function: returns the program directory, obtained from ENV variable.
295 Returns: string
296 Args :
297  
298 =cut
299  
300 0 ▶sub program_dir {
Subroutine program_dir: not called CC=2 SCAR=17.9
Pod documented
301 0 ▶ return Bio::Root::IO->catfile($ENV{PHYLIPDIR}) if $ENV{PHYLIPDIR};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PHYLIPDIR"} 0 0 0
302 }
303  
304 1 ▶sub new {
Subroutine new: called CC=5 SCAR=16.4
Pod documented
305 1 my ($class,@args) = @_;
306 1 my $self = $class->SUPER::new(@args);
307 1 my ($attr, $value);
308 1 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 7 1 8
309 7 $attr = shift @args;
310 7 $value = shift @args;
311 7 ▶ next if( $attr =~ /^-/ ); # don't want named parameters
Branch: 1 branch
BranchTrueFalseTotal
if $attr =~ /^-/ 0 7 7
312 7 ▶ if ($attr =~/PROGRAM/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /PROGRAM/i) 0 7 7
313 0 $self->executable($value);
314 0 next;
315 }
316 7 ▶ if ($attr =~ /IDLENGTH/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /IDLENGTH/i) 1 6 7
317 1 $self->idlength($value);
318 1 next;
319 }
320 6 $self->$attr($value);
321 }
322 1 return $self;
323 }
324  
325 6 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.2
326 6 my $self = shift;
327 6 my $attr = $AUTOLOAD;
328 6 $attr =~ s/.*:://;
329 6 $attr = uc $attr;
330 6 ▶ $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Bio::Tools::Run::Phylo::Phylip::ProtDist::OK_FIELD{$attr} 0 6 6
331 6 ▶ $self->{$attr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 6 0 6
332 6 return $self->{$attr};
333 }
334  
335 =head2 idlength
336  
337 Title : idlength
338 Usage : $obj->idlength ($newval)
339 Function:
340 Returns : value of idlength
341 Args : newvalue (optional)
342  
343  
344 =cut
345  
346 1 ▶sub idlength{
Subroutine idlength: called CC=2 SCAR=7.0
Pod documented
347 1 my $self = shift;
348 1 ▶ if( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
349 1 my $value = shift;
350 1 $self->{'idlength'} = $value;
351 }
352 1 return $self->{'idlength'};
353  
354 }
355  
356  
357 =head2 run
358  
359 Title : run
360 Usage :
361 $inputfilename = 't/data/prot.phy';
362 $matrix= $prodistfactory->run($inputfilename);
363 or
364 $seq_array_ref = \@seq_array; @seq_array is array of Seq objs
365 $aln = $protdistfactory->align($seq_array_ref);
366 $matrix = $protdistfactory->run($aln);
367  
368 Function: Create a distance matrix from a SimpleAlign object or a multiple alignment file
369 Example :
370 Returns : L<Bio::Matrix::PhylipDist>
371 Args : Name of a file containing a multiple alignment in Phylip format
372 or an SimpleAlign object
373  
374 Throws an exception if argument is not either a string (eg a
375 filename) or a Bio::SimpleAlign object. If
376 argument is string, throws exception if file corresponding to string
377 name can not be found.
378  
379 =cut
380  
381 0 ▶sub run{
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
382  
383 0 my ($self,$input) = @_;
384 0 my ($infilename);
385  
386 # Create input file pointer
387 0 $infilename = $self->_setinput($input);
388 0 ▶ if (!$infilename) {$self->throw("Problems setting up for protdist. Probably bad input data in $input !");}
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename) 0 0 0
389 # Create parameter string to pass to protdist program
390 0 my $param_string = $self->_setparams();
391 # run protdist
392 0 my @mat = $self->_run($infilename,$param_string);
393 0 ▶ return wantarray ? @mat:\@mat;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
394 }
395  
396 #################################################
397  
398 =head2 _run
399  
400 Title : _run
401 Usage : Internal function, not to be called directly
402 Function: makes actual system call to protdist program
403 Example :
404 Returns : Bio::Tree object
405 Args : Name of a file containing a set of multiple alignments in Phylip format
406 and a parameter string to be passed to protdist
407  
408  
409 =cut
410  
411 0 ▶sub _run {
Subroutine _run: not called CC=8 SCAR=42.8
412 0 my ($self,$infile,$param_string) = @_;
413 0 my $instring;
414 0 my $curpath = cwd;
415 0 ▶ unless( File::Spec->file_name_is_absolute($infile) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->file_name_is_absolute($infile)) 0 0 0
416 0 $infile = $self->io->catfile($curpath,$infile);
417 }
418 0 $instring = $infile."\n$param_string";
419 0 $self->debug( "Program ".$self->executable." $instring\n");
420
421 0 chdir($self->tempdir);
422 #open a pipe to run protdist to bypass interactive menus
423 0 ▶ if ($self->quiet() || $self->verbose() < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->quiet or $self->verbose < 0) { } 0 0 0
Condition0%0/3
$self->quiet or $self->verbose < 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->quiet or $self->verbose < 0
$self->quiet $self->verbose < 0
Truth table0%0/3
A or B
A= $self->quietB= $self->verbose < 0
ABresult
1X1
011
000
424 0 ▶ my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null';
Branch: 1 branch
BranchTrueFalseTotal
$^O =~ /mswin/i ? : 0 0 0
425 0 open(PROTDIST,"|".$self->executable .">$null");
426 }
427 else {
428 0 open(PROTDIST,"|".$self->executable);
429 }
430 0 print PROTDIST $instring;
431 0 close(PROTDIST);
432
433 # get the results
434 0 my $outfile = $self->io->catfile($self->tempdir,$self->outfile);
435 0 chdir($curpath);
436 0 ▶ $self->throw("protdist did not create matrix correctly ($outfile)")
Branch: 1 branch
BranchTrueFalseTotal
unless -e $outfile 0 0 0
437 unless (-e $outfile);
438  
439 #Create the distance matrix here
440 0 my $parser = Bio::Tools::Phylo::Phylip::ProtDist->new(-file=>$outfile);
441 0 my @matrix;
442 0 ▶ while (my $mat = $parser->next_matrix){
Branch: 1 branch
BranchTrueFalseTotal
if (my $mat = $parser->next_matrix) 0 0 0
443 0 push @matrix, $mat;
444 }
445  
446 # Clean up the temporary files created along the way...
447 0 ▶ unlink $outfile unless $self->save_tempfiles;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->save_tempfiles 0 0 0
448
449 0 return @matrix;
450 }
451  
452 =head2 create_distance_matrix
453  
454 Title : create_distance_matrix
455 Usage : my $file = $app->create_distance_matrix($treefile);
456 Function: This method is deprecated. Please use run method.
457 Returns : L<Bio::Matrix::PhylipDist>
458 Args : Name of a file containing a multiple alignment in Phylip format
459 or an SimpleAlign object
460  
461 Throws an exception if argument is not either a string (eg a
462 filename) or a Bio::SimpleAlign object. If
463 argument is string, throws exception if file corresponding to string
464 name can not be found.
465  
466 =cut
467  
468 0 ▶sub create_distance_matrix{
Subroutine create_distance_matrix: not called CC=1 SCAR=6.9
Pod documented
469 0 return shift->run(@_);
470 }
471  
472 =head2 _setinput()
473  
474 Title : _setinput
475 Usage : Internal function, not to be called directly
476 Function: Create input file for protdist program
477 Example :
478 Returns : name of file containing a multiple alignment in Phylip format
479 Args : SimpleAlign object reference or input file name
480  
481  
482 =cut
483  
484 0 ▶sub _setinput {
Subroutine _setinput: not called CC=6 SCAR=37.4
485 0 my ($self, $input) = @_;
486 0 my ($alnfilename,$tfh);
487  
488 # suffix is used to distinguish alignment files from an align obkect
489 #If $input is not a reference it better be the name of a file with the sequence/
490  
491 # a phy formatted alignment file
492 0 ▶ unless (ref $input) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $input) 0 0 0
493 # check that file exists or throw
494 0 $alnfilename= $input;
495 0 ▶ unless (-e $input) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $input) 0 0 0
496 0 return $alnfilename;
497 }
498 0 ▶ my @input = ref $input eq 'ARRAY' ? @{$input} : ($input);
Branch: 1 branch
BranchTrueFalseTotal
ref $input eq 'ARRAY' ? : 0 0 0
499  
500 # $input may be a SimpleAlign Object
501 0 ($tfh,$alnfilename) = $self->io->tempfile(-dir=>$self->tempdir);
502 0 my $alnIO = Bio::AlignIO->new(-fh => $tfh,
503 -format=>'phylip',
504 -idlength=>$self->idlength());
505 0 my $input_count = 0;
506 0 foreach my $input(@input){
507 0 ▶ if ($input->isa("Bio::SimpleAlign")){
Branch: 1 branch
BranchTrueFalseTotal
if ($input->isa("Bio::SimpleAlign")) 0 0 0
508 # Open temporary file for both reading & writing of BioSeq array
509 0 $alnIO->write_aln($input);
510 }
511 0 $input_count++;
512 }
513 0 $alnIO->close();
514 0 close($tfh);
515 0 $tfh = undef;
516 0 $self->_input_nbr($input_count);
517 0 return $alnfilename;
518 }
519  
520 0 ▶sub _input_nbr {
Subroutine _input_nbr: not called CC=2 SCAR=17.9
521 0 my ($self,$val) = @_;
522 0 ▶ if($val){
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 0 0 0
523 0 $self->{'_input_nbr'} = $val;
524 }
525 0 return $self->{'_input_nbr'};
526 }
527  
528 =head2 _setparams()
529  
530 Title : _setparams
531 Usage : Internal function, not to be called directly
532 Function: Create parameter inputs for protdist program
533 Example :
534 Returns : parameter string to be passed to protdist
535 Args : name of calling object
536  
537 =cut
538  
539 0 ▶sub _setparams {
Subroutine _setparams: not called CC=25 SCAR=64.8
540 0 my ($attr, $value, $self);
541  
542 #do nothing for now
543 0 $self = shift;
544 0 my $param_string = "";
545 0 my $cat = 0;
546 0 my %menu = %{$Menu{$self->version}->{'PROTDIST'}};
547  
548 0 foreach my $attr ( @PROTDIST_PARAMS) {
549 0 $value = $self->$attr();
550 0 ▶ next unless (defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
551 0 ▶ if ($attr =~/MODEL/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /MODEL/i) 0 0 0
552 0 ▶ if ($value=~/CAT/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /CAT/i) 0 0 0
553 0 $cat = 1;
554 }
555 0 $param_string .= $menu{'MODEL'}{$value};
556 }
557 0 ▶ if($attr=~/MULTIPLE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /MULTIPLE/i) 0 0 0
558 0 $param_string.=$menu{'MULTIPLE'}."$value\n";
559 }
560 0 ▶ if ($cat == 1){
Branch: 1 branch
BranchTrueFalseTotal
if ($cat == 1) 0 0 0
561 0 ▶ if($attr =~ /GENCODE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /GENCODE/i) 0 0 0
562 0 my $allowed = $menu{'GENCODE'}{'ALLOWED'};
563 0 ▶ $self->throw("Unallowed value for genetic code") unless ($value =~ /[$allowed]/);
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /[$allowed]/ 0 0 0
564 0 $param_string .= $menu{'GENCODE'}{'OPTION'}."$value\n";
565 }
566 0 ▶ if ($attr =~/CATEGORY/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /CATEGORY/i) 0 0 0
567 0 my $allowed = $menu{'CATEGORY'}{'ALLOWED'};
568 0 ▶ $self->throw("Unallowed value for categorization of amino acids") unless ($value =~/[$allowed]/);
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /[$allowed]/ 0 0 0
569 0 $param_string .= $menu{'CATEGORY'}{'OPTION'}."$value\n";
570 }
571 0 ▶ if ($attr =~/PROBCHANGE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /PROBCHANGE/i) 0 0 0
572 0 ▶ if (($value =~ /\d+/)&&($value >= 0) && ($value < 1)){
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /\d+/ and $value >= 0 and $value < 1) { } 0 0 0
Condition0%0/6
$value =~ /\d+/ and $value >= 0 and $value < 1
!ll&&!rl&&r
000
$value =~ /\d+/ and $value >= 0
!ll&&!rl&&r
000
MC/DC0%0/3
$value =~ /\d+/ and $value >= 0 and $value < 1
$value =~ /\d+/ $value >= 0 $value < 1
Truth table0%0/4
A and B and C
A= $value =~ /\d+/B= $value >= 0C= $value < 1
ABCresult
0XX0
10X0
1100
1111
573 0 $param_string .= $menu{'PROBCHANGE'}."$value\n";
574 }
575 else {
576 0 $self->throw("Unallowed value for probability change category");
577 }
578 }
579 0 ▶ if ($attr =~/TRANS/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /TRANS/i) 0 0 0
580 0 ▶ if (($value=~/\d+/) && ($value >=0)){
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /\d+/ and $value >= 0) 0 0 0
Condition0%0/3
$value =~ /\d+/ and $value >= 0
!ll&&!rl&&r
000
MC/DC0%0/2
$value =~ /\d+/ and $value >= 0
$value =~ /\d+/ $value >= 0
Truth table0%0/3
A and B
A= $value =~ /\d+/B= $value >= 0
ABresult
0X0
100
111
581 0 $param_string .=$menu{'TRANS'}."$value\n";
582 }
583 }
584 0 ▶ if ($attr =~ /FREQ/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /FREQ/i) 0 0 0
585 0 my @freq = split(",",$value);
586 0 ▶ if ($freq[0] !~ /\d+/){ #a letter provided (sets frequencies equally to 0.25)
Branch: 2 branches
BranchTrueFalseTotal
if (not $freq[0] =~ /\d+/) { } 0 0 0
elsif ($#freq == 3) { } 0 0 0
587 0 $param_string .=$menu{'FREQ'}.$freq[0]."\n";
588 }
589 elsif ($#freq == 3) {#must have 4 digits for each base
590 0 $param_string .=$menu{'FREQ'};
591 0 foreach my $f (@freq){
592 0 $param_string.="$f\n";
593 }
594 }
595 else {
596 0 $self->throw("Unallowed value for base frequencies");
597 }
598 }
599 }
600 }
601 #set multiple option is not set and there are more than one sequence
602 0 ▶ if (($param_string !~ $menu{'MULTIPLE'}) && (defined ($self->_input_nbr) &&($self->_input_nbr > 1))){
Branch: 1 branch
BranchTrueFalseTotal
if (not $param_string =~ /$menu{"MULTIPLE"}/ and (defined $self->_input_nbr and $self->_input_nbr > 1)) 0 0 0
Condition0%0/6
not $param_string =~ /$menu{"MULTIPLE"}/ and (defined $self->_input_nbr and $self->_input_nbr > 1)
!ll&&!rl&&r
000
defined $self->_input_nbr and $self->_input_nbr > 1
!ll&&!rl&&r
000
MC/DC0%0/3
not $param_string =~ /$menu{"MULTIPLE"}/ and (defined $self->_input_nbr and $self->_input_nbr > 1)
not $param_string =~ /$menu{"MULTIPLE"}/ defined $self->_input_nbr $self->_input_nbr > 1
Truth table0%0/4
not(A) and B and C
A= not $param_string =~ /$menu{"MULTIPLE"}/B= defined $self->_input_nbrC= $self->_input_nbr > 1
ABCresult
0XX0
10X0
1100
1111
603 0 $param_string.=$menu{'MULTIPLE'}.$self->_input_nbr."\n";
604 }
605 0 $param_string .=$menu{'SUBMIT'};
606  
607 0 return $param_string;
608 }
609  
610  
611  
612 =head1 Bio::Tools::Run::Wrapper methods
613  
614 =cut
615  
616 =head2 no_param_checks
617  
618 Title : no_param_checks
619 Usage : $obj->no_param_checks($newval)
620 Function: Boolean flag as to whether or not we should
621 trust the sanity checks for parameter values
622 Returns : value of no_param_checks
623 Args : newvalue (optional)
624  
625  
626 =cut
627  
628 =head2 save_tempfiles
629  
630 Title : save_tempfiles
631 Usage : $obj->save_tempfiles($newval)
632 Function:
633 Returns : value of save_tempfiles
634 Args : newvalue (optional)
635  
636  
637 =cut
638  
639 =head2 outfile_name
640  
641 Title : outfile_name
642 Usage : my $outfile = $protdist->outfile_name();
643 Function: Get/Set the name of the output file for this run
644 (if you wanted to do something special)
645 Returns : string
646 Args : [optional] string to set value to
647  
648  
649 =cut
650  
651  
652 =head2 tempdir
653  
654 Title : tempdir
655 Usage : my $tmpdir = $self->tempdir();
656 Function: Retrieve a temporary directory name (which is created)
657 Returns : string which is the name of the temporary directory
658 Args : none
659  
660  
661 =cut
662  
663 =head2 cleanup
664  
665 Title : cleanup
666 Usage : $codeml->cleanup();
667 Function: Will cleanup the tempdir directory after a ProtDist run
668 Returns : none
669 Args : none
670  
671  
672 =cut
673  
674 =head2 io
675  
676 Title : io
677 Usage : $obj->io($newval)
678 Function: Gets a L<Bio::Root::IO> object
679 Returns : L<Bio::Root::IO>
680 Args : none
681  
682  
683 =cut
684  
685 2 1; # Needed to keep compiler happy
« Tools/Run/TribeMCL.pm ↑ Summary Tools/Run/Primer3.pm »