From 799133f94523f962135e0d6a3dcc295f09d1b143 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Tue, 12 Mar 2013 06:43:45 +0000 Subject: [PATCH] [ENSCORESW-377]. Fixing the seq region synonym as mentioned by Steve S. Also added a test case which looks for synonyms with a coordinate system not as before which only worked when we had no coordinate system) --- modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm | 4 ++-- modules/t/sliceAdaptor.t | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm index 85d4072175..28d29f286f 100644 --- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm @@ -301,9 +301,9 @@ sub fetch_by_region { if($syn_sql_sth->fetch){ $syn_sql_sth->finish; - if (not defined($cs)) { + if ((not defined($cs)) || ($cs->name eq $new_coord_system)) { return $self->fetch_by_region($new_coord_system, $new_name, $start, $end, $strand, $new_version, $no_fuzz); - } elsif ($cs->dbID != $new_coord_system) { + } elsif ($cs->name ne $new_coord_system) { warning("Searched for a known feature on coordinate system: ".$cs->dbID." but found it on: ".$new_coord_system. "\n No result returned, consider searching without coordinate system or use toplevel."); return; diff --git a/modules/t/sliceAdaptor.t b/modules/t/sliceAdaptor.t index 726f6f7518..9efad50ab8 100644 --- a/modules/t/sliceAdaptor.t +++ b/modules/t/sliceAdaptor.t @@ -426,6 +426,8 @@ ok($slice->seq_region_name =~ /$clone_name\.\d+/); { my $syn_slice = $slice_adaptor->fetch_by_region(undef, 'anoth_20'); is($syn_slice->seq_region_name(), '20', 'Ensuring slice is Chr20 as expected'); + my $chr_syn_slice = $slice_adaptor->fetch_by_region('chromosome', 'anoth_20'); + is($chr_syn_slice->seq_region_name(), '20', 'Ensuring slice is Chr20 as expected'); } #{ -- GitLab