From 8adc78e53a384ed6f2e3a98995b3afa583e163b7 Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Thu, 16 Aug 2012 10:23:47 +0000
Subject: [PATCH] Now can search DBs more than just otherfeatures

---
 modules/Bio/EnsEMBL/Registry.pm | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Registry.pm b/modules/Bio/EnsEMBL/Registry.pm
index 75d8b51374..88a91283e6 100644
--- a/modules/Bio/EnsEMBL/Registry.pm
+++ b/modules/Bio/EnsEMBL/Registry.pm
@@ -2717,13 +2717,12 @@ my %stable_id_stmts = (
 
 
 sub get_species_and_object_type {
-  my ($self, $stable_id, $known_type, $known_species, $known_db_type) = @_;
+  my ($self, $stable_id, $known_type, $known_species, $known_db_type, $force_long_lookup) = @_;
 
   #get the stable_id lookup database adaptor
   my $stable_ids_dba = $self->get_DBAdaptor("multi", "stable_ids", 1);
 
-  if ($stable_ids_dba) {
-
+  if ($stable_ids_dba && ! $force_long_lookup) {
      my $statement = 'SELECT name, object_type, db_type FROM stable_id_lookup join species using(species_id) WHERE stable_id = ?';
 
      if ($known_species) {
@@ -2758,19 +2757,22 @@ sub get_species_and_object_type {
      return ($species ,$type, $db_type);
 
   } else {
-
       if (defined $known_type && !exists $stable_id_stmts{lc $known_type}) {
 	  return;
       }
 
       my @types = defined $known_type ? ($known_type) : ('Gene', 'Transcript', 'Translation', 'Exon', 'Operon', 'OperonTranscript');
   
-      if ($known_db_type && $known_db_type ne 'core' && $known_db_type ne 'Core' ) {
-	  return;
+      if(! $known_db_type) {
+        $known_db_type = 'core';
       }
       
+      warn $known_db_type;
+      warn $known_species;
+      warn $known_type;
+      
       my %get_adaptors_args;
-      $get_adaptors_args{'-group'} = 'Core';
+      $get_adaptors_args{'-group'} = $known_db_type;
       if ($known_species) {
 	  $get_adaptors_args{'-species'} = $known_species; 
       }
@@ -2790,7 +2792,7 @@ sub get_species_and_object_type {
 
 	      $sth->finish;
 
-	      return ($species, $type, 'Core') if defined $species;
+	      return ($species, $type, $known_db_type) if defined $species;
 	  }
 
       } ## end foreach my $dba ( sort { $a...})
-- 
GitLab