Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
core::scoring::aa_composition_energy::AACompositionEnergySetup Class Reference

AACompositionEnergySetup, a helper class for the AACompositionEnergy energy method that stores all of its setup data. More...

#include <AACompositionEnergySetup.hh>

Inheritance diagram for core::scoring::aa_composition_energy::AACompositionEnergySetup:
Inheritance graph
[legend]

Public Member Functions

 AACompositionEnergySetup ()
 Default constructor for AACompositionEnergySetup. More...
 
 AACompositionEnergySetup (AACompositionEnergySetup const &src)
 Copy constructor for AACompositionEnergySetup. More...
 
 ~AACompositionEnergySetup () override
 Default destructor for AACompositionEnergySetup. More...
 
virtual AACompositionEnergySetupOP clone () const
 Clone: create a copy of this object, and return an owning pointer to the copy. More...
 
void reset ()
 Reset all data in this data storage object. More...
 
void initialize_from_file (std::string const &filename)
 Initialize from a .comp file. More...
 
void initialize_from_file_contents (std::string const &filecontents)
 Initialize from a string in the format of a .comp file. More...
 
std::string get_tailfunction_name (TailFunction const tf) const
 Get tail function name from enum. More...
 
TailFunction get_tailfunction_from_name (std::string const &name) const
 Get tail function enum from name. More...
 
bool use_fract_ranges (core::Size const index) const
 Look up whether we're using absolute (return false) or fractional (return true) penalty ranges. More...
 
bool use_fract_ranges_any () const
 Determine whether ANY of the property sets of this helper object use fractional ranges. More...
 
bool use_fract_expected_values_any () const
 Determine whether ANY of the property sets of this helper object use fractional expected values. More...
 
core::Real property_penalty (signed long const delta_expected, core::Size const property_set_index) const
 Look up the penalty for a property set of internal index property_set_index, given a deviation from the desired count given by delta_expected. More...
 
core::Real fract_property_penalty (core::Real const delta_fract, core::Size const property_set_index) const
 Look up the penalty for a property set of internal index property_set_index, given a fractional content given by fract. More...
 
core::Size n_property_sets () const
 Get the number of sets of properties that we'll be counting. More...
 
signed long expected_by_properties_absolute (core::Size const index) const
 Get the expected absolute number of residues for a given set of properties, by property set index. More...
 
core::Real expected_by_properties_fraction (core::Size const index) const
 Get the expected fractional number of residues for a given set of properties, by property set index. More...
 
void property_set_indices_matching_residue (core::chemical::ResidueType const &rsd_type, utility::vector1< core::Size > &indices_out) const
 Get the indices of all of the property sets corresponding to the current residue. More...
 
std::string report () const
 Get a summary of the data stored in this object. More...
 

Private Member Functions

void parse_penalty_definitions (utility::vector1< std::string > const &lines)
 Parse out penalty definition blocks from the data read from file. More...
 
void parse_a_penalty_definition (utility::vector1< std::string > const &lines)
 Parse out penalty definition from a single block of lines from file. More...
 
void check_data () const
 Do some final checks to ensure that data were loaded properly. More...
 
core::Real interpolate_property_penalties (core::Real const &delta_fract, core::Size const index) const
 Calculate a penalty, linearly interpolating between penalty values. More...
 
core::Real out_of_bounds_func (core::Size const index, signed long const delta_expected, bool const before) const
 Calculate the out-of-bounds behaviour of the penalty function and return the penalty value. More...
 
core::Real fract_out_of_bounds_func (core::Size const index, core::Real const &delta_fract, bool const before) const
 Calculate the out-of-bounds behaviour of the penalty function and return the penalty value. This version is for cases with fractional desired contents. More...
 
core::Real const_out_of_bounds_func (bool const before, core::Size const index) const
 Return a constant value for an out-of-bounds behaviour. More...
 
core::Real linear_fract_out_of_bounds_func (bool const before, core::Size const index, core::Real const &delta_fract) const
 Return a linear value for an out-of-bounds behaviour. This version is for fractional penalty ranges. More...
 
