![]() |
Rosetta
2021.16
|
AACompositionEnergySetup, a helper class for the AACompositionEnergy energy method that stores all of its setup data. More...
#include <AACompositionEnergySetup.hh>

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::Real > | expected_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< bool > | use_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... | |
AACompositionEnergySetup, a helper class for the AACompositionEnergy energy method that stores all of its setup data.
| 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_.
|
overridedefault |
Default destructor for AACompositionEnergySetup.
|
private |
Do some final checks to ensure that data were loaded properly.
References expected_by_properties_absolute_, expected_by_properties_fraction_, fract_property_deviation_ranges_, property_deviation_ranges_, property_penalties_, property_penalty_fracts_, property_sets_, property_tailfunctions_, core::scoring::aa_composition_energy::TR(), and use_fract_ranges_.
Referenced by AACompositionEnergySetup(), initialize_from_file(), and initialize_from_file_contents().
|
virtual |
Clone: create a copy of this object, and return an owning pointer to the copy.
|
inlineprivate |
Return a constant value for an out-of-bounds behaviour.
Inputs are:
| [in] | before | If true, this is beyond the low range of penalty values. If false, we're beyond the high range. |
| [in] | property | If true, we're counting property sets. If false, we're counting residue types. |
| [in] | index | The 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().
|
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_.
|
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_.
|
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:
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_fract | The fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02). |
| [in] | before | If 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().
|
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.
| [in] | delta_fract | The measured fractional content of amino acids matching this property set in the pose or pose subset minus the expected. |
| [in] | property_set_index | The 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 |
Get tail function name from enum.
References core::scoring::aa_composition_energy::tf_constant, core::scoring::aa_composition_energy::tf_linear, and core::scoring::aa_composition_energy::tf_quadratic.
Referenced by get_tailfunction_from_name().
| void core::scoring::aa_composition_energy::AACompositionEnergySetup::initialize_from_file | ( | std::string const & | filename | ) |
Initialize from a .comp file.
References check_data(), protocols::abinitio::filename(), parse_penalty_definitions(), reset(), and core::scoring::aa_composition_energy::TR().
| 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().
|
inlineprivate |
Calculate a penalty, linearly interpolating between penalty values.
Used only in the case of fractional penalty ranges.
| [in] | delta_fract | The fractional deviation from the expected count (e.g. if expected is 5% and observed is 3%, this is -0.02). |
| [in] | index | The 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().
|
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:
| [in] | before | If true, this is beyond the low range of penalty values. If false, we're beyond the high range. |
| [in] | property | If true, we're counting property sets. If false, we're counting residue types. |
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_fract | The 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().
|
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:
| [in] | before | If true, this is beyond the low range of penalty values. If false, we're beyond the high range. |
| [in] | property | If true, we're counting property sets. If false, we're counting residue types. |
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_expected | The deviation from the expected count. |
References protocols::match::upstream::b, property_deviation_ranges_, and property_penalties_.
Referenced by out_of_bounds_func().
|
inline |
Get the number of sets of properties that we'll be counting.
References property_sets_.
|
inlineprivate |
Calculate the out-of-bounds behaviour of the penalty function and return the penalty value.
Inputs are:
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_expected | The deviation from the expected count. |
| [in] | before | If 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().
|
private |
Parse out penalty definition from a single block of lines from file.
The lines vector should be the lines BETWEEN the PENALTY_DEFINITION and END_PENALTY_DEFINITION lines.
References expected_by_properties_absolute_, expected_by_properties_fraction_, fract_property_deviation_ranges_, get_tailfunction_from_name(), property_deviation_ranges_, property_penalties_, property_penalty_fracts_, property_sets_, property_tailfunctions_, core::scoring::aa_composition_energy::tf_quadratic, core::scoring::aa_composition_energy::tf_unknown, and use_fract_ranges_.
Referenced by parse_penalty_definitions().
|
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().
|
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_.
|
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_.
|
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:
| [in] | before | If true, this is beyond the low range of penalty values. If false, we're beyond the high range. |
| [in] | property | If true, we're counting property sets. If false, we're counting residue types. |
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_fract | The 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().
|
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:
| [in] | before | If true, this is beyond the low range of penalty values. If false, we're beyond the high range. |
| [in] | property | If true, we're counting property sets. If false, we're counting residue types. |
| [in] | index | The index in the list of properties or residue types that we're counting. |
| [in] | delta_expected | The 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 |
Get a summary of the data stored in this object.
References expected_by_properties_absolute_, expected_by_properties_fraction_, fract_property_deviation_ranges_, property_deviation_ranges_, property_penalties_, property_penalty_fracts_, property_sets_, and use_fract_ranges_.
| void core::scoring::aa_composition_energy::AACompositionEnergySetup::reset | ( | ) |
Reset all data in this data storage object.
References expected_by_properties_absolute_, expected_by_properties_fraction_, fract_property_deviation_ranges_, property_deviation_ranges_, property_penalties_, property_penalty_fracts_, property_sets_, property_tailfunctions_, and use_fract_ranges_.
Referenced by initialize_from_file(), and initialize_from_file_contents().
| 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_.
|
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_.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
The residue property sets that we'll be counting.
Referenced by AACompositionEnergySetup(), check_data(), n_property_sets(), parse_a_penalty_definition(), property_set_indices_matching_residue(), report(), and reset().
|
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().
|
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().
1.8.7