chemprop.featurizers.molgraph.molecule#

Classes#

SimpleMoleculeMolGraphFeaturizer

A SimpleMoleculeMolGraphFeaturizer is the default implementation of a

BatchCuikMolGraph

CuikmolmakerMolGraphFeaturizer

A CuikmolmakerMolGraphFeaturizer featurizes a list of molecules at once instead of

Module Contents#

class chemprop.featurizers.molgraph.molecule.SimpleMoleculeMolGraphFeaturizer[source]#

Bases: chemprop.featurizers.molgraph.mixins._MolGraphFeaturizerMixin, chemprop.featurizers.base.GraphFeaturizer[rdkit.Chem.Mol]

A SimpleMoleculeMolGraphFeaturizer is the default implementation of a MoleculeMolGraphFeaturizer

Parameters:
  • atom_featurizer (AtomFeaturizer, default=MultiHotAtomFeaturizer()) – the featurizer with which to calculate feature representations of the atoms in a given molecule

  • bond_featurizer (BondFeaturizer, default=MultiHotBondFeaturizer()) – the featurizer with which to calculate feature representations of the bonds in a given molecule

  • extra_atom_fdim (int, default=0) – the dimension of the additional features that will be concatenated onto the calculated features of each atom

  • extra_bond_fdim (int, default=0) – the dimension of the additional features that will be concatenated onto the calculated features of each bond

extra_atom_fdim: int = 0#
extra_bond_fdim: int = 0#
__post_init__()[source]#
__call__(mol, atom_features_extra=None, bond_features_extra=None)[source]#
Parameters:
  • mol (rdkit.Chem.Mol)

  • atom_features_extra (numpy.ndarray | None)

  • bond_features_extra (numpy.ndarray | None)

Return type:

chemprop.data.molgraph.MolGraph

class chemprop.featurizers.molgraph.molecule.BatchCuikMolGraph[source]#
V: torch.Tensor#

the atom feature matrix

E: torch.Tensor#

the bond feature matrix

edge_index: torch.Tensor#

an tensor of shape 2 x E containing the edges of the graph in COO format

rev_edge_index: torch.Tensor#

A tensor of shape E that maps from an edge index to the index of the source of the reverse edge in the edge_index attribute.

batch: torch.Tensor#

the index of the parent MolGraph in the batched graph

__post_init__()[source]#
__len__()[source]#

the number of individual MolGraphs in this batch

Return type:

int

to(device)[source]#
Parameters:

device (str | torch.device)

class chemprop.featurizers.molgraph.molecule.CuikmolmakerMolGraphFeaturizer[source]#

Bases: chemprop.featurizers.base.Featurizer[list[str], BatchCuikMolGraph]

A CuikmolmakerMolGraphFeaturizer featurizes a list of molecules at once instead of one molecule at a time for efficiency.

Parameters:
  • atom_featurizer_mode (str, default="V2") – The mode of the atom featurizer (V1, V2, ORGANIC, RIGR) to use.

  • extra_atom_fdim (int, default=0) – the dimension of the additional features that will be concatenated onto the calculated features of each atom

  • extra_bond_fdim (int, default=0) – the dimension of the additional features that will be concatenated onto the calculated features of each bond

  • add_h (bool, default=False) – whether to add hydrogens to the Chem.Mol objects created from the input SMILES strings

atom_featurizer_mode: Literal['V1', 'V2', 'ORGANIC', 'RIGR'] = 'V2'#
extra_atom_fdim: int = 0#
extra_bond_fdim: int = 0#
add_h: bool = False#
atom_fdim: int#
bond_fdim: int#
__post_init__()[source]#
__call__(smiles_list, atom_features_extra=None, bond_features_extra=None)[source]#

featurize an input

Parameters:
  • smiles_list (list[str])

  • atom_features_extra (numpy.ndarray | None)

  • bond_features_extra (numpy.ndarray | None)

Return type:

BatchCuikMolGraph