Rosetta
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Static Private Member Functions | Private Attributes | List of all members
core::simple_metrics::PerResidueProbabilitiesMetric Class Referenceabstract

A class that is derived to calculate probabilities for different residue types for each Residue. Apply(pose) method calculates this metric and adds it to the pose score for output. More...

#include <PerResidueProbabilitiesMetric.hh>

Inheritance diagram for core::simple_metrics::PerResidueProbabilitiesMetric:
Inheritance graph
[legend]

Public Member Functions

 PerResidueProbabilitiesMetric ()
 
 ~PerResidueProbabilitiesMetric () override
 
 PerResidueProbabilitiesMetric (PerResidueProbabilitiesMetric const &other)
 
PerResidueProbabilitiesMetricoperator= (PerResidueProbabilitiesMetric const &)
 
void apply (std::string const &out_label, pose::Pose &pose, bool override_existing_data=false) const override
 Calculate the metric and add it to the pose as a score. labeled as out_label. More...
 
void set_residue_selector (select::residue_selector::ResidueSelectorCOP selector)
 Set a ResidueSelector for which we will calculate values over. More...
 
void set_output_as_pdb_nums (bool output_as_pdb_nums)
 Set to output in PDB numbering instead of Rosetta during the Apply function, which adds the data to pose as extra scores. More...
 
virtual std::map< core::Size, std::map< core::chemical::AA, core::Real > > calculate (pose::Pose const &pose) const =0
 Calculate the metric. This map is Rosetta Resnum->(ResType->value) and includes only those residues selected. More...
 
std::map< core::Size, std::map< core::chemical::AA, core::Real > > cached_calculate (pose::Pose const &pose, bool use_cache, std::string const &prefix="", std::string const &suffix="", bool fail_on_missing_cache=true, bool use_ref_pose_for_cache=true) const
 Grab the data from the pose if it exists or calculate the metric. More...
 
std::string name () const override=0
 Name of the class. More...
 
std::string metric () const override=0
 Name of the metric. More...
 
utility::vector1< std::string > get_metric_names () const override
 Get the submetric names that this Metric will calculate. More...
 
select::residue_selector::ResidueSelectorCOP get_selector () const
 Get the set residue selector of this class. More...
 
void parse_my_tag (utility::tag::TagCOP tag, basic::datacache::DataMap &data) override=0
 called by parse_my_tag – should not be used directly More...
 
SimpleMetricOP clone () const override=0
 
virtual void parse_per_residue_tag (utility::tag::TagCOP tag, basic::datacache::DataMap &data)
 Parse the base class tag. Keep required interface for parse_my_tag. More...
 
virtual void apply (std::string const &out_label, pose::Pose &pose, bool override_existing_data=false) const=0
 Calculate the metric and add it to the Score, which is output into a scorefile - labeled as label Must be implemented by derived classes. More...
 
void apply (pose::Pose &pose, std::string const &prefix="", std::string const &suffix="", bool override_existing_data=false) const
 Calculate the metric and add it to the Score, which is output into a scorefile - labeled as prefix+metric+suffix. More...
 
- Public Member Functions inherited from core::simple_metrics::SimpleMetric
 SimpleMetric (std::string const &simple_metric_type)
 
 ~SimpleMetric () override
 
 SimpleMetric (SimpleMetric const &other)
 
SimpleMetricoperator= (SimpleMetric const &)
 
void apply (pose::Pose &pose, std::string const &prefix="", std::string const &suffix="", bool override_existing_data=false) const
 Calculate the metric and add it to the Score, which is output into a scorefile - labeled as prefix+metric+suffix. More...
 
void set_custom_type (std::string const &custom_type)
 
std::string get_custom_type () const
 Additional setting to prefix/suffix. More...
 
virtual void parse_base_tag (utility::tag::TagCOP tag)
 Parse the base class tag. Keep required interface for parse_my_tag. More...
 
std::string simple_metric_type () const
 
std::string get_final_sm_type () const
 Get the final name of this metric including its simple_metric_type_ name and any set custom type. More...
 
virtual void provide_citation_info (basic::citation_manager::CitationCollectionList &) const
 Provide citations to the passed CitationCollectionList Subclasses should add the info for themselves and any other classes they use. More...
 

Static Public Member Functions

static void add_schema (utility::tag::XMLSchemaComplexTypeGeneratorOP complex_schema)
 Add options to the schema from this base class. More...
 
