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::string
get_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
key
The 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 void
print_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
vec
The gemmi::Vec3 object whose coordinates will be printed.
public void
print_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
vec
The gemmi::Vec3 object whose coordinates will be printed.
public void
print_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
position
The gemmi::Position object whose coordinates will be printed.
public std::string
format_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
residue
A pointer to the gemmi::Residue object representing the residue.
Returns
The formatted key for the residue.
public std::string
format_site_key
(const
Glycosite
& 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
glycosite
A glycosite
Returns
The formatted key for the site.
public std::string
format_residue_from_site
(const
Glycosite
& 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
glycosite
A glycositestructure
Returns
The formatted key for the site.
public gemmi::Chain
get_chain_from_glycosite
(const
Glycosite
& 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
site
The glycosite object containing the model, chain, and residue indices.structure
A 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::Residue
get_residue_from_glycosite
(const
Glycosite
& 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
site
The glycosite object containing the model, chain, and residue indices.structure
A 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
(const
Glycosite
& 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
site
The glycosite object containing the model, chain, and residue indices.structure
A 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
(const
Glycosite
& 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
site
The glycosite object containing the model, chain, and residue indices.structure
A ptr to a structure object from which to retrieve the chain.
Returns
The gemmi::Chain pointer from the specified glycosite.
public gemmi::Atom
get_atom_from_glycosite
(const
Glycosite
& 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
site
The glycosite object containing the model, chain, and residue indices.structure
The structure from which to retrieve the atom.
Returns
The gemmi::Atom from the specified glycosite.
Exceptions
std::runtime_error
if 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 int
get_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::string
linkage_to_id
(const
Sails::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
data
The LinkageData object to convert to an ID string.
Returns
The ID string representation of the LinkageData object.
public void
save_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
residues
The vector of gemmi::Residue objects to save.path
The 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 void
save_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
grid
The grid object to save to file.path
The path to the file where the grid will be saved.
public void
save_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
structure
The gemmi::Structure object to be saved.path
The path of the file where the structure should be saved.
public std::string
get_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
input
The string to increment.
Returns
The incremented string.
public bool
file_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
path
The 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
string
The string to splitdelimiter
The delimiter to split at
Returns
a vector of strings split by the delimiter