Commit 551995be authored by Graham McVicker's avatar Graham McVicker
Browse files

deprecated several unused methods in Exon and incorrect implementation of...

deprecated several unused methods in Exon and incorrect implementation of translate method - added replacement peptide method
parent 32291943
This diff is collapsed.
......@@ -313,8 +313,9 @@ sub _sort_by_sticky_rank {
=head1 seq
Arg [1] : String $seq
You can set the seq of a sticky Exon. Omit, if you want to retrieve.
Attachseq is probably the better way (sigh)
You can set the seq of a sticky Exon.
Omit, if you want to retrieve.
contig method is probably the better way (sigh)
Function : retrieve sequence of sticky exon from db or return stored one.
If sequence was retrieved once, its cached.
......@@ -347,6 +348,68 @@ sub seq {
=head2 peptide
Arg [1] : Bio::EnsEMBL::Transcript $tr
Example : my $pep_str = $sticky_exon->peptide($transcript)->seq;
Description: StickyExon implementation of Bio::EnsEMBL::Exon::peptide.
See Bio::EnsEMBL::Exon::peptide for details
Returntype : Bio::Seq
Exceptions : thrown if transcript argument is not provided
Caller : general
=cut
sub peptide {
my $self = shift;
my $tr = shift;
unless($tr && ref($tr) && $tr->isa('Bio::EnsEMBL::Transcript')) {
$self->throw("transcript arg must be Bio::EnsEMBL:::Transcript not [$tr]");
}
my $pep_start = undef;
my $pep_end = undef;
foreach my $exon (@{$self->get_all_component_Exons}) {
#convert exons coordinates to peptide coordinates
my @coords =
$tr->genomic2pep($exon->start, $exon->end, $exon->strand, $exon->contig);
#filter out gaps
my @coords = grep {$_->isa('Bio::EnsEMBL::Mapper::Coordinate')} @coords;
if(scalar(@coords) > 1) {
$self->throw("Error. Exon maps to multiple locations in peptide." .
" Is this exon [$self] a member of this transcript [$tr]?");
#if this is UTR then the peptide will be empty string
} elsif(scalar(@coords) == 1) {
my $c = $coords[0];
#set the pep start to the minimum of all coords
if(!defined $pep_start || $c->start < $pep_start) {
$pep_start = $c->start;
}
#set the pep end to the maximum of all coords
if(!defined $pep_end || $c->end > $pep_end) {
$pep_end = $c->end;
}
}
}
#the peptide of this sticky is the region spanned by the component exons
my $pep_str = '';
if($pep_start && $pep_end) {
$pep_str = $tr->translate->subseq($pep_start, $pep_end);
}
return Bio::Seq->new(-seq => $pep_str,
-moltype => 'protein',
-alphabet => 'protein',
-id => $self->stable_id);
}
=head2 transform
......@@ -578,4 +641,7 @@ sub add_supporting_features {
}
}
1;
Markdown is supported
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