chemprop.utils.utils#

Module Contents#

Classes#

EnumMapping

Enum where members are also (and must be) strings

Functions#

make_mol(smi, keep_h, add_h)

build an RDKit molecule from a SMILES string.

pretty_shape(shape)

Make a pretty string from an input shape

class chemprop.utils.utils.EnumMapping[source]#

Bases: enum.StrEnum

Enum where members are also (and must be) strings

classmethod get(name)[source]#
Parameters:

name (str | EnumMapping)

Return type:

EnumMapping

classmethod keys()[source]#
Return type:

Iterator[str]

classmethod values()[source]#
Return type:

Iterator[str]

classmethod items()[source]#
Return type:

Iterator[tuple[str, str]]

chemprop.utils.utils.make_mol(smi, keep_h, add_h)[source]#

build an RDKit molecule from a SMILES string.

Parameters:
  • smi (str) – a SMILES string.

  • keep_h (bool) – whether to keep hydrogens in the input smiles. This does not add hydrogens, it only keeps them if they are specified

  • add_h (bool) – whether to add hydrogens to the molecule

Returns:

the RDKit molecule.

Return type:

Chem.Mol

chemprop.utils.utils.pretty_shape(shape)[source]#

Make a pretty string from an input shape

Example

>>> X = np.random.rand(10, 4)
>>> X.shape
(10, 4)
>>> pretty_shape(X.shape)
'10 x 4'
Parameters:

shape (Iterable[int])

Return type:

str