From 893438b2906a66f1e16a135623061550f529b7c3 Mon Sep 17 00:00:00 2001 From: Web Admin <w3adm@sanger.ac.uk> Date: Mon, 15 Dec 2003 10:51:25 +0000 Subject: [PATCH] Added %age context on Gene based slices, tweaks to stable id fetches, and white space removal --- modules/Bio/EnsEMBL/ArchiveStableId.pm | 9 ++++++++- modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm | 7 +++++-- modules/Bio/EnsEMBL/Lite/GeneAdaptor.pm | 2 -- modules/Bio/EnsEMBL/Transcript.pm | 1 - 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/Bio/EnsEMBL/ArchiveStableId.pm b/modules/Bio/EnsEMBL/ArchiveStableId.pm index ed3d242f7d..df577f48b7 100644 --- a/modules/Bio/EnsEMBL/ArchiveStableId.pm +++ b/modules/Bio/EnsEMBL/ArchiveStableId.pm @@ -222,7 +222,14 @@ sub get_translation_archive_id { my $self = shift; if( $self->type() eq "Transcript" ) { - return $self->adaptor->fetch_by_transcript_archive_id( $self ); + return [$self->adaptor->fetch_by_transcript_archive_id( $self )]; + } elsif( $self->type() eq "Gene" ) { + my $transcripts = $self->adaptor->fetch_all_by_gene_archive_id( $self ); + my @peptides ; + for (@$transcripts) { + push @peptides , $self->adaptor->fetch_by_transcript_archive_id( $_ ); + } + return \@peptides; } else { return undef; } diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm index d7ab091868..0dfd888126 100644 --- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm @@ -468,10 +468,13 @@ sub fetch_by_gene_stable_id{ if( !defined $geneid ) { $self->throw("Must have gene id to fetch Slice of gene"); } - if( !defined $size ) {$size=0;} - my ($chr_name,$start,$end) = $self->_get_chr_start_end_of_gene($geneid); + if( $size =~/([\d+\.]+)%/ ) { + $size = int($1/100 * ($end-$start+1)); + } + if( !defined $size ) {$size=0;} + if( !defined $start ) { my $type = $self->db->assembly_type() or $self->throw("No assembly type defined"); diff --git a/modules/Bio/EnsEMBL/Lite/GeneAdaptor.pm b/modules/Bio/EnsEMBL/Lite/GeneAdaptor.pm index a0d462c26e..683ed639ee 100644 --- a/modules/Bio/EnsEMBL/Lite/GeneAdaptor.pm +++ b/modules/Bio/EnsEMBL/Lite/GeneAdaptor.pm @@ -71,8 +71,6 @@ sub new { return $self; } - - =head2 fetch_all_by_gene_id_list Arg [1] : arrayref $gene_ids diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index e569c839c6..bccaf7b389 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -895,7 +895,6 @@ sub get_all_peptide_variations { return \%out; } - =head2 get_all_SNPs Arg [1] : (optional) int $flanking -- GitLab