Bioperl: Something wrong get_all_primary_ids() ?
Ewan Birney
birney@ebi.ac.uk
Wed, 14 Jun 2000 09:47:11 +0100 (GMT)
On Tue, 13 Jun 2000, Kris Boulez wrote:
> 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
Good spot Kris. It should be
"$file:$bytepos"
This is because a single sequence could be indexed under more than one
identifier.
I have made this change on the 06 stable branch and main trunk - James -
you might want to code review this. ;)
>
> 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
> ====================================================================
>
-----------------------------------------------------------------
Ewan Birney. Mobile: +44 (0)7970 151230, Work: +44 1223 494420
<birney@ebi.ac.uk>.
-----------------------------------------------------------------
=========== 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
====================================================================