meld.system.indexing.Indexer

class meld.system.indexing.Indexer(abs_atom_index, rel_residue_index, residue_names, abs_resid_to_resname)[source]

Bases: object

An object for performing atom and residue index lookups.

__init__(abs_atom_index, rel_residue_index, residue_names, abs_resid_to_resname)[source]

Initialize an Indexer object.

Parameters
  • abs_atom_index (Dict[Tuple[int, str], int]) – maps (resid, atom_name) to atomid

  • rel_residue_index (Dict[Tuple[int, int], int]) – maps (chainid, rel_resid) to resid

  • residue_names (List[str]) – residue name for each atom

  • abs_resid_to_resname (Dict[int, str]) – maps resid to resname

Methods

__init__(abs_atom_index, rel_residue_index, ...)

Initialize an Indexer object.

atom(resid, atom_name[, expected_resname, ...])

Find the AtomIndex

residue(resid[, expected_resname, chainid, ...])

Find the ResidueIndex

atom(resid, atom_name, expected_resname=None, chainid=None, one_based=False)[source]

Find the AtomIndex

The indexing can be either absolute (if chainid is None), or relative to a chain (if chainid is set).

Both resid and chainid are one-based if one_based is True, or both are zero-based if one_based=False (the default).

If expected_resname is specified, error checking will be performed to ensure that the returned atom has the expected residue name. Note that the residue names are those after processing with tleap, so some residue names may not match their value in an input pdb file.

Parameters
  • resid (int) – the residue index to lookup

  • atom_name (str) – the name of the atom to lookup

  • expected_resname (Optional[str]) – the expected residue name, usually three all-caps characters, e.g. “ALA”.

  • chainid (Optional[int]) – the chain id to lookup

  • one_based (bool) – use one-based indexing

Return type

AtomIndex

Returns

zero-based absolute atom index

residue(resid, expected_resname=None, chainid=None, one_based=False)[source]

Find the ResidueIndex

The indexing can be either absolute (if chainid is None), or relative to a chain (if chainid is set).

Both resid and chainid are one-based if one_based is True, or both are zero-based if one_based=False (the default).

If expected_resname is specified, error checking will be performed to ensure that the returned atom has the expected residue name. Note that the residue names are those after processing with tleap, so some residue names may not match their value in an input pdb file.

Parameters
  • resid (int) – the residue index to lookup

  • expected_resname (Optional[str]) – the expected residue name, usually three all-caps characters, e.g. “ALA”.

  • chainid (Optional[int]) – the chain id to lookup

  • one_based (bool) – use one-based indexing

Return type

ResidueIndex

Returns

zero-based absolute residue index