Bio::DB::Registry get_all_primary_ids

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bio::DB::Registry get_all_primary_ids

Daniel Lang-3
Hi,

I stumbled over a problem in the Registry modules:
I wanted to use the method get_all_primary_ids as laid out in
Bio::DB::SeqI.
The Bio::DB::Failover object as returned by the get_database method
doesn't support this method while the (in my case) attached
Bio::DB::Flat::BinarySearch object does!
How can I comfortably call this method on the object?

For now I'm using something "ugly" like:
$db->{_database}->[0]->get_all_primary_ids

Here is my object dump (Its describing a local sprot.dat):
Bio::DB::Failover=HASH(0x87ca9a0)
   '_database' => ARRAY(0x8b721a4)
      0  Bio::DB::Flat::BinarySearch=HASH(0x8bbacdc)
         '_dbfile' => HASH(0x8d02f54)
            '/home/lang/projects/core_ortho/uniprot_sprot.dat' => 0
         '_file' => HASH(0x8bbaf70)
            0 => '/home/lang/projects/core_ortho/uniprot_sprot.dat'
         '_fileid' => HASH(0x8d13ab4)
            0 => GLOB(0x8d42adc)
               -> *Bio::DB::Flat::BinarySearch::$fh
                     FileHandle({*Bio::DB::Flat::BinarySearch::$fh}) =>
fileno(9)
         '_index_directory' => '/home/lang/projects/core_ortho/'
         '_index_type' => 'flat'
         '_index_version' => 1
         '_primary_index_handle' => GLOB(0x8d13db4)
            -> *Bio::DB::Flat::BinarySearch::$__ANONIO__

FileHandle({*Bio::DB::Flat::BinarySearch::$__ANONIO__}) => fileno(8)
         '_primary_namespace' => undef
         '_record_size' => 29
         '_root_verbose' => 0
         '_size' => HASH(0x8d42e48)
            0 => 796304807
         '_start_pos' => 4
         'flat_dbname' => 'test'
         'format' => 'swiss'
         'primary_pattern' => undef
         'secondary_namespaces' => ARRAY(0x8b8f774)
            0  'ACC'
         'start_pattern' => undef

As far as I understand it, the corresponding method needs to be
implemented in Failover?

In addition I'm somewhat confused by the term "Failover" - but since the
 retrieval is working like its supposed to...

Thanks in advance,
Daniel

--

Daniel Lang
University of Freiburg, Plant Biotechnology
Schaenzlestr. 1, D-79104 Freiburg
fax: +49 761 203 6945
phone: +49 761 203 6974
homepage:  http://www.plant-biotech.net/
e-mail: [hidden email]

#################################################
My software never has bugs.
It just develops random features.
#################################################



_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

RE: Bio::DB::Registry get_all_primary_ids

