diff --git a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm index 2ae8b8c9809b687dca2a0d78118d2f357a7173ba..1aba840199dbc21902837ff7692e9bcf8afbeb65 100644 --- a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm @@ -477,6 +477,7 @@ sub exists { Arg [1] : Bio::EnsEMBL::Gene $gene (The gene to retrieve DBEntries for) Arg [2] : optional external database name + Arg [3] : optional info type Example : @db_entries = @{$db_entry_adaptor->fetch_by_Gene($gene)}; Description: This returns a list of DBEntries associated with this gene. Note that this method was changed in release 15. Previously @@ -492,13 +493,13 @@ sub exists { =cut sub fetch_all_by_Gene { - my ( $self, $gene, $ex_db_reg ) = @_; + my ( $self, $gene, $ex_db_reg, $info_type ) = @_; if(!ref($gene) || !$gene->isa('Bio::EnsEMBL::Gene')) { throw("Bio::EnsEMBL::Gene argument expected."); } - return $self->_fetch_by_object_type($gene->dbID(), 'Gene', $ex_db_reg); + return $self->_fetch_by_object_type($gene->dbID(), 'Gene', $ex_db_reg, $info_type); } @@ -506,6 +507,7 @@ sub fetch_all_by_Gene { Arg [1] : Bio::EnsEMBL::Transcript Arg [2] : optional external database name + Arg [3] : optional info type Example : @db_entries = @{$db_entry_adaptor->fetch_by_Gene($trans)}; Description: This returns a list of DBEntries associated with this transcript. Note that this method was changed in release 15. @@ -521,13 +523,13 @@ sub fetch_all_by_Gene { =cut sub fetch_all_by_Transcript { - my ( $self, $trans, $ex_db_reg ) = @_; + my ( $self, $trans, $ex_db_reg, $info_type ) = @_; if(!ref($trans) || !$trans->isa('Bio::EnsEMBL::Transcript')) { throw("Bio::EnsEMBL::Transcript argument expected."); } - return $self->_fetch_by_object_type( $trans->dbID(), 'Transcript', $ex_db_reg); + return $self->_fetch_by_object_type( $trans->dbID(), 'Transcript', $ex_db_reg, $info_type); } @@ -536,6 +538,7 @@ sub fetch_all_by_Transcript { Arg [1] : Bio::EnsEMBL::Translation $trans (The translation to fetch database entries for) Arg [2] : optional external database name + Arg [3] : optional info type Example : @db_entries = @{$db_entry_adptr->fetch_by_Translation($trans)}; Description: Retrieves external database entries for an EnsEMBL translation Returntype : listref of Bio::EnsEMBL::DBEntries; may be of type IdentityXref if @@ -547,7 +550,7 @@ sub fetch_all_by_Transcript { =cut sub fetch_all_by_Translation { - my ( $self, $trans, $ex_db_reg ) = @_; + my ( $self, $trans, $ex_db_reg, $info_type ) = @_; if(!ref($trans) || !$trans->isa('Bio::EnsEMBL::Translation')) { throw('Bio::EnsEMBL::Translation argument expected.'); @@ -557,7 +560,7 @@ sub fetch_all_by_Translation { return []; } - return $self->_fetch_by_object_type( $trans->dbID(), 'Translation', $ex_db_reg ); + return $self->_fetch_by_object_type( $trans->dbID(), 'Translation', $ex_db_reg, $info_type ); } @@ -681,7 +684,7 @@ sub remove_from_object { =cut sub _fetch_by_object_type { - my ( $self, $ensID, $ensType, $exdbname ) = @_; + my ( $self, $ensID, $ensType, $exdbname, $infotype ) = @_; my @out; if (!defined($ensID)) { @@ -713,6 +716,7 @@ sub _fetch_by_object_type { AND oxr.ensembl_object_type = ? SSQL $sql .= " AND exDB.db_name like '".$exdbname."' " if($exdbname); + $sql .= " AND xref.info_type like '".$infotype."' " if($infotype); my $sth = $self->prepare($sql); $sth->bind_param(1,$ensID,SQL_INTEGER); @@ -737,6 +741,8 @@ SSQL 'display_id' => $displayid, 'version' => $version, 'release' => $release, + 'info_type' => $info_type, + 'info_text' => $info_text, 'dbname' => $dbname ); @@ -778,8 +784,6 @@ SSQL $exDB->display_id_linkable($display_id_linkable); $exDB->priority($priority); $exDB->db_display_name($exDB_db_display_name); - $exDB->info_type($info_type); - $exDB->info_text($info_text); $exDB->type($type); push( @out, $exDB ); diff --git a/modules/Bio/EnsEMBL/Gene.pm b/modules/Bio/EnsEMBL/Gene.pm index ab32eb847e63abf89d82a601054c5e431b0bc512..155a50770d1d2439e1f5b26e8a38b0c4ecc7f8ab 100755 --- a/modules/Bio/EnsEMBL/Gene.pm +++ b/modules/Bio/EnsEMBL/Gene.pm @@ -435,16 +435,19 @@ sub add_DBEntry { =cut sub get_all_DBEntries { - my ($self, $db_name_exp) = @_; + my ($self, $db_name_exp, $info_type) = @_; my $cache_name = "dbentries"; if(defined($db_name_exp)){ $cache_name .= $db_name_exp; } + if(defined($info_type)){ + $cache_name .= $info_type; + } # if not cached, retrieve all of the xrefs for this gene if(!defined $self->{$cache_name} && $self->adaptor()) { $self->{$cache_name} = - $self->adaptor->db->get_DBEntryAdaptor->fetch_all_by_Gene($self,$db_name_exp); + $self->adaptor->db->get_DBEntryAdaptor->fetch_all_by_Gene($self,$db_name_exp,, $info_type); } $self->{$cache_name} ||= []; @@ -480,15 +483,16 @@ sub get_all_DBEntries { sub get_all_DBLinks { my $self = shift; my $db_name_exp = shift; + my $info_type = shift; - my @links = @{$self->get_all_DBEntries($db_name_exp)}; + my @links = @{$self->get_all_DBEntries($db_name_exp, $info_type)}; # add all of the transcript and translation xrefs to the return list foreach my $transc (@{$self->get_all_Transcripts}) { - push @links, @{$transc->get_all_DBEntries($db_name_exp)}; + push @links, @{$transc->get_all_DBEntries($db_name_exp, $info_type)}; my $transl = $transc->translation(); - push @links, @{$transl->get_all_DBEntries($db_name_exp)} if($transl); + push @links, @{$transl->get_all_DBEntries($db_name_exp, $info_type)} if($transl); } return \@links; diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index 76824ba7eec65c4edf3f92e2e8125cbe0ce7e24c..523735b36066e9d10f3a9aaa51298d93ad2909d9 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -181,13 +181,14 @@ sub new { sub get_all_DBLinks { my $self = shift; my $ex_db_exp = shift; + my $info_type = shift; my @links; - push @links, @{$self->get_all_DBEntries($ex_db_exp)}; + push @links, @{$self->get_all_DBEntries($ex_db_exp, $info_type)}; my $transl = $self->translation(); - push @links, @{$transl->get_all_DBEntries($ex_db_exp)} if($transl); + push @links, @{$transl->get_all_DBEntries($ex_db_exp, $info_type)} if($transl); @links = sort {_compare_xrefs()} @links; @@ -216,12 +217,16 @@ sub get_all_DBLinks { sub get_all_DBEntries { my $self = shift; my $ex_db_exp = shift; + my $info_type = shift; my $cache_name = "dbentries"; if(defined($ex_db_exp)){ $cache_name .= $ex_db_exp; } + if(defined($info_type)){ + $cache_name .= $info_type; + } # if not cached, retrieve all of the xrefs for this gene if(!defined $self->{$cache_name} && $self->adaptor()) { $self->{$cache_name} = diff --git a/modules/Bio/EnsEMBL/Translation.pm b/modules/Bio/EnsEMBL/Translation.pm index b8e273b4c9509fb6d1bf1c72f1f4f348ad80dfec..cb5109328241f4fe1f5054cea7e7fb312389d167 100755 --- a/modules/Bio/EnsEMBL/Translation.pm +++ b/modules/Bio/EnsEMBL/Translation.pm @@ -512,12 +512,16 @@ sub transform { sub get_all_DBEntries { my $self = shift; my $ex_db_exp = shift; + my $info_type = shift; my $cache_name = "dbentries"; if(defined($ex_db_exp)){ $cache_name .= $ex_db_exp; } + if(defined($info_type)){ + $cache_name .= $info_type; + } # if not cached, retrieve all of the xrefs for this gene if(!defined $self->{$cache_name}) { @@ -527,7 +531,7 @@ sub get_all_DBEntries { return [] if(!$adaptor || !$dbID); $self->{$cache_name} = - $self->adaptor->db->get_DBEntryAdaptor->fetch_all_by_Translation($self, $ex_db_exp); + $self->adaptor->db->get_DBEntryAdaptor->fetch_all_by_Translation($self, $ex_db_exp, $info_type); } $self->{$cache_name} ||= [];