core::Real linear_out_of_bounds_func (bool const before, core::Size const index, signed long const delta_expected) const
 Return a linear value for an out-of-bounds behaviour. More...
 
core::Real quadratic_fract_out_of_bounds_func (bool const before, core::Size const index, core::Real const &delta_fract) const
 Return a quadratic value for an out-of-bounds behaviour. This version is for fractional penalty ranges. More...
 
core::Real quadratic_out_of_bounds_func (bool const before, core::Size const index, signed long const delta_expected) const
 Return a quadratic value for an out-of-bounds behaviour. More...
 

Private Attributes

utility::vector1
< AACompositionPropertiesSetOP
property_sets_
 The residue property sets that we'll be counting. More...
 
utility::vector1< core::Realexpected_by_properties_fraction_
 The expected number of residues for each set of properties (by property set index), as a fraction (from 0 to 1) of total. More...
 
utility::vector1< signed long > expected_by_properties_absolute_
 The expected number of residues for each set of properties (by property set index), as an absolute number. More...
 
utility::vector1
< utility::vector1< core::Real > > 
property_penalties_
 Penalties for each residue count (relative to expected) and each property set. More...
 
utility::vector1
< utility::vector1< core::Real > > 
property_penalty_fracts_
 For each set of property penalties, this is the corresponding fractional abundance. More...
 
utility::vector1< booluse_fract_ranges_
 For a given property set, should we use absolute ranges (false) or fractional ranges (true)? More...
 
utility::vector1< std::pair
< signed long, signed long > > 
property_deviation_ranges_
 Deviation ranges for each property set. More...
 
utility::vector1< std::pair
< core::Real, core::Real > > 
fract_property_deviation_ranges_
 Deviation ranges for each property set, expressed as a fraction of total residues. More...
 
utility::vector1< std::pair
< TailFunction, TailFunction > > 
property_tailfunctions_
 The behaviours at the end of the user-defined range for each property set. More...
 

Detailed Description

AACompositionEnergySetup, a helper class for the AACompositionEnergy energy method that stores all of its setup data.

Constructor & Destructor Documentation

core::scoring::aa_composition_energy::AACompositionEnergySetup::AACompositionEnergySetup ( )

Default constructor for AACompositionEnergySetup.

core::scoring::aa_composition_energy::AACompositionEnergySetup::AACompositionEnergySetup ( AACompositionEnergySetup const &  src)

Copy constructor for AACompositionEnergySetup.

References check_data(), and property_sets_.

core::scoring::aa_composition_energy::AACompositionEnergySetup::~AACompositionEnergySetup ( )
overridedefault

Default destructor for AACompositionEnergySetup.

Member Function Documentation

void core::scoring::aa_composition_energy::AACompositionEnergySetup::check_data ( ) const
private
AACompositionEnergySetupOP core::scoring::aa_composition_energy::AACompositionEnergySetup::clone ( ) const
virtual

Clone: create a copy of this object, and return an owning pointer to the copy.

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::const_out_of_bounds_func ( bool const  before,
core::Size const  index 
) const
inlineprivate

Return a constant value for an out-of-bounds behaviour.

Inputs are:

Parameters
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.
[in]propertyIf true, we're counting property sets. If false, we're counting residue types.
[in]indexThe index in the list of properties or residue types that we're counting.

References property_penalties_.

Referenced by fract_out_of_bounds_func(), and out_of_bounds_func().

signed long core::scoring::aa_composition_energy::AACompositionEnergySetup::expected_by_properties_absolute ( core::Size const  index) const
inline

Get the expected absolute number of residues for a given set of properties, by property set index.

Warning! For speed, there's no check that the index is in range!

References expected_by_properties_absolute_.

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::expected_by_properties_fraction ( core::Size const  index) const
inline

Get the expected fractional number of residues for a given set of properties, by property set index.

Warning! For speed, there's no check that the index is in range!

References expected_by_properties_fraction_.

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::fract_out_of_bounds_func ( core::Size const  index,
core::Real const &  delta_fract,
bool const  before 
) const
inlineprivate

Calculate the out-of-bounds behaviour of the penalty function and return the penalty value. This version is for cases with fractional desired contents.

