From dc43679120fc47ac24260fdbc7f9a2b674071681 Mon Sep 17 00:00:00 2001 From: mrodobbe Date: Tue, 1 Oct 2024 20:32:57 +0200 Subject: [PATCH] make template search optional for enhanced efficiency --- src/rxn_insight/classification.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/rxn_insight/classification.py b/src/rxn_insight/classification.py index 921fe6e..d28c8ce 100644 --- a/src/rxn_insight/classification.py +++ b/src/rxn_insight/classification.py @@ -36,6 +36,7 @@ def __init__( reaction: str, rxn_mapper: Optional[RXNMapper] = None, keep_mapping: bool = False, + search_template: bool = True ): """Initializes the ReactionClassifier with the specified reaction and options. @@ -63,10 +64,14 @@ def __init__( self.sanitized_mapped_reaction, self.sanitized_reaction, self.extra_agents = ( sanitize_mapped_reaction(self.mapped_reaction) ) - self.template = get_reaction_template( - self.sanitized_mapped_reaction, radius_reactants=1, radius_products=0 - ) - self.template_smiles = self.get_template_smiles() + if search_template: + self.template = get_reaction_template( + self.sanitized_mapped_reaction, radius_reactants=1, radius_products=0 + ) + self.template_smiles = self.get_template_smiles() + else: + self.template = "" + self.template_smiles = "" self.reactants, self.products = self.sanitized_mapped_reaction.split(">>") self.reactant_mols = tuple( [Chem.MolFromSmiles(mol) for mol in self.reactants.split(".")]