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
publicModel() = default
public inlineModel(gemmi::Structure * structure, LinkageDatabase & linkage_database, ResidueDatabase & residue_database)
publicGlycanextend(Glycan& glycan,Glycosite& base_glycosite, Density & density, bool debug)
Extends the given glycan by adding new sugars based on the linkage database.
Parameters
glycanThe glycan to be extended.base_glycositeThe base sequence ID to determine terminal sugars.densityThe density class used to score residues into experimental data.
Returns
The extended glycan.
public voidsave(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
pathThe path where the CIF file should be saved.linksA vector of LinkRecord objects representing the links to be saved. Each LinkRecord contains the labels for a link.
public voidsave(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
pathThe 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 voidset_special_monomer_dir(const std::string & dir)
Sets the directory for the special monomer.
Parameters
dirThe directory path for the special monomer.
public voidcreate_pseudo_glycan(PseudoGlycan& pseudo_glycan)
Creates a default glycan chain using a psuedo_glycan.
enumChainType
Values | Descriptions |
|---|---|
protein | |
non_protein |
private gemmi::Structure *structure
private LinkageDatabaselinkage_database
private ResidueDatabaseresidue_database
private std::stringmonomer_library_path
private std::stringspecial_monomer_path
private std::map< std::string, gemmi::Residue >monomers
private voidextend_if_possible(Density & density, bool debug, ChainType & chain_type, constSugar* terminal_sugar)
Extends the given glycan by adding new sugars based on the linkage database.
Parameters
densityThe density class used to score residues into experimental data.debugA flag indicating whether debug output should be enabled.chain_typeA boolean reference that will be updated to indicate whether the extended glycan is a sugar-only chain.terminal_sugarThe 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
residueThe residue to calculate the translation for.dataThe linkage data containing donor and acceptor information.densityThe constructed density object for accessing experimental data.refineBoolean to run real space simplex refinement on the residue.
Returns
Optionally, the translated residue.
Exceptions
std::runtime_errorif 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
residueThe residue to calculate the translation for.dataThe linkage data containing donor and acceptor information.
Returns
Optionally, the translated residue.
Exceptions
std::runtime_errorif any required atom or data is not found, or unexpected atom count.
private std::vector<SuperpositionResult>find_favoured_additions(constSugar*& 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_sugarThe terminal sugar to consider.possible_additionsThe list of possible additions for the given terminal sugar.
Returns
A vector of SuperpositionResult objects representing the favoured additions.
private voidadd_sugar_to_structure(constSugar* 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_sugarThe terminal sugar to add.resultThe superposition result representing the sugar to be added.chain_typeA flag indicating whether the sugar chain is only composed of sugars.
private doublecalculate_clash_score(constSuperpositionResult& 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
resultThe 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
monomerThe 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 ChainTypefind_chain_type(std::vector<Sugar* > sugars)
Finds chain type of sugars.
private boolresidue_in_database(gemmi::Residue * residue)
Checks if a residue is in the residue database.
private voidprint_addition_log(constSugar* 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_sugarThe terminal sugar where the new residue is being added.additionThe superposition result containing the new residue being added.
private voidprint_attempted_addition_log(gemmi::Residue * residue_ptr,LinkageData& data, constGlycosite* 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_ptrA pointer to the gemmi::Residue object representing the residue being added.dataThe LinkageData object containing information about the donor and acceptor residues.siteThe site of the donor residue
private voidprint_rejection_log()
Prints the rejection log.
This method prints the rejection log to the standard output.
private voidprint_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
densityThe 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::Residuereplace_residue(gemmi::Residue * target_residue, const std::string & replacement_residue_name)
private static voidremove_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
dataThe linkage data that contains the acceptor number.reference_library_monomerThe reference library monomer residue object.new_monomerThe new monomer residue object.
private template<>
static voidmove_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
atomsThe vector of atoms representing the acceptor atoms.lengthThe length parameter used for calculating the new positions.anglesThe vector of angles used for calculating the new positions.torsionsThe vector of torsions used for calculating the new positions.
private static gemmi::Transformsuperpose_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
atomsThe set of atoms to be transformed.reference_atomsThe set of reference atoms used for the superposition calculation.lengthThe length parameter used in the superposition calculation.anglesThe angles parameter used in the superposition calculation.torsionsThe torsions parameter used in the superposition calculation.
Returns
The calculated transformation representing the superposition.
private static gemmi::Transformsuperpose_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
atomsThe set of atoms to be transformed.reference_atomsThe set of reference atoms used for the superposition calculation.lengthThe length parameter used in the superposition calculation.anglesThe angles parameter used in the superposition calculation.torsionsThe 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 voidrotate_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
residuePointer to the gemmi::Residue object representing the residue.atomsVector of strings representing the names of the three atoms that define the rotation axis.densityReference to a Density object used for scoring the rotated positions.