Bioperl: running local blasts

Alan Williams alan@neomorphic.com
Thu, 22 Jun 2000 09:29:12 -0700 (PDT)


Aside:
  Why does LocalBlast.pm throw an error in some situations and just
  print an error message in others in the _validate_seq method?

Your _run_local looks fine.

In LocalBlast.pm:

  * increased $maximumLength
  * changed _validate_options to only check for a known blast program
    (ie no checking for whether the database exists or not and no
     checking if the right program is used with the requested database)
  * Changed _validate_seq to NOT check for a correct sequence type and
    database program combination
  * I don't set the environmental variable stuff in the perl modules --
    we depend on the user having a proper environment to start with
    ( ie BLASTDB points to a dir with blast databases and the
      ~/.ncbirc file exists)
  * I implemented the blast_seq only (see below)

Hope this helps.

-Alan


#---------------
sub _blast_seqs {
#---------------
 
#% HACK!
 
    my $seq;
    my $tmp_seq_file;
    my $id;
    my $baseFileName;
    my $blast_cmd;  
    my $sequence;
 
    $blast_cmd = "blastall ";
 
    # Linux Hack to check for more than one processor
    my @procs;
    if (-e "/proc/cpuinfo") { @procs=`grep processor /proc/cpuinfo` }
    $blast_cmd .= "-a " . @procs ." ";  # For using both processors
 
    $blast_cmd .= "-p $program ";
    $blast_cmd .= "-d $database ";
    if($expect) {$blast_cmd .= "-e $expect ";}
    if($gappedAlignmentFlag) {$blast_cmd .= "-g $gappedAlignmentFlag ";}
    if($filter) {$blast_cmd .= "-F $filter ";}
    if($matrix) {$blast_cmd .= "-M $matrix ";}
    if($alignments) {$blast_cmd .= "-b $alignments ";}
    if($descriptions) {$blast_cmd .= "-v $descriptions ";}

    foreach $seq (@seq_queue) {

      next unless &_validate_seq($seq);

      $tmp_seq_file = POSIX::tmpnam();
      my $out = Bio::SeqIO->new(-file => ">$tmp_seq_file", -format=>
'Fasta');
      $out->write_seq($seq);
  $out->close();

      # get temp filename and final filename
      $id = $seq->id;
      $id =~ s/[|:\/\\<>]/_/g;  # remove special chars that could confuse
shell
      #$id =~ s/\.\w+?$//;  # trim off the extension if id is a filename.
      $baseFileName = "$_out_dir$id.$database.$program";


      system("echo '$blast_cmd -i $tmp_seq_file > $baseFileName'
>/tmp/bioperl_blast_cmd");

      system("$blast_cmd -i $tmp_seq_file > $baseFileName");
      unlink $tmp_seq_file;

      push @_outFiles, $baseFileName;

    }
}

---------------------------------
Alan Williams
Neomorphic, Inc.
Alan@Neomorphic.com
510-981-8513
---------------------------------

On Wed, 21 Jun 2000, Joey Morris wrote:

> Date: Wed, 21 Jun 2000 19:55:44 -0400
> From: Joey Morris <rjmorris@unity.ncsu.edu>
> To: Alan Williams <alan@neomorphic.com>
> Cc: vsns-bcd-perl@lists.uni-bielefeld.de
> Subject: Re: Bioperl: running local blasts
> 
> Well, I did both of those things (I think). For (1), I set the arrays
> Blast_dbp_local, Blast_dbn_local, and Blast_matrix_local, I set some of the
> default values (program, database, etc), and I wrote the functions
> _get_environment and _blast_files. I left the function _blast_seqs as is
> because I knew we wouldn't be using it for now. The function definitions for
> _get_environment and _blast_files were the same as the ones I used in 0.05.1
> (which worked). For (2), I changed _run_local to be
> 
> sub _run_local {
>     my ($self, %param) = @_;
>     
>     require Bio::Tools::Blast::Run::LocalBlast; 
>     Bio::Tools::Blast::Run::LocalBlast->import(qw(&blast_local));
> 
>     &blast_local($self, %param);
> }
> 
> Let me know if I skipped something.
> 
> Thanks,
> Joey
> 
> 
> Alan Williams wrote on Jun 21 at 02:46 pm:
> > 
> > I am. However it required:
> >   1) implementing the appropriate stub in the LocalBlast.pm module
> >   2) fixing Blast.pm to call LocalBlast.pm
> > This was with 0.5 and 0.6 (not sure about 0.6.1). You may also want to
> > change the MIN/MAX sequence size constraints set in the LocalBlast.pm as
> > well. 
> > 
> > If you need more detailed pointers let me know.
> > 
> > -Alan
> > 
> > ---------------------------------
> > Alan Williams
> > Neomorphic, Inc.
> > Alan@Neomorphic.com
> > 510-981-8513
> > ---------------------------------
> > 
> > On Wed, 21 Jun 2000, Joey Morris wrote:
> > 
> > > Date: Wed, 21 Jun 2000 15:58:13 -0400
> > > From: Joey Morris <rjmorris@unity.ncsu.edu>
> > > To: vsns-bcd-perl@lists.uni-bielefeld.de
> > > Subject: Bioperl: running local blasts
> > > 
> > > Can anyone tell me if they are successfully running local blast searches
> > > using the LocalBlast.pm module? I just downloaded 0.6.1 and I get this error
> > > when running a local blast:
> > > 
> > > *** 1 Blast reports produced fatal errors:
> > > Undefined subroutine &Bio::Root::Object::_rearrange called at
> > > /local/lib/perl/lib/Bio/Tools/Blast/Run/LocalBlast.pm line 309.
> > > 
> > > I experienced the same issue with 0.6.0 but not with the 0.05.1 release.
> > > I've reported it as a bug but there's been no progess on it apparently.
> > > 
> > > Thanks,
> > > Joey
> > > 
> > > =========== Bioperl Project Mailing List Message Footer =======
> > > Project URL: http://bio.perl.org/
> > > For info about how to (un)subscribe, where messages are archived, etc:
> > > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
> > > ====================================================================
> > > 
> > 
> 

=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================