BioPerl-Run

 view release on metacpan or  search on metacpan

lib/Bio/Tools/Run/StandAloneBlast.pm  view on Meta::CPAN

use base qw(Bio::Tools::Run::WrapperBase Bio::Factory::ApplicationFactoryI);

our $AUTOLOAD;
our $DEFAULTBLASTTYPE = 'NCBI';
our $DEFAULTREADMETHOD = 'BLAST';

# If local BLAST databases are not stored in the standard
# /data directory, the variable BLASTDATADIR will need to be 
# set explicitly 
our $DATADIR = $ENV{'BLASTDATADIR'} || $ENV{'BLASTDB'};
if (! defined $DATADIR && defined $ENV{'BLASTDIR'}) {
    my $dir = Bio::Root::IO->catfile($ENV{'BLASTDIR'}, 'data');
    if (-d $dir) {
        $DATADIR = $dir;
    }
    elsif ($ENV{'BLASTDIR'} =~ /bin/) {
        $dir = $ENV{'BLASTDIR'};
        $dir =~ s/bin/data/;
        $DATADIR = $dir if -d $dir;
    }
}

=head2 new

 Title   : new
 Usage   : my $obj = Bio::Tools::Run::StandAloneBlast->new();
 Function: Builds a newBio::Tools::Run::StandAloneBlast object 
 Returns : Bio::Tools::Run::StandAloneNCBIBlast or StandAloneWUBlast
 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 in those programs that
have it. For a complete listing of settable parameters, run the relevant
executable BLAST program with the option "-" as in blastall -
Note that the input parameters (-i, -j, -input) should not be set directly by
you: this module sets them when you call one of the executable methods.

Blastall

  -p  Program Name [String]
        Input should be one of "blastp", "blastn", "blastx", 
        "tblastn", or "tblastx".
  -d  Database [String] default = nr
        The database specified must first be formatted with formatdb.
        Multiple database names (bracketed by quotations) will be accepted.
        An example would be -d "nr est"
  -e  Expectation value (E) [Real] default = 10.0
  -o  BLAST report Output File [File Out]  Optional,
	    default = ./blastreport.out ; set by StandAloneBlast.pm		
  -S  Query strands to search against database (for blast[nx], and tblastx). 3 is both, 1 is top, 2 is bottom [Integer]
	    default = 3

Blastpgp (including Psiblast)

  -j  is the maximum number of rounds (default 1; i.e., regular BLAST)
  -h  is the e-value threshold for including sequences in the
	    score matrix model (default 0.001)
  -c  is the "constant" used in the pseudocount formula specified in the paper (default 10)
  -B  Multiple alignment file for PSI-BLAST "jump start mode"  Optional
  -Q  Output File for PSI-BLAST Matrix in ASCII [File Out]  Optional

rpsblast

  -d  Database [String] default = (none - you must specify a database)
        The database specified must first be formatted with formatdb.
        Multiple database names (bracketed by quotations) will be accepted.
        An example would be -d "Cog Smart"
  -e  Expectation value (E) [Real] default = 10.0
  -o  BLAST report Output File [File Out]  Optional,
	    default = ./blastreport.out ; set by StandAloneBlast.pm		

Bl2seq

  -p  Program name: blastp, blastn, blastx. For blastx 1st argument should be nucleotide [String]
    default = blastp
  -o  alignment output file [File Out] default = stdout
  -e  Expectation value (E) [Real]  default = 10.0
  -S  Query strands to search against database (blastn only).  3 is both, 1 is top, 2 is bottom [Integer]
    default = 3

WU-Blast

  -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		

=cut

sub new {
    my ($caller, @args) = @_;
    my $class = ref($caller) || $caller;
    
    # Because of case-sensitivity issues, ncbi and wublast methods are
    # mutually exclusive. We can't load ncbi methods if we start with wublast
    # (and vice versa) since wublast e() and E() should be the same thing,
    # whilst they must be different things in ncbi blast.
    #
    # Solution: split StandAloneBlast out into two more modules for NCBI and WU
    
    if ($class =~ /NCBI|WU/) {
        return $class->SUPER::new(@args);
    }
    
    my %args = @args;
    my $blasttype = $DEFAULTBLASTTYPE;
    while (my ($attr, $value) = each %args) {
        if ($attr =~/^-?\s*program\s*$|^-?p$/) {
            if ($value =~ /^wu*/) {
                $blasttype = 'WU';
            }
        }
    }
    



( run in 1.637 second using v1.01-cache-2.11-cpan-cd2fffc590a )