Bioperl: Something wrong get_all_primary_ids() ?

Kris Boulez krbou@pgsgent.be
Tue, 13 Jun 2000 12:18:52 +0200


When using the get_all_primary_ids() method on a Bio::Index object I got
back less id's then expected. Looking at the code in Bio::Index::AbstractSeq

    my( %bytepos );
   while (my($id, $rec) = each %$db) {
       my ($file, $begin, $end) = $self->unpack_record( $rec );
       $bytepos{$begin} = $id;
   }

   return values %bytepos;

I think $begin is not unique enough as key to %bytepos (same place in
multiple files). Wouldn't it be better to replace this with

    my( %bytepos );
    my ($t);
   while (my($id, $rec) = each %$db) {
       my ($file, $begin, $end) = $self->unpack_record( $rec );
       $bytepos{++$t} = $id;
   }

   return values %bytepos;

It might be asked if (in this case) an array is not a better data structure.


P.S. I'm hoping I'm not making a fool of me by overlooking something
simple :).

Kris,
=========== 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
====================================================================