Commit ce0593ce authored by Magali Ruffier's avatar Magali Ruffier
Browse files

Merge pull request #97 from danstaines/master

added taxonomy adaptor support
parents aeec515a 0f534f4b
......@@ -162,6 +162,7 @@ my %group2adaptor = (
'pipeline' => 'Bio::EnsEMBL::Pipeline::DBSQL::DBAdaptor',
'production' => 'Bio::EnsEMBL::Production::DBSQL::DBAdaptor',
'stable_ids' => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
'taxonomy' => 'Bio::EnsEMBL::DBSQL::TaxonomyDBAdaptor',
'variation' => 'Bio::EnsEMBL::Variation::DBSQL::DBAdaptor',
'vega' => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
'vega_update' => 'Bio::EnsEMBL::DBSQL::DBAdaptor',
......@@ -374,7 +375,6 @@ sub load_all {
$adaptor_args{'-no_cache'} = 1;
}
}
if ($verbose) {
printf( "Configuring adaptor '%s' "
. "for configuration section '%s'...\n",
......@@ -1734,6 +1734,8 @@ sub load_registry_from_db {
my $ontology_db;
my $ontology_version;
my $taxonomy_db;
my $production_dba_ok =
eval { require Bio::EnsEMBL::Production::DBSQL::DBAdaptor; 1 };
my $production_db;
......@@ -1804,6 +1806,8 @@ sub load_registry_from_db {
$ontology_db = $db;
$ontology_version = $1;
}
} elsif ( $db =~ /^ncbi_taxonomy$/ ) {
$taxonomy_db = $db;
} elsif ( $production_dba_ok and $db =~ /^ensembl(?:genomes)?_production(_\d+)?/x ) {
# production db can come with no version (i.e. that on ens-staging1),
# but it's backed up with a release number
......@@ -2305,6 +2309,28 @@ sub load_registry_from_db {
print("No ontology database found\n");
}
# Taxonomy
if ( defined $taxonomy_db) {
require Bio::EnsEMBL::DBSQL::TaxonomyDBAdaptor;
my $dba =
Bio::EnsEMBL::DBSQL::TaxonomyDBAdaptor->new(
'-species' => 'multi' . $species_suffix,
'-group' => 'taxonomy',
'-host' => $host,
'-port' => $port,
'-user' => $user,
'-pass' => $pass,
'-dbname' => $taxonomy_db, );
if ($verbose) {
printf( "%s loaded\n", $taxonomy_db );
}
}
elsif ($verbose) {
print("No taxonomy database found\n");
}
# Production
if ( $production_dba_ok and defined($production_db) && !$ignore_multi) {
......
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
use Config;
use Test::More;
use Test::Exception;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::ApiVersion;
my $version = software_version()-1;
Bio::EnsEMBL::Registry->load_registry_from_url('mysql://anonymous@ensembldb.ensembl.org:5306/'.$version);
my $dbas = Bio::EnsEMBL::Registry->get_all_DBAdaptors(-GROUP=>'core');
my $min = 10;
ok(defined $dbas && scalar(@$dbas)>$min,'More than '.$min.' DBAs found');
ok($dbas->[0]->isa('Bio::EnsEMBL::DBSQL::DBAdaptor'),'First DBA is core');
my $species = 'homo_sapiens';
my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species,'core');
ok(defined $dba && $dba->isa('Bio::EnsEMBL::DBSQL::DBAdaptor') && ($dba->species() eq $species), "$species adaptor retrieved");
done_testing();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment