diff --git a/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm index 67d1fc528625eeba1beb7f88fc929a5728697ed3..8377eeea615721cf8fa215f3071fedbd825ec3d3 100755 --- a/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm @@ -82,6 +82,10 @@ my $registry = "Bio::EnsEMBL::Registry"; the database if not used properly. If in doubt, do not use it or ask in the developer mailing list. + Arg [-ADD_ALIASES]: (optional) boolean + Used to automatically load aliases for this + species into the Registry upon loading. + Arg [..] : Other args are passed to superclass Bio::EnsEMBL::DBSQL::DBConnection @@ -125,10 +129,11 @@ sub new { my $self = bless {}, $class; my ( $is_multispecies, $species, $species_id, $group, $con, $dnadb, - $no_cache, $dbname ) + $no_cache, $dbname, $add_aliases ) = rearrange( [ 'MULTISPECIES_DB', 'SPECIES', 'SPECIES_ID', 'GROUP', - 'DBCONN', 'DNADB', 'NO_CACHE', 'DBNAME' + 'DBCONN', 'DNADB', 'NO_CACHE', 'DBNAME', + 'ADD_ALIASES' ], @args ); @@ -154,6 +159,7 @@ sub new { if ( defined($dnadb) ) { $self->dnadb($dnadb) } if ( defined($no_cache) ) { $self->no_cache($no_cache) } + if ( defined($add_aliases) ) { $self->find_and_add_aliases($add_aliases) } return $self; } ## end sub new @@ -182,6 +188,25 @@ sub clear_caches { return; } +=head2 find_and_add_aliases + + Example : $dba->find_and_add_aliases(); + Description : When executed we delegate to the find_and_add_aliases + method in Bio::EnsEMBL::Registry which scans the + database's MetaContainer for species.alias entries + indicating alternative names for this species. This + is best executed on a core DBAdaptor instance. + Returntype : None + Exceptions : None + +=cut + +sub find_and_add_aliases { + my ($self) = @_; + $registry->find_and_add_aliases(-ADAPTOR => $self); + return; +} + =head2 dbc Arg[1] : (optional) Bio::EnsEMBL::DBSQL::DBConnection