Inputs are:

Parameters
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_fractThe fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02).
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.

References const_out_of_bounds_func(), linear_fract_out_of_bounds_func(), property_tailfunctions_, quadratic_fract_out_of_bounds_func(), core::scoring::aa_composition_energy::tf_constant, core::scoring::aa_composition_energy::tf_linear, core::scoring::aa_composition_energy::tf_quadratic, and core::scoring::aa_composition_energy::tf_unknown.

Referenced by fract_property_penalty().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::fract_property_penalty ( core::Real const  delta_fract,
core::Size const  property_set_index 
) const
inline

Look up the penalty for a property set of internal index property_set_index, given a fractional content given by fract.

This version is for fractional property penalties.

Parameters
[in]delta_fractThe measured fractional content of amino acids matching this property set in the pose or pose subset minus the expected.
[in]property_set_indexThe index of this property set.

References fract_out_of_bounds_func(), fract_property_deviation_ranges_, and interpolate_property_penalties().

TailFunction core::scoring::aa_composition_energy::AACompositionEnergySetup::get_tailfunction_from_name ( std::string const &  name) const

Get tail function enum from name.

This is slow; it calls get_tailfunction_name repeatedly. Intended only for use during setup.

References get_tailfunction_name(), core::scoring::aa_composition_energy::tf_end_of_list, and core::scoring::aa_composition_energy::tf_unknown.

Referenced by parse_a_penalty_definition().

std::string core::scoring::aa_composition_energy::AACompositionEnergySetup::get_tailfunction_name ( TailFunction const  tf) const
void core::scoring::aa_composition_energy::AACompositionEnergySetup::initialize_from_file ( std::string const &  filename)
void core::scoring::aa_composition_energy::AACompositionEnergySetup::initialize_from_file_contents ( std::string const &  filecontents)

Initialize from a string in the format of a .comp file.

Allows external code to initialize object without having it read directly from disk.

References check_data(), parse_penalty_definitions(), reset(), and core::scoring::aa_composition_energy::TR().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::interpolate_property_penalties ( core::Real const &  delta_fract,
core::Size const  index 
) const
inlineprivate

Calculate a penalty, linearly interpolating between penalty values.

Used only in the case of fractional penalty ranges.

Parameters
[in]delta_fractThe fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02).
[in]indexThe index of the property set that we're counting. Note that, for speed, there is no check that this is in range.

References property_penalties_, and property_penalty_fracts_.

Referenced by fract_property_penalty().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::linear_fract_out_of_bounds_func ( bool const  before,
core::Size const  index,
core::Real const &  delta_fract 
) const
inlineprivate

Return a linear value for an out-of-bounds behaviour. This version is for fractional penalty ranges.

This fits the first two or last two points to a straight line, then extends it. Inputs are:

Parameters
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.
[in]propertyIf true, we're counting property sets. If false, we're counting residue types.
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_fractThe fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02).

References protocols::match::upstream::b, fract_property_deviation_ranges_, property_penalties_, and property_penalty_fracts_.

Referenced by fract_out_of_bounds_func().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::linear_out_of_bounds_func ( bool const  before,
core::Size const  index,
signed long const  delta_expected 
) const
inlineprivate

Return a linear value for an out-of-bounds behaviour.

This fits the first two or last two points to a straight line, then extends it. Inputs are:

Parameters
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.
[in]propertyIf true, we're counting property sets. If false, we're counting residue types.
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_expectedThe deviation from the expected count.

References protocols::match::upstream::b, property_deviation_ranges_, and property_penalties_.

Referenced by out_of_bounds_func().

core::Size core::scoring::aa_composition_energy::AACompositionEnergySetup::n_property_sets ( ) const
inline

Get the number of sets of properties that we'll be counting.

References property_sets_.

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::out_of_bounds_func ( core::Size const  index,
signed long const  delta_expected,
bool const  before 
) const
inlineprivate

Calculate the out-of-bounds behaviour of the penalty function and return the penalty value.

Inputs are:

Parameters
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_expectedThe deviation from the expected count.
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.

