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 atomidrel_residue_index (
Dict
[Tuple
[int
,int
],int
]) – maps (chainid, rel_resid) to residresidue_names (
List
[str
]) – residue name for each atomabs_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 lookupatom_name (
str
) – the name of the atom to lookupexpected_resname (
Optional
[str
]) – the expected residue name, usually three all-caps characters, e.g. “ALA”.chainid (
Optional
[int
]) – the chain id to lookupone_based (
bool
) – use one-based indexing
- Return type
- 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 lookupexpected_resname (
Optional
[str
]) – the expected residue name, usually three all-caps characters, e.g. “ALA”.chainid (
Optional
[int
]) – the chain id to lookupone_based (
bool
) – use one-based indexing
- Return type
- Returns
zero-based absolute residue index