.

Ensembl Registry

Introduction

The Registry system allows to tell your programs where to find the EnsEMBL databases and how to connect to them.

Use

The following call will load all the "latest" databases from the public Ensembl MySQL server ensembldb.ensembl.org:

Bio::EnsEMBL::Registry->load_registry_from_db(
    -host => 'ensembldb.ensembl.org',
    -user => 'anonymous',
    -verbose => "1" );

Port and Password are the other allowed parameters to this subroutine. The latest database is the one with the highest release for each species.

Alternatively, a custom registry configuration file could be typically loaded at the beginning of the script using the command:

Bio::EnsEMBL::Registry->load_all();

This method loads the Registry from the configuration file passed as an argument. If no argument is supplied, it tries to use the file defined in the environment variable ENSEMBL_REGISTRY. It uses the file .ensembl_init if all the previous fail.

Registry Configuration File

The Registry configuration file for the Perl API is a Perl file which defines the DBAdaptors you will need in your scripts. You probably want to start with a:

use strict;

clause. You will have to import some modules:

use Bio::EnsEMBL::Utils::ConfigRegistry;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;

The first one will allow you to define some aliases for the databases. The second module is needed if you want to configure EnsEMBL core databases and the third one is needed for the EnsEMBL Compara databases. You may need other DBAdaptors for connecting to an EnsEMBL Variation database for instance. Next, you have to declare your DBAdaptors. For each database you will need to create a new object. You will have to create Bio::EnsEMBL::DBSQL::DBAdaptor objects for EnsEMBL core database, Bio::EnsEMBL::Compara::DBSQL::DBAdaptor objects for EnsEMBL Compara databases and so on. You will have to define the database host, the port (3306 is the default value), the name of the database, the type of database (core, compara, variation, vega...) and the species to which this database refers to. You may also add some aliases of the name using the Bio::EnsEMBL::Utils::ConfigRegistry module. Here is an example for the public human EnsEMBL Core database (release 30):

new Bio::EnsEMBL::DBSQL::DBAdaptor(
    -host    => 'ensembldb.ensembl.org',
    -user    => 'anonymous',
    -port    => 3306,
    -species => 'Homo sapiens',
    -group   => 'core',
    -dbname  => 'homo_sapiens_core_30_35c' );

my @aliases = ('H_Sapiens', 'human');

Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
    -species => "Homo sapiens",
    -alias   => \@aliases );

From release to release, you will have to change the dbname parameter. In order to find out the exact name of the new database you can use the "show databases" command of mysql:

shell> mysql -u anonymous -h ensembldb.ensembl.org -P 3306
mysql> show databases like "homo_sapiens_core_%";

The species name can be whatever you want and you may add as many aliases as you want, BUT:

  1. You should not have two databases with the same name or alias.

  2. If you intend to use the EnsEMBL Compara API, you need to use the standard binomial name as the species name or any of the aliases as the API relies on this in order to connect to the right EnsEMBL Core database.

For connecting to the EnsEMBL Compara database, you will have to create a Bio::EnsEMBL::Compara::DBSQL::DBAdaptor. Here is an example:

new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor(
    -host    => 'ensembldb.ensembl.org',
    -user    => 'anonymous',
    -port    => 3306,
    -species => 'Compara30',
    -dbname  => 'ensembl_compara_30' );

@aliases = ('ensembl_compara_30', 'compara30', 'compara');

Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
		-species => "Compara30",
		-alias   => \@aliases );

Finally, you have to end with a 1 for the import to be successful:

1;

Save the File

If you want this file to be your default configuration file, you probably want to save it as .ensembl_init in your home directory. You can also save it elsewhere and point the ENSEMBL_REGISTRY environment variable to that location. Here are a couple of examples of how to configure your environment depending on your shell:

Ensembl Software Support

Ensembl is an open project and we would like to encourage correspondence and discussions on any subject on any aspect of Ensembl. Please see the Ensembl Contacts page for suitable options getting in touch with us.


 

© 2024 Inserm. Hosted by genouest.org. This product includes software developed by Ensembl.

                
GermOnline based on Ensembl release 50 - Jul 2008
HELP