Marc Logghe
Hi Daniel,
As far as I can see, you are using actually only 1 database (no need to
use Bio::DB::Failover), of type Bio::DB::Flat::BinarySearch.
Using a Bio::DB::Failover object you can attach multiple databases (e.g.
Bio::DB::SeqI compliant objects). In case it fails to fetch a seq from
the first database in the list, it will try the second and so on.
Bio::DB::Failover ISA Bio::DB::RandomAccessI while
Bio::DB::Flat::BinarySearch ISA Bio::DB::SeqI. In the first case an
implementation of get_all_primary_ids is not necessary, in contrast to
the latter case.
So, you might think of using Bio::DB::Flat::BinarySearch directly if you
depend on that method and you need only 1 database.
Hope it all makes sense cos I don't have much experience with these
modules.
Cheers,
Marc

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Daniel Lang
> Sent: Wednesday, January 04, 2006 11:01 AM
> To: Bioperl list
> Subject: [Bioperl-l] Bio::DB::Registry get_all_primary_ids
>
> Hi,
>
> I stumbled over a problem in the Registry modules:
> I wanted to use the method get_all_primary_ids as laid out in
> Bio::DB::SeqI.
> The Bio::DB::Failover object as returned by the get_database
> method doesn't support this method while the (in my case)
> attached Bio::DB::Flat::BinarySearch object does!
> How can I comfortably call this method on the object?
>
> For now I'm using something "ugly" like:
> $db->{_database}->[0]->get_all_primary_ids
>
> Here is my object dump (Its describing a local sprot.dat):
> Bio::DB::Failover=HASH(0x87ca9a0)
>    '_database' => ARRAY(0x8b721a4)
>       0  Bio::DB::Flat::BinarySearch=HASH(0x8bbacdc)
>          '_dbfile' => HASH(0x8d02f54)
>             '/home/lang/projects/core_ortho/uniprot_sprot.dat' => 0
>          '_file' => HASH(0x8bbaf70)
>             0 => '/home/lang/projects/core_ortho/uniprot_sprot.dat'
>          '_fileid' => HASH(0x8d13ab4)
>             0 => GLOB(0x8d42adc)
>                -> *Bio::DB::Flat::BinarySearch::$fh
>                      
> FileHandle({*Bio::DB::Flat::BinarySearch::$fh}) =>
> fileno(9)
>          '_index_directory' => '/home/lang/projects/core_ortho/'
>          '_index_type' => 'flat'
>          '_index_version' => 1
>          '_primary_index_handle' => GLOB(0x8d13db4)
>             -> *Bio::DB::Flat::BinarySearch::$__ANONIO__
>
> FileHandle({*Bio::DB::Flat::BinarySearch::$__ANONIO__}) => fileno(8)
>          '_primary_namespace' => undef
>          '_record_size' => 29
>          '_root_verbose' => 0
>          '_size' => HASH(0x8d42e48)
>             0 => 796304807
>          '_start_pos' => 4
>          'flat_dbname' => 'test'
>          'format' => 'swiss'
>          'primary_pattern' => undef
>          'secondary_namespaces' => ARRAY(0x8b8f774)
>             0  'ACC'
>          'start_pattern' => undef
>
> As far as I understand it, the corresponding method needs to
> be implemented in Failover?
>
> In addition I'm somewhat confused by the term "Failover" -
> but since the  retrieval is working like its supposed to...
>
> Thanks in advance,
> Daniel
>
> --
>
> Daniel Lang
> University of Freiburg, Plant Biotechnology Schaenzlestr. 1,
> D-79104 Freiburg
> fax: +49 761 203 6945
> phone: +49 761 203 6974
> homepage:  http://www.plant-biotech.net/
> e-mail: [hidden email]
>
> #################################################
> My software never has bugs.
> It just develops random features.
> #################################################
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> [hidden email]
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

RE: Bio::DB::Registry get_all_primary_ids

Daniel Lang-3
Hi Marc,

sorry for my late reply!
Thanks, for your answer!

Am Mittwoch, den 04.01.2006, 14:01 +0100 schrieb Marc Logghe:
> As far as I can see, you are using actually only 1 database (no need to
> use Bio::DB::Failover), of type Bio::DB::Flat::BinarySearch.
I'm actually retrieving from more than one database (different formats).
Not to litter this list I just provided one object dump:)
My last remark concerning Failover was, whether it is normal, that I'm
getting a Failover object when asking for a Registry database like:
$db=$registry->get_database('test');

> Using a Bio::DB::Failover object you can attach multiple databases (e.g.
> Bio::DB::SeqI compliant objects). In case it fails to fetch a seq from
> the first database in the list, it will try the second and so on.
> Bio::DB::Failover ISA Bio::DB::RandomAccessI while
> Bio::DB::Flat::BinarySearch ISA Bio::DB::SeqI. In the first case an
> implementation of get_all_primary_ids is not necessary, in contrast to
> the latter case.
> So, you might think of using Bio::DB::Flat::BinarySearch directly if you
> depend on that method and you need only 1 database.
So is there a method to call the Bio::DB::Flat::BinarySearch attached to
the Failover object, which allows me to call all methods suggested by
Bio::DB::SeqI on?
For I want to get rid of the ugly hashref and arrayref invocations:
$db->{_database}->[0]->get_all_primary_ids

Cheers,

Daniel:)

_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l