blib/lib/Bio/Tools/Run/Alignment/Muscle.pm

filter: Statementstmt 33.3% 68 / 204 Branchbran 13.0% 13 / 100 Conditioncond 10.5% 2 / 19 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 66.6% 16 / 24 Podpod 100% 9 / 9 totaltotal 29.3% 108 / 368 CC 62 SCAR 48.3
CC
62
Cov
26%
profile
342.0
_setinput
240.0
_setparams
72.0
CRAP 125.8
« blib/lib/Bio/Tools/Run/Phylo/SLR.pm ↑ Summary blib/lib/Bio/Tools/Run/Phylo/PAML/Baseml.pm »
1 # $Id$
2 #
3 # BioPerl module for Bio::Tools::Run::Alignment::Muscle
4 #
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 #
7 # Cared for by Jason Stajich
8 #
9 # Copyright Jason Stajich <jason-at-bioperl-dot-org>
10 #
11 # You may distribute this module under the same terms as perl itself
12 #
13 # POD documentation - main docs before the code
14  
15 =head1 NAME
16  
17 Bio::Tools::Run::Alignment::Muscle - Object for the calculation of an
18 iterative multiple sequence alignment from a set of unaligned
19 sequences or alignments using the MUSCLE program
20  
21 =head1 SYNOPSIS
22  
23 # Build a muscle alignment factory
24 $factory = Bio::Tools::Run::Alignment::Muscle->new(@params);
25  
26 # Pass the factory a list of sequences to be aligned.
27 $inputfilename = 't/cysprot.fa';
28 # $aln is a SimpleAlign object.
29 $aln = $factory->align($inputfilename);
30  
31 # or where @seq_array is an array of Bio::Seq objects
32 $seq_array_ref = \@seq_array;
33 $aln = $factory->align($seq_array_ref);
34  
35 # Or one can pass the factory a pair of (sub)alignments
36 #to be aligned against each other, e.g.:
37  
38 #There are various additional options and input formats available.
39 #See the DESCRIPTION section that follows for additional details.
40  
41 =head1 DESCRIPTION
42  
43 Muscle is Robert Edgar's progressive alignment program. You can get
44 it and see information about it at this URL
45 http://www.drive5.com/muscle
46  
47 It is recommended you use at least version 3.6. Behaviour with earlier versions
48 is questionable.
49  
50 =head2 Helping the module find your executable
51  
52 You will need to enable Muscle to find the muscle program. This can be
53 done in (at least) three ways:
54  
55 1. Make sure the muscle executable is in your path (i.e.
56 'which muscle' returns a valid program
57 2. define an environmental variable MUSCLEDIR which points to a
58 directory containing the 'muscle' app:
59 In bash
60 export MUSCLEDIR=/home/progs/muscle or
61 In csh/tcsh
62 setenv MUSCLEDIR /home/progs/muscle
63  
64 3. include a definition of an environmental variable MUSCLEDIR
65 in every script that will
66 BEGIN {$ENV{MUSCLEDIR} = '/home/progs/muscle'; }
67 use Bio::Tools::Run::Alignment::Muscle;
68  
69 =head1 FEEDBACK
70  
71 =head2 Mailing Lists
72  
73 User feedback is an integral part of the evolution of this and other
74 Bioperl modules. Send your comments and suggestions preferably to one
75 of the Bioperl mailing lists. Your participation is much appreciated.
76  
77 bioperl-l@bioperl.org - General discussion
78 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
79  
80 =head2 Support
81  
82 Please direct usage questions or support issues to the mailing list:
83  
84 I<bioperl-l@bioperl.org>
85  
86 rather than to the module maintainer directly. Many experienced and
87 reponsive experts will be able look at the problem and quickly
88 address it. Please include a thorough description of the problem
89 with code and data examples if at all possible.
90  
91 =head2 Reporting Bugs
92  
93 Report bugs to the Bioperl bug tracking system to help us keep track
94 the bugs and their resolution. Bug reports can be submitted via the web:
95  
96 http://redmine.open-bio.org/projects/bioperl/
97  
98 =head1 AUTHOR - Jason Stajich
99  
100 Email jason-at-bioperl-dot-org
101  
102 =head1 APPENDIX
103  
104 The rest of the documentation details each of the object
105 methods. Internal methods are usually preceded with a _
106  
107 =cut
108  
109 package Bio::Tools::Run::Alignment::Muscle;
110  
111 1 use vars qw($AUTOLOAD @ISA $PROGRAMNAME $PROGRAM %DEFAULTS
112 @MUSCLE_PARAMS @MUSCLE_SWITCHES %OK_FIELD
113 1 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
114 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
115 1 ▶use Bio::Seq;
Subroutine BEGIN: called CC=1 SCAR=0.0
116 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
117 1 ▶use Bio::SimpleAlign;
Subroutine BEGIN: called CC=1 SCAR=0.0
118 1 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
119 1 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
120 1 ▶use Bio::Root::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
121 1 ▶use Bio::Factory::ApplicationFactoryI;
Subroutine BEGIN: called CC=1 SCAR=0.0
122 1 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
123 1 @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase
124 Bio::Factory::ApplicationFactoryI);
125  
126  
127 BEGIN {
128 1 ▶ %DEFAULTS = ( 'AFORMAT' => 'fasta' );
Subroutine BEGIN: called CC=2 SCAR=6.9
129 1 @MUSCLE_PARAMS = qw(IN OUT TREE1 LOG LOGA SCOREFILE GAPOPEN
130 MAXMB MAXHOURS MAXITERS KBAND IN1 IN2);
131 1 @MUSCLE_SWITCHES = qw(QUIET DIAGS REFINE STABLE GROUP
132 CLW CLWSTRICT MSF);
133  
134 # Authorize attribute fields
135 1 foreach my $attr ( @MUSCLE_PARAMS, @MUSCLE_SWITCHES ) {
136 21 $OK_FIELD{$attr}++; }
137 }
138  
139 =head2 program_name
140  
141 Title : program_name
142 Usage : $factory->program_name()
143 Function: holds the program name
144 Returns: string
145 Args : None
146  
147 =cut
148  
149 sub program_name {
150 6 ▶ return 'muscle';
Subroutine program_name: called CC=1 SCAR=0.0
Pod documented
151 }
152  
153 =head2 program_dir
154  
155 Title : program_dir
156 Usage : $factory->program_dir(@params)
157 Function: returns the program directory, obtained from ENV variable.
158 Returns: string
159 Args :
160  
161 =cut
162  
163 sub program_dir {
164 3 ▶ return Bio::Root::IO->catfile($ENV{MUSCLEDIR}) if $ENV{MUSCLEDIR};
Subroutine program_dir: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"MUSCLEDIR"} 0 3 3
165 }
166  
167 =head2 new
168  
169 Title : new
170 Usage : my $muscle = Bio::Tools::Run::Alignment::Muscle->new();
171 Function: Constructor
172 Returns : Bio::Tools::Run::Alignment::Muscle
173 Args : -outfile_name => $outname
174  
175  
176 =cut
177  
178 sub new {
179 1 ▶ my ($class,@args) = @_;
Subroutine new: called CC=10 SCAR=24.5
Pod documented
180 1 my( @muscle_args, @obj_args);
181 1 ▶ while( my $arg = shift @args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $arg = shift @args) 1 1 2
182 1 ▶ if( $arg =~ /^-/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /^-/) { } 0 1 1
183 0 push @obj_args, $arg, shift @args;
184 } else {
185 1 push @muscle_args,$arg, shift @args;
186 }
187 }
188 1 my $self = $class->SUPER::new(@obj_args);
189
190 1 my ($on) = $self->_rearrange([qw(OUTFILE_NAME)],@obj_args);
191
192 1 ▶ $self->outfile_name($on || '');
Condition50%1/2
$on || ''
l!l
01
MC/DC0%0/1
$on || ''
$on
Truth table50%1/2
A
A= $on
Aresult
11
00
193 1 my ($attr, $value);
194 1 $self->aformat($DEFAULTS{'AFORMAT'});
195  
196 1 ▶ while ( @muscle_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@muscle_args) 1 1 2
197 1 $attr = shift @muscle_args;
198 1 $value = shift @muscle_args;
199 1 ▶ next if( $attr =~ /^-/); # don't want named parameters
Branch: 1 branch
BranchTrueFalseTotal
if $attr =~ /^-/ 0 1 1
200 1 $self->$attr($value);
201 }
202 1 ▶ $self->aformat('msf') if $self->msf;
Branch: 1 branch
BranchTrueFalseTotal
if $self->msf 0 1 1
203 1 ▶ $self->aformat('clustalw') if $self->clw || $self->clwstrict;
Branch: 1 branch
BranchTrueFalseTotal
if $self->clw or $self->clwstrict 0 1 1
Condition33%1/3
$self->clw or $self->clwstrict
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->clw or $self->clwstrict
$self->clw $self->clwstrict
Truth table33%1/3
A or B
A= $self->clwB= $self->clwstrict
ABresult
1X1
011
000
204
205 1 ▶ if( defined $self->out ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->out) 0 1 1
206 0 $self->outfile_name($self->out);
207 }
208 1 return $self;
209 }
210  
211 sub AUTOLOAD {
212 4 ▶ my $self = shift;
Subroutine AUTOLOAD: called CC=3 SCAR=11.2
213 4 my $attr = $AUTOLOAD;
214 4 $attr =~ s/.*:://;
215 4 $attr = uc $attr;
216 # aliasing
217 4 ▶ $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Bio::Tools::Run::Alignment::Muscle::OK_FIELD{$attr} 0 4 4
218  
219 4 ▶ $self->{$attr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 4 4
220 4 return $self->{$attr};
221 }
222  
223 =head2 error_string
224  
225 Title : error_string
226 Usage : $obj->error_string($newval)
227 Function: Where the output from the last analysus run is stored.
228 Returns : value of error_string
229 Args : newvalue (optional)
230  
231  
232 =cut
233  
234 sub error_string{
235 0 ▶ my ($self,$value) = @_;
Subroutine error_string: not called CC=2 SCAR=17.9
Pod documented
236 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
237 0 $self->{'error_string'} = $value;
238 }
239 0 return $self->{'error_string'};
240  
241 }
242  
243 =head2 version
244  
245 Title : version
246 Usage : exit if $prog->version() < 1.8
247 Function: Determine the version number of the program
248 Example :
249 Returns : float or undef
250 Args : none
251  
252 =cut
253  
254 sub version {
255 0 ▶ my ($self) = @_;
Subroutine version: not called CC=3 SCAR=24.8
Pod documented
256 0 my $exe;
257 0 ▶ return undef unless $exe = $self->executable;
Branch: 1 branch
BranchTrueFalseTotal
unless $exe = $self->executable 0 0 0
258 0 my $string = `$exe 2>&1` ;
259  
260 0 $string =~ /MUSCLE\s+v(\d+\.\d+)/m;
261 0 ▶ return $1 || undef;
Condition0%0/2
$1 || undef
l!l
00
MC/DC0%0/1
$1 || undef
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
262 }
263  
264 =head2 run
265  
266 Title : run
267 Usage : my $output = $application->run(\@seqs);
268 Function: Generic run of an application
269 Returns : Bio::SimpleAlign object
270 Args : Arrayref of Bio::PrimarySeqI objects or
271 a filename to run on
272  
273 =cut
274  
275 sub run {
276 0 ▶ my $self = shift;
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
277 0 return $self->align(shift);
278 }
279  
280 =head2 align
281  
282 Title : align
283 Usage :
284 $inputfilename = 't/data/cysprot.fa';
285 $aln = $factory->align($inputfilename);
286 or
287 $seq_array_ref = \@seq_array;
288 # @seq_array is array of Seq objs
289 $aln = $factory->align($seq_array_ref);
290 Function: Perform a multiple sequence alignment
291 Returns : Reference to a SimpleAlign object containing the
292 sequence alignment.
293 Args : Name of a file containing a set of unaligned fasta sequences
294 or else an array of references to Bio::Seq objects.
295  
296 Throws an exception if argument is not either a string (eg a
297 filename) or a reference to an array of Bio::Seq objects. If
298 argument is string, throws exception if file corresponding to string
299 name can not be found. If argument is Bio::Seq array, throws
300 exception if less than two sequence objects are in array.
301  
302 =cut
303  
304 sub align {
305 0 ▶ my ($self,$input) = @_;
Subroutine align: not called CC=4 SCAR=30.0
Pod documented
306 # Create input file pointer
307 0 $self->io->_io_cleanup();
308 0 my $infilename;
309 0 ▶ if( defined $input ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $input) { } 0 0 0
elsif (defined $self->in) { } 0 0 0
310 0 $infilename = $self->_setinput($input);
311 } elsif( defined $self->in ) {
312 0 $infilename = $self->_setinput($self->in);
313 } else {
314 0 $self->throw("No inputdata provided\n");
315 }
316 0 ▶ if (! $infilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename) 0 0 0
317 0 $self->throw("Bad input data or less than 2 sequences in $input !");
318 }
319  
320 0 my $param_string = $self->_setparams();
321  
322 # run muscle
323 0 return &_run($self, $infilename, $param_string);
324 }
325  
326 =head2 profile
327  
328 Title : profile
329 Usage :
330 $alnfilename = /t/data/cysprot.msa';
331 $seqsfilename = 't/data/cysprot.fa';
332 $aln = $factory->profile($alnfilename,$seqsfilename);
333  
334 Function: Perform a profile alignment on a MSA to include more seqs
335 Returns : Reference to a SimpleAlign object containing the
336 sequence alignment.
337 Args : Name of a file containing the fasta MSA and name of a file
338 containing a set of unaligned fasta sequences
339 Comments : This only works for muscle version 3.52.
340 Some early versions of the 3.6 sources had a bug that
341 caused a segfault with -profile. The attached should fix
342 it, if not let Bob Edgar know.
343  
344 =cut
345  
346 sub profile {
347 0 ▶ my ($self,$alnfilename,$seqsfilename) = @_;
Subroutine profile: not called CC=18 SCAR=58.3
Pod documented
348 # Create input file pointer
349 0 $self->io->_io_cleanup();
350 0 ▶ if ($self->version ne '3.52') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->version ne "3.52") 0 0 0
351 0 $self->throw("profile does not work for this version of muscle\n");
352 }
353 0 my $infilename;
354 0 ▶ if( defined $alnfilename ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $alnfilename) { } 0 0 0
355 0 ▶ if (! ref $alnfilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $alnfilename) 0 0 0
356 # check that file exists or throw
357 0 $infilename = $alnfilename;
358 0 ▶ unless (-e $infilename) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $infilename) 0 0 0
359 # let's peek and guess
360 0 ▶ open(IN,$infilename) || $self->throw("Cannot open $infilename");
Branch: 1 branch
BranchTrueFalseTotal
open IN, $infilename or $self->throw("Cannot open $infilename") 0 0 0
361 0 my $header;
362 0 ▶ while( defined ($header = <IN>) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($header = readline IN)) 0 0 0
363 0 ▶ last if $header !~ /^\s+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $header =~ /^\s+$/ 0 0 0
364 }
365 0 close(IN);
366 0 ▶ if ( $header !~ /^>\s*\S+/ ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($header =~ /^>\s*\S+/) 0 0 0
367 0 $self->throw("Need to provide a FASTA format file to muscle profile!");
368 }
369 }
370 } else {
371 0 $self->throw("No inputdata provided\n");
372 }
373 0 ▶ if (! $infilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename) 0 0 0
374 0 $self->throw("Bad input data or less than 2 sequences in $infilename !");
375 }
376 0 ▶ if( defined $seqsfilename ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $seqsfilename) { } 0 0 0
377 0 ▶ if (! ref $seqsfilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $seqsfilename) 0 0 0
378 # check that file exists or throw
379 0 $infilename = $seqsfilename;
380 0 ▶ unless (-e $infilename) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $infilename) 0 0 0
381 # let's peek and guess
382 0 ▶ open(IN,$infilename) || $self->throw("Cannot open $infilename");
Branch: 1 branch
BranchTrueFalseTotal
open IN, $infilename or $self->throw("Cannot open $infilename") 0 0 0
383 0 my $header;
384 0 ▶ while( defined ($header = <IN>) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($header = readline IN)) 0 0 0
385 0 ▶ last if $header !~ /^\s+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $header =~ /^\s+$/ 0 0 0
386 }
387 0 close(IN);
388 0 ▶ if ( $header !~ /^>\s*\S+/ ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($header =~ /^>\s*\S+/) 0 0 0
389 0 $self->throw("Need to provide a FASTA format file to muscle profile!");
390 }
391 }
392 } else {
393 0 $self->throw("No inputdata provided\n");
394 }
395 0 ▶ if (! $infilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename) 0 0 0
396 0 $self->throw("Bad input data or less than 2 sequences in $infilename !");
397 }
398  
399 0 my $param_string = $self->_setparams();
400  
401 # run muscle
402 0 $self->{_profile} = 1;
403 0 return &_run($self, "$alnfilename -in2 $seqsfilename", $param_string);
404 }
405  
406 =head2 _run
407  
408 Title : _run
409 Usage : Internal function, not to be called directly
410 Function: makes actual system call to muscle program
411 Example :
412 Returns : nothing; muscle output is written to a
413 temporary file OR specified output file
414 Args : Name of a file containing a set of unaligned fasta sequences
415 and hash of parameters to be passed to muscle
416  
417  
418 =cut
419  
420 sub _run {
421 0 ▶ my ($self,$infilename,$params) = @_;
Subroutine _run: not called CC=4 SCAR=30.0
422 0 my $commandstring;
423 0 ▶ if ($self->{_profile}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_profile'}) { } 0 0 0
424 0 $commandstring = $self->executable." -profile -in1 $infilename $params";
425 0 $self->{_profile} = 0;
426 } else {
427 0 $commandstring = $self->executable." -in $infilename $params";
428 }
429  
430 0 $self->debug( "muscle command = $commandstring \n");
431  
432 0 my $status = system($commandstring);
433 0 my $outfile = $self->outfile_name();
434 0 ▶ if( !-e $outfile || -z $outfile ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not -e $outfile or -z $outfile) 0 0 0
Condition0%0/3
not -e $outfile or -z $outfile
l!l&&r!l&&!r
000
MC/DC0%0/2
not -e $outfile or -z $outfile
not -e $outfile -z $outfile
Truth table0%0/3
not(A) or B
A= not -e $outfileB= -z $outfile
ABresult
1X1
011
000
435 0 $self->warn( "Muscle call crashed: $? [command $commandstring]\n");
436 0 return undef;
437 }
438  
439 0 my $in = Bio::AlignIO->new('-file' => $outfile,
440 '-format' => $self->aformat);
441 0 my $aln = $in->next_aln();
442 0 return $aln;
443 }
444  
445  
446 =head2 _setinput
447  
448 Title : _setinput
449 Usage : Internal function, not to be called directly
450 Function: Create input file for muscle program
451 Example :
452 Returns : name of file containing muscle data input AND
453 Args : Arrayref of Seqs or input file name
454  
455  
456 =cut
457  
458 sub _setinput {
459 0 ▶ my ($self,$input) = @_;
Subroutine _setinput: not called CC=15 SCAR=54.8
460 0 my ($infilename, $seq, $temp, $tfh);
461 0 ▶ if (! ref $input) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $input) { } 0 0 0
elsif (ref($input) =~ /ARRAY/i) { } 0 0 0
462 # check that file exists or throw
463 0 $infilename = $input;
464 0 ▶ unless (-e $input) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $input) 0 0 0
465 # let's peek and guess
466 0 ▶ open(IN,$infilename) || $self->throw("Cannot open $infilename");
Branch: 1 branch
BranchTrueFalseTotal
open IN, $infilename or $self->throw("Cannot open $infilename") 0 0 0
467 0 my $header;
468 0 ▶ while( defined ($header = <IN>) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($header = readline IN)) 0 0 0
469 0 ▶ last if $header !~ /^\s+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $header =~ /^\s+$/ 0 0 0
470 }
471 0 close(IN);
472 0 ▶ if ( $header !~ /^>\s*\S+/ ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($header =~ /^>\s*\S+/) 0 0 0
473 0 $self->throw("Need to provide a FASTA format file to muscle!");
474 }
475 0 return ($infilename);
476 } elsif (ref($input) =~ /ARRAY/i ) { # $input may be an
477 # array of BioSeq objects...
478 # Open temporary file for both reading & writing of array
479 0 ($tfh,$infilename) = $self->io->tempfile();
480 0 ▶ if( ! ref($input->[0]) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $input->[0]) { } 0 0 0
elsif ($input->[0]->isa('Bio::PrimarySeqI')) { } 0 0 0
481 0 $self->warn("passed an array ref which did not contain objects to _setinput");
482 0 return undef;
483 } elsif( $input->[0]->isa('Bio::PrimarySeqI') ) {
484 0 $temp = Bio::SeqIO->new('-fh' => $tfh,
485 '-format' => 'fasta');
486 0 my $ct = 1;
487 0 foreach $seq (@$input) {
488 0 ▶ return 0 unless ( ref($seq) &&
Branch: 1 branch
BranchTrueFalseTotal
unless ref $seq and $seq->isa("Bio::PrimarySeqI") 0 0 0
Condition0%0/3
ref $seq and $seq->isa("Bio::PrimarySeqI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $seq and $seq->isa("Bio::PrimarySeqI")
ref $seq $seq->isa("Bio::PrimarySeqI")
Truth table0%0/3
A and B
A= ref $seqB= $seq->isa("Bio::PrimarySeqI")
ABresult
0X0
100
111
489 $seq->isa("Bio::PrimarySeqI") );
490 0 ▶ if( ! defined $seq->display_id ||
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $seq->display_id or $seq->display_id =~ /^\s+$/) 0 0 0
Condition0%0/3
not defined $seq->display_id or $seq->display_id =~ /^\s+$/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $seq->display_id or $seq->display_id =~ /^\s+$/
not defined $seq->display_id $seq->display_id =~ /^\s+$/
Truth table0%0/3
not(A) or B
A= not defined $seq->display_idB= $seq->display_id =~ /^\s+$/
ABresult
1X1
011
000
491 $seq->display_id =~ /^\s+$/) {
492 0 $seq->display_id( "Seq".$ct++);
493 }
494 0 $temp->write_seq($seq);
495 }
496 0 $temp->close();
497 0 undef $temp;
498 0 close($tfh);
499 0 $tfh = undef;
500 } else {
501 0 $self->warn( "got an array ref with 1st entry ".
502 $input->[0].
503 " and don't know what to do with it\n");
504 }
505 0 return ($infilename);
506 } else {
507 0 $self->warn("Got $input and don't know what to do with it\n");
508 }
509 0 return 0;
510 }
511  
512  
513 =head2 _setparams
514  
515 Title : _setparams
516 Usage : Internal function, not to be called directly
517 Function: Create parameter inputs for muscle program
518 Example :
519 Returns : parameter string to be passed to muscle
520 during align or profile_align
521 Args : name of calling object
522  
523 =cut
524  
525 sub _setparams {
526 0 ▶ my ($self) = @_;
Subroutine _setparams: not called CC=8 SCAR=42.8
527 0 my ($attr, $value,$param_string);
528 0 $param_string = '';
529 0 my $laststr;
530 0 for $attr ( @MUSCLE_PARAMS ) {
531 0 $value = $self->$attr();
532 0 ▶ next unless (defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
533 0 my $attr_key = lc $attr;
534 0 $attr_key = ' -'.$attr_key;
535 0 $param_string .= $attr_key .' '.$value;
536  
537 }
538 0 for $attr ( @MUSCLE_SWITCHES) {
539 0 $value = $self->$attr();
540 0 ▶ next unless ($value);
Branch: 1 branch
BranchTrueFalseTotal
unless $value 0 0 0
541 0 my $attr_key = lc $attr; #put switches in format expected by tcoffee
542 0 $attr_key = ' -'.$attr_key;
543 0 $param_string .= $attr_key ;
544 }
545  
546 # Set default output file if no explicit output file selected
547 0 ▶ unless ($self->outfile_name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->outfile_name) 0 0 0
548 0 my ($tfh, $outfile) = $self->io->tempfile(-dir=>$self->tempdir());
549 0 close($tfh);
550 0 undef $tfh;
551 0 $self->outfile_name($outfile);
552 }
553 0 $param_string .= " -out ".$self->outfile_name;
554
555 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
556 0 $param_string .= ' 2> /dev/null';
557 }
558 0 return $param_string;
559 }
560  
561 =head2 aformat
562  
563 Title : aformat
564 Usage : my $alignmentformat = $self->aformat();
565 Function: Get/Set alignment format
566 Returns : string
567 Args : string
568  
569  
570 =cut
571  
572 sub aformat{
573 1 ▶ my $self = shift;
Subroutine aformat: called CC=2 SCAR=7.1
Pod documented
574 1 ▶ $self->{'_aformat'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 1 0 1
575 1 return $self->{'_aformat'};
576 }
577  
578 =head1 Bio::Tools::Run::BaseWrapper methods
579  
580 =cut
581  
582 =head2 no_param_checks
583  
584 Title : no_param_checks
585 Usage : $obj->no_param_checks($newval)
586 Function: Boolean flag as to whether or not we should
587 trust the sanity checks for parameter values
588 Returns : value of no_param_checks
589 Args : newvalue (optional)
590  
591  
592 =cut
593  
594 =head2 save_tempfiles
595  
596 Title : save_tempfiles
597 Usage : $obj->save_tempfiles($newval)
598 Function:
599 Returns : value of save_tempfiles
600 Args : newvalue (optional)
601  
602  
603 =cut
604  
605 =head2 outfile_name
606  
607 Title : outfile_name
608 Usage : my $outfile = $muscle->outfile_name();
609 Function: Get/Set the name of the output file for this run
610 (if you wanted to do something special)
611 Returns : string
612 Args : [optional] string to set value to
613  
614  
615 =cut
616  
617  
618 =head2 tempdir
619  
620 Title : tempdir
621 Usage : my $tmpdir = $self->tempdir();
622 Function: Retrieve a temporary directory name (which is created)
623 Returns : string which is the name of the temporary directory
624 Args : none
625  
626  
627 =cut
628  
629 =head2 cleanup
630  
631 Title : cleanup
632 Usage : $muscle->cleanup();
633 Function: Will cleanup the tempdir directory
634 Returns : none
635 Args : none
636  
637  
638 =cut
639  
640 =head2 io
641  
642 Title : io
643 Usage : $obj->io($newval)
644 Function: Gets a L<Bio::Root::IO> object
645 Returns : L<Bio::Root::IO>
646 Args : none
647  
648  
649 =cut
650  
651 1 1; # Needed to keep compiler happy
« blib/lib/Bio/Tools/Run/Phylo/SLR.pm ↑ Summary blib/lib/Bio/Tools/Run/Phylo/PAML/Baseml.pm »