Bioperl: Something wrong get_all_primary_ids() ?

James Gilbert jgrg@sanger.ac.uk
Wed, 14 Jun 2000 16:33:28 +0100 (BST)



Ewan,

This is fine.  I've just removed $end though,
since we don't store it any more:

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

   return values %bytepos;

	James

On Wed, 14 Jun 2000, Ewan Birney wrote:

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

James G.R. Gilbert
The Sanger Centre
Wellcome Trust Genome Campus
Hinxton
Cambridge                        Tel: 01223 494906
CB10 1SA                         Fax: 01223 494919

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