References const_out_of_bounds_func(), linear_out_of_bounds_func(), property_tailfunctions_, quadratic_out_of_bounds_func(), core::scoring::aa_composition_energy::tf_constant, core::scoring::aa_composition_energy::tf_linear, core::scoring::aa_composition_energy::tf_quadratic, and core::scoring::aa_composition_energy::tf_unknown.

Referenced by property_penalty().

void core::scoring::aa_composition_energy::AACompositionEnergySetup::parse_a_penalty_definition ( utility::vector1< std::string > const &  lines)
private
void core::scoring::aa_composition_energy::AACompositionEnergySetup::parse_penalty_definitions ( utility::vector1< std::string > const &  lines)
private

Parse out penalty definition blocks from the data read from file.

References parse_a_penalty_definition().

Referenced by initialize_from_file(), and initialize_from_file_contents().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::property_penalty ( signed long const  delta_expected,
core::Size const  property_set_index 
) const
inline

Look up the penalty for a property set of internal index property_set_index, given a deviation from the desired count given by delta_expected.

References out_of_bounds_func(), property_deviation_ranges_, and property_penalties_.

void core::scoring::aa_composition_energy::AACompositionEnergySetup::property_set_indices_matching_residue ( core::chemical::ResidueType const &  rsd_type,
utility::vector1< core::Size > &  indices_out 
) const
inline

Get the indices of all of the property sets corresponding to the current residue.

Returns empty vector if none of the property sets that we're counting corresponds to the current residue.

References property_sets_.

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::quadratic_fract_out_of_bounds_func ( bool const  before,
core::Size const  index,
core::Real const &  delta_fract 
) const
inlineprivate

Return a quadratic value for an out-of-bounds behaviour. This version is for fractional penalty ranges.

This fits the first two or the last two values to a parabola centred on the origin, then extends it. Inputs are:

Parameters
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.
[in]propertyIf true, we're counting property sets. If false, we're counting residue types.
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_fractThe fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02).

References core::pose::motif::a(), protocols::match::upstream::b, property_penalties_, and property_penalty_fracts_.

Referenced by fract_out_of_bounds_func().

core::Real core::scoring::aa_composition_energy::AACompositionEnergySetup::quadratic_out_of_bounds_func ( bool const  before,
core::Size const  index,
signed long const  delta_expected 
) const
inlineprivate

Return a quadratic value for an out-of-bounds behaviour.

This fits the first two or the last two values to a parabola centred on the origin, then extends it. Inputs are:

Parameters
[in]beforeIf true, this is beyond the low range of penalty values. If false, we're beyond the high range.
[in]propertyIf true, we're counting property sets. If false, we're counting residue types.
[in]indexThe index in the list of properties or residue types that we're counting.
[in]delta_expectedThe deviation from the expected count.

References core::pose::motif::a(), protocols::match::upstream::b, property_deviation_ranges_, and property_penalties_.

Referenced by out_of_bounds_func().

std::string core::scoring::aa_composition_energy::AACompositionEnergySetup::report ( ) const
void core::scoring::aa_composition_energy::AACompositionEnergySetup::reset ( )
bool core::scoring::aa_composition_energy::AACompositionEnergySetup::use_fract_expected_values_any ( ) const

Determine whether ANY of the property sets of this helper object use fractional expected values.

References expected_by_properties_absolute_.

bool core::scoring::aa_composition_energy::AACompositionEnergySetup::use_fract_ranges ( core::Size const  index) const
inline

Look up whether we're using absolute (return false) or fractional (return true) penalty ranges.

References use_fract_ranges_.

bool core::scoring::aa_composition_energy::AACompositionEnergySetup::use_fract_ranges_any ( ) const

Determine whether ANY of the property sets of this helper object use fractional ranges.

References use_fract_ranges_.

Member Data Documentation

utility::vector1< signed long > core::scoring::aa_composition_energy::AACompositionEnergySetup::expected_by_properties_absolute_
private

The expected number of residues for each set of properties (by property set index), as an absolute number.

If this is negative, the fraction is used instead.

