rxn.reaction_preprocessing.annotations.missing_annotation_detector.MissingAnnotationDetector

class rxn.reaction_preprocessing.annotations.missing_annotation_detector.MissingAnnotationDetector(annotated_molecules, requires_annotation_fn=None)[source]

Bases: object

Find reactions with molecules that should be annotated, taking into account a set of already-annotated molecules.

Parameters
  • annotated_molecules (Set[str]) –

  • requires_annotation_fn (Optional[Callable[[str], bool]], default: None) –

__init__(annotated_molecules, requires_annotation_fn=None)[source]
Parameters
  • annotated_molecules (Set[str]) – set of already-annotated molecules.

  • requires_annotation_fn (Optional[Callable[[str], bool]], default: None) – function with which to decide whether a molecule needs an annotation. Defaults to AnnotationCriterion().

Methods

__init__(annotated_molecules[, ...])

type annotated_molecules

Set[str]

from_molecule_annotations(molecule_annotations)

Create a MissingAnnotationDetector instance from existing molecule annotations.

missing_in_reaction_equation(reaction_equation)

In a reaction equation, find the molecules requiring annotation.

missing_in_reaction_equations(reaction_equations)

In multiple reaction equations, find the molecules requiring annotation.

missing_in_reaction_smiles(reaction_smiles)

In one or multiple reaction SMILES, find the molecules requiring annotation.

molecule_needs_annotation(smiles)

Whether a molecule needs annotation.

classmethod from_molecule_annotations(molecule_annotations, requires_annotation_fn=None)[source]

Create a MissingAnnotationDetector instance from existing molecule annotations.

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

  • requires_annotation_fn (Optional[Callable[[str], bool]], default: None) – function with which to decide whether a molecule needs an annotation. Defaults to AnnotationCriterion().

Return type

MissingAnnotationDetector

missing_in_reaction_equation(reaction_equation)[source]

In a reaction equation, find the molecules requiring annotation.

Parameters

reaction_equation (ReactionEquation) –

Return type

Generator[str, None, None]

missing_in_reaction_equations(reaction_equations)[source]

In multiple reaction equations, find the molecules requiring annotation.

Parameters

reaction_equations (Iterable[ReactionEquation]) –

Return type

Generator[str, None, None]

missing_in_reaction_smiles(reaction_smiles, fragment_bond=None)[source]

In one or multiple reaction SMILES, find the molecules requiring annotation.

Parameters
  • reaction_smiles (Union[Iterable[str], str]) – One reaction SMILES (str), or multiple reaction SMILES.

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

Return type

Generator[str, None, None]

molecule_needs_annotation(smiles)[source]

Whether a molecule needs annotation.

Checks the overlap between the elements in the molecule and the extended transition metals, and then looks in the annotated molecules if necessary.

Parameters

smiles (str) –

Return type

bool