Rosetta
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric Class Reference

A metric for estimating the amino acid probabilities using the ESM language model family. More...

#include <PerResidueEsmProbabilitiesMetric.hh>

Inheritance diagram for protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric:
Inheritance graph
[legend]

Public Member Functions

 PerResidueEsmProbabilitiesMetric ()
 Constructors ///. More...
 
 PerResidueEsmProbabilitiesMetric (PerResidueEsmProbabilitiesMetric const &src)
 Copy constructor (not needed unless you need deep copies) More...
 
 ~PerResidueEsmProbabilitiesMetric () override
 Destructor (important for properly forward-declaring smart-pointer members) More...
 
std::map< core::Size, std::map< core::chemical::AA, core::Real > > calculate (core::pose::Pose const &pose) const override
 Metric Methods ///. More...
 
std::string name () const override
 Name of the class. More...
 
std::string metric () const override
 Name of the metric. More...
 
void parse_my_tag (utility::tag::TagCOP tag, basic::datacache::DataMap &data) override
 called by parse_my_tag – should not be used directly More...
 
core::simple_metrics::SimpleMetricOP clone () const override
 
std::string model () const
 Get the ESM model that will be used for prediction. More...
 
std::string write_pssm () const
 Get the output filename of the pssm. More...
 
void set_residue_selector (core::select::residue_selector::ResidueSelectorCOP selector_in)
 Set the residue selector that we'll be using. More...
 
core::select::residue_selector::ResidueSelectorCOP residue_selector () const
 Get the residue selector. More...
 
void set_residue_selector2 (core::select::residue_selector::ResidueSelectorCOP selector)
 A second optional residue selector for attention masking. More...
 
- Public Member Functions inherited from core::simple_metrics::PerResidueProbabilitiesMetric
 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...
 
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...
 
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...
 
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...
 

Static Public Member Functions

static std::string name_static ()
 Name of the class for creator. More...
 
static void provide_xml_schema (utility::tag::XMLSchemaDefinition &xsd)
 
- Static Public Member Functions inherited from core::simple_metrics::PerResidueProbabilitiesMetric
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 &)
 

Private Member Functions

std::string get_selection_sequence (std::string const &pose_sequence, std::map< core::Size, utility::vector1< core::Real >> const &position_map) const
 Get the sequence of the selection. More...
 
void provide_citation_info (basic::citation_manager::CitationCollectionList &citations) const override
 This metric is unpublished. It returns Moritz Ertelt as its author. More...
 

Static Private Member Functions

static void fill_return_map (const std::map< core::Size, utility::vector1< core::Real >> &softmax_map, std::map< core::Size, std::map< core::chemical::AA, core::Real >> &return_map)
 Fill the return_map with the probabilities from the softmax_map for all amino acids. More...
 

Private Attributes

std::string model_
 The ESM model to use for prediction. More...
 
std::string write_pssm_
 The output filename of the pssm. More...
 
bool multirun_ {}
 Whether to multirun the network. More...
 
core::select::residue_selector::ResidueSelectorCOP residue_selector_ = nullptr
 An optional residue selector. More...
 
EsmPerplexityTensorflowProtocolCOP tensorflow_protocol_ = nullptr
 The tensorflow protocol used. More...
 
core::select::residue_selector::ResidueSelectorCOP selector_two_ = nullptr
 Residue selector for attention masking. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from core::simple_metrics::PerResidueProbabilitiesMetric
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...
 

Detailed Description

A metric for estimating the amino acid probabilities using the ESM language model family.

Constructor & Destructor Documentation

◆ PerResidueEsmProbabilitiesMetric() [1/2]

protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::PerResidueEsmProbabilitiesMetric ( )

Constructors ///.

Default constructor

◆ PerResidueEsmProbabilitiesMetric() [2/2]

protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::PerResidueEsmProbabilitiesMetric ( PerResidueEsmProbabilitiesMetric const &  src)
default

Copy constructor (not needed unless you need deep copies)

Copy constructor.

◆ ~PerResidueEsmProbabilitiesMetric()

protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::~PerResidueEsmProbabilitiesMetric ( )
overridedefault

Destructor (important for properly forward-declaring smart-pointer members)

Member Function Documentation

◆ calculate()

std::map< core::Size, std::map< core::chemical::AA, core::Real > > protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::calculate ( core::pose::Pose const &  pose) const
overridevirtual

