Skip to content
Snippets Groups Projects
Commit b1ca6d52 authored by Ian Longden's avatar Ian Longden
Browse files

report warning if regitry call to get_alias is called with an invalid species...

report warning if regitry call to get_alias is called with an invalid species name. Also had to add option to get_DBAdaptor to not look up aliases so that warning are not given the first time we use it
parent a9816e5e
No related branches found
No related tags found
No related merge requests found
...@@ -554,6 +554,7 @@ sub add_DBAdaptor { ...@@ -554,6 +554,7 @@ sub add_DBAdaptor {
Arg [1] : name of the species to get the adaptor for in the registry. Arg [1] : name of the species to get the adaptor for in the registry.
Arg [2] : name of the group to get the adaptor for in the registry. Arg [2] : name of the group to get the adaptor for in the registry.
Arg [3] : if set will not look for alias.
Example : $dba = Bio::EnsEMBL::Registry->get_DBAdaptor("Human", "core"); Example : $dba = Bio::EnsEMBL::Registry->get_DBAdaptor("Human", "core");
Returntype : DBAdaptor Returntype : DBAdaptor
Exceptions : none Exceptions : none
...@@ -562,10 +563,11 @@ sub add_DBAdaptor { ...@@ -562,10 +563,11 @@ sub add_DBAdaptor {
=cut =cut
sub get_DBAdaptor { sub get_DBAdaptor {
my ( $class, $species, $group ) = @_; my ( $class, $species, $group , $no_alias_check) = @_;
throw 'arrggh for '.$species if ! defined $species; throw 'arrggh for '.$species if ! defined $species;
$species = $class->get_alias($species); if(!defined($no_alias_check) or !$no_alias_check){
$species = $class->get_alias($species);
}
return $registry_register{_SPECIES}{$species}{ lc($group) }{'_DB'}; return $registry_register{_SPECIES}{$species}{ lc($group) }{'_DB'};
} }
...@@ -1104,7 +1106,13 @@ sub get_alias{ ...@@ -1104,7 +1106,13 @@ sub get_alias{
my ($class, $key) = @_; my ($class, $key) = @_;
if(!defined($registry_register{'_ALIAS'}{lc($key)})){ if(!defined($registry_register{'_ALIAS'}{lc($key)})){
return $key; if(!defined( $registry_register{_SPECIES}{ lc($key) }) and !defined ($registry_register{_ALIAS}{ lc($key) })){
warn "$key is not a valid species name for this instance\n";
return undef;
}
else{
return $key;
}
} }
return $registry_register{'_ALIAS'}{lc($key)}; return $registry_register{'_ALIAS'}{lc($key)};
} }
......
...@@ -154,7 +154,7 @@ sub gen_load { ...@@ -154,7 +154,7 @@ sub gen_load {
# return if the connection and species, group are the same # return if the connection and species, group are the same
if ( defined( $dba->species ) ) { if ( defined( $dba->species ) ) {
my $db_reg = $reg->get_DBAdaptor( $dba->species, $dba->group ); my $db_reg = $reg->get_DBAdaptor( $dba->species, $dba->group, 1 );
if ( defined($db_reg) ) { if ( defined($db_reg) ) {
if ( $dba->dbc->equals( $db_reg->dbc ) ) { return $db_reg } if ( $dba->dbc->equals( $db_reg->dbc ) ) { return $db_reg }
else { else {
...@@ -169,6 +169,7 @@ sub gen_load { ...@@ -169,6 +169,7 @@ sub gen_load {
} }
} }
} else { # no species } else { # no species
my @db_reg = my @db_reg =
@{ $reg->get_all_DBAdaptors_by_connection( $dba->dbc ) }; @{ $reg->get_all_DBAdaptors_by_connection( $dba->dbc ) };
......
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