Skip to content

Atom Types

Provides definitions for various sets of atoms and atom types used in chemical and biochemical contexts. Additionally, it includes a helper function for remapping atom types for easier lookups.

Variables
HALOGENS (set): A set of standard halogens.
MAINCHAIN_ATOMS (set): A set of atoms usually found in the main chain of a protein.
STANDARD_NUCLEOTIDES (set): A set of standard nucleotides in RNA and DNA.
METALS (set): A set of metal atoms, sourced from `_atom_type_strings.py`.
STANDARD_AMINO_ACIDS (set): A set of standard amino acids, sourced from `_atom_type_strings.py`.
PROT_ATOM_TYPES (dict): A dictionary mapping atom types to sets of atom names (strings),
    as defined in `_atom_type_strings.py`.
ID_TO_TYPES (dict): A dictionary mapping atom names (strings) to sets of atom types,
    as defined in `_atom_type_strings.py`.

The module is expected to be used for handling and processing biochemical data structures, with specific focuses on proteins and nucleic acids.

HALOGENS module-attribute

HALOGENS = {'F', 'CL', 'BR', 'I', 'AT'}

Type: set[str]: A set of standard halogens.

MAINCHAIN_ATOMS module-attribute

MAINCHAIN_ATOMS = {'N', 'C', 'CA', 'O', 'OXT'}

Type: set[str]: A set of atoms usually found in the main chain of a protein.

STANDARD_NUCLEOTIDES module-attribute

STANDARD_NUCLEOTIDES = {'A', 'C', 'G', 'I', 'U', 'DA', 'DC', 'DG', 'DI', 'DT', 'DU', 'N'}

Type: set[str]: A set of standard nucleotides in RNA and DNA.

METALS module-attribute

METALS = METALS

Type: set[str]: A set of metal atoms, sourced from lahuta.config._atom_type_strings.py.

STANDARD_AMINO_ACIDS module-attribute

STANDARD_AMINO_ACIDS = STANDARD_AMINO_ACIDS

Type: set[str]: A set of standard amino acids. See the source.

PROT_ATOM_TYPES module-attribute

PROT_ATOM_TYPES = {'hbond_acceptor': HBOND_ACCEPTORS, 'hbond_donor': HBOND_DONORS, 'xbond_acceptor': XBOND_ACCEPTORS, 'xbond_donor': set(), 'weak_hbond_acceptor': WEAK_HBOND_ACCEPTORS, 'weak_hbond_donor': WEAK_HBOND_DONORS, 'pos_ionisable': POS_IONISABLE, 'neg_ionisable': NEG_IONISABLE, 'hydrophobe': HYDROPHOBES, 'carbonyl_oxygen': CARBONYL_OXYGENS, 'carbonyl_carbon': CARBONYL_CARBONS, 'aromatic': AROMATIC}

Type: dict[str, set[str]]: A dictionary mapping atom types to sets of atom names (strings).

Definitions

ID_TO_TYPES module-attribute

ID_TO_TYPES = remap_prot_atom_types(PROT_ATOM_TYPES)

Type: dict[str, set[str]]: A dictionary mapping atom names (strings) to sets of atom types.

Definitions

See PROT_ATOM_TYPES for the definitions of atom types.

remap_prot_atom_types

remap_prot_atom_types(prot_atom_types)

Convert the PROT_ATOM_TYPES dictionary to a dictionary mapping atom ids to atom types.

Parameters:

Name Type Description Default
prot_atom_types dict

A dictionary mapping atom types to atom ids.

required

Returns:

Name Type Description
dict dict[str, set[str]]

A dictionary mapping atom ids to atom types.

Source code in lahuta/config/atoms.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
def remap_prot_atom_types(prot_atom_types: dict[str, set[str]]) -> dict[str, set[str]]:
    """Convert the PROT_ATOM_TYPES dictionary to a dictionary mapping atom ids to atom types.

    Args:
        prot_atom_types (dict): A dictionary mapping atom types to atom ids.

    Returns:
        dict: A dictionary mapping atom ids to atom types.
    """
    id_to_types: dict[str, set[str]] = {}
    for atom_type, atom_set in prot_atom_types.items():
        for atom_id in atom_set:
            if atom_id not in id_to_types:
                id_to_types[atom_id] = set()
            id_to_types[atom_id].add(atom_type)
    return id_to_types