◆ clone()

core::simple_metrics::SimpleMetricOP protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::clone ( ) const
overridevirtual

◆ fill_return_map()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::fill_return_map ( const std::map< core::Size, utility::vector1< core::Real >> &  softmax_map,
std::map< core::Size, std::map< core::chemical::AA, core::Real >> &  return_map 
)
staticprivate

Fill the return_map with the probabilities from the softmax_map for all amino acids.

Parameters
[in]softmax_mapThe map containing all probabilities or logits returned from ESM (including special tokens)
[in]return_mapThe map that will be returned by the calculate function, will be filled with probabilities/logits by this function
[in]softmax_mapThe map containing all probabilities or logits returned from ESM (including special tokens)
[in]return_mapThe map that will be returned by the calculate function, will be filled with probabilities by this function

References core::chemical::aa_from_oneletter_code(), protocols::esm_perplexity::EsmPerplexityTensorflowProtocol::alphabet_, and core::scoring::pair.

Referenced by calculate().

◆ get_selection_sequence()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::get_selection_sequence ( std::string const &  pose_sequence,
std::map< core::Size, utility::vector1< core::Real >> const &  position_map 
) const
private

Get the sequence of the selection.

References core::scoring::pair.

Referenced by calculate().

◆ metric()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::metric ( ) const
overridevirtual

Name of the metric.

Implements core::simple_metrics::PerResidueProbabilitiesMetric.

References name_static().

◆ model()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::model ( ) const
inline

Get the ESM model that will be used for prediction.

References model_.

◆ name()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::name ( ) const
overridevirtual

Name of the class.

Implements core::simple_metrics::PerResidueProbabilitiesMetric.

References name_static().

◆ name_static()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::name_static ( )
static

◆ parse_my_tag()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::parse_my_tag ( utility::tag::TagCOP  tag,
basic::datacache::DataMap data 
)
overridevirtual

◆ provide_citation_info()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::provide_citation_info ( basic::citation_manager::CitationCollectionList &  citations) const
overrideprivatevirtual

This metric is unpublished. It returns Moritz Ertelt as its author.

Reimplemented from core::simple_metrics::SimpleMetric.

◆ provide_xml_schema()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::provide_xml_schema ( utility::tag::XMLSchemaDefinition &  xsd)
static

◆ residue_selector()

core::select::residue_selector::ResidueSelectorCOP protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::residue_selector ( ) const

Get the residue selector.

If this returns nullptr, it means that no residue selector is being used.

References residue_selector_.

◆ set_residue_selector()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::set_residue_selector ( core::select::residue_selector::ResidueSelectorCOP  selector_in)

Set the residue selector that we'll be using.

Passing nullptr results in no residue selector being used.

References residue_selector_.

Referenced by parse_my_tag().

◆ set_residue_selector2()

void protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::set_residue_selector2 ( core::select::residue_selector::ResidueSelectorCOP  selector)

A second optional residue selector for attention masking.

set the optional residue selector for the attention masking

References selector_two_.

Referenced by parse_my_tag().

◆ write_pssm()

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::write_pssm ( ) const
inline

Get the output filename of the pssm.

References write_pssm_.

Member Data Documentation

◆ model_

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::model_
private

The ESM model to use for prediction.

Referenced by model(), and parse_my_tag().

◆ multirun_

bool protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::multirun_ {}
private

Whether to multirun the network.

Referenced by calculate(), and parse_my_tag().

◆ residue_selector_

core::select::residue_selector::ResidueSelectorCOP protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::residue_selector_ = nullptr
private

An optional residue selector.

Referenced by calculate(), residue_selector(), and set_residue_selector().

◆ selector_two_

core::select::residue_selector::ResidueSelectorCOP protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::selector_two_ = nullptr
private

Residue selector for attention masking.

Referenced by calculate(), and set_residue_selector2().

◆ tensorflow_protocol_

EsmPerplexityTensorflowProtocolCOP protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::tensorflow_protocol_ = nullptr
private

The tensorflow protocol used.

Referenced by calculate(), and parse_my_tag().

◆ write_pssm_

std::string protocols::esm_perplexity::PerResidueEsmProbabilitiesMetric::write_pssm_
private

The output filename of the pssm.

Referenced by calculate(), parse_my_tag(), and write_pssm().


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