HowTo: Get a list of all species in Ensembl

From ensembl-dev mailing list: advice on how to get the current list of all ensembl species:

List lives in the compara database and can be retrieved directly with something like:


mysql -u anonymous -h ensembldb.ensembl.org -P 5306 ensembl_compara_52 \
-e "SELECT name FROM genome_db";

Or you can do essentially the same query via the Perl API:


use Bio::EnsEMBL::Registry;
my $reg = "Bio::EnsEMBL::Registry";
$reg->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);


my $genomes = $reg->get_adaptor("Multi", "compara", "GenomeDB")->fetch_all;
print $_->name."\n" foreach (@$genomes);


#or in asciibetical:
print $_."\n" foreach (sort {$a cmp $b} map {$_->name} @$genomes );

If you can’t / don’t want to use compara, you can achieve the same thing by retrieving all of the core DBAdaptors and asking them what species they are:


use Bio::EnsEMBL::Registry;
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);


my @db_adaptors = @{ $registry->get_all_DBAdaptors(-GROUP=>'core') };
print $_->species() ."\n" foreach (@db_adaptors);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s