- Static Public Member Functions inherited from core::simple_metrics::SimpleMetric
static utility::tag::XMLSchemaComplexTypeGeneratorOP complex_type_generator_for_simple_metric (utility::tag::XMLSchemaDefinition &)
 

Static Protected Member Functions

static void output_sequence_profile (std::string const &sequence, std::map< core::Size, std::map< core::chemical::AA, core::Real >> const &logit_map, std::string const &output_filename)
 Format the probabilities in psi-blast position-specific-scoring-matrix (PSSM) format and write to file. More...
 

Static Private Member Functions

static void write_profile (core::sequence::SequenceProfile &profile, std::string const &output_filename)
 Output the sequence_profile as file. More...
 

Private Attributes

select::residue_selector::ResidueSelectorCOP selector_
 
bool output_as_pdb_nums_ = false
 

Detailed Description

A class that is derived to calculate probabilities for different residue types for each Residue. Apply(pose) method calculates this metric and adds it to the pose score for output.

Calculate(pose) method calculates core::Real values and returns them as a map<Size, map< AA, Real>> Resnum:(Restype:Value)

Constructor & Destructor Documentation

◆ PerResidueProbabilitiesMetric() [1/2]

core::simple_metrics::PerResidueProbabilitiesMetric::PerResidueProbabilitiesMetric ( )

References selector_.

◆ ~PerResidueProbabilitiesMetric()

core::simple_metrics::PerResidueProbabilitiesMetric::~PerResidueProbabilitiesMetric ( )
overridedefault

◆ PerResidueProbabilitiesMetric() [2/2]

core::simple_metrics::PerResidueProbabilitiesMetric::PerResidueProbabilitiesMetric ( PerResidueProbabilitiesMetric const &  other)

References selector_.

Member Function Documentation

◆ add_schema()

void core::simple_metrics::PerResidueProbabilitiesMetric::add_schema ( utility::tag::XMLSchemaComplexTypeGeneratorOP  complex_schema)
static

◆ apply() [1/3]

void core::simple_metrics::SimpleMetric::apply

Calculate the metric and add it to the Score, which is output into a scorefile - labeled as prefix+metric+suffix.

◆ apply() [2/3]

void core::simple_metrics::PerResidueProbabilitiesMetric::apply ( std::string const &  out_label,
pose::Pose pose,
bool  override_existing_data = false 
) const
overridevirtual

Calculate the metric and add it to the pose as a score. labeled as out_label.

Score is added to the SimpleMetricData cache in the pose A ReferencePose is created with out_label as a name for further access. Data is output to the final scorefile.

Implements core::simple_metrics::SimpleMetric.

References calculate(), core::simple_metrics::get_sm_data(), name(), output_as_pdb_nums_, and core::simple_metrics::throw_sm_override_error().

◆ apply() [3/3]

virtual void core::simple_metrics::SimpleMetric::apply

Calculate the metric and add it to the Score, which is output into a scorefile - labeled as label Must be implemented by derived classes.

◆ cached_calculate()

std::map< core::Size, std::map< core::chemical::AA, core::Real > > core::simple_metrics::PerResidueProbabilitiesMetric::cached_calculate ( pose::Pose const &  pose,
bool  use_cache,
std::string const &  prefix = "",
std::string const &  suffix = "",
bool  fail_on_missing_cache = true,
bool  use_ref_pose_for_cache = true 
) const

Grab the data from the pose if it exists or calculate the metric.

If use_cache is true, we will attempt to pull the data from the pose. If fail_on_missing_cache is true, we will fail, otherwise, we will calculate the metric.

This function is meant to support caching metrics, so values do not need to be calculated twice, for example in SimpleMetricFilter/Features or code-wise where data takes a while to calculate and can be reused.

If we cached the data, we have created a ref-pose and can match the current resnums with our refpose resnums using the use_ref_pose_for_cache option. This allows us to delete residues and still retain the given data to match.

References calculate(), core::simple_metrics::SimpleMetric::get_final_sm_type(), core::simple_metrics::get_sm_data(), core::simple_metrics::has_sm_data(), and name().

◆ calculate()

virtual std::map< core::Size, std::map< core::chemical::AA, core::Real > > core::simple_metrics::PerResidueProbabilitiesMetric::calculate ( pose::Pose const &  pose) const
pure virtual

Calculate the metric. This map is Rosetta Resnum->(ResType->value) and includes only those residues selected.

