Sails::Density
class Sails::Density
Summary
Members | Descriptions |
---|---|
| Best map |
| Difference map |
| Po-Pc map |
| MTZ Object |
| Fc maps for residues in standard positions - used for fast RSCC calculations |
| Clipper Spacegroup used for map recalcualtion - initialised in initialise_hkl |
| Clipper Resolution used for map recalcualtion - initialised in initialise_hkl |
| Clipper Cell used for map recalcualtion - initialised in initialise_hkl |
| Clipper container for reflection metadata used for map recalcualtion |
| Clipper Grid sampling used for map recalcualtion - initialised in initialise_hkl |
| Clipper list of F obs reflections |
| Clipper best map |
| |
| |
| |
| Scores a residue based on the specified density score method. |
| Initializes the necessary parameters for density calculation. |
| Loads the reflection data from the specified MTZ file and builds HKL data. |
| Recalculates the map based on the given structure. |
| Recalculates the map based on the given structure. |
| Writes the density data to an MTZ file. |
| Calculates the atomwise score for a given residue. |
| Calculates the density for a given box based on a gemmi::Residue object. |
| Calculates the RSCC (Real Space Correlation Coefficient) score for a given residue. |
| Calculates the Real Space Correlation Coefficient (RSCC) between observed and calculated values. |
| Calculates the RSCC score for a given superposition result. |
| Calculates the RSR (Real Space R) score for a given residue. |
| Calculates the RSR (Real Space R) score for a given SuperpositionResult. |
| Calculates the difference density score for a residue. |
| Scores an atom. |
| Scores a position based on the density value at that position. |
| Transforms F and Phi values from an MTZ file into a grid map. |
| Forms a list of clipper::Atom objects from a gemmi::Structure object. |
Members
public gemmi::Grid
m_grid
Best map
public gemmi::Grid
m_difference_grid
Difference map
public gemmi::Grid
m_po_pc_grid
Po-Pc map
public gemmi::Mtz
m_mtz
MTZ Object
public std::unordered_map< std::string, gemmi::Grid<> >
calculated_maps
Fc maps for residues in standard positions - used for fast RSCC calculations
public clipper::Spacegroup
m_spacegroup
Clipper Spacegroup used for map recalcualtion - initialised in initialise_hkl
public clipper::Resolution
m_resolution
Clipper Resolution used for map recalcualtion - initialised in initialise_hkl
public clipper::Cell
m_cell
Clipper Cell used for map recalcualtion - initialised in initialise_hkl
public clipper::HKL_info
m_hkl_info
Clipper container for reflection metadata used for map recalcualtion
public clipper::Grid_sampling
m_grid_sampling
Clipper Grid sampling used for map recalcualtion - initialised in initialise_hkl
public clipper::HKL_data< clipper::data32::F_sigF >
m_fobs
Clipper list of F obs reflections
public clipper::Xmap< float >
m_best_map
Clipper best map
public
Density
() = default
public explicit
Density
(const std::string & mtz_path)
public explicit
Density
(gemmi::Mtz & mtz)
public inline
Density
(
Density
& d)
public double
score_residue
(gemmi::Residue & residue, const DensityScoreMethod & method)
Scores a residue based on the specified density score method.
This method takes a gemmi::Residue object and scores it based on the specified density score method.
Parameters
residue
The gemmi::Residue object to be scored.method
The density score method to be used. Default value is atomwise.
Returns
The score of the residue based on the specified density score method.
public void
initialise_hkl
()
Initializes the necessary parameters for density calculation.
This method initializes the necessary parameters for density calculation, such as resolution, cell, spacegroup, hkl_info, and grid_sampling. These parameters are obtained from the m_mtz object which represents the input MTZ file.
public void
load_hkl
(const std::string & f, const std::string & sig_f)
Loads the reflection data from the specified MTZ file and builds HKL data.
This method reads the reflection data from the MTZ file specified by 'f' and 'sig_f' and builds HKL (H, K, L) data. It populates the internal structures with the HKL data for further analysis.
Parameters
public void
recalculate_map
(gemmi::Structure & structure)
Recalculates the map based on the given structure.
This method takes a gemmi::Structure object and recalculates the map with a clipper sigma-a calculation. This function updates the internal mtz, grid and density grid.
Parameters
structure
The gemmi::Structure object for which the map needs to be recalculated.
public void
calculate_po_pc_map
(gemmi::Structure & structure)
Recalculates the map based on the given structure.
This method takes a gemmi::Structure object and recalculates the p_o - p_c map, where p_o is the internal best map and p_c is calculated with the provided structure. This function should be called after recalculate_map This function updates the internal mtz, grid and density grid.
Parameters
structure
The gemmi::Structure object for which the map needs to be recalculated.
public void
write_mtz
(const std::string & path) const
Writes the density data to an MTZ file.
This method writes the density data to an MTZ file at the specified path.
Parameters
path
The path of the MTZ file to be written.
public float
atomwise_score
(const gemmi::Residue & residue) const
Calculates the atomwise score for a given residue.
This method calculates the atomwise score by iteratively interpolating the grid values at each atom position in the given residue and summing them up.
Parameters
residue
The residue for which the atomwise score is calculated.
Returns
The atomwise score for the given residue.
public gemmi::Grid
calculate_density_for_box
(gemmi::Residue & residue) const
Calculates the density for a given box based on a gemmi::Residue object.
This method takes a gemmi::Residue object and calculates the density for the specified box using the gemmi::DensityCalculator class. The density calculation is performed using the density score method specified in the constructor of the gemmi::DensityCalculator.
Parameters
residue
The gemmi::Residue object for which the density is calculated.
Returns
The calculated density grid for the specified box.
public float
rscc_score
(gemmi::Residue & residue)
Calculates the RSCC (Real Space Correlation Coefficient) score for a given residue.
The RSCC score is a measure of how well the observed electron density matches the calculated electron density for a residue. This method calculates the RSCC score by comparing the observed and calculated density values at different positions within a bounding box around the residue.
Parameters
residue
The gemmi::Residue object for which the RSCC score will be calculated.
Returns
The RSCC score for the given residue.
Exceptions
std::runtime_error
if the residue is empty.
public float
calculate_rscc
(std::vector< float > obs_values, std::vector< float > calc_values)
Calculates the Real Space Correlation Coefficient (RSCC) between observed and calculated values.
This method takes in two vectors of observed and calculated values and calculates the RSCC.
Parameters
obs_values
The vector of observed values.calc_values
The vector of calculated values.
Exceptions
std::runtime_error
If the sizes of the observation and calculation lists are different, if either list is empty, if the calculated map average is 0, or if the denominator is 0.
Returns
The RSCC between the observed and calculated values.
public float
rscc_score
(
SuperpositionResult
& result)
Calculates the RSCC score for a given superposition result.
This method takes a SuperpositionResult object and calculates the RSCC (Real Space Correlation Coefficient) score for it based on the following steps:
Calculates the minimum bounding box for the new_residue atoms.
Extends the box by adding a margin of 1 Angstrom.
Checks if the density map for the residue name is already calculated. If not, it calculates it using the calculate_density_for_box() method and stores it in the calculated_maps.
Retrieves the calculated density map for the residue name from the calculated_maps.
Iterates over a grid with a step size of 0.5 (Angstrom or any other unit) within the bounding box and retrieves the observed and calculated density values at each position.
Calculates and returns the RSCC score using the calculate_rscc() method with the observed and calculated density values.
Parameters
result
The SuperpositionResult object for which the RSCC score needs to be calculated.
Returns
The RSCC score for the given superposition result.
public float
rsr_score
(gemmi::Residue & residue)
Calculates the RSR (Real Space R) score for a given residue.
The RSR score measures the agreement between the observed electron density and the calculated electron density for a residue. The score is calculated by comparing the observed and calculated electron densities at regular intervals within the residue's bounding box. The RSR score is defined as the absolute difference between the observed and calculated densities divided by the sum of the absolute values of the observed and calculated densities.
Parameters
residue
The gemmi::Residue object for which the RSR score is calculated.
Returns
The RSR score for the given residue.
Exceptions
std::runtime_error
if the residue's bounding box is empty.
public float
rsr_score
(
SuperpositionResult
& result)
Calculates the RSR (Real Space R) score for a given SuperpositionResult.
This method calculates the RSR score for a given SuperpositionResult. The RSR score measures the agreement between the observed electron density and the calculated electron density for a residue. The score is calculated by comparing the observed and calculated electron densities at regular intervals within the residue's bounding box. The RSR score is defined as the absolute difference between the observed and calculated densities divided by the sum of the absolute values of the observed and calculated densities.
Parameters
result
The SuperpositionResult object containing the required data for calculating the RSR score.
Returns
The RSR score for the given SuperpositionResult.
Exceptions
std::runtime_error
if the box is empty (denominator is 0.0f).
public float
difference_density_score
(gemmi::Residue & residue) const
Calculates the difference density score for a residue.
This method calculates the difference density score for the given residue using the difference_grid.
Parameters
residue
The gemmi::Residue object for which the difference density score is to be calculated.
Returns
The difference density score for the residue.
public float
score_atomic_position
(const gemmi::Atom & atom) const
Scores an atom.
This method takes a gemmi::Atom object and generates a score corresponding to the interpolated density value.
Parameters
atom
The gemmi::Atom object whose position needs to be scored.
Returns
The score of the atom based on the density value at that atom's position.
public float
score_position
(const gemmi::Position & pos) const
Scores a position based on the density value at that position.
This method takes a gemmi::Position object and scores it based on the density value at that position.
Parameters
pos
The gemmi::Position object to be scored.
Returns
The score of the position based on the density value at that position.
public static gemmi::Grid
load_grid
(const gemmi::Mtz & mtz, const std::string & f_col, const std::string & phi_col, bool normalise)
Transforms F and Phi values from an MTZ file into a grid map.
This method takes F and Phi values from an MTZ file and transforms them into a grid using an FFT.
Parameters
Returns
The real space grid formed after FFT.
public static void
form_atom_list
(const gemmi::Structure & structure, std::vector< clipper::Atom > & atoms)
Forms a list of clipper::Atom objects from a gemmi::Structure object.
This method takes a gemmi::Structure object and populates a vector of clipper::Atom objects. Each atom in the structure is converted to a clipper::Atom object and added to the list.
Parameters
structure
The gemmi::Structure object from which to form the list of atoms.atoms
The vector of clipper::Atom objects to be populated.