BioPerl-Run

 view release on metacpan or  search on metacpan

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


our $AUTOLOAD;
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 = $Bio::Tools::Run::StandAloneBlast::DATADIR;

our %GENERAL_PARAMS  = (i => 'input',
                        o => 'outfile',
                        p => 'program',
                        d => 'database');
our @BLASTALL_PARAMS = qw(A B C D E F G K L M O P Q R S W X Y Z a b e f l m q r t v w y z n);
our @BLASTALL_SWITCH = qw(I g J T U n V s);
our @BLASTPGP_PARAMS = qw(A B C E F G H I J K L M N O P Q R S T U W X Y Z a b c e f h j k l m q s t u v y z);
our @RPSBLAST_PARAMS = qw(F I J L N O P T U V X Y Z a b e l m v y z);
our @BL2SEQ_PARAMS   = qw(A D E F G I J M S T U V W X Y a e g j m q r t);

our @OTHER_PARAMS = qw(_READMETHOD);


=head2 new

 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 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

=cut

sub new {
    my ($caller, @args) = @_;
    my $self = $caller->SUPER::new(@args);
    
    # StandAloneBlast is special in that "one can modify the name of
    # the (ncbi) BLAST parameters as desired as long as the initial letter (and
    # case) of the parameter are preserved". We handle this by truncating input
    # args to their first char
    my %args = @args;
    @args = ();
    while (my ($attr, $value) = each %args) {
        $attr =~ s/^-//;
        $attr = substr($attr, 0, 1) unless $attr =~ /^_/;
        push(@args, $attr, $value);
    }
    
    $self->_set_from_args(\@args, -methods => {(map { $_ => $GENERAL_PARAMS{$_} } keys %GENERAL_PARAMS),
                                               (map { $_ => $_ } (@OTHER_PARAMS,
                                                                  @BLASTALL_PARAMS,
                                                                  @BLASTALL_SWITCH,
                                                                  @BLASTPGP_PARAMS,
                                                                  @RPSBLAST_PARAMS,
                                                                  @BL2SEQ_PARAMS))},
                                  -code => { map { $_ => 'my $self = shift;
                                                          if (@_) {
                                                              my $value = shift;
                                                              if ($value && $value ne \'F\') {
                                                                  $value = \'T\';
                                                              }
                                                              else {
                                                                  $value = \'F\';
                                                              }
                                                              $self->{\'_\'.$method} = $value;
                                                          }
                                                          return $self->{\'_\'.$method} || return;' } @BLASTALL_SWITCH },  # these methods can take boolean or 'T' and 'F'
                                  -create => 1,



( run in 1.439 second using v1.01-cache-2.11-cpan-5a3173703d6 )