Sails 0.2.0 Help

Sails::Model

class Sails::Model

Represents a model used for extending glycans and performing other operations.

Summary

Members

Descriptions

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.

public voidsave(const std::string & path, std::vector<LinkRecord> & links)

Save the model with link records to a specified path.

public voidsave(const std::string & path)

Saves the model to a file.

public inline gemmi::Structure *get_structure() const

Get the structure.

public inline voidset_special_monomer_dir(const std::string & dir)

Sets the directory for the special monomer.

enumChainType

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.

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.

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.

private voidadd_sugar_to_structure(constSugar* terminal_sugar,SuperpositionResult& result, ChainType & chain_type)

Adds a sugar to a structure.

private doublecalculate_clash_score(constSuperpositionResult& result) const

Calculates the clash score for the given SuperpositionResult.

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.

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.

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.

private voidprint_rejection_log()

Prints the rejection log.

private voidprint_successful_log(Density& density, std::optional<SuperpositionResult> opt_result)

Prints a successful log message after adding a residue to the density.

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.

private static voidmove_acceptor_atomic_positions(std::vector< gemmi::Atom * > & atoms, double length, std::vector< double > & angles, std::vector< double > & torsions)

Move the positions of acceptor atoms based on given parameters.

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.

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.

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

  • 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 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

  • 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 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

  • 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 voidset_special_monomer_dir(const std::string & dir)

Sets the directory for the special monomer.

Parameters

  • dir The directory path for the special monomer.

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

  • 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.

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::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_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 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_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 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

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 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_sugar The terminal sugar where the new residue is being added.

  • addition The 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_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 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

  • 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.

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

  • 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 static voidmove_acceptor_atomic_positions(std::vector< gemmi::Atom * > & 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::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

  • 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 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

  • 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.

Last modified: 08 August 2024