rxn.reaction_preprocessing.annotations.molecule_replacer.MoleculeReplacer

class rxn.reaction_preprocessing.annotations.molecule_replacer.MoleculeReplacer(replacements)[source]

Bases: object

Class to replace SMILES strings by their improved alternatives (for instance from the catalyst annotations).

Parameters

replacements (Mapping[str, Union[str, List[str]]]) –

__init__(replacements)[source]
Parameters

replacements (Mapping[str, Union[str, List[str]]]) – mapping between SMILES strings to replace, and what to replace them with (given as a string or list of strings). Use dots for fragment bonds!

Methods

__init__(replacements)

type replacements

Mapping[str, Union[str, List[str]]]

from_molecule_annotations(molecule_annotations)

Instantiate from a list of molecule annotations.

replace_in_reaction_equation(reaction_equation)

Do the molecule replacements in a ReactionEquation instance.

replace_in_reaction_smiles(smiles[, ...])

Do the molecule replacements in a reaction SMILES.

replace_molecule_smiles(smiles)

Do the molecule replacements in a molecule SMILES.

classmethod from_molecule_annotations(molecule_annotations)[source]

Instantiate from a list of molecule annotations.

Parameters

molecule_annotations (Iterable[MoleculeAnnotation]) –

Return type

MoleculeReplacer

replace_in_reaction_equation(reaction_equation)[source]

Do the molecule replacements in a ReactionEquation instance.

Parameters

reaction_equation (ReactionEquation) –

Return type

ReactionEquation

replace_in_reaction_smiles(smiles, fragment_bond=None)[source]

Do the molecule replacements in a reaction SMILES.

Parameters
  • smiles (str) – reaction SMILES.

  • fragment_bond (Optional[str], default: None) – fragment bond used in the reaction SMILES.

Return type

str

replace_molecule_smiles(smiles)[source]

Do the molecule replacements in a molecule SMILES.

Return type

List[str]

Returns

List of replaced molecules (will have length of one in most cases)

Parameters

smiles (str) –