Skip to content

graphchem.preprocessing.bond_to_str

prepare to tokenize a bond's attributes by constructing a unique string

Parameters:

Name Type Description Default
bond rdkit.Chem.Bond

bond to tokenize

required

Returns:

Name Type Description
str str

bond properties

Source code in graphchem/preprocessing/features.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
def bond_to_str(bond: 'rdkit.Chem.Bond') -> str:
    """ prepare to tokenize a bond's attributes by constructing a unique string

    Args:
        bond (rdkit.Chem.Bond): bond to tokenize

    Returns:
        str: bond properties
    """

    return str((
        bond.GetBondType(),
        bond.GetIsConjugated(),
        bond.GetStereo(),
        get_ring_size(bond),
        [sorted([bond.GetBeginAtom().GetSymbol(),
                 bond.GetEndAtom().GetSymbol()])]
    ))