Commit c6cb84f8 authored by Matthew Laird's avatar Matthew Laird
Browse files

- If fetch_by_region is toplevel, try to use the synonym table to find the region name

- Corresponding test to test functionality
parent 471a7903
......@@ -294,7 +294,7 @@ sub fetch_by_region {
# try synonyms
my $syn_sql = "select s.name, cs.name, cs.version from seq_region s join seq_region_synonym ss using (seq_region_id) join coord_system cs using (coord_system_id) where ss.synonym = ? and cs.species_id =? ";
if (defined $coord_system_name) {
if (defined $coord_system_name && defined $cs) {
$syn_sql .= "AND cs.name = '" . $coord_system_name . "' ";
}
if (defined $version) {
......
......@@ -552,6 +552,8 @@ ok($slice->seq_region_name =~ /$clone_name\.\d+/);
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');
$chr_syn_slice = $slice_adaptor->fetch_by_region('toplevel', 'chrx');
is($chr_syn_slice->seq_region_name(), 'X', 'Ensuring slice is ChrX as expected');
}
#{
......
1 469283 alt_20 \N
2 469283 anoth_20 4200
3 469293 chrx 11000
Markdown is supported
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