mmtbx.ions.utils module

mmtbx.ions.utils.anonymize_ions(pdb_hierarchy, log=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

Convert any elemental ions in the PDB hierarchy to water, resetting the occupancy and scaling the B-factor. The atom segids will be set to the old resname. NOTE: this does not change the corresponding scatterer in the xray structure, but a new xray structure can be obtained by calling hierarchy.extract_xray_structure(crystal_symmetry).

Parameters:
Returns:

  • iotbx.pdb.hierarchy.root – New pdb hierarchy with its ions anonymized

  • int – Number of atoms that were anonymized.

mmtbx.ions.utils.collect_ions(pdb_hierarchy)

Collects a list of all ions in pdb_hierarchy.

Parameters:

pdb_hierarchy (iotbx.pdb.hierarchy.root)

Return type:

list of iotbx.pdb.hierarchy.atom

mmtbx.ions.utils.compare_ions(hierarchy, reference_hierarchy, reference_xrs, distance_cutoff=2.0, log=None, ignore_elements=(), only_elements=(), sel_str_base='segid ION')

Compares two pdb structures to determine the number of ions that appear in the reference structure and are either matched or missing in the other structure.

Parameters:
Returns:

  • int – Number of ions in reference_hierarchy that were also found in hierarchy.

  • int – Number of ions in reference_hierarchy that were not found in hierarchy.

mmtbx.ions.utils.count_coordinating_residues(nearby_atoms, distance_cutoff=3.0)

Count the number of residues of each type involved in the coordination sphere. This may yield additional clues to the identity of ions, e.g. only Zn will have 4 Cys residues.

Parameters:
Return type:

dict of str, int

mmtbx.ions.utils.fit_gaussian(unit_cell, site_cart, real_map, radius=1.6)

Fit a gaussian function to the map around a site. Samples points in concentric spheres up to radius away from the site.

f(x) = a * exp(-b * x ** 2)

Parameters:
  • unit_cell (uctbx.unit_cell)

  • site_cart (tuple of float, float, float) – The site’s cartesian coordinates to sample the density around.

  • real_map (scitbx.array_family.flex) – Real space map of the electron density in the unit cell.

  • radius (float, optional) – The max radius to use for sampling.

Returns:

  • float – Height of gaussian curve.

  • float – Spread of guassian curve.

See also

scitbx.math.gaussian_fit_1d_analytical

mmtbx.ions.utils.sort_atoms_permutation(pdb_atoms, xray_structure)

Creates a list of atoms in pdb_atoms, sorted first by their atomic number, then by occupancy, and finally, by isotropic b-factor.

Parameters:
Returns:

i_seqs of sorted atoms

Return type:

flex.size_t of int