diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm index d4d6f2cee74508218799f693cbee905154b26211..db22c919202a2ad5605203e1e3a215924feeddb2 100755 --- a/modules/Bio/EnsEMBL/Transcript.pm +++ b/modules/Bio/EnsEMBL/Transcript.pm @@ -344,12 +344,13 @@ sub translation { my $self = shift; if( @_ ) { my $value = shift; - if( ! ref $value || !$value->isa('Bio::EnsEMBL::Translation') ) { - throw("This [$value] is not a translation"); + if( defined($value) && + (!ref($value) || !$value->isa('Bio::EnsEMBL::Translation'))) { + throw("Bio::EnsEMBL::Translation argument expected."); } $self->{'translation'} = $value; - } elsif( !exists $self->{'translation'} and defined $self->adaptor() ) { - $self->{'translation'} = + } elsif( !exists($self->{'translation'}) and defined($self->adaptor())) { + $self->{'translation'} = $self->adaptor()->db()->get_TranslationAdaptor()-> fetch_by_Transcript( $self ); }