polymerist.molfiles.pdb.pdbatoms

PDB file atom line formatting tools

Attributes

PDB_ATOM_RECORD_TOKENS

Classes

SerialAtomLabeller

For assigning unique numbered atom names based on their

Functions

parse_pdb_atom_record(→ dict[str, Union[str, int, float]])

Extracts informations (with correct type casting) from a PDB "ATOM" or "HETATM" record

Module Contents

polymerist.molfiles.pdb.pdbatoms.PDB_ATOM_RECORD_TOKENS: dict[str, tuple[tuple[int, int], type]]
polymerist.molfiles.pdb.pdbatoms.parse_pdb_atom_record(pdb_atom_record: str) dict[str, str | int | float][source]

Extracts informations (with correct type casting) from a PDB “ATOM” or “HETATM” record

class polymerist.molfiles.pdb.pdbatoms.SerialAtomLabeller[source]

For assigning unique numbered atom names based on their order of appearance within a molecule and elemental class

Useful, for example, in generating unique atom names for a PDB file

Parameters:
  • atom_label_width (int , default 4) – Exact length alloted for any generated atom label Labels shorter than this are right-padded with spaces, while labels longer than this are truncated

    Default of 4 is the chosen to be compatible with the PDB specification (“Atom name: lines 13-16, left-justified”) https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html

  • include_elem_idx (bool, default True) – Whether to attach a numerical element-index postfix to atom labels

    E.g. with atom_label_width=4, the fifth carbon in a topology will be labelled as “C004” with include_elem_idx=True, while labelled as “C “ with include_elem_idx=False,

  • default_elem_idx (int, default 0) – Starting index for each element category By default, is 0-indexed; MUST BE POSITIVE

atom_label_width: int = 4
include_elem_idx: bool = True
default_elem_idx: int = 0
element_counter: collections.Counter
get_atom_label(elem_symbol: str) str[source]

Obtain a numbered atom label for an atom based on its element, updating the underlying element context in the process