Return by value as this function can not STORE the result, it only calculates. Store the result in the pose by using the apply method, which calls this method and stores the result in the pose as ExtraScoreValues.

Implemented in core::simple_metrics::TestPerResidueProbabilitiesMetric, and protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric.

Referenced by apply(), and cached_calculate().

◆ clone()

SimpleMetricOP core::simple_metrics::PerResidueProbabilitiesMetric::clone ( ) const
overridepure virtual

◆ get_metric_names()

utility::vector1< std::string > core::simple_metrics::PerResidueProbabilitiesMetric::get_metric_names ( ) const
overridevirtual

Get the submetric names that this Metric will calculate.

Implements core::simple_metrics::SimpleMetric.

References metric().

◆ get_selector()

select::residue_selector::ResidueSelectorCOP core::simple_metrics::PerResidueProbabilitiesMetric::get_selector ( ) const

Get the set residue selector of this class.

References selector_.

◆ metric()

std::string core::simple_metrics::PerResidueProbabilitiesMetric::metric ( ) const
overridepure virtual

◆ name()

std::string core::simple_metrics::PerResidueProbabilitiesMetric::name ( ) const
overridepure virtual

◆ operator=()

PerResidueProbabilitiesMetric & core::simple_metrics::PerResidueProbabilitiesMetric::operator= ( PerResidueProbabilitiesMetric const &  ot)

◆ output_sequence_profile()

void core::simple_metrics::PerResidueProbabilitiesMetric::output_sequence_profile ( std::string const &  sequence,
std::map< core::Size, std::map< core::chemical::AA, core::Real >> const &  logit_map,
std::string const &  output_filename 
)
staticprotected

Format the probabilities in psi-blast position-specific-scoring-matrix (PSSM) format and write to file.

Return the probabilities in psi-blast position-specific-scoring-matrix (PSSM) format.

Parameters
[in]sequenceThe sequence of the pose
[in]logit_mapA map containing the predicted logits for each position
[in]output_filenameA string defining the name of the output file

References core::sequence::SequenceProfile::alphabet(), core::chemical::oneletter_code_from_aa(), core::sequence::SequenceProfile::profile(), core::sequence::Sequence::sequence(), and write_profile().

Referenced by protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::calculate().

◆ parse_my_tag()

void core::simple_metrics::PerResidueProbabilitiesMetric::parse_my_tag ( utility::tag::TagCOP  tag,
basic::datacache::DataMap data 
)
overridepure virtual

◆ parse_per_residue_tag()

void core::simple_metrics::PerResidueProbabilitiesMetric::parse_per_residue_tag ( utility::tag::TagCOP  tag,
basic::datacache::DataMap data 
)
virtual

Parse the base class tag. Keep required interface for parse_my_tag.

References core::select::residue_selector::parse_residue_selector(), set_output_as_pdb_nums(), and set_residue_selector().

◆ set_output_as_pdb_nums()

void core::simple_metrics::PerResidueProbabilitiesMetric::set_output_as_pdb_nums ( bool  output_as_pdb_nums)

Set to output in PDB numbering instead of Rosetta during the Apply function, which adds the data to pose as extra scores.

References output_as_pdb_nums_.

Referenced by parse_per_residue_tag().

◆ set_residue_selector()

void core::simple_metrics::PerResidueProbabilitiesMetric::set_residue_selector ( select::residue_selector::ResidueSelectorCOP  selector)

Set a ResidueSelector for which we will calculate values over.

References selector_.

Referenced by parse_per_residue_tag().

◆ write_profile()

void core::simple_metrics::PerResidueProbabilitiesMetric::write_profile ( core::sequence::SequenceProfile profile,
std::string const &  output_filename 
)
staticprivate

Output the sequence_profile as file.

Output the sequence_profile.

Parameters
[in]profileA SequenceProfile filled with the logits
[in]output_filenameA string defining the name of the output file

References core::sequence::SequenceProfile::alphabet(), core::sequence::Sequence::length(), core::conformation::membrane::out, core::sequence::SequenceProfile::prof_row(), core::sequence::Sequence::sequence(), and core::sequence::SequenceProfile::width().

Referenced by output_sequence_profile().

Member Data Documentation

◆ output_as_pdb_nums_

bool core::simple_metrics::PerResidueProbabilitiesMetric::output_as_pdb_nums_ = false
private

◆ selector_

select::residue_selector::ResidueSelectorCOP core::simple_metrics::PerResidueProbabilitiesMetric::selector_
private

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