rxn.reaction_preprocessing.annotations.rejected_molecules_filter.RejectedMoleculesFilter

class rxn.reaction_preprocessing.annotations.rejected_molecules_filter.RejectedMoleculesFilter(rejected_molecules)[source]

Bases: object

Class to filter rejected molecules (potentially based on annotations).

Parameters

rejected_molecules (Iterable[str]) –

__init__(rejected_molecules)[source]
Parameters

rejected_molecules (Iterable[str]) – Molecules to reject. Use dots for fragment bonds!

Methods

__init__(rejected_molecules)

type rejected_molecules

Iterable[str]

from_molecule_annotations(molecule_annotations)

Instantiate from existing molecule annotations.

is_valid_molecule_smiles(smiles)

Whether a molecule SMILES is considered to be valid.

is_valid_reaction_equation(reaction_equation)

Whether a reaction equation is considered to be valid.

is_valid_reaction_smiles(smiles[, fragment_bond])

Whether a reaction SMILES is considered to be valid.

classmethod from_molecule_annotations(molecule_annotations)[source]

Instantiate from existing molecule annotations.

Parameters

molecule_annotations (Iterable[MoleculeAnnotation]) – existing molecule annotations.

Return type

RejectedMoleculesFilter

is_valid_molecule_smiles(smiles)[source]

Whether a molecule SMILES is considered to be valid.

Parameters

smiles (str) – molecule SMILES. Fragment bonds must be given with a dot!

Return type

bool

is_valid_reaction_equation(reaction_equation)[source]

Whether a reaction equation is considered to be valid.

Parameters

reaction_equation (ReactionEquation) – reaction equation instance.

Return type

bool

is_valid_reaction_smiles(smiles, fragment_bond=None)[source]

Whether a reaction SMILES is considered to be valid.

Parameters
  • smiles (str) – reaction SMILES.

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

Return type

bool