Sails 0.2.0 Help

Sails::Density

class Sails::Density

Summary

Members

Descriptions

public gemmi::Gridm_grid

Best map

public gemmi::Gridm_difference_grid

Difference map

public gemmi::Gridm_po_pc_grid

Po-Pc map

public gemmi::Mtzm_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::Spacegroupm_spacegroup

Clipper Spacegroup used for map recalcualtion - initialised in initialise_hkl

public clipper::Resolutionm_resolution

Clipper Resolution used for map recalcualtion - initialised in initialise_hkl

public clipper::Cellm_cell

Clipper Cell used for map recalcualtion - initialised in initialise_hkl

public clipper::HKL_infom_hkl_info

Clipper container for reflection metadata used for map recalcualtion

public clipper::Grid_samplingm_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

publicDensity() = default

public explicitDensity(const std::string & mtz_path)

public explicitDensity(gemmi::Mtz & mtz)

public inlineDensity(Density& d)

public doublescore_residue(gemmi::Residue & residue, const DensityScoreMethod & method)

Scores a residue based on the specified density score method.

public voidinitialise_hkl()

Initializes the necessary parameters for density calculation.

public voidload_hkl(const std::string & f, const std::string & sig_f)

Loads the reflection data from the specified MTZ file and builds HKL data.

public voidrecalculate_map(gemmi::Structure & structure)

Recalculates the map based on the given structure.

public voidcalculate_po_pc_map(gemmi::Structure & structure)

Recalculates the map based on the given structure.

public voidwrite_mtz(const std::string & path) const

Writes the density data to an MTZ file.

public floatatomwise_score(const gemmi::Residue & residue) const

Calculates the atomwise score for a given residue.

public gemmi::Gridcalculate_density_for_box(gemmi::Residue & residue) const

Calculates the density for a given box based on a gemmi::Residue object.

public floatrscc_score(gemmi::Residue & residue)

Calculates the RSCC (Real Space Correlation Coefficient) score for a given residue.

public floatcalculate_rscc(std::vector< float > obs_values, std::vector< float > calc_values)

Calculates the Real Space Correlation Coefficient (RSCC) between observed and calculated values.

public floatrscc_score(SuperpositionResult& result)

Calculates the RSCC score for a given superposition result.

public floatrsr_score(gemmi::Residue & residue)

Calculates the RSR (Real Space R) score for a given residue.

public floatrsr_score(SuperpositionResult& result)

Calculates the RSR (Real Space R) score for a given SuperpositionResult.

public floatdifference_density_score(gemmi::Residue & residue) const

Calculates the difference density score for a residue.

public floatscore_atomic_position(const gemmi::Atom & atom) const

Scores an atom.

public floatscore_position(const gemmi::Position & pos) const

Scores a position based on the density value at that position.

public static gemmi::Gridload_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.

public static voidform_atom_list(const gemmi::Structure & structure, std::vector< clipper::Atom > & atoms)

Forms a list of clipper::Atom objects from a gemmi::Structure object.

Members

public gemmi::Gridm_grid

Best map

public gemmi::Gridm_difference_grid

Difference map

public gemmi::Gridm_po_pc_grid

Po-Pc map

public gemmi::Mtzm_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::Spacegroupm_spacegroup

Clipper Spacegroup used for map recalcualtion - initialised in initialise_hkl

public clipper::Resolutionm_resolution

Clipper Resolution used for map recalcualtion - initialised in initialise_hkl

public clipper::Cellm_cell

Clipper Cell used for map recalcualtion - initialised in initialise_hkl

public clipper::HKL_infom_hkl_info

Clipper container for reflection metadata used for map recalcualtion

public clipper::Grid_samplingm_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

publicDensity() = default

public explicitDensity(const std::string & mtz_path)

public explicitDensity(gemmi::Mtz & mtz)

public inlineDensity(Density& d)

public doublescore_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 voidinitialise_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 voidload_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

  • f The path to the MTZ file containing the reflection data.

  • sig_f The path to the MTZ file containing the sigma data.

public voidrecalculate_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 voidcalculate_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 voidwrite_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 floatatomwise_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::Gridcalculate_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 floatrscc_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 floatcalculate_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 floatrscc_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

Returns

The RSCC score for the given superposition result.

public floatrsr_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 floatrsr_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 floatdifference_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 floatscore_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 floatscore_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::Gridload_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

  • mtz The MTZ file containing the F and Phi values.

  • f_col The label of the column in the MTZ file containing the F values e.g. FWT.

  • phi_col The label of the column in the MTZ file containing the Phi values e.g PHWT.

  • normalise Indicates whether to normalize the resulting grid map.

Returns

The real space grid formed after FFT.

public static voidform_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.

Last modified: 08 August 2024