Commit da0d1d94 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Cache the most recently used slice.

parent 7c5f39a4
...@@ -34,17 +34,31 @@ sub _create_feature { ...@@ -34,17 +34,31 @@ sub _create_feature {
my ( $dbid, $start, $end, $strand, $slice ) = my ( $dbid, $start, $end, $strand, $slice ) =
rearrange( [ 'DBID', 'START', 'END', 'STRAND', 'SLICE' ], rearrange( [ 'DBID', 'START', 'END', 'STRAND', 'SLICE' ],
@{$args} ); %{$args} );
my $feature =
[ $dbid, $slice->get_seq_region_id(), $start, $end, $strand ];
return [ $dbid, $slice->get_seq_region_id(), $start, $end, $strand ]; return $feature;
} }
sub _create_feature_fast { sub _create_feature_fast {
my ( $this, $feature_type, $args ) = @_; my ( $this, $feature_type, $args ) = @_;
return [ $args->{'dbID'}, $args->{'slice'}->get_seq_region_id(), if ( !defined( $this->{'recent_slice'} )
$args->{'start'}, $args->{'end'}, || $this->{'recent_slice'} ne $args->{'slice'} )
$args->{'strand'} ]; {
$this->{'recent_slice'} = $args->{'slice'};
$this->{'recent_slice_seq_region_id'} =
$args->{'slice'}->get_seq_region_id();
}
my $feature = [ $args->{'dbID'},
$this->{'recent_slice_seq_region_id'},
$args->{'start'},
$args->{'end'},
$args->{'strand'} ];
return $feature;
} }
1; 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