Commit a7e104bd authored by Andy Yates's avatar Andy Yates
Browse files

[ENSCORESW-314]. Synonym lookup bug fixed. Passed coord system id into the...

[ENSCORESW-314]. Synonym lookup bug fixed. Passed coord system id into the lookup rather than the actual coord system name. Bad bad bad
parent 98782778
......@@ -291,17 +291,17 @@ sub fetch_by_region {
# try synonyms
my $syn_sql_sth = $self->prepare("select s.name, s.coord_system_id from seq_region s, seq_region_synonym ss where s.seq_region_id = ss.seq_region_id and ss.synonym = ?");
my $syn_sql_sth = $self->prepare("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 =?");
$syn_sql_sth->bind_param(1, $seq_region_name, SQL_VARCHAR);
$syn_sql_sth->bind_param(2, $self->species_id(), SQL_INTEGER);
$syn_sql_sth->execute();
my $new_name;
my $new_coord_system;
$syn_sql_sth->bind_columns( \$new_name, \$new_coord_system);
my ($new_name, $new_coord_system, $new_version);
$syn_sql_sth->bind_columns( \$new_name, \$new_coord_system, \$new_version);
if($syn_sql_sth->fetch){
$syn_sql_sth->finish;
if (not defined($cs)) {
return $self->fetch_by_region($new_coord_system, $new_name, $start, $end, $strand, $version, $no_fuzz);
return $self->fetch_by_region($new_coord_system, $new_name, $start, $end, $strand, $new_version, $no_fuzz);
} elsif ($cs->dbID != $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.");
......@@ -1407,8 +1407,6 @@ sub fetch_by_transcript_stable_id{
return $self->fetch_by_Feature($transcript, $size);
}
=head2 fetch_by_transcript_id
Arg [1] : int $transcriptid
......
......@@ -422,6 +422,20 @@ $clone_name = 'AL031658';
$slice = $slice_adaptor->fetch_by_region(undef, $clone_name);
ok($slice->seq_region_name =~ /$clone_name\.\d+/);
# Testing synonym fetching
{
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 @slices = @{$slice_adaptor->fetch_all_by_synonym('anoth_20', 'UniGene')};
# is(scalar(@slices), 0, 'Checking querying with a bad external name means no Slices');
#
# @slices = @{$slice_adaptor->fetch_all_by_synonym('anoth_20', 'RFAM')}; #Yeah ... RFAM
# is(scalar(@slices), 1, 'Checking querying with a good external name means Slices');
# is($slices[0]->seq_region_name(), '20', 'Ensuring slice is Chr20 as expected');
#}
# test that with multiple sequence regions with the same name, the
# highest (lowest-numbered) ranked comes out first
......@@ -504,6 +518,8 @@ ok(!defined $slice_adaptor->fetch_by_toplevel_location('1:-100--50', 1), 'Checki
ok(!defined $strand, 'Strand is undefined');
}
############# METHODS BELOW HERE
sub test_toplevel_location {
my ($location, $cs_name, $seq_region_name, $start, $end, $strand) = @_;
my $incoming_slice = $slice_adaptor->fetch_by_toplevel_location($location, 1);
......
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