Ensembl Genomes API
Auxillary Perl API for Ensembl Genomes
 All Classes Functions
Public Member Functions | List of all members
Bio::EnsEMBL::LookUp::LocalLookUp Class Reference

Public Member Functions

public new ()
 
public Registry registry ()
 
public File cache_file ()
 
public update_from_registry ()
 
public taxonomy_adaptor ()
 
protected void _register_dba ()
 
protected _dba_id ()
 
protected _get_dbc_meta ()
 
protected _hash_dba ()
 
protected _hash_dba_from_values ()
 
protected _invert_dba_hash ()
 
protected Arrayref _registry_to_hash ()
 
protected _registry_to_json ()
 
public void write_registry_to_file ()
 
public clear_cache ()
 
protected _load_registry_from_json ()
 
public load_registry_from_file ()
 
public load_registry_from_url ()
 
public Arrayref dba_to_args ()
 
protected _dba_to_locator ()
 
protected _dbc_to_locator ()
 
protected _intern_db_connections ()
 
public Arrayref get_all_DBConnections ()
 
public Arrayref get_all_dbnames ()
 
public Arrayref get_all ()
 
public get_all_by_taxon_branch ()
 
public Arrayref get_all_by_taxon_id ()
 
public Arrayref get_by_name_exact ()
 
public Arrayref get_all_by_accession ()
 
public
Bio::EnsEMBL::DBSQL::DatabaseAdaptor 
get_by_assembly_accession ()
 
public Arrayref get_all_by_name_pattern ()
 
public Arrayref get_all_by_dbname ()
 
public Arrayref get_all_taxon_ids ()
 
public Arrayref get_all_names ()
 
public Arrayref get_all_accessions ()
 
public Arrayref get_all_versioned_accessions ()
 
public Arrayref get_all_assemblies ()
 
public Arrayref get_all_versioned_assemblies ()
 
public void register_all_dbs ()
 
protected _register_singlespecies_core ()
 
protected _register_multispecies_core ()
 
protected _register_multispecies_x ()
 
protected _query_multispecies_db ()
 
protected _add_aliases ()
 
protected _runtime_include ()
 
protected _check_name ()
 
protected _login_hash ()
 

Detailed Description

Synopsis

# 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');

Description

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

Member Function Documentation

protected Bio::EnsEMBL::LookUp::LocalLookUp::_add_aliases ( )
   Description : Registry all aliases
    Argument    : Species name
    Argument    : Arrayref of alias strings
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_check_name ( )
   Description : Check that the name is not longer than 64 characters
    Argument    : Name to check
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dba_id ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dba_to_locator ( )
   Description : return a hash key for a DBAdaptor
    Argument    : Bio::EnsEMBL::DBAdaptor
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_dbc_to_locator ( )
   Description : return a hash key for a DBConnection
    Argument    : Bio::EnsEMBL::DBConnection
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_get_dbc_meta ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_hash_dba ( )
   Description : Add details from a DBAdaptor to the internal hashes of details
    Argument    : Bio::EnsEMBL::DBAdaptor
    Argument    : (optional) If set to 1, do not update from a DBAdaptor if already processed (allows updates of an existing LookUp instance)
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_hash_dba_from_values ( )
   Description : Add supplied details to the internal hashes of details
    Argument    : Bio::EnsEMBL::DBAdaptor to hash
    Argument    : Arrayref of taxonomy IDs to use as keys
    Argument    : Arrayref of aliases to use as keys
    Argument    : Arrayref of ENA accessions to use as keys
 
Code:
click to view
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
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_invert_dba_hash ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_load_registry_from_json ( )
   Description : load the registry from the supplied JSON string
    Argument    : JSON string
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_login_hash ( )
   Description : Generate dbadaptor login hash from supplied arguments
    Argument    : Host
    Argument    : Port
    Argument    : User
    Argument    : Password
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_query_multispecies_db ( )
   Description : Find all species in the multispecies database
 
Code:
click to view
protected void Bio::EnsEMBL::LookUp::LocalLookUp::_register_dba ( )
   Description : Add a single DBAdaptor to the registry and the internal hashes of details
    Argument    : Bio::EnsEMBL::DBAdaptor
    Return      : None
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_multispecies_core ( )
   Description : Register core dbas for all species in the supplied database
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_multispecies_x ( )
   Description : Register specified dba type for all species in the supplied database
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_register_singlespecies_core ( )
   Description : Register core dbas for all species in the supplied database
 
Code:
click to view
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
 
Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_registry_to_json ( )

Undocumented method

Code:
click to view
protected Bio::EnsEMBL::LookUp::LocalLookUp::_runtime_include ( )
   Description : Load the specified module (usually a DatabaseAdaptor)
    Argument    : Module name
 
Code:
click to view
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
 
Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::clear_cache ( )

Undocumented method

Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::dba_to_args ( )
   Description : Dump the arguments needed for contructing a DBA
    Argument    : Bio::EnsEMBL::DBAdaptor
    Return      : Arrayref of args
 
Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all ( )
   Description : Return all database adaptors that have been retrieved from registry
    Argument    : None
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
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
 
Code:
click to view
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
 
Code:
click to view
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)
    Argument    : Int
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_dbname ( )
   Description : Returns all database adaptors that have the supplied dbname
    Argument    : String
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
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
    Argument    : String
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_taxon_branch ( )

Undocumented method

Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_by_taxon_id ( )
   Description : Returns all database adaptors that have the supplied taxonomy ID
    Argument    : Int
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_DBConnections ( )
   Description : Return all database connections used by the DBAs retrieved from the registry
    Argument    : None
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DBConnection
 
Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_all_dbnames ( )
   Description : Return all database names used by the DBAs retrieved from the registry
    Argument    : None
    Exceptions  : None
    Return type : Arrayref of strings
 
Code:
click to view
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
 
Code:
click to view
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
 
Code:
click to view
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
 
Code:
click to view
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
 
Code:
click to view
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
    Argument    : Int
    Exceptions  : None
    Return type : Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
public Arrayref Bio::EnsEMBL::LookUp::LocalLookUp::get_by_name_exact ( )
   Description : Return all database adaptors that have the supplied string as an alias/name
    Argument    : String
    Exceptions  : None
    Return type : Arrayref of Bio::EnsEMBL::DBSQL::DatabaseAdaptor
 
Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::load_registry_from_file ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::load_registry_from_url ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::new ( )

Undocumented method

Code:
click to view
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
    Argument    : Host
    Argument    : Port
    Argument    : User
    Argument    : Password
    Argument    : (optional) String with database regexp (default is _collection_core_[0-9]_eVersion_[0-9]+)
    Exceptions  : None
    Return type : None
 
Code:
click to view
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
 
Code:
click to view
public Bio::EnsEMBL::LookUp::LocalLookUp::taxonomy_adaptor ( )

Undocumented method

Code:
click to view
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.
    Argument    : (optional) If set to 1, do not update from a DBAdaptor if already processed (allows updates of an existing LookUp instance)
    Exceptions  : None
 
Code:
click to view
public void Bio::EnsEMBL::LookUp::LocalLookUp::write_registry_to_file ( )
   Description : Write the contents of the registry and species lists to a JSON file
    Argument    : File name
    Return      : None
 
Code:
click to view

The documentation for this class was generated from the following file: