| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Tools::Run::Phylo::FastTree |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Copyright Brian Osborne |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Bio::Tools::Run::Phylo::FastTree |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Build a FastTree factory |
|
19
|
|
|
|
|
|
|
$factory = Bio::Tools::Run::Phylo::FastTree->new(-quiet => 1, |
|
20
|
|
|
|
|
|
|
-fastest => 1); |
|
21
|
|
|
|
|
|
|
# Get an alignment |
|
22
|
|
|
|
|
|
|
my $alignio = Bio::AlignIO->new( |
|
23
|
|
|
|
|
|
|
-format => 'fasta', |
|
24
|
|
|
|
|
|
|
-file => '219877.cdna.fasta'); |
|
25
|
|
|
|
|
|
|
my $alnobj = $alignio->next_aln; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Analyze the aligment and get a Tree |
|
28
|
|
|
|
|
|
|
my $tree = $factory->run($alnobj); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Get a Bio::Tree object given a protein or DNA alignment. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 FEEDBACK |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 Mailing Lists |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
|
39
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
|
40
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
|
43
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 Support |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
I |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Do not contact the module maintainer directly. Many experienced experts |
|
52
|
|
|
|
|
|
|
at bioperl-l will be able look at the problem and quickly |
|
53
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
|
54
|
|
|
|
|
|
|
with code and data examples if at all possible. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 Reporting Bugs |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
|
59
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the web: |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
http://redmine.open-bio.org/projects/bioperl/ |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR - Brian Osborne |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Email briano@bioteam.net |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 APPENDIX |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
|
70
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
package Bio::Tools::Run::Phylo::FastTree; |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
|
|
1
|
|
119761
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
77
|
1
|
|
|
1
|
|
491
|
use Bio::Seq; |
|
|
1
|
|
|
|
|
25840
|
|
|
|
1
|
|
|
|
|
28
|
|
|
78
|
1
|
|
|
1
|
|
458
|
use Bio::SeqIO; |
|
|
1
|
|
|
|
|
19033
|
|
|
|
1
|
|
|
|
|
28
|
|
|
79
|
1
|
|
|
1
|
|
378
|
use Bio::TreeIO; |
|
|
1
|
|
|
|
|
13287
|
|
|
|
1
|
|
|
|
|
27
|
|
|
80
|
1
|
|
|
1
|
|
421
|
use Bio::AlignIO; |
|
|
1
|
|
|
|
|
28377
|
|
|
|
1
|
|
|
|
|
24
|
|
|
81
|
1
|
|
|
1
|
|
6
|
use Bio::Root::IO; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
1
|
|
|
1
|
|
3
|
use base qw(Bio::Root::Root Bio::Tools::Run::WrapperBase); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
486
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
our @FastTree_PARAMS = |
|
86
|
|
|
|
|
|
|
qw(log cat n intree intree1 constraints sprlength topm close |
|
87
|
|
|
|
|
|
|
refresh constraintWeight spr mlacc nni mlnni seed matrix gtrrates gtrfreq makematrix ); |
|
88
|
|
|
|
|
|
|
our @FastTree_SWITCHES = |
|
89
|
|
|
|
|
|
|
qw(quiet nopr nt fastest slow nosupport gtr wag quote noml |
|
90
|
|
|
|
|
|
|
nome gamma mllen slownni nocat notoo 2nd no2nd nj bionj top notop |
|
91
|
|
|
|
|
|
|
nomatrix rawdist ); |
|
92
|
|
|
|
|
|
|
our $PROGRAM_NAME = 'FastTree'; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 new |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Title : new |
|
97
|
|
|
|
|
|
|
Usage : my $treebuilder = Bio::Tools::Run::Phylo::FastTree->new(); |
|
98
|
|
|
|
|
|
|
Function: Constructor |
|
99
|
|
|
|
|
|
|
Returns : Bio::Tools::Run::Phylo::FastTree |
|
100
|
|
|
|
|
|
|
Args : -outfile_name => $outname |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub new { |
|
105
|
1
|
|
|
1
|
1
|
85
|
my ( $class, @args ) = @_; |
|
106
|
1
|
|
|
|
|
13
|
my $self = $class->SUPER::new(@args); |
|
107
|
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
51
|
$self->_set_from_args( |
|
109
|
|
|
|
|
|
|
\@args, |
|
110
|
|
|
|
|
|
|
-methods => [ @FastTree_PARAMS, @FastTree_SWITCHES ], |
|
111
|
|
|
|
|
|
|
-create => 1 |
|
112
|
|
|
|
|
|
|
); |
|
113
|
|
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
15
|
my ($out) = $self->SUPER::_rearrange( [qw(OUTFILE_NAME)], @args ); |
|
115
|
|
|
|
|
|
|
|
|
116
|
1
|
|
50
|
|
|
25
|
$self->outfile_name( $out || '' ); |
|
117
|
|
|
|
|
|
|
|
|
118
|
1
|
|
|
|
|
5
|
$self; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 program_name |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Title : program_name |
|
124
|
|
|
|
|
|
|
Usage : $factory->program_name() |
|
125
|
|
|
|
|
|
|
Function: holds the program name |
|
126
|
|
|
|
|
|
|
Returns: string |
|
127
|
|
|
|
|
|
|
Args : None |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub program_name { |
|
132
|
6
|
|
|
6
|
1
|
26
|
$PROGRAM_NAME; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 program_dir |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Title : program_dir |
|
138
|
|
|
|
|
|
|
Usage : $factory->program_dir(@params) |
|
139
|
|
|
|
|
|
|
Function: returns the program directory |
|
140
|
|
|
|
|
|
|
Returns: string |
|
141
|
|
|
|
|
|
|
Args : |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub program_dir { |
|
146
|
3
|
|
|
3
|
1
|
8
|
undef; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 error_string |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Title : error_string |
|
152
|
|
|
|
|
|
|
Usage : $obj->error_string($newval) |
|
153
|
|
|
|
|
|
|
Function: Where the output from the last analysus run is stored. |
|
154
|
|
|
|
|
|
|
Returns : value of error_string |
|
155
|
|
|
|
|
|
|
Args : newvalue (optional) |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub error_string { |
|
160
|
0
|
|
|
0
|
1
|
|
my ( $self, $value ) = @_; |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
$self->{'error_string'} = $value if ( defined $value ); |
|
163
|
0
|
|
|
|
|
|
$self->{'error_string'}; |
|
164
|
|
|
|
|
|
|
} |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 version |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Title : version |
|
169
|
|
|
|
|
|
|
Usage : exit if $prog->version() < 1.8 |
|
170
|
|
|
|
|
|
|
Function: Determine the version number of the program |
|
171
|
|
|
|
|
|
|
Example : |
|
172
|
|
|
|
|
|
|
Returns : float or undef |
|
173
|
|
|
|
|
|
|
Args : none |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub version { |
|
178
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
179
|
0
|
|
|
|
|
|
my $exe; |
|
180
|
|
|
|
|
|
|
|
|
181
|
0
|
0
|
|
|
|
|
return undef unless $exe = $self->executable; |
|
182
|
0
|
|
|
|
|
|
my $string = `$exe 2>&1`; |
|
183
|
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
$string =~ /FastTree\s+version\s+([\d\.]+)/; |
|
185
|
0
|
|
0
|
|
|
|
return $1 || undef; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 run |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Title : run |
|
191
|
|
|
|
|
|
|
Usage : $factory->run($stockholm_file) OR |
|
192
|
|
|
|
|
|
|
$factory->run($align_object) |
|
193
|
|
|
|
|
|
|
Function: Runs FastTree to generate a tree |
|
194
|
|
|
|
|
|
|
Returns : Bio::Tree::Tree object |
|
195
|
|
|
|
|
|
|
Args : File name for your input alignment in stockholm format, OR |
|
196
|
|
|
|
|
|
|
Bio::Align::AlignI compliant object (eg. Bio::SimpleAlign). |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub run { |
|
201
|
0
|
|
|
0
|
1
|
|
my ($self, $in) = @_; |
|
202
|
|
|
|
|
|
|
|
|
203
|
0
|
0
|
0
|
|
|
|
if (ref $in && $in->isa("Bio::Align::AlignI")) { |
|
|
|
0
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
$in = $self->_write_alignfile($in); |
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
elsif (! -e $in) { |
|
207
|
0
|
|
|
|
|
|
$self->throw("When not supplying a Bio::Align::AlignI object, you must supply a readable filename"); |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
$self->_run($in); |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 _run |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Title : _run |
|
216
|
|
|
|
|
|
|
Usage : Internal function, not to be called directly |
|
217
|
|
|
|
|
|
|
Function: Runs the application |
|
218
|
|
|
|
|
|
|
Returns : Tree object |
|
219
|
|
|
|
|
|
|
Args : Alignment file name |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=cut |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub _run { |
|
224
|
0
|
|
|
0
|
|
|
my ( $self, $file ) = @_; |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# If -nt is not set check the alphabet of the input |
|
227
|
0
|
0
|
|
|
|
|
$self->_alphabet($file) if ( ! $self->nt ); |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
|
0
|
|
|
|
my $exe = $self->executable || return; |
|
230
|
0
|
|
|
|
|
|
my $param_str = $self->arguments . " " . $self->_setparams($file); |
|
231
|
0
|
|
|
|
|
|
my $command = "$exe $param_str"; |
|
232
|
0
|
|
|
|
|
|
$self->debug("FastTree command = $command"); |
|
233
|
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
my $status = system($command); |
|
235
|
0
|
|
|
|
|
|
my $outfile = $self->outfile_name(); |
|
236
|
|
|
|
|
|
|
|
|
237
|
0
|
0
|
0
|
|
|
|
if ( !-e $outfile || -z $outfile ) { |
|
238
|
0
|
|
|
|
|
|
$self->warn("FastTree call had status of $status: $? [command $command]\n"); |
|
239
|
0
|
|
|
|
|
|
return undef; |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
my $treeio = Bio::TreeIO->new( -format => 'newick', -file => $outfile ); |
|
243
|
0
|
|
|
|
|
|
my $tree = $treeio->next_tree; |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# if bootstraps were enabled, the bootstraps are the ids; convert to |
|
246
|
|
|
|
|
|
|
# bootstrap and no id |
|
247
|
|
|
|
|
|
|
# if ($self->boot) { |
|
248
|
|
|
|
|
|
|
# my @nodes = $tree->get_nodes; |
|
249
|
|
|
|
|
|
|
# my %non_internal = map { $_ => 1 } ($tree->get_leaf_nodes, $tree->get_root_node); |
|
250
|
|
|
|
|
|
|
# foreach my $node (@nodes) { |
|
251
|
|
|
|
|
|
|
# next if exists $non_internal{$node}; |
|
252
|
|
|
|
|
|
|
# $node->bootstrap && next; # protect ourselves incase the parser improves |
|
253
|
|
|
|
|
|
|
# $node->bootstrap($node->id); |
|
254
|
|
|
|
|
|
|
# $node->id(''); |
|
255
|
|
|
|
|
|
|
# } |
|
256
|
|
|
|
|
|
|
# } |
|
257
|
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
$tree; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head2 _write_alignfile |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Title : _write_alignfile |
|
264
|
|
|
|
|
|
|
Usage : Internal function, not to be called directly |
|
265
|
|
|
|
|
|
|
Function: Create an alignment file |
|
266
|
|
|
|
|
|
|
Returns : filename |
|
267
|
|
|
|
|
|
|
Args : Bio::Align::AlignI |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub _write_alignfile { |
|
272
|
0
|
|
|
0
|
|
|
my ( $self, $align ) = @_; |
|
273
|
|
|
|
|
|
|
|
|
274
|
0
|
|
|
|
|
|
my ( $tfh, $tempfile ) = $self->io->tempfile( -dir => $self->tempdir ); |
|
275
|
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
my $out = Bio::AlignIO->new( |
|
277
|
|
|
|
|
|
|
-file => ">$tempfile", |
|
278
|
|
|
|
|
|
|
-format => 'phylip' |
|
279
|
|
|
|
|
|
|
); |
|
280
|
0
|
|
|
|
|
|
$out->write_aln($align); |
|
281
|
0
|
|
|
|
|
|
$out->close(); |
|
282
|
0
|
|
|
|
|
|
undef($out); |
|
283
|
0
|
|
|
|
|
|
close($tfh); |
|
284
|
0
|
|
|
|
|
|
undef($tfh); |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
0
|
|
|
|
|
die "Alignment file $tempfile was not created" if ( ! -e $tempfile ); |
|
287
|
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
|
$tempfile; |
|
289
|
|
|
|
|
|
|
} |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 _alphabet |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Title : _alphabet |
|
294
|
|
|
|
|
|
|
Usage : my $alphabet = $self->_alphabet; |
|
295
|
|
|
|
|
|
|
Function: Get the alphabet of the input alignment, defaults to 'dna' |
|
296
|
|
|
|
|
|
|
Returns : 'dna' or 'protein' |
|
297
|
|
|
|
|
|
|
Args : Alignment file |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=cut |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
sub _alphabet { |
|
302
|
0
|
|
|
0
|
|
|
my ($self,$file) = @_; |
|
303
|
|
|
|
|
|
|
|
|
304
|
0
|
0
|
|
|
|
|
if ( $file ) { |
|
305
|
0
|
0
|
|
|
|
|
if ( -e $file ) { |
|
306
|
0
|
|
|
|
|
|
my $in = Bio::AlignIO->new(-file => $file); |
|
307
|
0
|
|
|
|
|
|
my $aln = $in->next_aln; |
|
308
|
|
|
|
|
|
|
# arbitrary, the first one |
|
309
|
0
|
|
|
|
|
|
my $seq = $aln->get_seq_by_pos(1); |
|
310
|
0
|
|
|
|
|
|
my $alphabet = $seq->alphabet; |
|
311
|
0
|
|
|
|
|
|
$self->{_alphabet} = $alphabet; |
|
312
|
|
|
|
|
|
|
|
|
313
|
0
|
0
|
|
|
|
|
$self->nt(1) if ( $alphabet eq 'dna' ); |
|
314
|
|
|
|
|
|
|
} else { |
|
315
|
0
|
|
|
|
|
|
die "File $file can not be found"; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# default is 'dna' |
|
320
|
0
|
|
0
|
|
|
|
return $self->{'_alphabet'} || 'dna'; |
|
321
|
|
|
|
|
|
|
} |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=head2 _setparams |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Title : _setparams |
|
326
|
|
|
|
|
|
|
Usage : Internal function, not to be called directly |
|
327
|
|
|
|
|
|
|
Function: Create parameter inputs for FastTree program |
|
328
|
|
|
|
|
|
|
Example : |
|
329
|
|
|
|
|
|
|
Returns : parameter string to be passed to FastTree |
|
330
|
|
|
|
|
|
|
Args : name of calling object |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=cut |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub _setparams { |
|
335
|
0
|
|
|
0
|
|
|
my ($self,$infile) = @_; |
|
336
|
0
|
|
|
|
|
|
my ( $attr, $value, $param_string ); |
|
337
|
0
|
|
|
|
|
|
$param_string = ''; |
|
338
|
0
|
|
|
|
|
|
my $laststr; |
|
339
|
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
for $attr (@FastTree_PARAMS) { |
|
341
|
0
|
|
|
|
|
|
$value = $self->$attr(); |
|
342
|
0
|
0
|
|
|
|
|
next unless ( defined $value ); |
|
343
|
0
|
|
|
|
|
|
my $attr_key = lc $attr; |
|
344
|
0
|
|
|
|
|
|
$attr_key = ' -' . $attr_key; |
|
345
|
0
|
|
|
|
|
|
$param_string .= $attr_key . ' ' . $value; |
|
346
|
|
|
|
|
|
|
} |
|
347
|
0
|
|
|
|
|
|
for $attr (@FastTree_SWITCHES) { |
|
348
|
0
|
|
|
|
|
|
$value = $self->$attr(); |
|
349
|
0
|
0
|
|
|
|
|
next unless ($value); |
|
350
|
0
|
|
|
|
|
|
my $attr_key = lc $attr; |
|
351
|
0
|
|
|
|
|
|
$attr_key = ' -' . $attr_key; |
|
352
|
0
|
|
|
|
|
|
$param_string .= $attr_key; |
|
353
|
|
|
|
|
|
|
} |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
# Set default output file if no explicit output file has been given |
|
356
|
0
|
0
|
|
|
|
|
if ( ! $self->outfile_name ) { |
|
357
|
0
|
|
|
|
|
|
my ( $tfh, $outfile ) = $self->io->tempfile( -dir => $self->tempdir() ); |
|
358
|
0
|
|
|
|
|
|
close($tfh); |
|
359
|
0
|
|
|
|
|
|
undef $tfh; |
|
360
|
0
|
|
|
|
|
|
$self->outfile_name($outfile); |
|
361
|
|
|
|
|
|
|
} |
|
362
|
0
|
|
|
|
|
|
$param_string .= " $infile > " . $self->outfile_name; |
|
363
|
|
|
|
|
|
|
|
|
364
|
0
|
0
|
|
|
|
|
my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null'; |
|
365
|
0
|
0
|
0
|
|
|
|
$param_string .= " 2> $null" if ( $self->quiet() || $self->verbose < 0 ); |
|
366
|
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
$param_string; |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=head1 Bio::Tools::Run::BaseWrapper methods |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=cut |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=head2 no_param_checks |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
Title : no_param_checks |
|
377
|
|
|
|
|
|
|
Usage : $obj->no_param_checks($newval) |
|
378
|
|
|
|
|
|
|
Function: Boolean flag as to whether or not we should |
|
379
|
|
|
|
|
|
|
trust the sanity checks for parameter values |
|
380
|
|
|
|
|
|
|
Returns : value of no_param_checks |
|
381
|
|
|
|
|
|
|
Args : newvalue (optional) |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=cut |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=head2 save_tempfiles |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
Title : save_tempfiles |
|
388
|
|
|
|
|
|
|
Usage : $obj->save_tempfiles($newval) |
|
389
|
|
|
|
|
|
|
Function: |
|
390
|
|
|
|
|
|
|
Returns : value of save_tempfiles |
|
391
|
|
|
|
|
|
|
Args : newvalue (optional) |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=cut |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head2 outfile_name |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Title : outfile_name |
|
398
|
|
|
|
|
|
|
Usage : my $outfile = $FastTree->outfile_name(); |
|
399
|
|
|
|
|
|
|
Function: Get/Set the name of the output file for this run |
|
400
|
|
|
|
|
|
|
(if you wanted to do something special) |
|
401
|
|
|
|
|
|
|
Returns : string |
|
402
|
|
|
|
|
|
|
Args : [optional] string to set value to |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=cut |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head2 tempdir |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
Title : tempdir |
|
409
|
|
|
|
|
|
|
Usage : my $tmpdir = $self->tempdir(); |
|
410
|
|
|
|
|
|
|
Function: Retrieve a temporary directory name (which is created) |
|
411
|
|
|
|
|
|
|
Returns : string which is the name of the temporary directory |
|
412
|
|
|
|
|
|
|
Args : none |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=cut |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=head2 cleanup |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
Title : cleanup |
|
419
|
|
|
|
|
|
|
Usage : $FastTree->cleanup(); |
|
420
|
|
|
|
|
|
|
Function: Will cleanup the tempdir directory |
|
421
|
|
|
|
|
|
|
Returns : none |
|
422
|
|
|
|
|
|
|
Args : none |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=cut |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=head2 io |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
Title : io |
|
429
|
|
|
|
|
|
|
Usage : $obj->io($newval) |
|
430
|
|
|
|
|
|
|
Function: Gets a L object |
|
431
|
|
|
|
|
|
|
Returns : L |
|
432
|
|
|
|
|
|
|
Args : none |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=cut |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
1; # Needed to keep compiler happy |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
__END__ |