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