Referenced by check_data(), expected_by_properties_absolute(), parse_a_penalty_definition(), report(), reset(), and use_fract_expected_values_any().

utility::vector1< core::Real > core::scoring::aa_composition_energy::AACompositionEnergySetup::expected_by_properties_fraction_
private

The expected number of residues for each set of properties (by property set index), as a fraction (from 0 to 1) of total.

Referenced by check_data(), expected_by_properties_fraction(), parse_a_penalty_definition(), report(), and reset().

utility::vector1< std::pair < core::Real, core::Real > > core::scoring::aa_composition_energy::AACompositionEnergySetup::fract_property_deviation_ranges_
private

Deviation ranges for each property set, expressed as a fraction of total residues.

Outer vector is the property set, by internal index. Inner vector is pairs of deviation ranges (e.g. 0.05,0.09 indicating that we are storing penalties for having 5% of a residue type to 9% of a residue type for a given property set). Deviations outside of this range are assigned a value given by the begin function or end function.

Referenced by check_data(), fract_property_penalty(), linear_fract_out_of_bounds_func(), parse_a_penalty_definition(), report(), and reset().

utility::vector1< std::pair < signed long, signed long > > core::scoring::aa_composition_energy::AACompositionEnergySetup::property_deviation_ranges_
private

Deviation ranges for each property set.

Outer vector is the property set, by internal index. Inner vector is pairs of deviation ranges (e.g. -10,5 indicating that we are storing penalties for having 10 residues too few up to 5 residues too many for a given property set). Deviations outside of this range are assigned a value given by the begin function or end function.

Referenced by check_data(), linear_out_of_bounds_func(), parse_a_penalty_definition(), property_penalty(), quadratic_out_of_bounds_func(), report(), and reset().

utility::vector1< utility::vector1 < core::Real > > core::scoring::aa_composition_energy::AACompositionEnergySetup::property_penalties_
private

Penalties for each residue count (relative to expected) and each property set.

Outer vector is the property set, by internal index. Inner vector is the penalty value for a given deviation from the ideal count, by internal index.

Referenced by check_data(), const_out_of_bounds_func(), interpolate_property_penalties(), linear_fract_out_of_bounds_func(), linear_out_of_bounds_func(), parse_a_penalty_definition(), property_penalty(), quadratic_fract_out_of_bounds_func(), quadratic_out_of_bounds_func(), report(), and reset().

utility::vector1< utility::vector1 < core::Real > > core::scoring::aa_composition_energy::AACompositionEnergySetup::property_penalty_fracts_
private

For each set of property penalties, this is the corresponding fractional abundance.

Outer vector is the property set, by internal index. Inner vector is the fractional abundance corresponding to each penalty value in property_penalties_. Inner vector will be an empty vector if use_fract_ranges_ is false (i.e. only used if fractional ranges are used).

Referenced by check_data(), interpolate_property_penalties(), linear_fract_out_of_bounds_func(), parse_a_penalty_definition(), quadratic_fract_out_of_bounds_func(), report(), and reset().

utility::vector1< AACompositionPropertiesSetOP > core::scoring::aa_composition_energy::AACompositionEnergySetup::property_sets_
private
utility::vector1< std::pair <TailFunction, TailFunction > > core::scoring::aa_composition_energy::AACompositionEnergySetup::property_tailfunctions_
private

The behaviours at the end of the user-defined range for each property set.

By default, past the user-defined range, the energy increases quadratically with increasing deviations from ideal sequence composition. The user can set this to be linear or constant, though. The vector index corresponds to the property set index, and the internal std::pair represents the behaviour below the range and the behaviour above the range.

Referenced by check_data(), fract_out_of_bounds_func(), out_of_bounds_func(), parse_a_penalty_definition(), and reset().

utility::vector1< bool > core::scoring::aa_composition_energy::AACompositionEnergySetup::use_fract_ranges_
private

For a given property set, should we use absolute ranges (false) or fractional ranges (true)?

Referenced by check_data(), parse_a_penalty_definition(), report(), reset(), use_fract_ranges(), and use_fract_ranges_any().


The documentation for this class was generated from the following files: