Skip to content

Commit

Permalink
make template search optional for enhanced efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodobbe committed Oct 1, 2024
1 parent 4f7c248 commit dc43679
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/rxn_insight/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(".")]
Expand Down

0 comments on commit dc43679

Please sign in to comment.