Skip to content
Snippets Groups Projects
Commit e1e3fc04 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Use assert_ref() in canonical_transcript() to clean it up a bit.

In load(): also load the canonical transcript.
parent 2073a424
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,7 @@ use POSIX; ...@@ -57,6 +57,7 @@ use POSIX;
use Bio::EnsEMBL::Feature; use Bio::EnsEMBL::Feature;
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate); use Bio::EnsEMBL::Utils::Exception qw(throw warning deprecate);
use Bio::EnsEMBL::Utils::Scalar qw(assert_ref);
use vars qw(@ISA); use vars qw(@ISA);
@ISA = qw(Bio::EnsEMBL::Feature); @ISA = qw(Bio::EnsEMBL::Feature);
...@@ -369,19 +370,13 @@ sub canonical_transcript { ...@@ -369,19 +370,13 @@ sub canonical_transcript {
if ( defined($transcript) ) { if ( defined($transcript) ) {
# We're attaching a new canonical transcript. # We're attaching a new canonical transcript.
if ( assert_ref( $transcript, 'Bio::EnsEMBL::Transcript' );
!(
ref($transcript)
&& $transcript->isa('Bio::EnsEMBL::Transcript') ) )
{
throw('Argument must be a Bio::EnsEMBL::Transcript');
}
$self->{'canonical_transcript'} = $transcript; $self->{'canonical_transcript'} = $transcript;
$self->{'canonical_transcript_id'} = $transcript->dbID(); $self->{'canonical_transcript_id'} = $transcript->dbID();
} elsif ( !defined( $self->{'canonical_transcript'} ) } elsif ( !defined( $self->{'canonical_transcript'} )
&& defined( $self->{'canonical_transcript_id'} ) ) && defined( $self->{'canonical_transcript_id'} ) )
{ {
# We have not attached a canoncical transcript, but we have the dbID # We have not attached a canoncical transcript, but we have the dbID
# of one. # of one.
...@@ -392,10 +387,10 @@ sub canonical_transcript { ...@@ -392,10 +387,10 @@ sub canonical_transcript {
$self->{'canonical_transcript'} = $self->{'canonical_transcript'} =
$transcript_adaptor->fetch_by_dbID( $transcript_adaptor->fetch_by_dbID(
$self->{'canonical_transcript_id'} ); $self->{'canonical_transcript_id'} );
} else { } else {
warning( "Gene has no adaptor " warning( "Gene has no adaptor "
. "when trying to fetch canonical transcript." ); . "when trying to fetch canonical transcript." );
} }
} }
...@@ -422,8 +417,6 @@ sub canonical_annotation { ...@@ -422,8 +417,6 @@ sub canonical_annotation {
return $self->{'canonical_annotation'}; return $self->{'canonical_annotation'};
} }
=head2 get_all_Attributes =head2 get_all_Attributes
Arg [1] : (optional) String $attrib_code Arg [1] : (optional) String $attrib_code
...@@ -1259,6 +1252,7 @@ sub load { ...@@ -1259,6 +1252,7 @@ sub load {
$self->analysis(); $self->analysis();
$self->get_all_Attributes(); $self->get_all_Attributes();
$self->stable_id(); $self->stable_id();
$self->canonical_transcript();
if ($load_xrefs) { if ($load_xrefs) {
$self->get_all_DBEntries(); $self->get_all_DBEntries();
......
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