From d836fc703fdd7bd6de6a3f899518f85db26f7cb3 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Tue, 21 May 2013 16:41:26 +0000 Subject: [PATCH] [ENSCORESW-475] fixing the dbentry return to prioritise genes, transcripts and translations found on reference slices --- modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm | 10 +++++----- modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm | 5 ++++- modules/Bio/EnsEMBL/DBSQL/TranslationAdaptor.pm | 13 ++++++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm index 19e12072e6..2d390514b7 100644 --- a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm @@ -837,12 +837,12 @@ sub fetch_all_by_external_name { my @ids = $entryAdaptor->list_gene_ids_by_extids($external_name, $external_db_name, $override); - my %genes_by_dbIDs = - map { $_->dbID(), $_ } @{$self->fetch_all_by_dbID_list(\@ids)}; + my %genes_by_dbIDs = map { $_->dbID(), $_ } @{$self->fetch_all_by_dbID_list(\@ids)}; - my @result = map { $genes_by_dbIDs{$_} } @ids; - - return \@result; + my @features = map { $genes_by_dbIDs{$_} } @ids; + my @reference = grep { $_->slice()->is_reference() } @features; + my @non_reference = grep { ! $_->slice()->is_reference() } @features; + return [ @reference, @non_reference ]; } =head2 fetch_all_by_description diff --git a/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm index 933d491abb..7c459cbfd5 100644 --- a/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm @@ -519,7 +519,10 @@ sub fetch_all_by_external_name { $entryAdaptor->list_transcript_ids_by_extids( $external_name, $external_db_name, $override ); - return $self->fetch_all_by_dbID_list( \@ids ); + my @features = @{ $self->fetch_all_by_dbID_list( \@ids ) }; + my @reference = grep { $_->slice()->is_reference() } @features; + my @non_reference = grep { ! $_->slice()->is_reference() } @features; + return [ @reference, @non_reference ]; } =head2 fetch_all_by_GOTerm diff --git a/modules/Bio/EnsEMBL/DBSQL/TranslationAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/TranslationAdaptor.pm index 0de5dfafab..9588fbd43d 100644 --- a/modules/Bio/EnsEMBL/DBSQL/TranslationAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/TranslationAdaptor.pm @@ -313,16 +313,23 @@ sub fetch_all_by_external_name { my $transcript_adaptor = $self->db()->get_TranscriptAdaptor(); - my @out; + my @reference; + my @non_reference; foreach my $id (@ids) { my $transcript = $transcript_adaptor->fetch_by_translation_id($id); if ( defined($transcript) ) { - push @out, $self->fetch_by_Transcript($transcript); + my $translation = $self->fetch_by_Transcript($transcript); + if($transcript->slice()->is_reference()) { + push(@reference, $translation); + } + else { + push(@non_reference, $translation); + } } } - return \@out; + return [@reference, @non_reference]; } =head2 fetch_all_by_GOTerm -- GitLab