[Bioperl-l] StandAloneBlast

BHurwitz@twt.com BHurwitz@twt.com
Fri, 25 Oct 2002 12:05:56 -0500


Hi Cory,

What you suggested is sort of the way it works now... If a user doesn't
specify the database with the -d option (as Jason mentioned) then
StandAloneBlast defaults to looking for the environmental variable.  I have
a similar situation as you, where I have multiple blastable databases in
different directories that I blast against.  Here is an example of how I
handle this in my scripts now...

#a directory containing multiple blastable databases I want to blast
against.
my $blastdbdir = /home/bhurwitz/blast/blastdbdir;

# get all of the blastable databases in the specified directory.
opendir DIR, $blastdbdir or die "Cannot open $blastdbdir\n";
my @files = readdir DIR;
close DIR;
my @blastdbs = ();
foreach my $file (@files) {
   if ($file =~ m/(nhr)/) {
      $file =~ s/(.*)\.nhr/$1/;
      push (@blastdbs, $file);
   }
}

# create a factory foreach of the blastable databases and Blast...
foreach my $db (@blastdbs) {
      my $blastdb = $blastdbdir . "/" . $db;

      my $factory = Bio::Tools::Run::StandAloneBlast->new(
                                       'program'   => 'blastn' );

       #set blast parameters.
       $factory->d($blastdb); #set the blastable database.

       # create a blast report object
       my $blast_report = $factory->blastall($query);   #some query
sequence that you provide...

      #parse....

}

This is just a rough example that seems to work for me...  Good luck!

PS:
If we are on the topic of updating Bio::Tools::Run::StandAloneBlast...we
should also consider including megablast.  I have the modified code for
Bio::Tools::Run::StandAloneBlast to do this and would be willing to
contibute it.  It was a relatively easy addition to
Bio::Tools::Run::StandAloneBlast, but it also involved modifying the BPlite
parser to create a new parser for megablast (MBPlite) and several small
changes to  BPlite::HSP and BPlite:: Sbjct.  We could also look into
changing the MB parser to SearchIO.  When I originally wrote the parser for
MB, the output format was slightly different from blast, so I had to create
an entirely separate parser.  There was a new release of the blast suite
which fixed this slight difference in the MB output, so it might be
possible to include megablast output in the SearchIO parser rather than
using the MBPlite module I am using now.

-Bonnie



                                                                                                                                                  
                    Jason Stajich                                                                                                                 
                    <jason@cgt.mc.duk        To:     Cory Spencer <cspencer@sfu.ca>                                                               
                    e.edu>                   cc:     <bioperl-l@bioperl.org>                                                                      
                    Sent by:                 Subject:     Re: [Bioperl-l] StandAloneBlast                                                         
                    bioperl-l-admin@b                                                                                                             
                    ioperl.org                                                                                                                    
                                                                                                                                                  
                                                                                                                                                  
                    10/25/2002 07:09                                                                                                              
                    AM                                                                                                                            
                                                                                                                                                  
                                                                                                                                                  




Cory -
You can specify the file just as you would on the cmd line running blast
-d PATH/TO/BLASTDB

so just specify the full path name of the db when specifying the db.

I would strongly encourage anyone wanting to see standaloneblast work
better for them to consider improving it - it currently does not have a
caretaker so no new improvements have gone in to it. It could certainly
use work to make sure it runs smoothly in lots of different situations.

Cory - would you want to make the improvements you suggest?



On Thu, 24 Oct 2002, Cory Spencer wrote:

>
> Is it currently possible to run the Bio::Tools::Run::StandAloneBlast
> module *without* having to set the BLASTDATADIR environment variable?  I
> currently have blast database files in several directories, and unless
I'm
> missing something, it's not possible to have multiple instances of
> StandAloneBlast in the same program referencing different data
> directories.  The BLASTDATADIR environment variable doesn't seem to be a
> requirement of any particular BLAST implementation, rather a requirement
> of the module itself.  It should be possible (and from my
> viewpoint, preferable) instead to add -blastdatadir/-blastdir options to
> the  constructor to facilitate this (while at the same time, defaulting
to
> the environment variable values if not provided to maintain backwards
> compatability.)
>
> Were there any particular reasons it was implemented this way?  (And have
> I managed to overlook something that I should be aware of?)
>
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu

_______________________________________________
Bioperl-l mailing list
Bioperl-l@bioperl.org
http://bioperl.org/mailman/listinfo/bioperl-l