# creation from a database server Bio::EnsEMBL::LookUp::LocalLookUp->register_all_dbs( $conf->{host}, $conf->{port}, $conf->{user}, $conf->{pass}, $conf->{db}); my $lookup = Bio::EnsEMBL::LookUp::LocalLookUp->new(); my $dbas = $lookup->registry()->get_all(); $dbas = $lookup->get_all_by_taxon_id(388919); $dbas = $lookup->get_by_name_pattern("Escherichia.*"); # creation from a URL my $lookup = Bio::EnsEMBL::LookUp::::LocalLookUp->new(-URL=>'http://bacteria.ensembl.org/registry.json');
This module is an implementation of Bio::EnsEMBL::LookUp that uses a local hash to store information about available Ensembl Genomes data. It can be constructed in a number of different ways: A remote cache file containing a JSON representation of the hash can be supplied: my $lookup = Bio::EnsEMBL::LookUp::LocalLookUp->new(-URL=>'http://bacteria.ensembl.org/registry.json'); Alternatively, a local file containing the required JSON can be specified instead: my $lookup = Bio::EnsEMBL::LookUp::LocalLookUp->new(-FILE=>"/path/to/reg.json"); Finally, a Registry already loaded with core databases can be supplied: my $lookup = Bio::EnsEMBL::LookUp::LocalLookUp->new(-REGISTRY=>'Bio::EnsEMBL::Registry'); If the standard Registry is used, the Arg can be omitted completely: my $lookup = Bio::EnsEMBL::LookUp::LocalLookUp->new(); To populate the registry with just the Ensembl Genomes databases for the current software release on a specified server, the following method can be used: Bio::EnsEMBL::LookUp::LocalLookUp->register_all_dbs( $host, $port, $user, $pass); Once a lookup has been created, it can be used as specified in Bio::EnsEMBL::LookUp
Definition at line 66 of file LocalLookUp.pm.
Available Methods | |
protected | _add_aliases () |
protected | _check_name () |
protected | _dba_id () |
protected | _dba_to_locator () |
protected | _dbc_to_locator () |
protected | _get_dbc_meta () |
protected | _hash_dba () |
protected | _hash_dba_from_values () |
protected | _intern_db_connections () |
protected | _invert_dba_hash () |
protected | _load_registry_from_json () |
protected | _login_hash () |
protected | _query_multispecies_db () |
protected void | _register_dba () |
protected | _register_multispecies_core () |
protected | _register_multispecies_x () |
protected | _register_singlespecies_core () |
protected Arrayref | _registry_to_hash () |
protected | _registry_to_json () |
protected | _runtime_include () |
public File | cache_file () |
public | clear_cache () |
public Arrayref | dba_to_args () |
public Arrayref | get_all () |
public Arrayref | get_all_accessions () |
public Arrayref | get_all_assemblies () |
public Arrayref | get_all_by_accession () |
public Arrayref | get_all_by_dbname () |
public Arrayref | get_all_by_name_pattern () |
public | get_all_by_taxon_branch () |
public Arrayref | get_all_by_taxon_id () |
public Arrayref | get_all_DBConnections () |
public Arrayref | get_all_dbnames () |
public Arrayref | get_all_names () |
public Arrayref | get_all_taxon_ids () |
public Arrayref | get_all_versioned_accessions () |
public Arrayref | get_all_versioned_assemblies () |
public Bio::EnsEMBL::DBSQL::DatabaseAdaptor | get_by_assembly_accession () |
public Arrayref | get_by_name_exact () |
public | load_registry_from_file () |
public | load_registry_from_url () |
public | new () |
public void | register_all_dbs () |
public Registry | registry () |
public Bio::EnsEMBL::Taxonomy::DBSQL::DBAdaptor | taxonomy_adaptor () |
public | update_from_registry () |
public void | write_registry_to_file () |
protected Bio::EnsEMBL::LookUp::LocalLookUp::_add_aliases | ( | ) |
Description : Registry all aliases Arg : Species name Arg : Arrayref of alias strings
protected Bio::EnsEMBL::LookUp::LocalLookUp::_check_name | ( | ) |
Description : Check that the name is not longer than 64 characters Arg : Name to check
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dba_id | ( | ) |
Undocumented method
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dba_to_locator | ( | ) |
Description : return a hash key for a DBAdaptor Arg : Bio::EnsEMBL::DBAdaptor
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dbc_to_locator | ( | ) |
Description : return a hash key for a DBConnection Arg : Bio::EnsEMBL::DBConnection
protected Bio::EnsEMBL::LookUp::LocalLookUp::_get_dbc_meta | ( | ) |
Undocumented method
protected Bio::EnsEMBL::LookUp::LocalLookUp::_hash_dba | ( | ) |
Description : Add details from a DBAdaptor to the internal hashes of details Arg : Bio::EnsEMBL::DBAdaptor Arg : (optional) If set to 1, do not update from a DBAdaptor if already processed (allows updates of an existing LookUp instance)
protected Bio::EnsEMBL::LookUp::LocalLookUp::_hash_dba_from_values | ( | ) |
Description : Add supplied details to the internal hashes of details Arg : Bio::EnsEMBL::DBAdaptor to hash Arg : Arrayref of taxonomy IDs to use as keys Arg : Arrayref of aliases to use as keys Arg : Arrayref of ENA accessions to use as keys
protected Bio::EnsEMBL::LookUp::LocalLookUp::_intern_db_connections | ( | ) |
Description : Go through all available DBAdaptors of registry and ensure they use the same DBConnection instance. Exceptions : None Status : At Risk
protected Bio::EnsEMBL::LookUp::LocalLookUp::_invert_dba_hash | ( | ) |
Undocumented method
protected Bio::EnsEMBL::LookUp::LocalLookUp::_load_registry_from_json | ( | ) |
Description : load the registry from the supplied JSON string Arg : JSON string
protected Bio::EnsEMBL::LookUp::LocalLookUp::_login_hash | ( | ) |
Description : Generate dbadaptor login hash from supplied Args Arg : Host Arg : Port Arg : User Arg : Password
protected Bio::EnsEMBL::LookUp::LocalLookUp::_query_multispecies_db | ( | ) |
Description : Find all species in the multispecies database
protected void Bio::EnsEMBL::LookUp::LocalLookUp::_register_dba | ( | ) |
Description : Add a single DBAdaptor to the registry and the internal hashes of details Arg : Bio::EnsEMBL::DBSQL::DBAdaptor Return : None
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_multispecies_core | ( | ) |
Description : Register core dbas for all species in the supplied database
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_multispecies_x | ( | ) |
Description : Register specified dba type for all species in the supplied database
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_singlespecies_core | ( | ) |
Description : Register core dbas for all species in the supplied database
protected Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::_registry_to_hash | ( | ) |
Description : Generate a hash array structure for the current registry and species details for turning to JSON Returns : Arrayref of hashes
protected Bio::EnsEMBL::LookUp::LocalLookUp::_registry_to_json | ( | ) |
Undocumented method
protected Bio::EnsEMBL::LookUp::LocalLookUp::_runtime_include | ( | ) |
Description : Load the specified module (usually a DatabaseAdaptor) Arg : Module name
public File Bio::EnsEMBL::LookUp::LocalLookUp::cache_file | ( | ) |
Arg [1] : File to use for local caching Description : Sets and retrieves the local cache file Returntype : File name if set; otherwise undef Status : Stable
public Bio::EnsEMBL::LookUp::LocalLookUp::clear_cache | ( | ) |
Undocumented method
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::dba_to_args | ( | ) |
Description : Dump the Args needed for contructing a DBA Arg : Bio::EnsEMBL::DBAdaptor Return : Arrayref of args
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all | ( | ) |
Description : Return all database adaptors that have been retrieved from registry Arg : None Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_accessions | ( | ) |
Description : Return list of all INSDC sequence accessions (or other seq_region names) registered with the helper Exceptions : None Return type : Arrayref of strings
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_assemblies | ( | ) |
Description : Return list of all INSDC assembly accessions registered with the helper Exceptions : None Return type : Arrayref of strings
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_accession | ( | ) |
Description : Returns the database adaptor(s) that contains a seq_region with the supplied INSDC accession (or other seq_region name) Arg : Int Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_dbname | ( | ) |
Description : Returns all database adaptors that have the supplied dbname Arg : String Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_name_pattern | ( | ) |
Description : Return all database adaptors that have an alias/name that match the supplied regexp Arg : String Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_taxon_branch | ( | ) |
Undocumented method
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_taxon_id | ( | ) |
Description : Returns all database adaptors that have the supplied taxonomy ID Arg : Int Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_DBConnections | ( | ) |
Description : Return all database connections used by the DBAs retrieved from the registry Arg : None Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DBConnection
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_dbnames | ( | ) |
Description : Return all database names used by the DBAs retrieved from the registry Arg : None Exceptions : None Return type : Arrayref of strings
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_names | ( | ) |
Description : Return list of all species names registered with the helper Exceptions : None Return type : Arrayref of strings
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_taxon_ids | ( | ) |
Description : Return list of all taxon IDs registered with the helper Exceptions : None Return type : Arrayref of integers
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_versioned_accessions | ( | ) |
Description : Return list of all versioned INSDC sequence accessions (or other seq_region names) registered with the helper Exceptions : None Return type : Arrayref of strings
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_versioned_assemblies | ( | ) |
Description : Return list of all versioned INSDC assembly accessions registered with the helper Exceptions : None Return type : Arrayref of strings
public Bio::EnsEMBL::DBSQL::DatabaseAdaptor Bio::EnsEMBL::LookUp::LocalLookUp::get_by_assembly_accession | ( | ) |
Description : Returns the database adaptor that contains the assembly with the supplied INSDC assembly accession Arg : Int Exceptions : None Return type : Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_by_name_exact | ( | ) |
Description : Return all database adaptors that have the supplied string as an alias/name Arg : String Exceptions : None Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
public Bio::EnsEMBL::LookUp::LocalLookUp::load_registry_from_file | ( | ) |
Undocumented method
public Bio::EnsEMBL::LookUp::LocalLookUp::load_registry_from_url | ( | ) |
Undocumented method
public Bio::EnsEMBL::LookUp::LocalLookUp::new | ( | ) |
Undocumented method
public void Bio::EnsEMBL::LookUp::LocalLookUp::register_all_dbs | ( | ) |
Description : Helper method to load the registry with all multispecies core databases on the supplied server Arg : Host Arg : Port Arg : User Arg : Password Arg : (optional) String with database regexp (default is _collection_core_[0-9]_eVersion_[0-9]+) Exceptions : None Return type : None
public Registry Bio::EnsEMBL::LookUp::LocalLookUp::registry | ( | ) |
Arg [1] : Registry module to use (default is Bio::EnsEMBL::Registry) Description : Sets and retrieves the Registry Returntype : Registry if set; otherwise undef Exceptions : if an attempt is made to set the value more than once Status : Stable
public Bio::EnsEMBL::Taxonomy::DBSQL::DBAdaptor Bio::EnsEMBL::LookUp::LocalLookUp::taxonomy_adaptor | ( | ) |
Description : Get/set the taxonomy adaptor Arg : (optional) Bio::EnsEMBL::Taxonomy::DBSQL::DBAdaptor Caller : Internal Status : Stable Return : Bio::EnsEMBL::Taxonomy::DBSQL::DBAdaptor
public Bio::EnsEMBL::LookUp::LocalLookUp::update_from_registry | ( | ) |
Description : Update internal hashes of database adaptors by name/taxids from the registry. Invoke when registry has been updated independently. Arg : (optional) If set to 1, do not update from a DBAdaptor if already processed (allows updates of an existing LookUp instance) Exceptions : None
public void Bio::EnsEMBL::LookUp::LocalLookUp::write_registry_to_file | ( | ) |
Description : Write the contents of the registry and species lists to a JSON file Arg : File name Return : None