Sails::Telemetry
class Sails::Telemetry
Handles telemetry for Sails addition and deletions.
This class provides functionality to store and manipulate telemetry data related to Glycosite objects. It supports operations such as adding and removing Glycosite objects, retrieving the size of the telemetry data, saving the state of the telemetry, and formatting the log with a given gemmi::Structure object.
Summary
Members | Descriptions |
---|---|
| |
| Overloaded operator<< for inserting Glycosite objects into a set. |
| Overloaded operator<< for appending multiple Glycosite objects to the stream. |
| Overloaded operator>> to remove a Glycosite from the sites container. |
| Overloaded operator>> for appending multiple Glycosite objects to the stream. |
| Returns the size of the telemetry data. |
| Saves the state of the telemetry at the given cycle. |
| Saves the SNFG (Symbol Nomenclature for Glycans) representation of a glycan structure. |
| Formats the log with a given gemmi::Structure object. |
| Calculates the telemetry log for Sails. |
| Formats the log with the given gemmi::Structure object. |
| Get the SNFGs. |
| |
| |
|
Members
public inline explicit
Telemetry
(const std::string & filepath)
public inline void
operator<<
(const
Glycosite
& site)
Overloaded operator<< for inserting Glycosite objects into a set.
This function takes a Glycosite object and inserts it into a set of Glycosite objects. The set is used to store telemetry data related to Glycosite objects. This operator is typically used in conjunction with std::cout to output Glycosite objects.
Parameters
site
The Glycosite object to be inserted.
public inline void
operator<<
(const std::set<
Glycosite
> & sites)
Overloaded operator<< for appending multiple Glycosite objects to the stream.
This function appends multiple Glycosite objects from the given vector to the stream. It iterates through the vector and calls the operator<<(const Glycosite& site) for each Glycosite object.
Parameters
sites
A vector of Glycosite objects to be appended to the stream.
public inline void
operator>>
(const
Glycosite
& site)
Overloaded operator>> to remove a Glycosite from the sites container.
This operator removes the provided Glycosite object from the sites container.
Parameters
site
The Glycosite object to be removed.
public inline void
operator>>
(const std::set<
Glycosite
> & sites)
Overloaded operator>> for appending multiple Glycosite objects to the stream.
This function appends multiple Glycosite objects from the given vector to the stream. It iterates through the vector and calls the operator>>(const Glycosite& site) for each Glycosite object.
Parameters
sites
A vector of Glycosite objects to be appended to the stream.
public inline size_t
size
() const
Returns the size of the telemetry data.
This method returns the number of elements in the "sites" container which represents the telemetry data. It provides a way to determine the current size of the telemetry data stored in the container.
Returns
The number of elements in the telemetry data.
public void
save_state
(int cycle)
Saves the state of the telemetry at the given cycle.
This method saves the state of the telemetry at the specified cycle by calculating the difference between the current set of Glycosite objects and the set of Glycosite objects at the previous cycle. If the given cycle is not 1 it calculates the difference using std::set_difference() and stores the result in the states map at the given cycle. If the given cycle is 1, it simply stores the current set of Glycosite objects in the states map at the given cycle.
Parameters
cycle
The cycle at which to save the state of the telemetry.
public void
save_snfg
(int cycle, std::string & key, std::string & snfg)
Saves the SNFG (Symbol Nomenclature for Glycans) representation of a glycan structure.
This method saves the SNFG representation of a glycan structure for a specific cycle and glycosite. The SNFG representation is stored as a string in the provided snfg
parameter.
Parameters
cycle
The cycle number of the glycan structure.key
The key corresponding to the glycosite.snfg
The string to store the SNFG representation of the glycan structure.
public void
format_log
(gemmi::Structure * structure)
Formats the log with a given gemmi::Structure object.
This method prints the formatted log of the telemetry data, including the cycles and added Glycosite objects in each cycle. The log is printed to the standard output.
Parameters
structure
A pointer to the gemmi::Structure object used for formatting the log. This object is used to retrieve information about Glycosite objects.
public TelemetryLog
calculate_log
(gemmi::Structure * structure, Density * density)
Calculates the telemetry log for Sails.
This method takes a gemmi::Structure pointer and a Density pointer and calculates the telemetry log for Sails. It iterates through the states and sites and calculates the rscc, rsr, and dds scores for each site by calling the density->score_residue method. It then formats the residue and adds it along with the scores to the telemetry log. Finally, it returns the telemetry log.
Parameters
structure
A pointer to the gemmi::Structure object.density
A pointer to the Density object.
Returns
The calculated telemetry log for Sails.
public std::optional< std::string >
format_log
(gemmi::Structure * structure, Density * density, bool write)
Formats the log with the given gemmi::Structure object.
This method formats the log by printing information about the cycles and added Glycosite objects stored in the telemetry. It uses the provided gemmi::Structure object to retrieve residue and score information for each Glycosite.
Parameters
structure
A pointer to the gemmi::Structure object.density
A pointer to the Density object.write
The method assumes that the telemetry data has already been stored using the add_glycosite() method.
See also: Sails::Telemetry::add_glycosite()
See also: Utils::format_residue_from_site()
See also: Utils::get_residue_from_glycosite()
See also: Density::score_residue()
public inline SNFGCycleData
get_snfgs
() const
Get the SNFGs.
This method returns the SNFGs (Symbol Nomenclature for Glycans) as a map of maps. The outer map uses the cycle number as keys. The inner map uses the base residue as keys and the SNFGs are the values
Returns
A map of maps representing the SNFGs. The outer map uses integers as keys and the inner map uses strings as keys.