From c49afa836a2a182bfcdef8a26c10584f369c7de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Fri, 25 Jul 2008 10:21:32 +0000 Subject: [PATCH] Being slightly more restrictive with the parsing of multispecies database names and making sure none of them are picked out when looking for core (single species) databases. --- modules/Bio/EnsEMBL/Registry.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/Bio/EnsEMBL/Registry.pm b/modules/Bio/EnsEMBL/Registry.pm index 0fb2f51930..166aa1f35b 100644 --- a/modules/Bio/EnsEMBL/Registry.pm +++ b/modules/Bio/EnsEMBL/Registry.pm @@ -1199,7 +1199,7 @@ sub load_registry_from_db { } for my $db (@dbnames) { - if ( $db =~ /^(\w+)_collection_core_(\w+)/ ) { # NEEDS TO BE FIRST + if ( $db =~ /^([a-z]+)_collection_core_(\w+)/ ) { # NEEDS TO BE FIRST if ( $2 eq $software_version ) { $temp{$1} = 'collection_core_' . $2; } @@ -1235,6 +1235,8 @@ sub load_registry_from_db { my @core_dbs = grep { /^[a-z]+_[a-z]+_core_\d+_/ } @dbnames; foreach my $coredb (@core_dbs) { + next if ($coredb =~ /collection/); # Skip multi-species databases + my ( $species, $num ) = ( $coredb =~ /(^[a-z]+_[a-z]+)_core_(\d+)/ ); @@ -1259,14 +1261,15 @@ sub load_registry_from_db { } # Register multi-species databases - my @multi_dbs = grep { /_collection_core_\w+$/ } @dbnames; + my @multi_dbs = grep { /^[a-z]+_collection_core_\w+$/ } @dbnames; foreach my $multidb (@multi_dbs) { my $sth = $dbh->prepare( - sprintf( 'SELECT species_id, meta_value FROM %s.meta ', - $dbh->quote_identifier($multidb) ) - . "WHERE meta_key = 'species.db_name'" ); + sprintf( 'SELECT species_id, meta_value FROM %s.meta ', + $dbh->quote_identifier($multidb) ) + . "WHERE meta_key = 'species.db_name'" ); + $sth->execute(); my ( $species_id, $species ); -- GitLab