Skip to content
Snippets Groups Projects
Commit b1a8772c authored by Alessandro Vullo's avatar Alessandro Vullo Committed by GitHub
Browse files

Merge pull request #183 from willmclaren/feature/generic-seqregionsynonym-adaptor

Make SeqRegionSynonymAdaptor compatible with BaseAdaptor
parents 8bf4ff23 2e48625a
No related branches found
No related tags found
No related merge requests found
......@@ -40,29 +40,10 @@ use Bio::EnsEMBL::SeqRegionSynonym;
@ISA = ('Bio::EnsEMBL::DBSQL::BaseAdaptor');
sub get_synonyms{
my $self = shift;
my $seq_id = shift;
my @results;
my $sth = $self->prepare("select seq_region_synonym_id, synonym, external_db_id from seq_region_synonym where seq_region_id = ?");
$sth->bind_param(1, $seq_id, SQL_INTEGER);
$sth->execute();
my $dbid;
my $alt_name;
my $ex_db;
$sth->bind_columns(\$dbid, \$alt_name, \$ex_db);
while($sth->fetch()){
push @results, Bio::EnsEMBL::SeqRegionSynonym->new(-adaptor => $self,
-synonym => $alt_name,
-dbID => $dbid,
-external_db_id => $ex_db,
-seq_region_id => $seq_id);
}
$sth->finish;
return \@results;
sub get_synonyms {
my ($self, $seq_id) = @_;
$self->bind_param_generic_fetch($seq_id, SQL_INTEGER);
return $self->generic_fetch(qq{srs.seq_region_id = ?});
}
sub store {
......@@ -85,6 +66,33 @@ sub store {
$sth->finish;
}
sub _tables {
return (['seq_region_synonym', 'srs']);
}
sub _columns {
return qw(srs.seq_region_synonym_id srs.seq_region_id srs.synonym srs.external_db_id);
}
sub _objs_from_sth {
my ($self, $sth) = @_;
my @results;
my ($seq_id, $dbid, $alt_name, $ex_db);
$sth->bind_columns(\$dbid, \$seq_id, \$alt_name, \$ex_db);
push @results, Bio::EnsEMBL::SeqRegionSynonym->new(
-adaptor => $self,
-synonym => $alt_name,
-dbID => $dbid,
-external_db_id => $ex_db,
-seq_region_id => $seq_id
) while $sth->fetch();
$sth->finish;
return \@results;
}
1;
......@@ -508,6 +508,10 @@ $multi->restore();
is($syn->name(), 'anoth_20', 'We have the right synonym');
}
# test fetch_all on synonym adaptor
my $all_synonyms = $syn_adap->fetch_all();
is(@$all_synonyms, 3, 'fetch_all on synonym adaptor');
#Test assembly exception type on HAP
my $hap_slice = $slice_adaptor->fetch_by_region(undef, '20_HAP1');
......
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