Skip to content
Snippets Groups Projects
Commit 17c888b4 authored by Stephen Searle's avatar Stephen Searle
Browse files

Added supporting feature lazy loading

parent 0dde70c8
No related branches found
No related tags found
No related merge requests found
...@@ -243,6 +243,14 @@ sub add_DBEntry { ...@@ -243,6 +243,14 @@ sub add_DBEntry {
sub get_all_supporting_features { sub get_all_supporting_features {
my $self = shift; my $self = shift;
if( !exists $self->{_supporting_evidence} ) {
if($self->adaptor) {
my $tsfa = $self->adaptor->db->get_TranscriptSupportingFeatureAdaptor();
$self->{_supporting_evidence} = $tsfa->fetch_all_by_Transcript($self);
}
}
return $self->{_supporting_evidence} || []; return $self->{_supporting_evidence} || [];
} }
...@@ -273,7 +281,11 @@ sub add_supporting_features { ...@@ -273,7 +281,11 @@ sub add_supporting_features {
# check whether this feature object has been added already # check whether this feature object has been added already
FEATURE: foreach my $feature (@features) { FEATURE: foreach my $feature (@features) {
unless($feature && $feature->isa("Bio::EnsEMBL::FeaturePair")) { if (!defined($feature) || ref($feature) eq "ARRAY") {
throw("Element in transcript supporting features array is undefined or is an ARRAY for " . $self->dbID);
}
if (!$feature || !$feature->isa("Bio::EnsEMBL::FeaturePair")) {
print "feature = " . $feature . "\n";
throw("Supporting feat [$feature] not a " . throw("Supporting feat [$feature] not a " .
"Bio::EnsEMBL::FeaturePair"); "Bio::EnsEMBL::FeaturePair");
} }
...@@ -1603,6 +1615,16 @@ sub transform { ...@@ -1603,6 +1615,16 @@ sub transform {
$new_transcript->{'_trans_exon_array'} = \@new_exons; $new_transcript->{'_trans_exon_array'} = \@new_exons;
} }
if( exists $self->{'_supporting_evidence'} ) {
my @new_features;
for my $old_feature ( @{$self->{'_supporting_evidence'}} ) {
my $new_feature = $old_feature->transform( @_ );
push( @new_features, $new_feature );
}
$new_transcript->{'_supporting_evidence'} = \@new_features;
}
# flush cached internal values that depend on the exon coords # flush cached internal values that depend on the exon coords
$new_transcript->{'transcript_mapper'} = undef; $new_transcript->{'transcript_mapper'} = undef;
$new_transcript->{'coding_region_start'} = undef; $new_transcript->{'coding_region_start'} = undef;
...@@ -1658,6 +1680,16 @@ sub transfer { ...@@ -1658,6 +1680,16 @@ sub transfer {
$new_transcript->{'_trans_exon_array'} = \@new_exons; $new_transcript->{'_trans_exon_array'} = \@new_exons;
} }
if( exists $self->{'_supporting_evidence'} ) {
my @new_features;
for my $old_feature ( @{$self->{'_supporting_evidence'}} ) {
my $new_feature = $old_feature->transfer( @_ );
push( @new_features, $new_feature );
}
$new_transcript->{'_supporting_evidence'} = \@new_features;
}
# flush cached internal values that depend on the exon coords # flush cached internal values that depend on the exon coords
$new_transcript->{'transcript_mapper'} = undef; $new_transcript->{'transcript_mapper'} = undef;
$new_transcript->{'coding_region_start'} = undef; $new_transcript->{'coding_region_start'} = undef;
......
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