Sails::Utils
namespace Sails::Utils
Summary
Members | Descriptions |
|---|---|
| Retrieves the value of the specified environment variable. |
| Prints the components of the given vector. |
| Prints the components of the given vector with given label prefix. |
| Prints the coordinates of a given gemmi::Position object. |
| Formats the key for a given residue. |
| Formats the key for a given glycosite. |
| Formats the key of the residue for a given glycosite. |
| Retrieves the gemmi::Chain object corresponding to a given Glycosite. |
| Retrieves the gemmi::Residue corresponding to a given Glycosite. |
| Retrieves the gemmi::Residue pointer corresponding to a given Glycosite. |
| Retrieves the gemmi::Chain pointer corresponding to a given Glycosite. |
| Retrieves the gemmi::Atom from the specified glycosite. |
| Retrieve a ptr to the last chain in a gemmi Structure. |
| Retrieve the index of the last chain in the gemmi Structure. |
| Converts the given LinkageData object into an ID string. |
| Save a vector of gemmi::Residue objects to a specified file path. |
| Saves a grid to a file in CCP4 format. |
| Saves the provided gemmi::Structure object to a file. |
| Computes the next string will be alphabetically. |
| Checks if a file exists at the specified path. |
| Splits a string by delimiter. |
Members
public std::stringget_environment_variable(std::string const & key)
Retrieves the value of the specified environment variable.
This function retrieves the value of the specified environment variable identified by the provided key.
Parameters
keyThe name of the environment variable to retrieve.
Returns
The value of the specified environment variable. If the environment variable is not found, an empty string is returned.
public voidprint_vector(const gemmi::Vec3 & vec)
Prints the components of the given vector.
This method prints the x, y, and z components of the provided vector using the format "(x, y, z)" using the std::cout stream
Parameters
vecThe gemmi::Vec3 object whose coordinates will be printed.
public voidprint_vector(const gemmi::Vec3 & vec, const std::string & name)
Prints the components of the given vector with given label prefix.
This method prints the x, y, and z components of the provided vector using the format "(x, y, z)" using the std::cout stream
Parameters
vecThe gemmi::Vec3 object whose coordinates will be printed.
public voidprint_position(const gemmi::Position & position)
Prints the coordinates of a given gemmi::Position object.
This method prints the x, y, and z components of the provided position using the format "(x, y, z)" using the std::cout stream
Parameters
positionThe gemmi::Position object whose coordinates will be printed.
public std::stringformat_residue_key(const gemmi::Residue * residue)
Formats the key for a given residue.
This function formats the key for the provided residue by concatenating its name and sequence identifier.
Parameters
residueA pointer to the gemmi::Residue object representing the residue.
Returns
The formatted key for the residue.
public std::stringformat_site_key(constGlycosite& glycosite)
Formats the key for a given glycosite.
This function formats the key for the provided residue by concatenating its the model, chain, residue and atom ids.
Parameters
glycositeA glycosite
Returns
The formatted key for the site.
public std::stringformat_residue_from_site(constGlycosite& glycosite, gemmi::Structure * structure)
Formats the key of the residue for a given glycosite.
This function formats the key for the provided glycosite by getting chain ID, residue name and residue SeqId.
Parameters
glycositeA glycositestructure
Returns
The formatted key for the site.
public gemmi::Chainget_chain_from_glycosite(constGlycosite& site, const gemmi::Structure * structure)
Retrieves the gemmi::Chain object corresponding to a given Glycosite.
This function retrieves the gemmi::Chain object that represents the chain of the provided Glycosite within the specified gemmi::Structure.
Parameters
siteThe glycosite object containing the model, chain, and residue indices.structureA ptr to a gemmi::Structure object from which the chain is to be retrieved.
Returns
The gemmi::Chain object from the specified glycosute.
public gemmi::Residueget_residue_from_glycosite(constGlycosite& site, const gemmi::Structure * structure)
Retrieves the gemmi::Residue corresponding to a given Glycosite.
This function retrieves the gemmi::Residue object that represents the residue of the provided Glycosite within the specified gemmi::Structure.
Parameters
siteThe glycosite object containing the model, chain, and residue indices.structureA ptr to a structure object from which to retrieve the residue.
Returns
The gemmi::Residue from the specified glycosite.
public gemmi::Residue *get_residue_ptr_from_glycosite(constGlycosite& site, gemmi::Structure * structure)
Retrieves the gemmi::Residue pointer corresponding to a given Glycosite.
This function retrieves the gemmi::Residue pointer that represents the residue of the provided Glycosite within the specified gemmi::Structure.
Parameters
siteThe glycosite object containing the model, chain, and residue indices.structureA ptr to a structure object from which to retrieve the residue.
Returns
The gemmi::Residue pointer from the specified glycosite.
public gemmi::Chain *get_chain_ptr_from_glycosite(constGlycosite& site, gemmi::Structure * structure)
Retrieves the gemmi::Chain pointer corresponding to a given Glycosite.
This function retrieves the gemmi::Chain pointer that represents the chain of the provided Glycosite within the specified gemmi::Structure.
Parameters
siteThe glycosite object containing the model, chain, and residue indices.structureA ptr to a structure object from which to retrieve the chain.
Returns
The gemmi::Chain pointer from the specified glycosite.
public gemmi::Atomget_atom_from_glycosite(constGlycosite& site, const gemmi::Structure * structure)
Retrieves the gemmi::Atom from the specified glycosite.
This function retrieves the gemmi::Atom object that represents the atom of the provided Glycosite within the specified gemmi::Structure.
Parameters
siteThe glycosite object containing the model, chain, and residue indices.structureThe structure from which to retrieve the atom.
Returns
The gemmi::Atom from the specified glycosite.
Exceptions
std::runtime_errorif the site has not been initialised from a Mark.
public std::optional< gemmi::Chain * >get_last_chain(gemmi::Structure * structure)
Retrieve a ptr to the last chain in a gemmi Structure.
Returns
an optional gemmi::Chain* if there is at least 1 chain in a ptr, or a nulloption if there are no chains
public intget_last_chain_index(gemmi::Structure * structure)
Retrieve the index of the last chain in the gemmi Structure.
Returns
the index of the last chain in the gemmi Structure
public std::stringlinkage_to_id(constSails::LinkageData& data)
Converts the given LinkageData object into an ID string.
This function takes a reference to a LinkageData object and converts it into an ID string. The ID string is constructed by concatenating the donor, donor_number, acceptor_number, and acceptor fields of the LinkageData object.
Parameters
dataThe LinkageData object to convert to an ID string.
Returns
The ID string representation of the LinkageData object.
public voidsave_residues_to_file(std::vector< gemmi::Residue > residues, const std::string & path)
Save a vector of gemmi::Residue objects to a specified file path.
This method takes a vector of gemmi::Residue objects and saves them to the specified file path. It creates a gemmi::Structure, gemmi::Model, and gemmi::Chain to hold the residues. The provided residues are appended to the chain, and the chain is added to the model. Finally, the model is added to the structure. The structure is then written to the specified file path using the gemmi::write_pdb function.
Parameters
residuesThe vector of gemmi::Residue objects to save.pathThe file path to save the residues to.
The file path must be valid and accessible for writing. If the file already exists, it will be overwritten.
public voidsave_grid_to_file(const gemmi::Grid<> & grid, const std::string & path)
Saves a grid to a file in CCP4 format.
This function saves the given grid to a file in CCP4 format. The grid is defined by the provided gemmi::Grid<> object and the file path is specified using the std::string path parameter.
Parameters
gridThe grid object to save to file.pathThe path to the file where the grid will be saved.
public voidsave_structure_to_file(const gemmi::Structure & structure, const std::string & path)
Saves the provided gemmi::Structure object to a file.
This method saves the provided gemmi::Structure object to a file specified by the given path.
Parameters
structureThe gemmi::Structure object to be saved.pathThe path of the file where the structure should be saved.
public std::stringget_next_string(const std::string & input)
Computes the next string will be alphabetically.
This computes what the string will be if we increment the letter by one. For example this function will return "B" given the input "A".
Parameters
inputThe string to increment.
Returns
The incremented string.
public boolfile_exists(const std::string & path)
Checks if a file exists at the specified path.
This function checks if a file exists at the specified path.
Parameters
pathThe path of the file to check.
Returns
true if the file exists, false otherwise.
public std::vector< std::string >split(const std::string & string, char delimiter)
Splits a string by delimiter.
Parameters
stringThe string to splitdelimiterThe delimiter to split at
Returns
a vector of strings split by the delimiter