Sails::Model
class Sails::Model
Represents a model used for extending glycans and performing other operations.
Summary
Members | Descriptions |
---|---|
| |
| |
| Extends the given glycan by adding new sugars based on the linkage database. |
| Save the model with link records to a specified path. |
| Saves the model to a file. |
| Get the structure. |
| Sets the directory for the special monomer. |
| Creates a default glycan chain using a psuedo_glycan. |
| |
| |
| |
| |
| |
| |
| |
| Extends the given glycan by adding new sugars based on the linkage database. |
| Performs the translation of a residue based on the given linkage data using density. |
| Performs the translation of a residue based on the given linkage data without density. |
| Finds favoured additions based on a terminal sugar and a list of possible additions. A favoured addition is one where the depth of the new residue matches one of the preferred depths in the residue database for that residue name. |
| Adds a sugar to a structure. |
| Calculates the clash score for the given SuperpositionResult. |
| Retrieves the monomer with the given name from the monomer library. |
| Finds chain type of sugars. |
| Checks if a residue is in the residue database. |
| Print the addition log of a new residue to a terminal sugar. |
| Print the log for an attempted addition of a residue to a model. |
| Prints the rejection log. |
| Prints a successful log message after adding a residue to the density. |
| |
| Removes the leaving atom from the given residue objects. |
| Move the positions of acceptor atoms based on given parameters. |
| Applies a superposition transformation to a set of atoms. |
| Applies a superposition transformation to a set of atoms. |
| |
| Rotates the exocyclic atoms of a residue and finds the best position based on density scoring. |
Members
public
Model
() = default
public inline
Model
(gemmi::Structure * structure, LinkageDatabase & linkage_database, ResidueDatabase & residue_database)
public
Glycan
extend
(
Glycan
& glycan,
Glycosite
& base_glycosite, Density & density, bool debug)
Extends the given glycan by adding new sugars based on the linkage database.
Parameters
glycan
The glycan to be extended.base_glycosite
The base sequence ID to determine terminal sugars.density
The density class used to score residues into experimental data.
Returns
The extended glycan.
public void
save
(const std::string & path, std::vector<
LinkRecord
> & links)
Save the model with link records to a specified path.
This method saves the model with links links to a specified path. It creates a CIF document using the given structure and adds the links to the "_struct_conn" category. The CIF document is then written to the specified path.
Parameters
path
The path where the CIF file should be saved.links
A vector of LinkRecord objects representing the links to be saved. Each LinkRecord contains the labels for a link.
public void
save
(const std::string & path)
Saves the model to a file.
This method saves the model to the specified file path. The method first opens a new output file stream using the given path. Then, it writes the model data in CIF format to the output stream using the write_cif_to_stream
function. Finally, it closes the output file stream.
Parameters
path
The file path where the model will be saved.
public inline gemmi::Structure *
get_structure
() const
Get the structure.
This method returns a pointer to the structure object.
Returns
A pointer to the structure object.
public inline void
set_special_monomer_dir
(const std::string & dir)
Sets the directory for the special monomer.
Parameters
dir
The directory path for the special monomer.
public void
create_pseudo_glycan
(
PseudoGlycan
& pseudo_glycan)
Creates a default glycan chain using a psuedo_glycan.
enum
ChainType
Values | Descriptions |
---|---|
protein | |
non_protein |
private gemmi::Structure *
structure
private LinkageDatabase
linkage_database
private ResidueDatabase
residue_database
private std::string
monomer_library_path
private std::string
special_monomer_path
private std::map< std::string, gemmi::Residue >
monomers
private void
extend_if_possible
(Density & density, bool debug, ChainType & chain_type, const
Sugar
* terminal_sugar)
Extends the given glycan by adding new sugars based on the linkage database.
Parameters
density
The density class used to score residues into experimental data.debug
A flag indicating whether debug output should be enabled.chain_type
A boolean reference that will be updated to indicate whether the extended glycan is a sugar-only chain.terminal_sugar
The terminal sugar from which to extend the glycan.
private std::optional<
Sails::SuperpositionResult
>
add_residue
(gemmi::Residue * residue,
LinkageData
& data, Density & density, bool refine)
Performs the translation of a residue based on the given linkage data using density.
The donor atoms of the input residue are used to calculate a superposition of a given new monomer. A new monomer is loaded and transformed to the correct position and returned.
Parameters
residue
The residue to calculate the translation for.data
The linkage data containing donor and acceptor information.density
The constructed density object for accessing experimental data.refine
Boolean to run real space simplex refinement on the residue.
Returns
Optionally, the translated residue.
Exceptions
std::runtime_error
if any required atom or data is not found, or unexpected atom count.
private std::optional<
Sails::SuperpositionResult
>
add_residue
(gemmi::Residue * residue,
LinkageData
& data)
Performs the translation of a residue based on the given linkage data without density.
The donor atoms of the input residue are used to calculate a superposition of a given new monomer. A new monomer is loaded and transformed to the correct position and returned.
Parameters
residue
The residue to calculate the translation for.data
The linkage data containing donor and acceptor information.
Returns
Optionally, the translated residue.
Exceptions
std::runtime_error
if any required atom or data is not found, or unexpected atom count.
private std::vector<
SuperpositionResult
>
find_favoured_additions
(const
Sugar
*& terminal_sugar, PossibleAdditions & possible_additions)
Finds favoured additions based on a terminal sugar and a list of possible additions. A favoured addition is one where the depth of the new residue matches one of the preferred depths in the residue database for that residue name.
Parameters
terminal_sugar
The terminal sugar to consider.possible_additions
The list of possible additions for the given terminal sugar.
Returns
A vector of SuperpositionResult objects representing the favoured additions.
private void
add_sugar_to_structure
(const
Sugar
* terminal_sugar,
SuperpositionResult
& result, ChainType & chain_type)
Adds a sugar to a structure.
This method adds a sugar to a structure given the terminal sugar, superposition result, and a flag indicating whether the sugar chain is only composed of sugars.
Parameters
terminal_sugar
The terminal sugar to add.result
The superposition result representing the sugar to be added.chain_type
A flag indicating whether the sugar chain is only composed of sugars.
private double
calculate_clash_score
(const
SuperpositionResult
& result) const
Calculates the clash score for the given SuperpositionResult.
The clash score is calculated by finding the number of nearby atoms for each atom in the SuperpositionResult. Nearby atoms are found using a NeighborSearch with a given radius.
Parameters
result
The SuperpositionResult from which to calculate the clash score.
Returns
The calculated clash score.
private std::optional< gemmi::Residue >
get_monomer
(const std::string & monomer, bool remove_h)
Retrieves the monomer with the given name from the monomer library.
Parameters
monomer
The name of the monomer to retrieve.remove_h
Returns
An optional value that contains the monomer, or an empty optional if the monomer does not exist.
private ChainType
find_chain_type
(std::vector<
Sugar
* > sugars)
Finds chain type of sugars.
private bool
residue_in_database
(gemmi::Residue * residue)
Checks if a residue is in the residue database.
private void
print_addition_log
(const
Sugar
* terminal_sugar,
SuperpositionResult
& addition)
Print the addition log of a new residue to a terminal sugar.
This function prints the addition log by outputting the new residue being added to the terminal sugar.
Parameters
terminal_sugar
The terminal sugar where the new residue is being added.addition
The superposition result containing the new residue being added.
private void
print_attempted_addition_log
(gemmi::Residue * residue_ptr,
LinkageData
& data, const
Glycosite
* site)
Print the log for an attempted addition of a residue to a model.
This function prints a log message indicating the attempted addition of a residue to a model. The log message includes information about the donor and acceptor residues, as well as the donor and acceptor numbers.
Parameters
residue_ptr
A pointer to the gemmi::Residue object representing the residue being added.data
The LinkageData object containing information about the donor and acceptor residues.site
The site of the donor residue
private void
print_rejection_log
()
Prints the rejection log.
This method prints the rejection log to the standard output.
private void
print_successful_log
(Density & density, std::optional<
SuperpositionResult
> opt_result)
Prints a successful log message after adding a residue to the density.
This method takes in a Density object and an optional SuperpositionResult object as parameters. It calculates the RSCC score using the SuperpositionResult and prints a log message indicating the successful addition of the residue along with the RSCC score.
Parameters
density
The Density object representing the density in which the residue is added.opt_result
(optional) The SuperpositionResult object containing the new residue and other details.
If the opt_result parameter is not provided, the method will throw an exception.
public static gemmi::Residue
replace_residue
(gemmi::Residue * target_residue, const std::string & replacement_residue_name)
private static void
remove_leaving_atom
(
LinkageData
& data, gemmi::Residue & reference_library_monomer, gemmi::Residue & new_monomer)
Removes the leaving atom from the given residue objects.
The leaving atom is identified by the acceptor number in the linkage data. The leaving atom is represented as "O" followed by the acceptor number. The leaving atom is removed from both the new_monomer and reference_library_monomer residue objects.
Parameters
data
The linkage data that contains the acceptor number.reference_library_monomer
The reference library monomer residue object.new_monomer
The new monomer residue object.
private template<>
static void
move_acceptor_atomic_positions
(std::vector< T > & atoms, double length, std::vector< double > & angles, std::vector< double > & torsions)
Move the positions of acceptor atoms based on given parameters.
This method calculates a new position for each acceptor atom in the provided vector of atoms, based on the length, angles, and torsions given. The new position is then assigned to the next atom in the vector.
Parameters
atoms
The vector of atoms representing the acceptor atoms.length
The length parameter used for calculating the new positions.angles
The vector of angles used for calculating the new positions.torsions
The vector of torsions used for calculating the new positions.
private static gemmi::Transform
superpose_atoms
(std::vector< gemmi::Atom > & atoms, std::vector< gemmi::Atom > & reference_atoms, double length, std::vector< double > & angles, std::vector< double > & torsions)
Applies a superposition transformation to a set of atoms.
This method calculates the superposition transformation between a set of atoms and a set of reference atoms, specified by their positions. The transformation consists of a translation and rotation applied to the set of atoms, such that they align as closely as possible with the reference atoms.
Parameters
atoms
The set of atoms to be transformed.reference_atoms
The set of reference atoms used for the superposition calculation.length
The length parameter used in the superposition calculation.angles
The angles parameter used in the superposition calculation.torsions
The torsions parameter used in the superposition calculation.
Returns
The calculated transformation representing the superposition.
private static gemmi::Transform
superpose_atoms
(std::vector< gemmi::Atom * > & atoms, std::vector< gemmi::Atom > & reference_atoms, double length, std::vector< double > & angles, std::vector< double > & torsions)
Applies a superposition transformation to a set of atoms.
This method calculates the superposition transformation between a set of atoms and a set of reference atoms, specified by their positions. The transformation consists of a translation and rotation applied to the set of atoms, such that they align as closely as possible with the reference atoms.
Parameters
atoms
The set of atoms to be transformed.reference_atoms
The set of reference atoms used for the superposition calculation.length
The length parameter used in the superposition calculation.angles
The angles parameter used in the superposition calculation.torsions
The torsions parameter used in the superposition calculation.
Returns
The calculated transformation representing the superposition.
private static std::optional< gemmi::Residue >
get_monomer_only
(const std::string & monomer, bool remove_h)
private static void
rotate_exocyclic_atoms
(gemmi::Residue * residue, std::vector< std::string > & atoms, Density & density)
Rotates the exocyclic atoms of a residue and finds the best position based on density scoring.
This method performs a rotation of the exocyclic atoms of a given residue around an axis defined by two atoms. It calculates the rotation matrix and applies it to the exocyclic atom specified by the third atom. The resulting positions are evaluated based on density scoring, and the best position is assigned to the exocyclic atom.
Parameters
residue
Pointer to the gemmi::Residue object representing the residue.atoms
Vector of strings representing the names of the three atoms that define the rotation axis.density
Reference to a Density object used for scoring the rotated positions.