syndirella.SMARTSHandler

SMARTSHandler.py

This module contains the SMARTSHandler class. This class contains information about the reaction SMARTS.

Classes

SMARTSHandler

Module Contents

class syndirella.SMARTSHandler.SMARTSHandler(rxn_smirks_path: str = None)[source]
reaction_smarts[source]
reactant1_dict[source]
reactant2_dict[source]
product_smarts[source]
n_reactants_per_reaction[source]
pattern_products[source]
pattern_reactant1[source]
pattern_reactant2[source]
matched_reactants = None[source]
found_1 = None[source]
found_2 = None[source]
logger[source]
fromReactionFullNameToReactantName(reactionName, reactantNum)[source]
fromReactantNameToReactionFullName(reactantName)[source]
from_SMARTS_to_patterns(smarts_dict)[source]
assign_reactants_w_rxn_smarts(product: rdkit.Chem.Mol, reactant_attach_ids: Dict[rdkit.Chem.Mol, List[Tuple[int, int]]], reaction_name: str) dict[str, tuple[rdkit.Chem.Mol, list[int], str]] | None | dict[Any | None, None][source]

This function is used to assign the reactant number to input reactants using the reaction SMARTS. For now it only supports bimolecular reactions.

seperate_matching_reactants(r1: rdkit.Chem.Mol, r2: rdkit.Chem.Mol, found_1: Dict[str, bool], found_2: Dict[str, bool], patt1: str, patt2: str) Dict[str, Tuple[rdkit.Chem.Mol, List[int], str]][source]

This function is used to fix edge cases: - to separate reactants that match both reactant SMARTS. - one reactant matches both reactant SMARTS.

These found_1 and found_2 dictionaries are a bit confusing: Key: ‘r1’ or ‘r2’ Value: False if no match, List of atom indices within reactant that match the SMARTS of that reactant.

check_found_reactants(product: rdkit.Chem.Mol, found_1: Dict[str, bool], found_2: Dict[str, bool], reaction_name: str, r1: rdkit.Chem.Mol, r2: rdkit.Chem.Mol) bool[source]

This function checks that both reactants have been found. It raises a warning if both reactants are matched to the same reactant SMARTS.

Returns False when both reactants match both reactant SMARTS.

find_matching_atoms(reactant: rdkit.Chem.Mol, patt1: str, patt2: str, attachment_idx: set) Dict[str, Tuple[int] | bool][source]

This function finds the matched atoms in a reactant against both reactant SMARTS.

format_matched_reactant_for_one(reactant_mol: rdkit.Chem.Mol, attach_ids: List[Tuple[int, int]], patt: str) Dict[str, Tuple[rdkit.Chem.Mol, List[int], str]][source]

Formats matched reactants for one reactant.