Skip to content
Snippets Groups Projects
Commit 2b23b974 authored by Web Admin's avatar Web Admin
Browse files

Add get_all_by_exon_stable_id method

parent b0a78762
No related branches found
No related tags found
No related merge requests found
......@@ -146,10 +146,76 @@ sub fetch_by_translation_stable_id {
$sth->execute($transl_stable_id);
my ($id) = $sth->fetchrow_array;
return $self->fetch_by_dbID($id);
if ($id){
return $self->fetch_by_dbID($id);
} else {
return undef;
}
}
=head2 fetch_all_by_DBEntry
Arg [1] : in $external_id
the external identifier for the transcript to be obtained
Example : @trans = @{$trans_adaptor->fetch_all_by_DBEntry($ext_id)}
Description: retrieves a list of transcripts with an external database
idenitifier $external_id
Returntype : listref of Bio::EnsEMBL::DBSQL::Transcript in contig coordinates
Exceptions : none
Caller : ?
=cut
sub fetch_all_by_DBEntry {
my $self = shift;
my $external_id = shift;
my @trans = ();
my $entryAdaptor = $self->db->get_DBEntryAdaptor();
my @ids = $entryAdaptor->transcriptids_by_extids($external_id);
foreach my $trans_id ( @ids ) {
my $trans = $self->fetch_by_dbID( $trans_id );
if( $trans ) {
push( @trans, $trans );
}
}
return \@trans;
}
=head2 fetch_all_by_exon_stable_id
Arg [1] : string $stable_id
The stable id of an exon in a transcript
Example : $trans = $trans_adptr->fetch_all_by_exon_stable_id('ENSE00000309301');
Description: Retrieves a list of transcripts via an exon stable id
Returntype : Bio::EnsEMBL::Transcript
Exceptions : none
Caller : general
=cut
sub fetch_all_by_exon_stable_id {
my ($self, $stable_id) = @_;
my @trans ;
my $sth = $self->prepare( qq( SELECT et.transcript_id
FROM exon_transcript as et,
exon_stable_id as esi
WHERE esi.exon_id = et.exon_id and
esi.stable_id = "$stable_id" ));
$sth->execute( );
while( my $id = $sth->fetchrow_array ) {
my $transcript = $self->fetch_by_dbID( $id );
push(@trans, $transcript) if $transcript;
}
if (!@trans) {
$self->warn( "No Transcript with this exon stable id found in the database." );
return undef;
}
return \@trans;
}
=head2 store
......@@ -481,36 +547,6 @@ sub update {
}
=head2 fetch_all_by_DBEntry
Arg [1] : in $external_id
the external identifier for the transcript to be obtained
Example : @trans = @{$trans_adaptor->fetch_all_by_DBEntry($ext_id)}
Description: retrieves a list of transcripts with an external database
idenitifier $external_id
Returntype : listref of Bio::EnsEMBL::DBSQL::Transcript in contig coordinates
Exceptions : none
Caller : ?
=cut
sub fetch_all_by_DBEntry {
my $self = shift;
my $external_id = shift;
my @trans = ();
my $entryAdaptor = $self->db->get_DBEntryAdaptor();
my @ids = $entryAdaptor->transcriptids_by_extids($external_id);
foreach my $trans_id ( @ids ) {
my $trans = $self->fetch_by_dbID( $trans_id );
if( $trans ) {
push( @trans, $trans );
}
}
return \@trans;
}
1;
......
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