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

In slice(): Transfer all supporting features to the new slice if a new

slice was given.  Noticed by Michael S.
parent af8449aa
No related branches found
No related tags found
No related merge requests found
...@@ -787,11 +787,32 @@ sub coding_region_end { ...@@ -787,11 +787,32 @@ sub coding_region_end {
=cut =cut
sub slice { sub slice {
my $self = shift; my ( $self, $slice ) = @_;
# if an arg was provided, flush the internal sequence cache
delete $self->{'_seq_cache'} if(@_); if ( defined($slice) ) {
return $self->SUPER::slice(@_); # If a new slice was provided, flush the internal sequence cache and
} # transcer all supporting evidence to the new slice.
delete $self->{'_seq_cache'};
if ( exists( $self->{'_supporting_evidence'} ) ) {
my @new_features;
for my $old_feature ( @{ $self->{'_supporting_evidence'} } ) {
my $new_feature = $old_feature->transfer($slice);
push( @new_features, $new_feature );
}
$self->{'_supporting_evidence'} = \@new_features;
}
return $self->SUPER::slice($slice);
} elsif ( @_ > 1 ) {
return $self->SUPER::slice(undef);
} else {
return $self->SUPER::slice();
}
} ## end sub slice
=head2 equals =head2 equals
......
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