[Bioperl-l] Bio::Index::Abstract & bug #860
Jason Stajich
jason@chg.mc.duke.edu
Fri, 19 Jan 2001 10:00:46 -0500 (EST)
Looking through this bug - I had 'fixed' it by adding
use DB_File; at the top, but now I realize that may not be the best
since it still causes an error when -type is specified as 'SDBM_File'.
Could just add both in the 'use' but what if DB_File is not present...
The code for the method dbm_package assumes that if you specify a package
it will have been already 'included'. What to do... Try and require both
in the BEGIN block so they are explictly loaded no matter what? Trap
errors if DB_file is not present and user asks for it?
From Bio::Index::Abstract
sub dbm_package {
my( $self, $value ) = @_;
if ($value) {
$self->{'_dbm_package'} = $value;
}
elsif (! $self->{'_dbm_package'}) {
if ($USE_DBM_TYPE) {
$self->{'_dbm_package'} = $USE_DBM_TYPE;
} else {
my( $type );
# DB_File isn't available on all systems
eval {
require DB_File;
DB_File->import("$DB_HASH");
};
if ($@) {
require SDBM_File;
$type = 'SDBM_File';
} else {
$type = 'DB_File';
}
$USE_DBM_TYPE = $self->{'_dbm_package'} = $type;
}
}
return $self->{'_dbm_package'};
}
Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center
http://www.chg.duke.edu/
---------- Forwarded message ----------
Date: Fri, 19 Jan 2001 09:55:29 +0000 (GMT)
From: K Howe <klh@sanger.ac.uk>
To: Jason Stajich <jason@chg.mc.duke.edu>
Subject: Re: biperl bug #860
Hi Jason,
We use the following command:
bpindex.pl -fmt EMBL -dir /nfs/disk92/Pfam/index -type DB_File
pfamseq.index <embl flat file>
where /nfs/disk92/Pfam/index is the intended location of the index file,
and pfamseq.index is the name of it. The key thing is that we explicitly
give the type as DB_File, and when this happens, it dies (when you don't
specify type, and it has to make a guess as to which dbm type to use, it
works, but this is not scalalble for us, since the default dmb file in
bioperl may change from DB_File in the future).
Hope this is enough information.
Best,
Kevin
On Thu, 18 Jan 2001, Jason Stajich wrote:
> Kevin - I'm trying to track down a bug you submitted for
> Bio::Index::Abstract - I may have fixed it, but I want to be sure. Can
> you give me an example of how to invoke bpfetch/bpindex so to throw an
> error due to a potentially missing require.
>
> Thanks.
> -Jason