moleculekit.tools.autosegment module

moleculekit.tools.autosegment.autoSegment(mol, sel='all', basename='P', spatial=True, spatialgap=4.0, field='segid', mode='alphanumeric', _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 of the CA atoms have distance more than spatialgap Angstrom
  • spatialgap (float) – The size of a spatial gap which validates a discontinuity (A)
  • field (str) – Field to fix. Can be “segid” (default), “chain”, or “both”
  • mode (str) – If set to ‘numeric’ it will use numbers for segment IDs. If set to ‘alphabetic’ it will use letters for segment IDs. If set to ‘alphanumeric’ it will use both numbers and letters for segment IDs.
Returns:

newmol – A new Molecule object with modified segids

Return type:

Molecule object

Example

>>> newmol = autoSegment(mol,'chain B','P')
moleculekit.tools.autosegment.autoSegment2(mol, sel='(protein or resname ACE NME)', basename='P', fields=('segid', ), residgaps=False, residgaptol=1, chaingaps=True, mode='alphanumeric', _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
  • mode (str) – If set to ‘numeric’ it will use numbers for segment IDs. If set to ‘alphabetic’ it will use letters for segment IDs. If set to ‘alphanumeric’ it will use both numbers and letters for segment IDs.
Returns:

newmol – A new Molecule object with modified segids

Return type:

Molecule object

Example

>>> newmol = autoSegment2(mol)