Skip to content

graphchem.preprocessing.atom_to_str

prepare to tokenize an atom's attributes by constructing a unique string

Parameters:

Name Type Description Default
atom rdkit.Chem.Atom

atom to tokenize

required

Returns:

Name Type Description
str str

atom properties

Source code in graphchem/preprocessing/features.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def atom_to_str(atom: 'rdkit.Chem.Atom') -> str:
    """ prepare to tokenize an atom's attributes by constructing a unique
    string

    Args:
        atom (rdkit.Chem.Atom): atom to tokenize

    Returns:
        str: atom properties
    """

    return str((
        atom.GetChiralTag(),
        atom.GetDegree(),
        atom.GetExplicitValence(),
        atom.GetFormalCharge(),
        atom.GetHybridization(),
        atom.GetImplicitValence(),
        atom.GetIsAromatic(),
        atom.GetNoImplicit(),
        atom.GetNumExplicitHs(),
        atom.GetNumImplicitHs(),
        atom.GetNumRadicalElectrons(),
        atom.GetSymbol(),
        atom.GetTotalDegree(),
        atom.GetTotalNumHs(),
        atom.GetTotalValence(),
        get_ring_size(atom)
    ))