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

filter: Statementstmt 25.2% 64 / 254 Branchbran 12.2% 13 / 106 Conditioncond 0.0% 0 / 41 MC/DCmcdc 0.0% 0 / 26 Subroutinesub 64.0% 16 / 25 Podpod 100% 10 / 10 totaltotal 22.2% 103 / 462 CC 74 SCAR 54.0
CC
74
Cov
19%
_setinput
552.0
_run
380.0
_setparams
132.0
CRAP 221.7
« blib/lib/Bio/Tools/Run/Primer3.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Clustalw.pm »
1 # $Id$
2 #
3 # BioPerl module for Bio::Tools::Run::Alignment::TCoffee
4 #
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 #
7 # Cared for by Jason Stajich, Peter Schattner
8 #
9 # Copyright Jason Stajich, Peter Schattner
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::TCoffee - Object for the calculation of a
18 multiple sequence alignment from a set of unaligned sequences or
19 alignments using the TCoffee program
20  
21 =head1 SYNOPSIS
22  
23 # Build a tcoffee alignment factory
24 @params = ('ktuple' => 2, 'matrix' => 'BLOSUM');
25 $factory = Bio::Tools::Run::Alignment::TCoffee->new(@params);
26  
27 # Pass the factory a list of sequences to be aligned.
28 $inputfilename = 't/cysprot.fa';
29 # $aln is a SimpleAlign object.
30 $aln = $factory->align($inputfilename);
31  
32 # or where @seq_array is an array of Bio::Seq objects
33 $seq_array_ref = \@seq_array;
34 $aln = $factory->align($seq_array_ref);
35  
36 # Or one can pass the factory a pair of (sub)alignments
37 #to be aligned against each other, e.g.:
38  
39 # where $aln1 and $aln2 are Bio::SimpleAlign objects.
40 $aln = $factory->profile_align($aln1,$aln2);
41  
42 # Or one can pass the factory an alignment and one or more
43 # unaligned sequences to be added to the alignment. For example:
44  
45 # $seq is a Bio::Seq object.
46 $aln = $factory->profile_align($aln1,$seq);
47  
48 #There are various additional options and input formats available.
49 #See the DESCRIPTION section that follows for additional details.
50  
51 =head1 DESCRIPTION
52  
53 Note: this DESCRIPTION only documents the (Bio)perl interface to
54 TCoffee.
55  
56 =head2 Helping the module find your executable
57  
58 You will need to enable TCoffee to find the t_coffee program. This
59 can be done in (at least) three ways:
60  
61 1. Make sure the t_coffee executable is in your path so that
62 which t_coffee returns a t_coffee executable on your system.
63  
64 2. Define an environmental variable TCOFFEEDIR which is a dir
65 which contains the 't_coffee' app:
66 In bash
67 export TCOFFEEDIR=/home/username/progs/T-COFFEE_distribution_Version_1.37/bin
68 In csh/tcsh
69 setenv TCOFFEEDIR /home/username/progs/T-COFFEE_distribution_Version_1.37/bin
70  
71 3. Include a definition of an environmental variable TCOFFEEDIR in
72 every script that will use this TCoffee wrapper module.
73 BEGIN { $ENV{TCOFFEDIR} = '/home/username/progs/T-COFFEE_distribution_Version_1.37/bin' }
74 use Bio::Tools::Run::Alignment::TCoffee;
75  
76 If you are running an application on a webserver make sure the
77 webserver environment has the proper PATH set or use the options 2 or
78 3 to set the variables.
79  
80 =head1 PARAMETERS FOR ALIGNMENT COMPUTATION
81  
82 There are a number of possible parameters one can pass in TCoffee.
83 One should really read the online manual for the best explanation of
84 all the features. See
85 http://igs-server.cnrs-mrs.fr/~cnotred/Documentation/t_coffee/t_coffee_doc.html
86  
87 These can be specified as parameters when instantiating a new TCoffee
88 object, or through get/set methods of the same name (lowercase).
89  
90 =head2 IN
91  
92 Title : IN
93 Description : (optional) input filename, this is specified when
94 align so should not use this directly unless one
95 understand TCoffee program very well.
96  
97 =head2 TYPE
98  
99 Title : TYPE
100 Args : [string] DNA, PROTEIN
101 Description : (optional) set the sequence type, guessed automatically
102 so should not use this directly
103  
104 =head2 PARAMETERS
105  
106 Title : PARAMETERS
107 Description : (optional) Indicates a file containing extra parameters
108  
109 =head2 EXTEND
110  
111 Title : EXTEND
112 Args : 0, 1, or positive value
113 Default : 1
114 Description : Flag indicating that library extension should be
115 carried out when performing multiple alignments, if set
116 to 0 then extension is not made, if set to 1 extension
117 is made on all pairs in the library. If extension is
118 set to another positive value, the extension is only
119 carried out on pairs having a weigth value superior to
120 the specified limit.
121  
122 =head2 DP_NORMALISE
123  
124 Title : DP_NORMALISE
125 Args : 0 or positive value
126 Default : 1000
127 Description : When using a value different from 0, this flag sets the
128 score of the highest scoring pair to 1000.
129  
130 =head2 DP_MODE
131  
132 Title : DP_MODE
133 Args : [string] gotoh_pair_wise, myers_miller_pair_wise,
134 fasta_pair_wise cfasta_pair_wise
135 Default : cfast_fair_wise
136 Description : Indicates the type of dynamic programming used by
137 the program
138  
139 gotoh_pair_wise : implementation of the gotoh algorithm
140 (quadratic in memory and time)
141  
142 myers_miller_pair_wise : implementation of the Myers and Miller
143 dynamic programming algorithm ( quadratic in time and linear in
144 space). This algorithm is recommended for very long sequences. It
145 is about 2 time slower than gotoh. It only accepts tg_mode=1.
146  
147 fasta_pair_wise: implementation of the fasta algorithm. The
148 sequence is hashed, looking for ktuples words. Dynamic programming
149 is only carried out on the ndiag best scoring diagonals. This is
150 much faster but less accurate than the two previous.
151  
152 cfasta_pair_wise : c stands for checked. It is the same
153 algorithm. The dynamic programming is made on the ndiag best
154 diagonals, and then on the 2*ndiags, and so on until the scores
155 converge. Complexity will depend on the level of divergence of the
156 sequences, but will usually be L*log(L), with an accuracy
157 comparable to the two first mode ( this was checked on BaliBase).
158  
159 =head2 KTUPLE
160  
161 Title : KTUPLE
162 Args : numeric value
163 Default : 1 or 2 (1 for protein, 2 for DNA )
164  
165 Description : Indicates the ktuple size for cfasta_pair_wise dp_mode
166 and fasta_pair_wise. It is set to 1 for proteins, and 2
167 for DNA. The alphabet used for protein is not the 20
168 letter code, but a mildly degenerated version, where
169 some residues are grouped under one letter, based on
170 physicochemical properties:
171 rk, de, qh, vilm, fy (the other residues are
172 not degenerated).
173  
174 =head2 NDIAGS
175  
176 Title : NDIAGS
177 Args : numeric value
178 Default : 0
179 Description : Indicates the number of diagonals used by the
180 fasta_pair_wise algorithm. When set to 0,
181 n_diag=Log (length of the smallest sequence)
182  
183 =head2 DIAG_MODE
184  
185 Title : DIAG_MODE
186 Args : numeric value
187 Default : 0
188  
189  
190 Description : Indicates the manner in which diagonals are scored
191 during the fasta hashing.
192  
193 0 indicates that the score of a diagonal is equal to the
194 sum of the scores of the exact matches it contains.
195  
196  
197 1 indicates that this score is set equal to the score of
198 the best uninterrupted segment
199  
200 1 can be useful when dealing with fragments of sequences.
201  
202 =head2 SIM_MATRIX
203  
204 Title : SIM_MATRIX
205 Args : string
206 Default : vasiliky
207 Description : Indicates the manner in which the amino acid is being
208 degenerated when hashing. All the substitution matrix
209 are acceptable. Categories will be defined as sub-group
210 of residues all having a positive substitution score
211 (they can overlap).
212  
213 If you wish to keep the non degenerated amino acid
214 alphabet, use 'idmat'
215  
216 =head2 MATRIX
217  
218 Title : MATRIX
219 Args :
220 Default :
221 Description : This flag is provided for compatibility with
222 ClustalW. Setting matrix = 'blosum' is equivalent to
223 -in=Xblosum62mt , -matrix=pam is equivalent to
224 in=Xpam250mt . Apart from this, the rules are similar
225 to those applying when declaring a matrix with the
226 -in=X fl
227  
228 =head2 GAPOPEN
229  
230 Title : GAPOPEN
231 Args : numeric
232 Default : 0
233 Description : Indicates the penalty applied for opening a gap. The
234 penalty must be negative. If you provide a positive
235 value, it will automatically be turned into a negative
236 number. We recommend a value of 10 with pam matrices,
237 and a value of 0 when a library is used.
238  
239 =head2 GAPEXT
240  
241 Title : GAPEXT
242 Args : numeric
243 Default : 0
244 Description : Indicates the penalty applied for extending a gap.
245  
246  
247 =head2 COSMETIC_PENALTY
248  
249 Title : COSMETIC_PENALTY
250 Args : numeric
251 Default : 100
252 Description : Indicates the penalty applied for opening a gap. This
253 penalty is set to a very low value. It will only have
254 an influence on the portions of the alignment that are
255 unalignable. It will not make them more correct, but
256 only more pleasing to the eye ( i.e. Avoid stretches of
257 lonely residues).
258  
259 The cosmetic penalty is automatically turned off if a
260 substitution matrix is used rather than a library.
261  
262 =head2 TG_MODE
263  
264 Title : TG_MODE
265 Args : 0,1,2
266 Default : 1
267 Description : (Terminal Gaps)
268 0: indicates that terminal gaps must be panelized with
269 a gapopen and a gapext penalty.
270 1: indicates that terminal gaps must be penalized only
271 with a gapext penalty
272 2: indicates that terminal gaps must not be penalized.
273  
274 =head2 WEIGHT
275  
276 Title : WEIGHT
277 Args : sim or sim_<matrix_name or matrix_file> or integer value
278 Default : sim
279  
280  
281 Description : Weight defines the way alignments are weighted when
282 turned into a library.
283  
284 sim indicates that the weight equals the average
285 identity within the match residues.
286  
287 sim_matrix_name indicates the average identity with two
288 residues regarded as identical when their
289 substitution value is positive. The valid matrices
290 names are in matrices.h (pam250mt) . Matrices not
291 found in this header are considered to be
292 filenames. See the format section for matrices. For
293 instance, -weight=sim_pam250mt indicates that the
294 grouping used for similarity will be the set of
295 classes with positive substitutions. Other groups
296 include
297  
298 sim_clustalw_col ( categories of clustalw
299 marked with :)
300  
301 sim_clustalw_dot ( categories of clustalw
302 marked with .)
303  
304  
305 Value indicates that all the pairs found in the
306 alignments must be given the same weight equal to
307 value. This is useful when the alignment one wishes to
308 turn into a library must be given a pre-specified score
309 (for instance if they come from a structure
310 super-imposition program). Value is an integer:
311  
312 -weight=1000
313  
314 Note : Weight only affects methods that return an alignment to
315 T-Coffee, such as ClustalW. On the contrary, the
316 version of Lalign we use here returns a library where
317 weights have already been applied and are therefore
318 insensitive to the -weight flag.
319  
320 =head2 SEQ_TO_ALIGN
321  
322 Title : SEQ_TO_ALIGN
323 Args : filename
324 Default : no file - align all the sequences
325  
326 Description : You may not wish to align all the sequences brought in
327 by the -in flag. Supplying the seq_to_align flag allows
328 for this, the file is simply a list of names in Fasta
329 format.
330  
331 However, note that library extension will be carried out
332 on all the sequences.
333  
334 =head1 PARAMETERS FOR TREE COMPUTATION AND OUTPUT
335  
336 =head2 NEWTREE
337  
338 Title : NEWTREE
339 Args : treefile
340 Default : no file
341 Description : Indicates the name of the new tree to compute. The
342 default will be <sequence_name>.dnd, or <run_name.dnd>.
343 Format is Phylip/Newick tree format
344  
345 =head2 USETREE
346  
347 Title : USETREE
348 Args : treefile
349 Default : no file specified
350 Description : This flag indicates that rather than computing a new
351 dendrogram, t_coffee can use a pre-computed one. The
352 tree files are in phylips format and compatible with
353 ClustalW. In most cases, using a pre-computed tree will
354 halve the computation time required by t_coffee. It is
355 also possible to use trees output by ClustalW or
356 Phylips. Format is Phylips tree format
357  
358 =head2 TREE_MODE
359  
360 Title : TREE_MODE
361 Args : slow, fast, very_fast
362 Default : very_fast
363 Description : This flag indicates the method used for computing the
364 dendrogram.
365 slow : the chosen dp_mode using the extended library,
366 fast : The fasta dp_mode using the extended library.
367 very_fast: The fasta dp_mode using pam250mt.
368  
369 =head2 QUICKTREE
370  
371 Title : QUICKTREE
372 Args :
373 Default :
374 Description : This flag is kept for compatibility with ClustalW.
375 It indicates that: -tree_mode=very_fast
376  
377 =head1 PARAMETERS FOR ALIGNMENT OUTPUT
378  
379 =head2 OUTFILE
380  
381 Title : OUTFILE
382 Args : out_aln file, default, no
383 Default : default ( yourseqfile.aln)
384 Description : indicates name of output alignment file
385  
386 =head2 OUTPUT
387  
388 Title : OUTPUT
389 Args : format1, format2
390 Default : clustalw
391 Description : Indicated format for outputting outputfile
392 Supported formats are:
393  
394 clustalw_aln, clustalw: ClustalW format.
395 gcg, msf_aln : Msf alignment.
396 pir_aln : pir alignment.
397 fasta_aln : fasta alignment.
398 phylip : Phylip format.
399 pir_seq : pir sequences (no gap).
400 fasta_seq : fasta sequences (no gap).
401 As well as:
402 score_html : causes the output to be a reliability
403 plot in HTML
404 score_pdf : idem in PDF.
405 score_ps : idem in postscript.
406  
407 More than one format can be indicated:
408 -output=clustalw,gcg, score_html
409  
410 =head2 CASE
411  
412 Title : CASE
413 Args : upper, lower
414 Default : upper
415 Description : triggers choice of the case for output
416  
417 =head2 CPU
418  
419 Title : CPU
420 Args : value
421 Default : 0
422 Description : Indicates the cpu time (micro seconds) that must be
423 added to the t_coffee computation time.
424  
425 =head2 OUT_LIB
426  
427 Title : OUT_LIB
428 Args : name of library, default, no
429 Default : default
430 Description : Sets the name of the library output. Default implies
431 <run_name>.tc_lib
432  
433 =head2 OUTORDER
434  
435 Title : OUTORDER
436 Args : input or aligned
437 Default : input
438 Description : Sets the name of the library output. Default implies
439 <run_name>.tc_lib
440  
441 =head2 SEQNOS
442  
443 Title : SEQNOS
444 Args : on or off
445 Default : off
446 Description : Causes the output alignment to contain residue numbers
447 at the end of each line:
448  
449 =head1 PARAMETERS FOR GENERIC OUTPUT
450  
451 =head2 RUN_NAME
452  
453 Title : RUN_NAME
454 Args : your run name
455 Default :
456 Description : This flag causes the prefix <your sequences> to be
457 replaced by <your run name> when renaming the default
458 files.
459  
460 =head2 ALIGN
461  
462 Title : ALIGN
463 Args :
464 Default :
465 Description : Indicates that the program must produce the
466 alignment. This flag is here for compatibility with
467 ClustalW
468  
469 =head2 QUIET
470  
471 Title : QUIET
472 Args : stderr, stdout, or filename, or nothing
473 Default : stderr
474 Description : Redirects the standard output to either a file.
475 -quiet on its own redirect the output to /dev/null.
476  
477 =head2 CONVERT
478  
479 Title : CONVERT
480 Args :
481 Default :
482 Description : Indicates that the program must not compute the
483 alignment but simply convert all the sequences,
484 alignments and libraries into the format indicated with
485 -output. This flag can also be used if you simply want
486 to compute a library ( i.e. You have an alignment and
487 you want to turn it into a library).
488  
489 =head1 FEEDBACK
490  
491 =head2 Mailing Lists
492  
493 User feedback is an integral part of the evolution of this and other
494 Bioperl modules. Send your comments and suggestions preferably to one
495 of the Bioperl mailing lists. Your participation is much appreciated.
496  
497 bioperl-l@bioperl.org - General discussion
498 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
499  
500 =head2 Support
501  
502 Please direct usage questions or support issues to the mailing list:
503  
504 I<bioperl-l@bioperl.org>
505  
506 rather than to the module maintainer directly. Many experienced and
507 reponsive experts will be able look at the problem and quickly
508 address it. Please include a thorough description of the problem
509 with code and data examples if at all possible.
510  
511 =head2 Reporting Bugs
512  
513 Report bugs to the Bioperl bug tracking system to help us keep track
514 the bugs and their resolution. Bug reports can be submitted via the web:
515  
516 http://redmine.open-bio.org/projects/bioperl/
517  
518 =head1 AUTHOR - Jason Stajich, Peter Schattner
519  
520 Email jason-at-bioperl-dot-org, schattner@alum.mit.edu
521  
522 =head1 APPENDIX
523  
524 The rest of the documentation details each of the object
525 methods. Internal methods are usually preceded with a _
526  
527 =cut
528  
529 package Bio::Tools::Run::Alignment::TCoffee;
530  
531 1 use vars qw($AUTOLOAD @ISA $PROGRAM_NAME $PROGRAM_DIR %DEFAULTS
532 @TCOFFEE_PARAMS @TCOFFEE_SWITCHES @OTHER_SWITCHES %OK_FIELD
533 1 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
534 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
535 1 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
536 1 ▶use Bio::Seq;
Subroutine BEGIN: called CC=1 SCAR=0.0
537 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
538 1 ▶use Bio::SimpleAlign;
Subroutine BEGIN: called CC=1 SCAR=0.0
539 1 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
540 1 ▶use Bio::Root::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
541 1 ▶use Bio::Factory::ApplicationFactoryI;
Subroutine BEGIN: called CC=1 SCAR=0.0
542 1 ▶use Bio::Tools::Run::WrapperBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
543 1 @ISA = qw(Bio::Tools::Run::WrapperBase
544 Bio::Factory::ApplicationFactoryI);
545  
546 # You will need to enable TCoffee to find the tcoffee program. This can be done
547 # in (at least) twp ways:
548 # 1. define an environmental variable TCOFFEE:
549 # export TCOFFEEDIR=/home/progs/tcoffee or
550 # 2. include a definition of an environmental variable TCOFFEEDIR
551 # in every script that will
552 # use Bio::Tools::Run::Alignment::TCoffee.pm.
553 # BEGIN {$ENV{TCOFFEEDIR} = '/home/progs/tcoffee'; }
554  
555 BEGIN {
556 1 ▶ $PROGRAM_NAME = 't_coffee';
Subroutine BEGIN: called CC=2 SCAR=6.9
557 1 $PROGRAM_DIR = $ENV{'TCOFFEEDIR'};
558 1 %DEFAULTS = ( 'MATRIX' => 'blosum',
559 'OUTPUT' => 'clustalw',
560 'AFORMAT'=> 'msf',
561 'METHODS' => [qw(lalign_id_pair clustalw_pair)]
562 );
563  
564  
565 1 @TCOFFEE_PARAMS = qw(IN TYPE PARAMETERS DO_NORMALISE EXTEND
566 DP_MODE KTUPLE NDIAGS DIAG_MODE SIM_MATRIX
567 MATRIX GAPOPEN GAPEXT COSMETIC_PENALTY TG_MODE
568 WEIGHT SEQ_TO_ALIGN NEWTREE USETREE TREE_MODE
569 OUTFILE OUTPUT CASE CPU OUT_LIB OUTORDER SEQNOS
570 RUN_NAME CONVERT
571 );
572  
573 1 @TCOFFEE_SWITCHES = qw(QUICKTREE);
574  
575 1 @OTHER_SWITCHES = qw(QUIET ALIGN KEEPDND);
576  
577 # Authorize attribute fields
578 1 foreach my $attr ( @TCOFFEE_PARAMS, @TCOFFEE_SWITCHES, @OTHER_SWITCHES ) {
579 33 $OK_FIELD{$attr}++; }
580 }
581  
582 =head2 program_name
583  
584 Title : program_name
585 Usage : $factory->program_name()
586 Function: holds the program name
587 Returns: string
588 Args : None
589  
590 =cut
591  
592 sub program_name {
593 6 ▶ return $PROGRAM_NAME;
Subroutine program_name: called CC=1 SCAR=0.0
Pod documented
594 }
595  
596 =head2 program_dir
597  
598 Title : program_dir
599 Usage : $factory->program_dir(@params)
600 Function: returns the program directory, obtained from ENV variable.
601 Returns: string
602 Args :
603  
604 =cut
605  
606 sub program_dir {
607 3 ▶ return $PROGRAM_DIR;
Subroutine program_dir: called CC=1 SCAR=0.0
Pod documented
608 }
609  
610 sub new {
611 1 ▶ my ($class,@args) = @_;
Subroutine new: called CC=6 SCAR=22.4
Pod documented
612 1 my $self = $class->SUPER::new(@args);
613 1 my ($attr, $value);
614  
615 1 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 1 1
616 0 $attr = shift @args;
617 0 $value = shift @args;
618 0 ▶ next if( $attr =~ /^-/); # don't want named parameters
Branch: 1 branch
BranchTrueFalseTotal
if $attr =~ /^-/ 0 0 0
619 0 $self->$attr($value);
620 }
621 1 ▶ $self->matrix($DEFAULTS{'MATRIX'}) unless( $self->matrix );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->matrix 1 0 1
622 1 ▶ $self->output($DEFAULTS{'OUTPUT'}) unless( $self->output );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->output 1 0 1
623 1 ▶ $self->methods($DEFAULTS{'METHODS'}) unless $self->methods;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->methods 1 0 1
624 # $self->aformat($DEFAULTS{'AFORMAT'}) unless $self->aformat;
625  
626 1 return $self;
627 }
628  
629 sub AUTOLOAD {
630 7 ▶ my $self = shift;
Subroutine AUTOLOAD: called CC=4 SCAR=14.0
631 7 my $attr = $AUTOLOAD;
632 7 $attr =~ s/.*:://;
633 7 $attr = uc $attr;
634 # aliasing
635 7 ▶ $attr = 'OUTFILE' if $attr eq 'OUTFILE_NAME';
Branch: 1 branch
BranchTrueFalseTotal
if $attr eq "OUTFILE_NAME" 0 7 7
636 7 ▶ $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $Bio::Tools::Run::Alignment::TCoffee::OK_FIELD{$attr} 0 7 7
637  
638 7 ▶ $self->{$attr} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 3 4 7
639 7 return $self->{$attr};
640 }
641  
642 =head2 error_string
643  
644 Title : error_string
645 Usage : $obj->error_string($newval)
646 Function: Where the output from the last analysus run is stored.
647 Returns : value of error_string
648 Args : newvalue (optional)
649  
650  
651 =cut
652  
653 sub error_string{
654 0 ▶ my ($self,$value) = @_;
Subroutine error_string: not called CC=2 SCAR=17.9
Pod documented
655 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
656 0 $self->{'error_string'} = $value;
657 }
658 0 return $self->{'error_string'};
659  
660 }
661  
662 =head2 version
663  
664 Title : version
665 Usage : exit if $prog->version() < 1.8
666 Function: Determine the version number of the program
667 Example :
668 Returns : float or undef
669 Args : none
670  
671 =cut
672  
673 sub version {
674 0 ▶ my ($self) = @_;
Subroutine version: not called CC=3 SCAR=24.8
Pod documented
675 0 my $exe;
676 0 ▶ return undef unless $exe = $self->executable;
Branch: 1 branch
BranchTrueFalseTotal
unless $exe = $self->executable 0 0 0
677 0 my $string = `$exe -quiet=stdout 2>&1` ;
678 0 $string =~ /Version_([\d.]+)/;
679 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
680  
681 }
682  
683 =head2 run
684  
685 Title : run
686 Usage : my $output = $application->run(-seq => $seq,
687 -profile => $profile,
688 -type => 'profile-aln');
689 Function: Generic run of an application
690 Returns : Bio::SimpleAlign object
691 Args : key-value parameters allowed for TCoffee runs AND
692 -type => profile-aln or alignment for profile alignments or
693 just multiple sequence alignment
694 -seq => either Bio::PrimarySeqI object OR
695 array ref of Bio::PrimarySeqI objects OR
696 filename of sequences to run with
697 -profile => profile to align to, if this is an array ref
698 will specify the first two entries as the two
699 profiles to align to each other
700  
701 =cut
702  
703 sub run{
704 0 ▶ my ($self,@args) = @_;
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
705 0 my ($type,$seq,$profile) = $self->_rearrange([qw(TYPE
706 SEQ
707 PROFILE)],
708 @args);
709 0 ▶ if( $type =~ /align/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type =~ /align/i) { } 0 0 0
elsif ($type =~ /profile/i) { } 0 0 0
710 0 return $self->align($seq);
711 } elsif( $type =~ /profile/i ) {
712 0 return $self->profile_align($profile,$seq);
713 } else {
714 0 $self->warn("unrecognized alignment type $type\n");
715 }
716 0 return undef;
717 }
718  
719 =head2 align
720  
721 Title : align
722 Usage :
723 $inputfilename = 't/data/cysprot.fa';
724 $aln = $factory->align($inputfilename);
725 or
726 $seq_array_ref = \@seq_array;
727 # @seq_array is array of Seq objs
728 $aln = $factory->align($seq_array_ref);
729 Function: Perform a multiple sequence alignment
730 Returns : Reference to a SimpleAlign object containing the
731 sequence alignment.
732 Args : Name of a file containing a set of unaligned fasta sequences
733 or else an array of references to Bio::Seq objects.
734  
735 Throws an exception if argument is not either a string (eg a
736 filename) or a reference to an array of Bio::Seq objects. If
737 argument is string, throws exception if file corresponding to string
738 name can not be found. If argument is Bio::Seq array, throws
739 exception if less than two sequence objects are in array.
740  
741 =cut
742  
743 sub align {
744 0 ▶ my ($self,$input) = @_;
Subroutine align: not called CC=2 SCAR=17.9
Pod documented
745 # Create input file pointer
746 0 $self->io->_io_cleanup();
747 0 my ($infilename,$type) = $self->_setinput($input);
748 0 ▶ if (!$infilename) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename) 0 0 0
749 0 $self->throw("Bad input data or less than 2 sequences in $input !");
750 }
751  
752 0 my $param_string = $self->_setparams();
753  
754 # run tcoffee
755 0 return $self->_run('align', [$infilename,$type], $param_string);
756 }
757  
758 #################################################
759  
760 =head2 profile_align
761  
762 Title : profile_align
763 Usage :
764 Function: Perform an alignment of 2 (sub)alignments
765 Example :
766 Returns : Reference to a SimpleAlign object containing the (super)alignment.
767 Args : Names of 2 files containing the subalignments
768 or references to 2 Bio::SimpleAlign objects.
769 Note : Needs to be updated to run with newer TCoffee code, which
770 allows more than two profile alignments.
771  
772 Throws an exception if arguments are not either strings (eg filenames)
773 or references to SimpleAlign objects.
774  
775 =cut
776  
777 sub profile_align {
778 0 ▶ my $self = shift;
Subroutine profile_align: not called CC=5 SCAR=34.0
Pod documented
779 0 my $input1 = shift;
780 0 my $input2 = shift;
781
782 0 my ($temp,$infilename1,$infilename2,$type1,$type2,$input,$seq);
783  
784 0 $self->io->_io_cleanup();
785 # Create input file pointers
786 0 ($infilename1,$type1) = $self->_setinput($input1);
787 0 ($infilename2,$type2) = $self->_setinput($input2);
788 0 ▶ unless ($type1) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($type1) 0 0 0
789 0 $self->throw("Unknown type for first argument");
790 }
791 0 ▶ unless ($type2) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($type2) 0 0 0
792 0 $self->throw("Unknown type for second argument")
793 }
794
795 0 ▶ if (!$infilename1 || !$infilename2) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($infilename1 and $infilename2) 0 0 0
Condition0%0/3
$infilename1 and $infilename2
!ll&&!rl&&r
000
MC/DC0%0/2
$infilename1 and $infilename2
$infilename1 $infilename2
Truth table0%0/3
A and B
A= $infilename1B= $infilename2
ABresult
0X0
100
111
796 0 $self->throw("Bad input data: $input1 or $input2 !");
797 }
798  
799 0 my $param_string = $self->_setparams();
800 # run tcoffee
801 0 my $aln = $self->_run('profile-aln',
802 [$infilename1,$type1],
803 [$infilename2,$type2],
804 $param_string)
805 ;
806 }
807 #################################################
808  
809 =head2 _run
810  
811 Title : _run
812 Usage : Internal function, not to be called directly
813 Function: makes actual system call to tcoffee program
814 Example :
815 Returns : nothing; tcoffee output is written to a
816 temporary file OR specified output file
817 Args : Name of a file containing a set of unaligned fasta sequences
818 and hash of parameters to be passed to tcoffee
819  
820 =cut
821  
822 sub _run {
823 0 ▶ my ($infilename, $infile1,$infile2) = ('','','');
Subroutine _run: not called CC=19 SCAR=59.4
824 0 my $self = shift;
825 0 my $command = shift;
826 0 my $instring;
827 0 ▶ if ($command =~ /align/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($command =~ /align/) 0 0 0
828 0 my $infile = shift ;
829 0 my $type;
830 0 ($infilename,$type) = @$infile;
831 0 $instring = '-in='.join(',',($infilename, 'X'.$self->matrix,
832 $self->methods));
833 }
834 0 ▶ if ($command =~ /profile/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($command =~ /profile/) 0 0 0
835 0 my $in1 = shift ;
836 0 my $in2 = shift ;
837 0 my ($type1,$type2);
838 0 ($infile1,$type1) = @$in1;
839 0 ($infile2,$type2) = @$in2;
840 # in later versions (tested on 5.72 and 7.54) the API for profile
841 # alignment changed. This attempts to do the right thing for older
842 # versions but corrects for newer ones
843 0 ▶ if ($self->version && $self->version < 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->version and $self->version < 5) { } 0 0 0
Condition0%0/3
$self->version and $self->version < 5
!ll&&!rl&&r
000
MC/DC0%0/2
$self->version and $self->version < 5
$self->version $self->version < 5
Truth table0%0/3
A and B
A= $self->versionB= $self->version < 5
ABresult
0X0
100
111
844 # this breaks severely on newer TCoffee (>= v5)
845 0 ▶ unless (($self->matrix =~ /none/i) || ($self->matrix =~ /null/i) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->matrix =~ /none/i or $self->matrix =~ /null/i) { } 0 0 0
Condition0%0/3
$self->matrix =~ /none/i or $self->matrix =~ /null/i
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->matrix =~ /none/i or $self->matrix =~ /null/i
$self->matrix =~ /none/i $self->matrix =~ /null/i
Truth table0%0/3
A or B
A= $self->matrix =~ /none/iB= $self->matrix =~ /null/i
ABresult
1X1
011
000
846 $instring = '-in='.join(',',
847 ($type2.$infile2),
848 'X'.$self->matrix,
849 0 (map {'M'.$_} $self->methods)
850 );
851 0 $instring .= ' -profile='.$infile1;
852 } else {
853 $instring = '-in='.join(',',(
854 $type1.$infile1,
855 $type2.$infile2,
856 0 (map {'M'.$_} $self->methods)
857 )
858 );
859 }
860 } else {
861 0 ▶ if ($type2 eq 'S') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type2 eq 'S') { } 0 0 0
862 # second infile is a sequence, not an alignment
863 0 $instring .= ' -profile='.join(',',$infile1);
864 0 $instring .= ' -seq='.join(',',$infile2);
865 } else {
866 0 $instring .= ' -profile='.join(',',$infile1,$infile2);
867 }
868 0 ▶ $instring .= ' -matrix='.$self->matrix unless (($self->matrix =~ /none/i) || ($self->matrix =~ /null/i)) ;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->matrix =~ /none/i or $self->matrix =~ /null/i 0 0 0
Condition0%0/3
$self->matrix =~ /none/i or $self->matrix =~ /null/i
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->matrix =~ /none/i or $self->matrix =~ /null/i
$self->matrix =~ /none/i $self->matrix =~ /null/i
Truth table0%0/3
A or B
A= $self->matrix =~ /none/iB= $self->matrix =~ /null/i
ABresult
1X1
011
000
869 0 ▶ $instring .= ' -method='.join(',',$self->methods) if ($self->methods) ;
Branch: 1 branch
BranchTrueFalseTotal
if $self->methods 0 0 0
870 }
871 }
872 0 my $param_string = shift;
873 # my ($paramfh,$parameterFile) = $self->io->tempfile;
874 # print $paramfh ( "$instring\n-output=gcg$param_string") ;
875 # close($paramfh);
876 # my $commandstring = "t_coffee -output=gcg -parameters $parameterFile" ; ##MJL
877  
878 0 my $commandstring = $self->executable." $instring $param_string";
879
880 #$self->debug( "tcoffee command = $commandstring \n");
881  
882 0 my $status = system($commandstring);
883 0 my $outfile = $self->outfile();
884  
885 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
886 0 $self->warn( "TCoffee call crashed: $? [command $commandstring]\n");
887 0 return undef;
888 }
889  
890 # retrieve alignment (Note: MSF format for AlignIO = GCG format of
891 # tcoffee)
892  
893 0 my $in = Bio::AlignIO->new('-file' => $outfile, '-format' =>
894 $self->output);
895 0 my $aln = $in->next_aln();
896  
897 # Replace file suffix with dnd to find name of dendrogram file(s) to delete
898 0 ▶ if( ! $self->keepdnd ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->keepdnd) 0 0 0
899 0 foreach my $f ( $infilename, $infile1, $infile2 ) {
900 0 ▶ next if( !defined $f || $f eq '');
Branch: 1 branch
BranchTrueFalseTotal
if not defined $f or $f eq "" 0 0 0
Condition0%0/3
not defined $f or $f eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $f or $f eq ""
not defined $f $f eq ""
Truth table0%0/3
not(A) or B
A= not defined $fB= $f eq ""
ABresult
1X1
011
000
901 0 $f =~ s/\.[^\.]*$// ;
902 # because TCoffee writes these files to the CWD
903 0 ▶ if( $Bio::Root::IO::PATHSEP ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Bio::Root::IO::PATHSEP) { } 0 0 0
904 0 my @line = split(/$Bio::Root::IO::PATHSEP/, $f);
905 0 $f = pop @line;
906 } else {
907 0 (undef, undef, $f) = File::Spec->splitpath($f);
908 }
909 0 ▶ unlink $f .'.dnd' if( $f ne '' );
Branch: 1 branch
BranchTrueFalseTotal
if $f ne "" 0 0 0
910 }
911 }
912 0 return $aln;
913 }
914  
915  
916 =head2 _setinput
917  
918 Title : _setinput
919 Usage : Internal function, not to be called directly
920 Function: Create input file for tcoffee program
921 Example :
922 Returns : name of file containing tcoffee data input AND
923 type of file (if known, S for sequence, L for sequence library,
924 A for sequence alignment)
925 Args : Seq or Align object reference or input file name
926  
927  
928 =cut
929  
930 sub _setinput {
931 0 ▶ my ($self,$input) = @_;
Subroutine _setinput: not called CC=23 SCAR=63.1
932 0 my ($infilename, $seq, $temp, $tfh);
933 # If $input is not a reference it better be the name of a
934 # file with the sequence/ alignment data...
935 0 my $type = '';
936 0 ▶ if (! ref $input) {
Branch: 4 branches
BranchTrueFalseTotal
if (not ref $input) { } 0 0 0
elsif (ref($input) =~ /ARRAY/i) { } 0 0 0
elsif ($input->isa('Bio::Align::AlignI')) { } 0 0 0
elsif ($input->isa('Bio::PrimarySeqI')) { } 0 0 0
937 # check that file exists or throw
938 0 $infilename = $input;
939 0 ▶ unless (-e $input) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $input) 0 0 0
940 # let's peek and guess
941 0 ▶ open(my $IN,$infilename) || $self->throw("Cannot open $infilename");
Branch: 1 branch
BranchTrueFalseTotal
open my $IN, $infilename or $self->throw("Cannot open $infilename") 0 0 0
942 0 my $header = <$IN>;
943 0 ▶ if( $header =~ /^\s+\d+\s+\d+/ ||
Branch: 1 branch
BranchTrueFalseTotal
if ($header =~ /^\s+\d+\s+\d+/ or $header =~ /Pileup/i or $header =~ /clustal/i) 0 0 0
Condition0%0/6
$header =~ /^\s+\d+\s+\d+/ or $header =~ /Pileup/i or $header =~ /clustal/i
l!l&&r!l&&!r
000
$header =~ /^\s+\d+\s+\d+/ or $header =~ /Pileup/i
l!l&&r!l&&!r
000
MC/DC0%0/3
$header =~ /^\s+\d+\s+\d+/ or $header =~ /Pileup/i or $header =~ /clustal/i
$header =~ /^\s+\d+\s+\d+/ $header =~ /Pileup/i $header =~ /clustal/i
Truth table0%0/4
A or B or C
A= $header =~ /^\s+\d+\s+\d+/B= $header =~ /Pileup/iC= $header =~ /clustal/i
ABCresult
1XX1
01X1
0011
0000
944 $header =~ /Pileup/i ||
945 $header =~ /clustal/i ) { # phylip
946 0 $type = 'A';
947 }
948
949 # On some systems, having filenames with / in them (ie. a file in a
950 # directory) causes t-coffee to completely fail. It warns on all systems.
951 # The -no_warning option solves this, but there is still some strange
952 # bug when doing certain profile-related things. This is magically solved
953 # by copying the profile file to a temp file in the current directory, so
954 # it its filename supplied to t-coffee contains no /
955 # (It's messy here - I just do this to /all/ input files to most easily
956 # catch all variants of providing a profile - it may only be the last
957 # form (isa("Bio::PrimarySeqI")) that causes a problem?)
958
959 0 my (undef, undef, $adjustedfilename) = File::Spec->splitpath($infilename);
960 0 ▶ if ($adjustedfilename ne $infilename) {
Branch: 1 branch
BranchTrueFalseTotal
if ($adjustedfilename ne $infilename) 0 0 0
961 0 my ($fh, $tempfile) = $self->io->tempfile(-dir => cwd());
962 0 seek($IN, 0, 0);
963 0 ▶ while (<$IN>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $IN)) 0 0 0
964 0 print $fh $_;
965 }
966 0 close($fh);
967 0 (undef, undef, $tempfile) = File::Spec->splitpath($tempfile);
968 0 $infilename = $tempfile;
969 0 $type = 'S';
970 }
971
972 0 close($IN);
973 0 return ($infilename,$type);
974 } elsif (ref($input) =~ /ARRAY/i ) {
975 # $input may be an array of BioSeq objects...
976 # Open temporary file for both reading & writing of array
977 0 ($tfh,$infilename) = $self->io->tempfile(-dir => cwd());
978 0 (undef, undef, $infilename) = File::Spec->splitpath($infilename);
979 0 ▶ if( ! ref($input->[0]) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (not ref $input->[0]) { } 0 0 0
elsif ($input->[0]->isa('Bio::PrimarySeqI')) { } 0 0 0
elsif ($input->[0]->isa('Bio::Align::AlignI')) { } 0 0 0
980 0 $self->warn("passed an array ref which did not contain objects to _setinput");
981 0 return undef;
982 } elsif( $input->[0]->isa('Bio::PrimarySeqI') ) {
983 0 $temp = Bio::SeqIO->new('-fh' => $tfh,
984 '-format' => 'fasta');
985 0 my $ct = 1;
986 0 foreach $seq (@$input) {
987 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
988 $seq->isa("Bio::PrimarySeqI") );
989 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
990 $seq->display_id =~ /^\s+$/) {
991 0 $seq->display_id( "Seq".$ct++);
992 }
993 0 $temp->write_seq($seq);
994 }
995 0 $temp->close();
996 0 undef $temp;
997 0 close($tfh);
998 0 $tfh = undef;
999 0 $type = 'S';
1000 } elsif( $input->[0]->isa('Bio::Align::AlignI' ) ) {
1001 0 $temp = Bio::AlignIO->new('-fh' => $tfh,
1002 '-format' => $self->aformat);
1003 0 foreach my $aln (@$input) {
1004 0 ▶ next unless ( ref($aln) &&
Branch: 1 branch
BranchTrueFalseTotal
unless ref $aln and $aln->isa("Bio::Align::AlignI") 0 0 0
Condition0%0/3
ref $aln and $aln->isa("Bio::Align::AlignI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $aln and $aln->isa("Bio::Align::AlignI")
ref $aln $aln->isa("Bio::Align::AlignI")
Truth table0%0/3
A and B
A= ref $alnB= $aln->isa("Bio::Align::AlignI")
ABresult
0X0
100
111
1005 $aln->isa("Bio::Align::AlignI") );
1006 0 $temp->write_aln($aln);
1007 }
1008 0 $temp->close();
1009 0 undef $temp;
1010 0 close($tfh);
1011 0 $tfh = undef;
1012 0 $type = 'A';
1013 } else {
1014 0 $self->warn( "got an array ref with 1st entry ".
1015 $input->[0].
1016 " and don't know what to do with it\n");
1017 }
1018 0 return ($infilename,$type);
1019 # $input may be a SimpleAlign object.
1020 } elsif ( $input->isa("Bio::Align::AlignI") ) {
1021 # Open temporary file for both reading & writing of SimpleAlign object
1022 0 ($tfh, $infilename) = $self->io->tempfile(-dir => cwd());
1023 0 (undef, undef, $infilename) = File::Spec->splitpath($infilename);
1024 0 $temp = Bio::AlignIO->new(-fh=>$tfh,
1025 '-format' => 'clustalw');
1026 0 $temp->write_aln($input);
1027 0 close($tfh);
1028 0 undef $tfh;
1029 0 return ($infilename,'A');
1030 }
1031
1032 # or $input may be a single BioSeq object (to be added to
1033 # a previous alignment)
1034 elsif ( $input->isa("Bio::PrimarySeqI")) {
1035 # Open temporary file for both reading & writing of BioSeq object
1036 0 ($tfh,$infilename) = $self->io->tempfile(-dir => cwd());
1037 0 (undef, undef, $infilename) = File::Spec->splitpath($infilename);
1038 0 $temp = Bio::SeqIO->new(-fh=> $tfh, '-format' =>'Fasta');
1039 0 $temp->write_seq($input);
1040 0 $temp->close();
1041 0 close($tfh);
1042 0 undef $tfh;
1043 0 return ($infilename,'S');
1044 } else {
1045 0 $self->warn("Got $input and don't know what to do with it\n");
1046 }
1047 0 return 0;
1048 }
1049  
1050  
1051 =head2 _setparams
1052  
1053 Title : _setparams
1054 Usage : Internal function, not to be called directly
1055 Function: Create parameter inputs for tcoffee program
1056 Example :
1057 Returns : parameter string to be passed to tcoffee
1058 during align or profile_align
1059 Args : name of calling object
1060  
1061 =cut
1062  
1063 sub _setparams {
1064 0 ▶ my ($self) = @_;
Subroutine _setparams: not called CC=11 SCAR=48.8
1065 0 my ($attr, $value,$param_string);
1066 0 $param_string = '';
1067 0 my $laststr;
1068 0 for $attr ( @TCOFFEE_PARAMS ) {
1069 0 $value = $self->$attr();
1070 0 ▶ next unless (defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
1071 0 my $attr_key = lc $attr;
1072 0 ▶ if( $attr_key =~ /matrix/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attr_key =~ /matrix/) { } 0 0 0
1073 0 $self->{'_in'} = [ "X".lc($value) ];
1074 } else {
1075 0 $attr_key = ' -'.$attr_key;
1076 0 $param_string .= $attr_key .'='.$value;
1077 }
1078 }
1079 0 for $attr ( @TCOFFEE_SWITCHES) {
1080 0 $value = $self->$attr();
1081 0 ▶ next unless ($value);
Branch: 1 branch
BranchTrueFalseTotal
unless $value 0 0 0
1082 0 my $attr_key = lc $attr; #put switches in format expected by tcoffee
1083 0 $attr_key = ' -'.$attr_key;
1084 0 $param_string .= $attr_key ;
1085 }
1086  
1087 # Set default output file if no explicit output file selected
1088 0 ▶ unless ($self->outfile ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->outfile) 0 0 0
1089 0 my ($tfh, $outfile) = $self->io->tempfile(-dir=>$self->tempdir());
1090 0 close($tfh);
1091 0 undef $tfh;
1092 0 $self->outfile($outfile);
1093 0 $param_string .= " -outfile=$outfile" ;
1094 }
1095  
1096 0 ▶ if ($self->quiet() || $self->verbose < 0) { $param_string .= ' -quiet';}
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
1097
1098 # -no_warning is required on some systems with certain versions or failure
1099 # is guaranteed
1100 0 ▶ if ($self->version >= 4 && $self->version < 4.7) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->version >= 4 and $self->version < "4.7") 0 0 0
Condition0%0/3
$self->version >= 4 and $self->version < "4.7"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->version >= 4 and $self->version < "4.7"
$self->version >= 4 $self->version < "4.7"
Truth table0%0/3
A and B
A= $self->version >= 4B= $self->version < "4.7"
ABresult
0X0
100
111
1101 0 $param_string .= ' -no_warning';
1102 }
1103
1104 0 return $param_string;
1105 }
1106  
1107 =head2 aformat
1108  
1109 Title : aformat
1110 Usage : my $alignmentformat = $self->aformat();
1111 Function: Get/Set alignment format
1112 Returns : string
1113 Args : string
1114  
1115  
1116 =cut
1117  
1118 sub aformat{
1119 0 ▶ my $self = shift;
Subroutine aformat: not called CC=2 SCAR=17.9
Pod documented
1120 0 ▶ $self->{'_aformat'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
1121 0 return $self->{'_aformat'};
1122 }
1123  
1124  
1125 =head2 methods
1126  
1127 Title : methods
1128 Usage : my @methods = $self->methods()
1129 Function: Get/Set Alignment methods - NOT VALIDATED
1130 Returns : array of strings
1131 Args : arrayref of strings
1132  
1133  
1134 =cut
1135  
1136 sub methods{
1137 2 ▶ my ($self) = shift;
Subroutine methods: called CC=4 SCAR=13.9
Pod documented
1138  
1139 2 ▶ @{$self->{'_methods'}} = @{shift || []} if @_;
Branch: 2 branches
BranchTrueFalseTotal
if @_ 1 1 2
shift() or [] 0 1 1
1140 2 ▶ return @{$self->{'_methods'} || []};
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_methods"} or [] 1 1 2
1141 }
1142  
1143  
1144 =head1 Bio::Tools::Run::BaseWrapper methods
1145  
1146 =cut
1147  
1148 =head2 no_param_checks
1149  
1150 Title : no_param_checks
1151 Usage : $obj->no_param_checks($newval)
1152 Function: Boolean flag as to whether or not we should
1153 trust the sanity checks for parameter values
1154 Returns : value of no_param_checks
1155 Args : newvalue (optional)
1156  
1157  
1158 =cut
1159  
1160 =head2 save_tempfiles
1161  
1162 Title : save_tempfiles
1163 Usage : $obj->save_tempfiles($newval)
1164 Function:
1165 Returns : value of save_tempfiles
1166 Args : newvalue (optional)
1167  
1168  
1169 =cut
1170  
1171 =head2 outfile_name
1172  
1173 Title : outfile_name
1174 Usage : my $outfile = $tcoffee->outfile_name();
1175 Function: Get/Set the name of the output file for this run
1176 (if you wanted to do something special)
1177 Returns : string
1178 Args : [optional] string to set value to
1179  
1180  
1181 =cut
1182  
1183  
1184 =head2 tempdir
1185  
1186 Title : tempdir
1187 Usage : my $tmpdir = $self->tempdir();
1188 Function: Retrieve a temporary directory name (which is created)
1189 Returns : string which is the name of the temporary directory
1190 Args : none
1191  
1192  
1193 =cut
1194  
1195 =head2 cleanup
1196  
1197 Title : cleanup
1198 Usage : $tcoffee->cleanup();
1199 Function: Will cleanup the tempdir directory
1200 Returns : none
1201 Args : none
1202  
1203  
1204 =cut
1205  
1206 =head2 io
1207  
1208 Title : io
1209 Usage : $obj->io($newval)
1210 Function: Gets a L<Bio::Root::IO> object
1211 Returns : L<Bio::Root::IO>
1212 Args : none
1213  
1214  
1215 =cut
1216  
1217 1 1; # Needed to keep compiler happy
« blib/lib/Bio/Tools/Run/Primer3.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Clustalw.pm »