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

Add _lightweight() method and use it to (temporarily) set the

lightweight flag when creating objects for binning.
parent e8f69431
......@@ -22,8 +22,10 @@ sub fetch_bins_by_Slice {
my ( $slice, $method, $nbins, $logic_name ) =
rearrange( [ 'SLICE', 'METHOD', 'NBINS', 'LOGIC_NAME' ], @_ );
# FIXME: Set lightweight
return
my $old_value = $this->_lightweight();
$this->_lightweight(1);
my $bins =
$this->_bin_features(
-slice => $slice,
-nbins => $nbins,
......@@ -31,7 +33,10 @@ sub fetch_bins_by_Slice {
-features =>
$this->fetch_by_Slice_constraint( $slice, undef, $logic_name )
);
# FIXME: Unset lightweight
$this->_lightweight($old_value);
return $bins;
}
# ----------------------------------------------------------------------
......@@ -87,6 +92,16 @@ sub _create_feature_fast {
# ----------------------------------------------------------------------
# Private methods
sub _lightweight {
my ( $this, $value ) = @_;
if ( defined($value) ) {
$self->{'lightweight'} = ( $value != 0 );
}
return $self->{'lightweight'} || 0;
}
our %VALID_BINNING_METHODS = (
'count' => 0,
'density' => 0, # Same as 'count'.
......
......@@ -16,10 +16,12 @@ sub _create_feature {
my $feature = $this->SUPER::_create_feature( $feature_type, $args );
my ( $analysis, $stable_id, $version ) =
rearrange( [ 'STABLE_ID', 'VERSION', ], %{$args} );
if ( !$this->_lightweight() ) {
my ( $analysis, $stable_id, $version ) =
rearrange( [ 'STABLE_ID', 'VERSION', ], %{$args} );
push( @{$feature}, $stable_id, $version );
push( @{$feature}, $stable_id, $version );
}
return $feature;
}
......
......@@ -16,16 +16,18 @@ sub _create_feature {
my $feature = $this->SUPER::_create_feature( $feature_type, $args );
my ( $hstart, $hend, $score, $repeat_consensus, $analysis ) =
rearrange( [ 'HSTART', 'HEND',
'SCORE', 'REPEAT_CONSENSUS',
'ANALYSIS'
],
@{$args} );
push( @{$feature},
$hstart, $hend, $score, $repeat_consensus->dbID(),
$analysis->dbID() );
if ( !$this->_lightweight() ) {
my ( $hstart, $hend, $score, $repeat_consensus, $analysis ) =
rearrange( [ 'HSTART', 'HEND',
'SCORE', 'REPEAT_CONSENSUS',
'ANALYSIS'
],
@{$args} );
push( @{$feature},
$hstart, $hend, $score, $repeat_consensus->dbID(),
$analysis->dbID() );
}
return $feature;
}
......@@ -36,10 +38,12 @@ sub _create_feature_fast {
my $feature =
$this->SUPER::_create_feature_fast( $feature_type, $args );
push( @{$feature},
$args->{'hstart'}, $args->{'hend'}, $args->{'score'},
$args->{'repeat_consensus'}->dbID(),
$args->{'analysis'}->dbID() );
if ( !$this->_lightweight() ) {
push( @{$feature},
$args->{'hstart'}, $args->{'hend'}, $args->{'score'},
$args->{'repeat_consensus'}->dbID(),
$args->{'analysis'}->dbID() );
}
return $feature;
}
......
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