chemprop.featurizers.bond#

Module Contents#

Classes#

MultiHotBondFeaturizer

A MultiHotBondFeaturizer feauturizes bonds based on the following attributes:

class chemprop.featurizers.bond.MultiHotBondFeaturizer(bond_types=None, stereos=None)[source]#

Bases: chemprop.featurizers.base.VectorFeaturizer[rdkit.Chem.rdchem.Bond]

A MultiHotBondFeaturizer feauturizes bonds based on the following attributes:

  • null-ity (i.e., is the bond None?)

  • bond type

  • conjugated?

  • in ring?

  • stereochemistry

The feature vectors produced by this featurizer have the following (general) signature:

slice [start, stop)

subfeature

unknown pad?

0-1

null?

N

1-5

bond type

N

5-6

conjugated?

N

6-8

in ring?

N

7-14

stereochemistry

Y

NOTE: the above signature only applies for the default arguments, as the bond type and sterochemistry slices can increase in size depending on the input arguments.

Parameters:
  • bond_types (Sequence[BondType] | None, default=[SINGLE, DOUBLE, TRIPLE, AROMATIC]) – the known bond types

  • stereos (Sequence[int] | None, default=[0, 1, 2, 3, 4, 5]) – the known bond stereochemistries. See [1] for more details

References

__len__()[source]#
__call__(b)[source]#
Parameters:

b (rdkit.Chem.rdchem.Bond)

Return type:

numpy.ndarray

classmethod one_hot_index(x, xs)[source]#

Returns a tuple of the index of x in xs and len(xs) + 1 if x is in xs. Otherwise, returns a tuple with len(xs) and len(xs) + 1.

Parameters:

xs (Sequence)

Return type:

tuple[int, int]