File Coverage

blib/lib/Bio/Tools/Run/BlastPlus.pm
Criterion Covered Total %
statement 28 46 60.8
branch 0 12 0.0
condition 1 3 33.3
subroutine 9 12 75.0
pod 3 3 100.0
total 41 76 53.9


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::Tools::Run::BlastPlus
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Mark A. Jensen
7             #
8             # Copyright Mark A. Jensen
9             #
10             # You may distribute this module under the same terms as perl itself
11              
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::Tools::Run::BlastPlus - A wrapper for NCBI's blast+ suite
17              
18             =head1 SYNOPSIS
19              
20             Give standard usage here
21              
22             =head1 DESCRIPTION
23              
24             Blast+ is NCBI's successor to the C family of programs.
25              
26             =head1 FEEDBACK
27              
28             =head2 Mailing Lists
29              
30             User feedback is an integral part of the evolution of this and other
31             Bioperl modules. Send your comments and suggestions preferably to
32             the Bioperl mailing list. Your participation is much appreciated.
33              
34             bioperl-l@bioperl.org - General discussion
35             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36              
37             =head2 Support
38              
39             Please direct usage questions or support issues to the mailing list:
40              
41             L
42              
43             rather than to the module maintainer directly. Many experienced and
44             reponsive experts will be able look at the problem and quickly
45             address it. Please include a thorough description of the problem
46             with code and data examples if at all possible.
47              
48             =head2 Reporting Bugs
49              
50             Report bugs to the Bioperl bug tracking system to help us keep track
51             of the bugs and their resolution. Bug reports can be submitted via
52             the web:
53              
54             http://redmine.open-bio.org/projects/bioperl/
55              
56             =head1 AUTHOR - Mark A. Jensen
57              
58             Email maj -at- fortinbras -dot- us
59              
60             Describe contact details here
61              
62             =head1 CONTRIBUTORS
63              
64             Additional contributors names and emails here
65              
66             =head1 APPENDIX
67              
68             The rest of the documentation details each of the object methods.
69             Internal methods are usually preceded with a _
70              
71             =cut
72              
73             # Let the code begin...
74              
75              
76             package Bio::Tools::Run::BlastPlus;
77 1     1   4 use strict;
  1         1  
  1         24  
78 1     1   3 use warnings;
  1         1  
  1         19  
79              
80 1     1   3 use lib '../../..';
  1         1  
  1         4  
81 1     1   74 use Bio::Root::Root;
  1         1  
  1         14  
82 1     1   484 use Bio::Tools::Run::BlastPlus::Config;
  1         2  
  1         116  
83 1     1   527 use Bio::Tools::Run::WrapperBase;
  1         2  
  1         21  
84 1     1   622 use Bio::Tools::Run::WrapperBase::CommandExts;
  1         1  
  1         6  
85              
86 1     1   27 use base qw(Bio::Tools::Run::WrapperBase Bio::Root::Root);
  1         1  
  1         264  
87              
88             =head2 new
89              
90             Title : new
91             Usage : my $obj = new Bio::Tools::Run::BlastPlus();
92             Function: Builds a new Bio::Tools::Run::BlastPlus object
93             Returns : an instance of Bio::Tools::Run::BlastPlus
94             Args :
95              
96             =cut
97              
98             sub new {
99 1     1 1 1467 my ($class,@args) = @_;
100 1   33     7 $program_dir ||= $ENV{BLASTPLUSDIR};
101 1         5 my $self = $class->SUPER::new(@args);
102 1         6 return $self;
103             }
104              
105             =head2 program_version()
106              
107             Title : program_version
108             Usage : $version = $bedtools_fac->program_version()
109             Function: Returns the program version (if available)
110             Returns : string representing location and version of the program
111             Note : this works around the WrapperBase::version() method conflicting with
112             the -version parameter for SABlast (good argument for not having
113             getter/setters for these)
114              
115             =cut
116              
117             =head2 package_version()
118              
119             Title : package_version
120             Usage : $version = $bedtools_fac->version()
121             Function: Returns the BLAST+ package version (if available)
122             Returns : string representing BLAST+ package version (may differ from version())
123              
124             =cut
125              
126             sub program_version {
127 0     0 1   my ($self) = @_;
128 0 0         if (!defined $self->{program_version}) {
129 0           $self->_version;
130             }
131 0 0         $self->{program_version} || '';
132             }
133              
134             sub package_version {
135 0     0 1   my ($self) = @_;
136 0 0         if (!defined $self->{package_version}) {
137 0           $self->_version;
138             }
139 0 0         $self->{package_version} || '';
140             }
141              
142             sub _version {
143 0     0     my $self = shift;
144 0           my ($in, $out, $err);
145              
146             # Get program executable
147 0           my $exe = $self->executable;
148 0           my @ipc_args = ( $exe, '-version');
149            
150 0           eval {
151 0 0         IPC::Run::run(\@ipc_args, \$in, \$out, \$err) or
152             die ("There was a problem running $exe : $!");
153             };
154            
155 0 0         if ($out =~ /blastdbcmd\:\s+(\S+)\nPackage\:\s+([^,]+)/xms) {
156 0           @{$self}{qw(program_version package_version)} = ($1, $2);
  0            
157             } else {
158 0           $self->throw("Unknown version output: $out");
159             }
160             }
161              
162             1;