rxn.chemutils.smiles_augmenter.SmilesAugmenter

class rxn.chemutils.smiles_augmenter.SmilesAugmenter(augmentation_fn, augmentation_probability=1.0, shuffle=True, ignore_exceptions=True)[source]

Bases: object

Class to augment any kind of SMILES string with the help of randomization and shuffling.

Parameters
  • augmentation_fn (Callable[[str], str]) –

  • augmentation_probability (float, default: 1.0) –

  • shuffle (bool, default: True) –

  • ignore_exceptions (bool, default: True) –

__init__(augmentation_fn, augmentation_probability=1.0, shuffle=True, ignore_exceptions=True)[source]
Parameters
  • augmentation_fn (Callable[[str], str]) – Function for augmenting the individual SMILES strings, such as the functions provided in smiles_randomization.py.

  • augmentation_probability (float, default: 1.0) – Probability with which to augment individual SMILES strings.

  • shuffle (bool, default: True) – Whether to shuffle the order of the compounds.

  • ignore_exceptions (bool, default: True) – Whether to ignore the error (and return the original string) when an augmentation fails. If False, exceptions will be propagated.

Methods

__init__(augmentation_fn[, ...])

type augmentation_fn

Callable[[str], str]

augment(smiles, number_augmentations)

Augment one SMILES string (of any kind).

augment(smiles, number_augmentations)[source]

Augment one SMILES string (of any kind).

Parameters
  • smiles (str) – SMILES string to augment.

  • number_augmentations (int) – how many times to do the augmentation.

Return type

List[str]