[Bioperl-l] Problems with Bio::DB::Flat::OBDAIndex

David Iberri diberri@ucla.edu
Tue, 21 May 2002 20:07:03 -0700


Hi Andreas,

I'm not an experienced Bioperl user, so I'm not exactly sure what the
problem is. But there's at least one problem with your code that boils down
t plain old Perl.

Part of the problem is Perl's interpolation of strings inside double quotes.
Your regexp is getting interpolated before it is sent to
Bio::DB::Flat::OBDAIndex::new(). So:

> my $primarypattern = "^>\w+\|(\d+)\|";

actually gets sent into -primary_pattern as

 "^>w+|(d+)|"

instead of the intended pattern. Try using single quotes instead:

 my $primarypattern = '^>\w+\|(\d+)\|';

That may help at least the syntactical side of things.

Cheers,
David Iberri 

At 5/21/2002 10:50 AM, Andreas Matern wrote:

> I think that Bio::DB::Flat::OBDAIndex is just what I need. . . but I'm
> having a bit of a problem with the index directory.
> 
> when I do this:
> 
> my $file = "/path/to/fastafile";
> my $indexdir = "/path/to/indexdir";
> my $startpattern = "^>";
> my $primarypattern = "^>\w+\|(\d+)\|";
> my $index = new 
> Bio::DB::Flat::OBDAIndex(-start_pattern=>$startpattern,-primary_pattern=>$prim
> arypattern,-primary_namespace=>"GID");
> $index->make_index($indexdir,"myindex",$file);
> 
> 
> I get:
> 
> No index directory set - can't build indicies
> 
> So if I add the line:
> 
> $index->make_indexdir($indexdir);
> 
> I get either:
> 
> Root index directory . . . doesn't exist
> 
> or
> 
> Index directory . . . already exists. Exiting.
> 
> 
> I'm clearly missing something, can anyone help?
> 
> Thanks!
> 
> Andreas