Bio::Tools::Run StandAloneWUBlast
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::Tools::Run::StandAloneWUBlast - Object for the local execution
of WU-Blast.
Package variables
No package variables defined.
Inherit
Bio::Tools::Run::StandAloneBlast
Synopsis
 # Do not use directly; use Bio::Tools::Run::StandAloneBlast
Description
See Bio::Tools::Run::StandAloneBlast
Methods
newDescriptionCode
AUTOLOAD
No description
Code
wublastDescriptionCode
_generic_local_wublastDescriptionCode
_runwublastDescriptionCode
_setparamsDescriptionCode
Methods description
newcode    nextTop
 Title   : new
Usage : my $obj = Bio::Tools::Run::StandAloneBlast->new();
Function: Builds a newBio::Tools::Run::StandAloneBlast object
Returns : Bio::Tools::Run::StandAloneBlast
Args : -quiet => boolean # make program execution quiet
-_READMETHOD => 'BLAST' (default, synonym 'SearchIO') || 'blast_pull'
# the parsing method, case insensitive
Essentially all BLAST parameters can be set via StandAloneBlast.pm.
Some of the most commonly used parameters are listed below. All
parameters have defaults and are optional except for -p.
  -p Program Name [String] 
Input should be one of "wublastp", "wublastn", "wublastx",
"wutblastn", or "wutblastx".
-d Database [String] default = nr
The database specified must first be formatted with xdformat.
-E Expectation value (E) [Real] default = 10.0
-o BLAST report Output File [File Out] Optional,
default = ./blastreport.out ; set by StandAloneBlast.pm
wublastcodeprevnextTop
 Title   : wublast
Usage : $blast_report = $factory->wublast('t/testquery.fa');
or
$input = Bio::Seq->new(-id=>"test query",
-seq=>"ACTACCCTTTAAATCAGTGGGGG");
$blast_report = $factory->wublast($input);
or
$seq_array_ref = \@seq_array; # where @seq_array is an array of Bio::Seq objects
$blast_report = $factory->wublast(\@seq_array);
Returns : Reference to a Blast object
Args : Name of a file or Bio::Seq object or an array of
Bio::Seq object containing the query sequence(s).
Throws an exception if argument is not either a string
(eg a filename) or a reference to a Bio::Seq object
(or to an array of Seq objects). If argument is string,
throws exception if file corresponding to string name can
not be found.
_generic_local_wublastcodeprevnextTop
 Title   : _generic_local_wublast
Usage : internal function not called directly
Returns : Blast object
Args : Reference to calling object and name of BLAST executable
_runwublastcodeprevnextTop
 Title   :  _runwublast
Usage : Internal function, not to be called directly
Function: makes actual system call to WU-Blast program
Example :
Returns : Report Blast object
Args : Reference to calling object, name of BLAST executable,
and parameter string for executable
_setparamscodeprevnextTop
 Title   : _setparams
Usage : Internal function, not to be called directly
Function: Create parameter inputs for Blast program
Example :
Returns : parameter string to be passed to Blast
Args : Reference to calling object and name of BLAST executable
Methods code
newdescriptionprevnextTop
sub new {
    my ($caller, @args) = @_;
    my $self = $caller->SUPER::new(@args);
    
    $self->_set_from_args(\@args, -methods => {(map { $_ => $GENERAL_PARAMS{$_} } keys %GENERAL_PARAMS),
                                               (map { $_ => $_ } (@OTHER_PARAMS,
                                                                  @WUBLAST_PARAMS,
                                                                  @WUBLAST_SWITCH))},
                                  -create => 1,
                                  -force => 1);
    
    my ($tfh, $tempfile) = $self->io->tempfile();
    my $outfile = $self->o || $self->outfile || $tempfile;
    $self->o($outfile);
    close($tfh);
    
    $self->_READMETHOD($DEFAULTREADMETHOD) unless $self->_READMETHOD;
    
    return $self;
}

# We let get/setter method names be case-insensitve
}
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
    my $self = shift;
    my $attr = $AUTOLOAD;
    $attr =~ s/.*:://;
    
    my $orig = $attr;
    
    $attr = lc($attr);
    
    $self->can($attr) || $self->throw("Unallowed parameter: $orig !");
    
    return $self->$attr(@_);
}
wublastdescriptionprevnextTop
sub wublast {
    my ($self, $input1) = @_;
    $self->io->_io_cleanup();
    my $executable = 'wublast';
    
    # Create input file pointer
my $infilename1 = $self->_setinput($executable, $input1) || $self->throw("$input1 not Bio::Seq object or array of Bio::Seq objects or file name!"); $self->i($infilename1); my $blast_report = $self->_generic_local_wublast($executable);
}
_generic_local_wublastdescriptionprevnextTop
sub _generic_local_wublast {
    my $self = shift;
    my $executable = shift;
    
    # Create parameter string to pass to Blast program
my $param_string = $self->_setparams($executable); $param_string = " ".$self->database." ".$self->input." ".$param_string; # run Blast
my $blast_report = $self->_runwublast($executable, $param_string);
}
_runwublastdescriptionprevnextTop
sub _runwublast {
	my ($self, $executable, $param_string) = @_;
	my ($blast_obj, $exe);
	if (! ($exe = $self->executable($self->p))){
        $self->warn("cannot find path to $executable");
        return;
	}
    
	my $commandstring = $exe.$param_string;
    
	$self->debug("$commandstring\n");
	system($commandstring) && $self->throw("$executable call crashed: $? | $! | $commandstring\n");
    
    # get outputfilename
my $outfile = $self->o(); $blast_obj = Bio::SearchIO->new(-file => $outfile, -format => 'blast'); return $blast_obj;
}
_setparamsdescriptionprevnextTop
sub _setparams {
    my ($self, $executable) = @_;
    my ($attr, $value, @execparams);
    
    @execparams = @WUBLAST_PARAMS;
    
    # of the general params, wublast only takes outfile at
# this stage (we add in program, input and database manually elsewhere)
push(@execparams, 'o'); # workaround for problems with shell metacharacters [bug 2707]
# simply quoting does not always work!
# Fixed so Windows files are not quotemeta'd
my $tmp = $self->o; $self->o(quotemeta($tmp)) if ($tmp && $^O !~ /^MSWin/); my $param_string = $self->SUPER::_setparams(-params => [@execparams], -switches =>\@ WUBLAST_SWITCH, -dash => 1); $self->o($tmp) if ($tmp && $^O !~ /^MSWin/); if ($self->quiet()) { $param_string .= ' 2> '.File::Spec->devnull; } return $param_string; } 1;
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
  bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support Top
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via
the web:
  https://redmine.open-bio.org/projects/bioperl/
AUTHOR - Peter SchattnerTop
Email schattner at alum.mit.edu
MAINTAINER - Torsten SeemannTop
Email torsten at infotech.monash.edu.au
CONTRIBUTORSTop
Sendu Bala bix@sendu.me.uk (reimplementation)
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _