moleculekit.tools.autosegment module

moleculekit.tools.autosegment.autoSegment(mol, sel='all', basename='P', spatial=True, spatialgap=4.0, fields=('segid',), field=None, _logger=True)

Detects resid gaps in a selection and assigns incrementing segid to each fragment

!!!WARNING!!! If you want to use atom selections like ‘protein’ or ‘fragment’, use this function on a Molecule containing only protein atoms, otherwise the protein selection can fail.

Parameters
  • mol (Molecule object) – The Molecule object

  • sel (str) – Atom selection string on which to check for gaps. See more here

  • basename (str) – The basename for segment ids. For example if given ‘P’ it will name the segments ‘P1’, ‘P2’, …

  • spatial (bool) – Only considers a discontinuity in resid as a gap if the CA atoms have distance more than spatialgap Angstrom

  • spatialgap (float) – The size of a spatial gap which validates a discontinuity (A)

  • fields (list) – Fields in which to set the segments. Must be a combination of “chain”, “segid” or only one of them.

Returns

newmol – A new Molecule object with modified segids

Return type

Molecule object

Example

>>> newmol = autoSegment(mol, "chain B", "P", fields=("chain", "segid"))
moleculekit.tools.autosegment.autoSegment2(mol, sel='(protein or resname ACE NME)', basename='P', fields=('segid',), residgaps=False, residgaptol=1, chaingaps=True, _logger=True)

Detects bonded segments in a selection and assigns incrementing segid to each segment

Parameters
  • mol (Molecule object) – The Molecule object

  • sel (str) – Atom selection string on which to check for gaps. See more here

  • basename (str) – The basename for segment ids. For example if given ‘P’ it will name the segments ‘P1’, ‘P2’, …

  • fields (tuple of strings) – Field to fix. Can be “segid” (default) or any other Molecule field or combinations thereof.

  • residgaps (bool) – Set to True to consider gaps in resids as structural gaps. Set to False to ignore resids

  • residgaptol (int) – Above what resid difference is considered a gap. I.e. with residgaptol 1, 235-233 = 2 > 1 hence is a gap. We set default to 2 because in many PDBs single residues are missing in the proteins without any gaps.

  • chaingaps (bool) – Set to True to consider changes in chains as structural gaps. Set to False to ignore chains

Returns

newmol – A new Molecule object with modified segids

Return type

Molecule object

Example

>>> newmol = autoSegment2(mol)