blib/lib/Bio/Tools/Run/Phylo/Phylip/ProtDist.pm

filter: Statementstmt 37.2% 60 / 161 Branchbran 13.5% 10 / 74 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 71.4% 15 / 21 Podpod 100% 6 / 6 totaltotal 31.3% 91 / 290 CC 48 SCAR 55.2
CC
48
Cov
28%
_setparams
650.0
_run
56.0
_setinput
42.0
CRAP 250.0
« blib/lib/Bio/Tools/Run/Vista.pm ↑ Summary blib/lib/Bio/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
236 @PROTDIST_PARAMS @OTHER_SWITCHES
237 2 ▶ %OK_FIELD);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 BEGIN {
269 2 ▶ @PROTDIST_PARAMS = qw(MODEL GENCODE CATEGORY PROBCHANGE TRANS WEIGHTS FREQ MULTIPLE);
Subroutine BEGIN: called CC=2 SCAR=6.9
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 sub program_name {
287 6 ▶ return 'protdist';
Subroutine program_name: called CC=1 SCAR=0.0
Pod documented
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 sub program_dir {
301 3 ▶ return Bio::Root::IO->catfile($ENV{PHYLIPDIR}) if $ENV{PHYLIPDIR};
Subroutine program_dir: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PHYLIPDIR"} 0 3 3
302 }
303  
304 sub new {
305 1 ▶ my ($class,@args) = @_;
Subroutine new: called CC=5 SCAR=16.4
Pod documented
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 sub AUTOLOAD {
326 6 ▶ my $self = shift;
Subroutine AUTOLOAD: called CC=3 SCAR=11.2
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 sub idlength{
347 1 ▶ my $self = shift;
Subroutine idlength: called CC=2 SCAR=7.0
Pod documented
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 sub run{
382  
383 0 ▶ my ($self,$input) = @_;
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
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 sub _run {
412 0 ▶ my ($self,$infile,$param_string) = @_;
Subroutine _run: not called CC=7 SCAR=40.3
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 open(PROTDIST,"|".$self->executable .">/dev/null");
425 }
426 else {
427 0 open(PROTDIST,"|".$self->executable);
428 }
429 0 print PROTDIST $instring;
430 0 close(PROTDIST);
431
432 # get the results
433 0 my $outfile = $self->io->catfile($self->tempdir,$self->outfile);
434 0 chdir($curpath);
435 0 ▶ $self->throw("protdist did not create matrix correctly ($outfile)")
Branch: 1 branch
BranchTrueFalseTotal
unless -e $outfile 0 0 0
436 unless (-e $outfile);
437  
438 #Create the distance matrix here
439 0 my $parser = Bio::Tools::Phylo::Phylip::ProtDist->new(-file=>$outfile);
440 0 my @matrix;
441 0 ▶ while (my $mat = $parser->next_matrix){
Branch: 1 branch
BranchTrueFalseTotal
if (my $mat = $parser->next_matrix) 0 0 0
442 0 push @matrix, $mat;
443 }
444  
445 # Clean up the temporary files created along the way...
446 0 ▶ unlink $outfile unless $self->save_tempfiles;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->save_tempfiles 0 0 0
447
448 0 return @matrix;
449 }
450  
451 =head2 create_distance_matrix
452  
453 Title : create_distance_matrix
454 Usage : my $file = $app->create_distance_matrix($treefile);
455 Function: This method is deprecated. Please use run method.
456 Returns : L<Bio::Matrix::PhylipDist>
457 Args : Name of a file containing a multiple alignment in Phylip format
458 or an SimpleAlign object
459  
460 Throws an exception if argument is not either a string (eg a
461 filename) or a Bio::SimpleAlign object. If
462 argument is string, throws exception if file corresponding to string
463 name can not be found.
464  
465 =cut
466  
467 sub create_distance_matrix{
468 0 ▶ return shift->run(@_);
Subroutine create_distance_matrix: not called CC=1 SCAR=6.9
Pod documented
469 }
470  
471 =head2 _setinput()
472  
473 Title : _setinput
474 Usage : Internal function, not to be called directly
475 Function: Create input file for protdist program
476 Example :
477 Returns : name of file containing a multiple alignment in Phylip format
478 Args : SimpleAlign object reference or input file name
479  
480  
481 =cut
482  
483 sub _setinput {
484 0 ▶ my ($self, $input) = @_;
Subroutine _setinput: not called CC=6 SCAR=37.4
485 0 my ($alnfilename,$tfh);
486  
487 # suffix is used to distinguish alignment files from an align obkect
488 #If $input is not a reference it better be the name of a file with the sequence/
489  
490 # a phy formatted alignment file
491 0 ▶ unless (ref $input) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $input) 0 0 0
492 # check that file exists or throw
493 0 $alnfilename= $input;
494 0 ▶ unless (-e $input) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $input) 0 0 0
495 0 return $alnfilename;
496 }
497 0 ▶ my @input = ref $input eq 'ARRAY' ? @{$input} : ($input);
Branch: 1 branch
BranchTrueFalseTotal
ref $input eq 'ARRAY' ? : 0 0 0
498  
499 # $input may be a SimpleAlign Object
500 0 ($tfh,$alnfilename) = $self->io->tempfile(-dir=>$self->tempdir);
501 0 my $alnIO = Bio::AlignIO->new(-fh => $tfh,
502 -format=>'phylip',
503 -idlength=>$self->idlength());
504 0 my $input_count = 0;
505 0 foreach my $input(@input){
506 0 ▶ if ($input->isa("Bio::SimpleAlign")){
Branch: 1 branch
BranchTrueFalseTotal
if ($input->isa("Bio::SimpleAlign")) 0 0 0
507 # Open temporary file for both reading & writing of BioSeq array
508 0 $alnIO->write_aln($input);
509 }
510 0 $input_count++;
511 }
512 0 $alnIO->close();
513 0 close($tfh);
514 0 $tfh = undef;
515 0 $self->_input_nbr($input_count);
516 0 return $alnfilename;
517 }
518  
519 sub _input_nbr {
520 0 ▶ my ($self,$val) = @_;
Subroutine _input_nbr: not called CC=2 SCAR=17.9
521 0 ▶ if($val){
Branch: 1 branch
BranchTrueFalseTotal
if ($val) 0 0 0
522 0 $self->{'_input_nbr'} = $val;
523 }
524 0 return $self->{'_input_nbr'};
525 }
526  
527 =head2 _setparams()
528  
529 Title : _setparams
530 Usage : Internal function, not to be called directly
531 Function: Create parameter inputs for protdist program
532 Example :
533 Returns : parameter string to be passed to protdist
534 Args : name of calling object
535  
536 =cut
537  
538 sub _setparams {
539 0 ▶ my ($attr, $value, $self);
Subroutine _setparams: not called CC=25 SCAR=64.8
540  
541 #do nothing for now
542 0 $self = shift;
543 0 my $param_string = "";
544 0 my $cat = 0;
545 0 my %menu = %{$Menu{$self->version}->{'PROTDIST'}};
546  
547 0 foreach my $attr ( @PROTDIST_PARAMS) {
548 0 $value = $self->$attr();
549 0 ▶ next unless (defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
550 0 ▶ if ($attr =~/MODEL/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /MODEL/i) 0 0 0
551 0 ▶ if ($value=~/CAT/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /CAT/i) 0 0 0
552 0 $cat = 1;
553 }
554 0 $param_string .= $menu{'MODEL'}{$value};
555 }
556 0 ▶ if($attr=~/MULTIPLE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /MULTIPLE/i) 0 0 0
557 0 $param_string.=$menu{'MULTIPLE'}."$value\n";
558 }
559 0 ▶ if ($cat == 1){
Branch: 1 branch
BranchTrueFalseTotal
if ($cat == 1) 0 0 0
560 0 ▶ if($attr =~ /GENCODE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /GENCODE/i) 0 0 0
561 0 my $allowed = $menu{'GENCODE'}{'ALLOWED'};
562 0 ▶ $self->throw("Unallowed value for genetic code") unless ($value =~ /[$allowed]/);
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /[$allowed]/ 0 0 0
563 0 $param_string .= $menu{'GENCODE'}{'OPTION'}."$value\n";
564 }
565 0 ▶ if ($attr =~/CATEGORY/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /CATEGORY/i) 0 0 0
566 0 my $allowed = $menu{'CATEGORY'}{'ALLOWED'};
567 0 ▶ $self->throw("Unallowed value for categorization of amino acids") unless ($value =~/[$allowed]/);
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /[$allowed]/ 0 0 0
568 0 $param_string .= $menu{'CATEGORY'}{'OPTION'}."$value\n";
569 }
570 0 ▶ if ($attr =~/PROBCHANGE/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /PROBCHANGE/i) 0 0 0
571 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
572 0 $param_string .= $menu{'PROBCHANGE'}."$value\n";
573 }
574 else {
575 0 $self->throw("Unallowed value for probability change category");
576 }
577 }
578 0 ▶ if ($attr =~/TRANS/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /TRANS/i) 0 0 0
579 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
580 0 $param_string .=$menu{'TRANS'}."$value\n";
581 }
582 }
583 0 ▶ if ($attr =~ /FREQ/i){
Branch: 1 branch
BranchTrueFalseTotal
if ($attr =~ /FREQ/i) 0 0 0
584 0 my @freq = split(",",$value);
585 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
586 0 $param_string .=$menu{'FREQ'}.$freq[0]."\n";
587 }
588 elsif ($#freq == 3) {#must have 4 digits for each base
589 0 $param_string .=$menu{'FREQ'};
590 0 foreach my $f (@freq){
591 0 $param_string.="$f\n";
592 }
593 }
594 else {
595 0 $self->throw("Unallowed value for base frequencies");
596 }
597 }
598 }
599 }
600 #set multiple option is not set and there are more than one sequence
601 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
602 0 $param_string.=$menu{'MULTIPLE'}.$self->_input_nbr."\n";
603 }
604 0 $param_string .=$menu{'SUBMIT'};
605  
606 0 return $param_string;
607 }
608  
609  
610  
611 =head1 Bio::Tools::Run::Wrapper methods
612  
613 =cut
614  
615 =head2 no_param_checks
616  
617 Title : no_param_checks
618 Usage : $obj->no_param_checks($newval)
619 Function: Boolean flag as to whether or not we should
620 trust the sanity checks for parameter values
621 Returns : value of no_param_checks
622 Args : newvalue (optional)
623  
624  
625 =cut
626  
627 =head2 save_tempfiles
628  
629 Title : save_tempfiles
630 Usage : $obj->save_tempfiles($newval)
631 Function:
632 Returns : value of save_tempfiles
633 Args : newvalue (optional)
634  
635  
636 =cut
637  
638 =head2 outfile_name
639  
640 Title : outfile_name
641 Usage : my $outfile = $protdist->outfile_name();
642 Function: Get/Set the name of the output file for this run
643 (if you wanted to do something special)
644 Returns : string
645 Args : [optional] string to set value to
646  
647  
648 =cut
649  
650  
651 =head2 tempdir
652  
653 Title : tempdir
654 Usage : my $tmpdir = $self->tempdir();
655 Function: Retrieve a temporary directory name (which is created)
656 Returns : string which is the name of the temporary directory
657 Args : none
658  
659  
660 =cut
661  
662 =head2 cleanup
663  
664 Title : cleanup
665 Usage : $codeml->cleanup();
666 Function: Will cleanup the tempdir directory after a ProtDist run
667 Returns : none
668 Args : none
669  
670  
671 =cut
672  
673 =head2 io
674  
675 Title : io
676 Usage : $obj->io($newval)
677 Function: Gets a L<Bio::Root::IO> object
678 Returns : L<Bio::Root::IO>
679 Args : none
680  
681  
682 =cut
683  
684 2 1; # Needed to keep compiler happy
« blib/lib/Bio/Tools/Run/Vista.pm ↑ Summary blib/lib/Bio/Tools/Run/Primer3.pm »