From be644987ef12a1677bbe68833aa1cc3930cd806b Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Thu, 10 Oct 2013 12:45:26 +0000
Subject: [PATCH] [ENSCORESW-710]. Perform alias addition only if we found the
 DB.

Patch submitted by Yuri Delia as aliases were added into the registry
even if a database was not found e.g. ontology. Additions moved
into the if blocks when we find and DB and constructed its adaptor.
---
 modules/Bio/EnsEMBL/Registry.pm | 37 +++++++++++++++++----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Registry.pm b/modules/Bio/EnsEMBL/Registry.pm
index 0bc06a90a3..dfd8b692fd 100644
--- a/modules/Bio/EnsEMBL/Registry.pm
+++ b/modules/Bio/EnsEMBL/Registry.pm
@@ -2065,6 +2065,11 @@ sub load_registry_from_db {
         }
       } ## end foreach my $compara_db (@compara_dbs)
     } ## end else [ if ($@)
+
+    Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
+      -species => 'multi'.$species_suffix,
+      -alias   => ['compara'.$species_suffix] );
+
   } elsif ($verbose) {
     print("No Compara databases found\n");
   }
@@ -2100,6 +2105,11 @@ sub load_registry_from_db {
           join( ', ', @ancestral_dbs ) );
       }
     }
+
+    Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
+      -species => 'Ancestral sequences'.$species_suffix,
+      -alias   => ['ancestral_sequences'.$species_suffix] );
+
   } elsif ($verbose) {
     print("No ancestral database found\n");
   }
@@ -2122,6 +2132,11 @@ sub load_registry_from_db {
     if ($verbose) {
       printf( "%s loaded\n", $ontology_db );
     }
+
+    Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
+      -species => 'multi'.$species_suffix,
+      -alias   => ['ontology'.$species_suffix] );
+
   }
   elsif ($verbose) {
     print("No ontology database found\n");
@@ -2144,25 +2159,11 @@ sub load_registry_from_db {
       printf( "%s loaded\n", $stable_ids_db );
     }      
 
-  }
+    Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
+      -species => 'multi'.$species_suffix,
+      -alias   => ['stable_ids'.$species_suffix] );
 
-
-  Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
-    -species => 'multi'.$species_suffix,
-    -alias   => ['compara'.$species_suffix] );
-
-  Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
-    -species => 'multi'.$species_suffix,
-    -alias   => ['ontology'.$species_suffix] );
-
-
-  Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
-    -species => 'multi'.$species_suffix,
-    -alias   => ['stable_ids'.$species_suffix] );
-
-  Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
-    -species => 'Ancestral sequences'.$species_suffix,
-    -alias   => ['ancestral_sequences'.$species_suffix] );
+  }
 
   # Register aliases as found in adaptor meta tables.
 
-- 
GitLab