[Bioperl-l] BioPerl 1.0.0: StandAloneBlast and multiple databases bug + quickfix

Michael Spitzer michael.spitzer@uni-muenster.de
Thu, 18 Apr 2002 14:09:56 +0200


Hi all!

I found a bug (I think) in StandAloneBlast.pm concerning the usage
of multiple databases (I'm using BioPerl 1.0alpha yet, but the 'buggy'
code didn't change in BioPerl 1.0.0 final release).
One can specify two or more databases to be used by BLAST as one 'virtual'
database by '-d nr est' for example.
StandAloneBlast.pm says it can, but fails to do so when 'ENV/BLASTDATADIR'
is set, because the path specified there is prepended to the databases
string (e.g. 'nr est') only once, so one gets a '/path/nr est' instead
of a '/path/nr /path/est'.
I did a quick fix for myself in subroutine '_setparams()':

original:
   if (! (-e $value.".nin" || -e $value.".pin")){
      $value = File::Spec->catdir($DATADIR,$value);
   }

fix:
   if (! (-e $value.".nin" || -e $value.".pin")){
      # do we have whitespaces in '$value'?
      if ($value =~ m/\s/) {
         my $value_tmp = "";
         # Yes, we have! -> multiple databases specified.
         # Split the database-names at spaces and prepend the
         # datadirectory to each entry
         foreach my $db (split(" ", $value)) {
            $value_tmp .= File::Spec->catdir($DATADIR,$db)." ";
         }
         # remove the last space from '$value_tmp' and add quotation
         # marks to indicate a contiguous parameter
         $value = '"'.substr($value_tmp, 0, (length($value_tmp)-1)).'"';
      }
      else { $value = File::Spec->catdir($DATADIR,$value); }
   }

It's quite quick'n'dirty, but it works. Maybe as a first help for people
facing the same problem and until it gets fixed 'officially'.
A copy of this bugreport has been put into the bug-tracking system.

Cheers, Micha
-- 
[ Michael Spitzer                ][ email: michael.spitzer@uni-muenster.de  ]
[ Integrated Functional Genomics ][ phone: +49-251-83-52207                 ]
[ von-Esmarch-Str. 56            ][ fax  : +49-251-83-55651                 ]
[ 48149 Muenster, FR Germany     ][ w3   : http://ifg-izkf.uni-muenster.de/ ]