| 1 | # | ||||||||||||||||||||
| 2 | # BioPerl module for Bio::Tools::Run::BlastPlus | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||
| 5 | # | ||||||||||||||||||||
| 6 | # Cared for by Mark A. Jensen <maj -at- fortinbras -dot- us> | ||||||||||||||||||||
| 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<blastall> 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<bioperl-l@bioperl.org> | ||||||||||||||||||||
| 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 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 78 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 1 | ▶ | use lib '../../..'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 81 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 82 | 1 | ▶ | use Bio::Tools::Run::BlastPlus::Config; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 83 | 1 | ▶ | use Bio::Tools::Run::WrapperBase; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 84 | 1 | ▶ | use Bio::Tools::Run::WrapperBase::CommandExts; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | ▶ | use base qw(Bio::Tools::Run::WrapperBase Bio::Root::Root); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 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 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||
| 99 | 1 | my ($class,@args) = @_; | |||||||||||||||||||
| 100 | 1 | ▶ | $program_dir ||= $ENV{BLASTPLUSDIR}; | ||||||||||||||||||
|
Condition33%1/3
$Bio::Tools::Run::BlastPlus::program_dir ||= $ENV{"BLASTPLUSDIR"}
MC/DC0%0/2
$Bio::Tools::Run::BlastPlus::program_dir ||= $ENV{"BLASTPLUSDIR"}
$Bio::Tools::Run::BlastPlus::program_dir
$ENV{"BLASTPLUSDIR"}
Truth table33%1/3
A ||= B
A= $Bio::Tools::Run::BlastPlus::program_dirB= $ENV{"BLASTPLUSDIR"}
| |||||||||||||||||||||
| 101 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||
| 102 | 1 | 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 | 0 | ▶ | sub program_version { | ||||||||||||||||||
|
Subroutine
program_version: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 127 | 0 | my ($self) = @_; | |||||||||||||||||||
| 128 | 0 | ▶ | if (!defined $self->{program_version}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 129 | 0 | $self->_version; | |||||||||||||||||||
| 130 | } | ||||||||||||||||||||
| 131 | 0 | ▶ | $self->{program_version} || ''; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 132 | } | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | 0 | ▶ | sub package_version { | ||||||||||||||||||
|
Subroutine
package_version: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 135 | 0 | my ($self) = @_; | |||||||||||||||||||
| 136 | 0 | ▶ | if (!defined $self->{package_version}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 137 | 0 | $self->_version; | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | 0 | ▶ | $self->{package_version} || ''; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 140 | } | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | 0 | ▶ | sub _version { | ||||||||||||||||||
|
Subroutine
_version: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 143 | 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 | ▶ | IPC::Run::run(\@ipc_args, \$in, \$out, \$err) or | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 152 | die ("There was a problem running $exe : $!"); | ||||||||||||||||||||
| 153 | }; | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | 0 | ▶ | if ($out =~ /blastdbcmd\:\s+(\S+)\n\s*Package\:\s+([^,]+)/xms) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 156 | 0 | @{$self}{qw(program_version package_version)} = ($1, $2); | |||||||||||||||||||
| 157 | } else { | ||||||||||||||||||||
| 158 | 0 | $self->throw("Unknown version output: $out"); | |||||||||||||||||||
| 159 | } | ||||||||||||||||||||
| 160 | } | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 1 | 1; | |||||||||||||||||||