blib/lib/Bio/Tools/Run/Hmmer.pm

filter: Statementstmt 27.5% 48 / 174 Branchbran 6.5% 5 / 76 Conditioncond 5.0% 1 / 20 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 40.0% 8 / 20 Podpod 100% 10 / 10 totaltotal 23.0% 72 / 313 CC 49 SCAR 45.9
CC
49
Cov
20%
_run
306.0
_setparams
90.0
_setinput
56.0
CRAP 98.3
« blib/lib/Bio/Tools/Run/Phylo/Phylip/Neighbor.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Pal2Nal.pm »
1 # You may distribute this module under the same terms as perl itself
2 # POD documentation - main docs before the code
3  
4 =head1 NAME
5  
6 Bio::Tools::Run::Hmmer - Wrapper for local execution of hmmalign, hmmbuild,
7 hmmcalibrate, hmmemit, hmmpfam, hmmsearch
8  
9 =head1 SYNOPSIS
10  
11 # run hmmsearch (similar for hmmpfam)
12 my $factory = Bio::Tools::Run::Hmmer->new(-hmm => 'model.hmm');
13  
14 # Pass the factory a Bio::Seq object or a file name, returns a Bio::SearchIO
15 my $searchio = $factory->hmmsearch($seq);
16  
17 while (my $result = $searchio->next_result){
18 while(my $hit = $result->next_hit){
19 while (my $hsp = $hit->next_hsp){
20 print join("\t", ( $result->query_name,
21 $hsp->query->start,
22 $hsp->query->end,
23 $hit->name,
24 $hsp->hit->start,
25 $hsp->hit->end,
26 $hsp->score,
27 $hsp->evalue,
28 $hsp->seq_str,
29 )), "\n";
30 }
31 }
32 }
33  
34 # build a hmm using hmmbuild
35 my $aio = Bio::AlignIO->new(-file => "protein.msf", -format => 'msf');
36 my $aln = $aio->next_aln;
37 my $factory = Bio::Tools::Run::Hmmer->new(-hmm => 'model.hmm');
38 $factory->hmmbuild($aln);
39  
40 # calibrate the hmm
41 $factory->calibrate();
42  
43 # emit a sequence stream from the hmm
44 my $seqio = $factory->hmmemit();
45  
46 # align sequences to the hmm
47 my $alnio = $factory->hmmalign(@seqs);
48  
49 =head1 DESCRIPTION
50  
51 Wrapper module for Sean Eddy's HMMER suite of program to allow running of
52 hmmalign, hmmbuild, hmmcalibrate, hmmemit, hmmpfam and hmmsearch. Binaries are
53 available at http://hmmer.janelia.org/
54  
55 You can pass most options understood by the command-line programs to new(), or
56 set the options by calling methods with the same name as the argument. In both
57 instances, case sensitivity matters.
58  
59 Additional methods are hmm() to specifiy the hmm file (needed for all HMMER
60 programs) which you would normally set in the call to new().
61  
62 The HMMER programs must either be in your path, or you must set the environment
63 variable HMMERDIR to point to their location.
64  
65 =head1 FEEDBACK
66  
67 =head2 Mailing Lists
68  
69 User feedback is an integral part of the evolution of this and other
70 Bioperl modules. Send your comments and suggestions preferably to one
71 of the Bioperl mailing lists. Your participation is much appreciated.
72  
73 bioperl-l@bioperl.org - General discussion
74 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
75  
76 =head2 Support
77  
78 Please direct usage questions or support issues to the mailing list:
79  
80 I<bioperl-l@bioperl.org>
81  
82 rather than to the module maintainer directly. Many experienced and
83 reponsive experts will be able look at the problem and quickly
84 address it. Please include a thorough description of the problem
85 with code and data examples if at all possible.
86  
87 =head2 Reporting Bugs
88  
89 Report bugs to the Bioperl bug tracking system to help us keep track
90 the bugs and their resolution. Bug reports can be submitted via the
91 web:
92  
93 http://redmine.open-bio.org/projects/bioperl/
94  
95 =head1 AUTHOR - Shawn Hoon
96  
97 Email: shawnh-at-gmx.net
98  
99 =head1 CONTRIBUTORS
100  
101 Shawn Hoon shawnh-at-gmx.net
102 Jason Stajich jason -at- bioperl -dot- org
103 Scott Markel scott -at- scitegic -dot com
104 Sendu Bala bix@sendu.me.uk
105  
106 =head1 APPENDIX
107  
108 The rest of the documentation details each of the object
109 methods. Internal methods are usually preceded with a _
110  
111 =cut
112  
113 package Bio::Tools::Run::Hmmer;
114  
115 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
116  
117 1 ▶use Bio::SeqIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
118 1 ▶use Bio::SearchIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
119 1 ▶use Bio::AlignIO;
Subroutine BEGIN: called CC=1 SCAR=0.0
120  
121 1 ▶use base qw(Bio::Tools::Run::WrapperBase);
Subroutine BEGIN: called CC=1 SCAR=0.0
122  
123 1 our $DefaultFormat = 'msf';
124 1 our $DefaultReadMethod = 'hmmer';
125 1 our %ALL = (quiet => 'q', o => 'outfile');
126 1 our @ALIGN_PARAMS = qw(mapali outformat withali o);
127 1 our @ALIGN_SWITCHES = qw(m oneline q);
128 1 our @BUILD_PARAMS = qw(n archpri cfile gapmax idlevel null pam pamwgt
129 pbswitch prior swentry swexit o);
130 1 our @BUILD_SWITCHES = qw(f g s A F amino binary fast hand noeff nucleic
131 wblosum wgsc wme wnone wpb wvoronoi);
132 1 our @CALIBRATE_PARAMS = qw(fixed histfile mean num sd seed cpu);
133 1 our @CALIBRATE_SWITCHES = qw();
134 1 our @EMIT_PARAMS = qw(n seed o);
135 1 our @EMIT_SWITCHES = qw(c q);
136 1 our @PFAM_PARAMS = qw(A E T Z domE domT informat cpu);
137 1 our @PFAM_SWITCHES = qw(n acc cut_ga cut_gc cut_nc forward null2 xnu);
138 1 our @SEARCH_PARAMS = @PFAM_PARAMS;
139 1 our @SEARCH_SWITCHES = @PFAM_SWITCHES;
140 1 our %OTHER = (_READMETHOD => '_readmethod',
141 program_name => [qw(PROGRAM program)],
142 hmm => [qw(HMM db DB)]);
143  
144 # just to be explicit
145 1 our @UNSUPPORTED = qw(h verbose a compat pvm);
146  
147  
148 =head2 new
149  
150 Title : new
151 Usage : $HMMER->new(@params)
152 Function: Creates a new HMMER factory
153 Returns : Bio::Tools::Run::HMMER
154 Args : -hmm => filename # the hmm, used by all program types; if not set
155 # here, must be set with hmm() method prior to
156 # running anything
157 -_READMETHOD => 'hmmer' (default) || 'hmmer_pull' # the parsing
158 # module to use for
159 # hmmpfam/hmmsearch
160  
161 Any option supported by a Hmmer program, where switches are given
162 a true value, eg. -q => 1, EXCEPT for the following which are handled
163 internally/ incompatible: h verbose a compat pvm
164  
165 WARNING: the default sequence format passed to hmmpfam is msf. If
166 you are using a different format, you need to pass it with informat.
167 e.g.
168 my $factory = Bio::Tools::Run::Hmmer->new(-hmm => 'model.hmm',
169 -informat => 'fasta');
170  
171 -q is synonymous with -quiet
172 -o is synonymous with -outfile
173  
174 # may be specified here, allowing run() to be used, or
175 # it can be ommitted and the corresponding method (eg.
176 # hmmalign()) used later.
177 -program => hmmalign|hmmbuild|hmmcalibrate|hmmemit|hmmpfam|hmmsearch
178  
179 =cut
180  
181 sub new {
182 1 ▶ my($class, @args) = @_;
Subroutine new: called CC=3 SCAR=11.1
Pod documented
183 1 my $self = $class->SUPER::new(@args);
184
185 2 $self->_set_from_args(\@args, -methods => {(map { $_ => $ALL{$_} } keys %ALL),
186 3 (map { $_ => $OTHER{$_} } keys %OTHER),
187 1 (map { $_ => $_ }
188 (@ALIGN_PARAMS,
189 @ALIGN_SWITCHES,
190 @BUILD_PARAMS,
191 @BUILD_SWITCHES,
192 @CALIBRATE_PARAMS,
193 @CALIBRATE_SWITCHES,
194 @EMIT_PARAMS,
195 @EMIT_SWITCHES,
196 @PFAM_PARAMS,
197 @PFAM_SWITCHES,
198 @SEARCH_PARAMS,
199 @SEARCH_SWITCHES))},
200 -create => 1,
201 -case_sensitive => 1);
202
203 1 ▶ $self->informat || $self->informat($DefaultFormat);
Branch: 1 branch
BranchTrueFalseTotal
$self->informat or $self->informat($Bio::Tools::Run::Hmmer::DefaultFormat) 1 0 1
204 1 ▶ $self->_READMETHOD || $self->_READMETHOD($DefaultReadMethod);
Branch: 1 branch
BranchTrueFalseTotal
$self->_READMETHOD or $self->_READMETHOD($Bio::Tools::Run::Hmmer::DefaultReadMethod) 1 0 1
205
206 1 return $self;
207 }
208  
209 =head2 run
210  
211 Title : run
212 Usage : $obj->run($seqFile)
213 Function: Runs one of the Hmmer programs, according to the current setting of
214 program() (as typically set during new(-program => 'name')).
215 Returns : A Bio::SearchIO, Bio::AlignIO, Bio::SeqIO or boolean depending on
216 the program being run (see method corresponding to program name for
217 details).
218 Args : A Bio::PrimarySeqI, Bio::Align::AlignI or filename
219  
220 =cut
221  
222 sub run {
223 0 ▶ my $self = shift;
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
224 0 ▶ my $program = lc($self->program_name || $self->throw("The program must already be specified"));
Condition0%0/3
$self->program_name || $self->throw('The program must already be specified')
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->program_name || $self->throw('The program must already be specified')
$self->program_name $self->throw('The program must already be specified')
Truth table0%0/3
A || B
A= $self->program_nameB= $self->throw('The program must already be specified')
ABresult
1X1
011
000
225 0 ▶ $self->can($program) || $self->throw("'$program' wasn't a valid program");
Branch: 1 branch
BranchTrueFalseTotal
$self->can($program) or $self->throw("'${program}' wasn't a valid program") 0 0 0
226 0 return $self->$program(@_);
227 }
228  
229 =head2 hmmalign
230  
231 Title : hmmalign
232 Usage : $obj->hmmalign()
233 Function: Runs hmmalign
234 Returns : A Bio::AlignIO
235 Args : list of Bio::SeqI OR Bio::Align::AlignI OR filename of file with
236 sequences or an alignment
237  
238 =cut
239  
240 sub hmmalign {
241 0 ▶ my $self = shift;
Subroutine hmmalign: not called CC=3 SCAR=24.8
Pod documented
242 0 $self->program_name('hmmalign');
243 0 my $input = $self->_setinput(@_);
244
245 0 ▶ unless (defined $self->o()) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->o) 0 0 0
246 0 $self->q(1);
247 }
248 0 ▶ if (! $self->outformat) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->outformat) 0 0 0
249 0 $self->outformat($DefaultFormat);
250 }
251
252 0 return $self->_run($input);
253 }
254  
255 =head2 hmmbuild
256  
257 Title : hmmbuild
258 Usage : $obj->hmmbuild()
259 Function: Runs hmmbuild, outputting an hmm to the file currently set by method
260 hmm() or db(), or failing that, o() or outfile(), or failing that, to
261 a temp location.
262 Returns : true on success
263 Args : Bio::Align::AlignI OR filename of file with an alignment
264  
265 =cut
266  
267 sub hmmbuild {
268 0 ▶ my $self = shift;
Subroutine hmmbuild: not called CC=3 SCAR=24.8
Pod documented
269 0 $self->program_name('hmmbuild');
270 0 my $input = $self->_setinput(@_);
271
272 0 ▶ unless (defined $self->hmm()) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->hmm) 0 0 0
273 0 ▶ $self->hmm($self->o() || $self->io->tempfile(-dir => $self->tempdir));
Condition0%0/3
$self->o || $self->io->tempfile('-dir', $self->tempdir)
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->o || $self->io->tempfile('-dir', $self->tempdir)
$self->o $self->io->tempfile('-dir', $self->tempdir)
Truth table0%0/3
A || B
A= $self->oB= $self->io->tempfile('-dir', $self->tempdir)
ABresult
1X1
011
000
274 }
275
276 0 return $self->_run($input);
277 }
278  
279 =head2 hmmcalibrate
280  
281 Title : hmmcalibrate
282 Usage : $obj->hmmcalibrate()
283 Function: Runs hmmcalibrate
284 Returns : true on success
285 Args : none (hmm() must be set, most likely by the -hmm option of new()), OR
286 optionally supply an hmm filename to set hmm() and run
287  
288 =cut
289  
290 sub hmmcalibrate {
291 0 ▶ my ($self, $hmm) = @_;
Subroutine hmmcalibrate: not called CC=3 SCAR=24.8
Pod documented
292 0 $self->program_name('hmmcalibrate');
293 0 ▶ $self->hmm($hmm) if $hmm;
Branch: 1 branch
BranchTrueFalseTotal
if $hmm 0 0 0
294 0 ▶ $self->hmm || $self->throw("hmm() must be set first");
Branch: 1 branch
BranchTrueFalseTotal
$self->hmm or $self->throw("hmm() must be set first") 0 0 0
295 0 return $self->_run();
296 }
297  
298 =head2 hmmemit
299  
300 Title : hmmemit
301 Usage : $obj->hmmemit()
302 Function: Runs hmmemit
303 Returns : A Bio::SeqIO
304 Args : none (hmm() must be set, most likely by the -hmm option of new()), OR
305 optionally supply an hmm filename to set hmm() and run
306  
307 =cut
308  
309 sub hmmemit {
310 0 ▶ my ($self, $hmm) = @_;
Subroutine hmmemit: not called CC=4 SCAR=30.0
Pod documented
311 0 $self->program_name('hmmemit');
312 0 ▶ $self->hmm($hmm) if $hmm;
Branch: 1 branch
BranchTrueFalseTotal
if $hmm 0 0 0
313 0 ▶ $self->hmm || $self->throw("hmm() must be set first");
Branch: 1 branch
BranchTrueFalseTotal
$self->hmm or $self->throw("hmm() must be set first") 0 0 0
314
315 0 ▶ unless (defined $self->o()) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->o) 0 0 0
316 0 $self->q(1);
317 }
318
319 0 return $self->_run();
320 }
321  
322 =head2 hmmpfam
323  
324 Title : hmmpfam
325 Usage : $obj->hmmpfam()
326 Function: Runs hmmpfam
327 Returns : A Bio::SearchIO
328 Args : A Bio::PrimarySeqI, Bio::Align::AlignI or filename
329  
330 =cut
331  
332 sub hmmpfam {
333 0 ▶ my $self = shift;
Subroutine hmmpfam: not called CC=1 SCAR=6.9
Pod documented
334 0 $self->program_name('hmmpfam');
335 0 my $input = $self->_setinput(@_);
336 0 return $self->_run($input);
337 }
338  
339 =head2 hmmsearch
340  
341 Title : hmmsearch
342 Usage : $obj->hmmsearch()
343 Function: Runs hmmsearch
344 Returns : A Bio::SearchIO
345 Args : A Bio::PrimarySeqI, Bio::Align::AlignI or filename
346  
347 =cut
348  
349 sub hmmsearch {
350 0 ▶ my $self = shift;
Subroutine hmmsearch: not called CC=1 SCAR=6.9
Pod documented
351 0 $self->program_name('hmmsearch');
352 0 my $input = $self->_setinput(@_);
353 0 return $self->_run($input);
354 }
355  
356 =head2 _setinput
357  
358 Title : _setinput
359 Usage : $obj->_setinput()
360 Function: Internal(not to be used directly)
361 Returns : filename
362 Args : A Bio::PrimarySeqI, Bio::Align::AlignI or filename
363  
364 =cut
365  
366 sub _setinput {
367 0 ▶ my ($self, @things) = @_;
Subroutine _setinput: not called CC=7 SCAR=40.3
368 0 ▶ @things || $self->throw("At least one input is required");
Branch: 1 branch
BranchTrueFalseTotal
@things or $self->throw("At least one input is required") 0 0 0
369
370 0 my $infile;
371 0 ▶ if (ref $things[0] && $things[0]->isa("Bio::PrimarySeqI") ){# it is an object
Branch: 3 branches
BranchTrueFalseTotal
if (ref $things[0] and $things[0]->isa('Bio::PrimarySeqI')) { } 0 0 0
elsif (ref $things[0] and $things[0]->isa('Bio::Align::AlignI')) { } 0 0 0
elsif (-e $things[0]) { } 0 0 0
Condition0%0/3
ref $things[0] and $things[0]->isa("Bio::PrimarySeqI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $things[0] and $things[0]->isa("Bio::PrimarySeqI")
ref $things[0] $things[0]->isa("Bio::PrimarySeqI")
Truth table0%0/3
A and B
A= ref $things[0]B= $things[0]->isa("Bio::PrimarySeqI")
ABresult
0X0
100
111
372 0 $infile = $self->_writeSeqFile(@things);
373 }
374 ▶ elsif(ref $things[0] && $things[0]->isa("Bio::Align::AlignI")){
Condition0%0/3
ref $things[0] and $things[0]->isa("Bio::Align::AlignI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $things[0] and $things[0]->isa("Bio::Align::AlignI")
ref $things[0] $things[0]->isa("Bio::Align::AlignI")
Truth table0%0/3
A and B
A= ref $things[0]B= $things[0]->isa("Bio::Align::AlignI")
ABresult
0X0
100
111
375 0 $infile = $self->_writeAlignFile(@things);
376 }
377 elsif (-e $things[0]) {
378 0 $infile = $things[0];
379 }
380 else {
381 0 $self->throw("Unknown kind of input '@things'");
382 }
383
384 0 return $infile;
385 }
386  
387 =head2 _run
388  
389 Title : _run
390 Usage : $obj->_run()
391 Function: Internal(not to be used directly)
392 Returns : Bio::SearchIO
393 Args : file name
394  
395 =cut
396  
397 sub _run {
398 0 ▶ my ($self, $file) = @_;
Subroutine _run: not called CC=17 SCAR=57.2
399
400 0 my $str = $self->executable;
401 0 $str .= $self->_setparams;
402 0 ▶ $str .= ' '.$file if $file;
Branch: 1 branch
BranchTrueFalseTotal
if $file 0 0 0
403 0 $self->debug("HMMER command = $str");
404
405 0 my $progname = $self->program_name;
406
407 0 my @in;
408 0 my @verbose = (-verbose => $self->verbose);
409 0 ▶ if ($progname =~ /align|build|emit/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($progname =~ /align|build|emit/) { } 0 0 0
elsif ($progname =~ /pfam|search/i) { } 0 0 0
410 0 my $outfile = $self->o;
411 0 ▶ if ($outfile || $progname eq 'hmmbuild') {
Branch: 1 branch
BranchTrueFalseTotal
if ($outfile or $progname eq 'hmmbuild') { } 0 0 0
Condition0%0/3
$outfile or $progname eq "hmmbuild"
l!l&&r!l&&!r
000
MC/DC0%0/2
$outfile or $progname eq "hmmbuild"
$outfile $progname eq "hmmbuild"
Truth table0%0/3
A or B
A= $outfileB= $progname eq "hmmbuild"
ABresult
1X1
011
000
412 0 ▶ $str .= " > /dev/null" if $self->quiet;
Branch: 1 branch
BranchTrueFalseTotal
if $self->quiet 0 0 0
413
414 0 ▶ if ($progname eq 'hmmbuild') {
Branch: 1 branch
BranchTrueFalseTotal
if ($progname eq 'hmmbuild') { } 0 0 0
415 0 my $status = system($str);
416 0 ▶ return $status ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$status ? : 0 0 0
417 }
418 else {
419 0 ▶ system($str) && $self->throw("HMMER call ($str) crashed: $?\n");
Branch: 1 branch
BranchTrueFalseTotal
system $str and $self->throw("HMMER call ($str) crashed: $?\n") 0 0 0
420 0 @in = (-file => $outfile);
421 }
422 }
423 else {
424 0 ▶ open(my $fh, "$str |") || $self->throw("HMMER call ($str) crashed: $?\n");
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "$str |" or $self->throw("HMMER call ($str) crashed: $?\n") 0 0 0
425 0 @in = (-fh => $fh);
426 }
427 }
428 elsif ($progname =~ /pfam|search/i) {
429 0 ▶ open(my $fh, "$str |") || $self->throw("HMMER call ($str) crashed: $?\n");
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "$str |" or $self->throw("HMMER call ($str) crashed: $?\n") 0 0 0
430
431 0 return Bio::SearchIO->new(-fh => $fh,
432 @verbose,
433 -format => $self->_READMETHOD);
434 }
435
436 0 ▶ if ($progname eq 'hmmalign') {
Branch: 3 branches
BranchTrueFalseTotal
if ($progname eq 'hmmalign') { } 0 0 0
elsif ($progname eq 'hmmemit') { } 0 0 0
elsif ($progname =~ /calibrate/) { } 0 0 0
437 0 return Bio::AlignIO->new(@in,
438 @verbose,
439 -format => $self->outformat);
440 }
441 elsif ($progname eq 'hmmemit') {
442 0 return Bio::SeqIO->new(@in,
443 @verbose,
444 -format => 'fasta');
445 }
446 elsif ($progname =~ /calibrate/) {
447 0 ▶ $str .= " > /dev/null 2> /dev/null" if $self->quiet;
Branch: 1 branch
BranchTrueFalseTotal
if $self->quiet 0 0 0
448 0 my $status = system($str);
449 0 ▶ return $status ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$status ? : 0 0 0
450 }
451 }
452  
453 =head2 _setparams
454  
455 Title : _setparams
456 Usage : Internal function, not to be called directly
457 Function: creates a string of params to be used in the command string
458 Returns : string of params
459 Args : none
460  
461 =cut
462  
463 sub _setparams {
464 0 ▶ my $self = shift;
Subroutine _setparams: not called CC=9 SCAR=45.0
465
466 0 my @execparams;
467 my @execswitches;
468 0 SWITCH: for ($self->program_name) {
469 0 ▶ /align/ && do { @execparams = @ALIGN_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/align/ and do { @execparams = @Bio::Tools::Run::Hmmer::ALIGN_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::ALIGN_SWITCHES; last SWITCH } 0 0 0
470 0 @execswitches = @ALIGN_SWITCHES;
471 0 last SWITCH; };
472 0 ▶ /build/ && do { @execparams = @BUILD_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/build/ and do { @execparams = @Bio::Tools::Run::Hmmer::BUILD_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::BUILD_SWITCHES; last SWITCH } 0 0 0
473 0 @execswitches = @BUILD_SWITCHES;
474 0 last SWITCH; };
475 0 ▶ /calibrate/ && do { @execparams = @CALIBRATE_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/calibrate/ and do { @execparams = @Bio::Tools::Run::Hmmer::CALIBRATE_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::CALIBRATE_SWITCHES; last SWITCH } 0 0 0
476 0 @execswitches = @CALIBRATE_SWITCHES;
477 0 last SWITCH; };
478 0 ▶ /emit/ && do { @execparams = @EMIT_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/emit/ and do { @execparams = @Bio::Tools::Run::Hmmer::EMIT_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::EMIT_SWITCHES; last SWITCH } 0 0 0
479 0 @execswitches = @EMIT_SWITCHES;
480 0 last SWITCH; };
481 0 ▶ /pfam/ && do { @execparams = @PFAM_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/pfam/ and do { @execparams = @Bio::Tools::Run::Hmmer::PFAM_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::PFAM_SWITCHES; last SWITCH } 0 0 0
482 0 @execswitches = @PFAM_SWITCHES;
483 0 last SWITCH; };
484 0 ▶ /search/ && do { @execparams = @SEARCH_PARAMS;
Branch: 1 branch
BranchTrueFalseTotal
/search/ and do { @execparams = @Bio::Tools::Run::Hmmer::SEARCH_PARAMS; @execswitches = @Bio::Tools::Run::Hmmer::SEARCH_SWITCHES; last SWITCH } 0 0 0
485 0 @execswitches = @SEARCH_SWITCHES;
486 0 last SWITCH; };
487 }
488
489 0 my $param_string = $self->SUPER::_setparams(-params => \@execparams,
490 -switches => \@execswitches,
491 -mixed_dash => 1);
492
493 0 ▶ my $hmm = $self->hmm || $self->throw("Need to specify either HMM file or Database");
Condition0%0/3
$self->hmm || $self->throw('Need to specify either HMM file or Database')
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->hmm || $self->throw('Need to specify either HMM file or Database')
$self->hmm $self->throw('Need to specify either HMM file or Database')
Truth table0%0/3
A || B
A= $self->hmmB= $self->throw('Need to specify either HMM file or Database')
ABresult
1X1
011
000
494 0 $param_string .= ' '.$hmm;
495
496 0 return $param_string;
497 }
498  
499 =head2 program_name
500  
501 Title : program_name
502 Usage : $factory>program_name()
503 Function: holds the program name
504 Returns : string
505 Args : none
506  
507 =cut
508  
509 sub program_name {
510 7 ▶ my $self = shift;
Subroutine program_name: called CC=3 SCAR=11.0
Pod documented
511 7 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 6 7
512 1 $self->{program_name} = shift;
513
514 # hack so that when program_name changes, so does executable()
515 1 delete $self->{'_pathtoexe'};
516 }
517 7 ▶ return $self->{program_name} || '';
Condition50%1/2
$self->{'program_name'} || ''
l!l
70
MC/DC0%0/1
$self->{'program_name'} || ''
$self->{'program_name'}
Truth table50%1/2
A
A= $self->{'program_name'}
Aresult
11
00
518 }
519  
520 =head2 program_dir
521  
522 Title : program_dir
523 Usage : $factory->program_dir(@params)
524 Function: returns the program directory, obtained from ENV variable.
525 Returns : string
526 Args : none
527  
528 =cut
529  
530 sub program_dir {
531 3 ▶ return $ENV{HMMERDIR} if $ENV{HMMERDIR};
Subroutine program_dir: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"HMMERDIR"} 0 3 3
532 }
533  
534 =head2 _writeSeqFile
535  
536 Title : _writeSeqFile
537 Usage : obj->_writeSeqFile($seq)
538 Function: Internal(not to be used directly)
539 Returns : filename
540 Args : list of Bio::SeqI
541  
542 =cut
543  
544 sub _writeSeqFile {
545 0 ▶ my ($self, @seq) = @_;
Subroutine _writeSeqFile: not called CC=2 SCAR=17.9
546 0 my ($tfh, $inputfile) = $self->io->tempfile(-dir=>$self->tempdir);
547 0 $self->informat('fasta');
548 0 my $out = Bio::SeqIO->new(-fh => $tfh , '-format' => 'fasta');
549 0 foreach my $s (@seq) {
550 0 $out->write_seq($s);
551 }
552 0 $out->close();
553 0 $out = undef;
554 0 close($tfh);
555 0 undef $tfh;
556 0 return $inputfile;
557 }
558  
559 =head2 _writeAlignFile
560  
561 Title : _writeAlignFile
562 Usage : obj->_writeAlignFile($seq)
563 Function: Internal(not to be used directly)
564 Returns : filename
565 Args : list of Bio::Align::AlignI
566  
567 =cut
568  
569 sub _writeAlignFile{
570 0 ▶ my ($self, @align) = @_;
Subroutine _writeAlignFile: not called CC=2 SCAR=17.9
571 0 my ($tfh, $inputfile) = $self->io->tempfile(-dir=>$self->tempdir);
572 0 my $out = Bio::AlignIO->new('-fh' => $tfh, '-format' => $self->informat);
573 0 foreach my $a (@align) {
574 0 $out->write_aln($a);
575 }
576 0 $out->close();
577 0 $out = undef;
578 0 close($tfh);
579 0 undef $tfh;
580 0 return $inputfile;
581 }
582  
583 1 1;
« blib/lib/Bio/Tools/Run/Phylo/Phylip/Neighbor.pm ↑ Summary blib/lib/Bio/Tools/Run/Alignment/Pal2Nal.pm »