syndirella.SMARTSHandler ======================== .. py:module:: syndirella.SMARTSHandler .. autoapi-nested-parse:: SMARTSHandler.py This module contains the SMARTSHandler class. This class contains information about the reaction SMARTS. Classes ------- .. autoapisummary:: syndirella.SMARTSHandler.SMARTSHandler Module Contents --------------- .. py:class:: SMARTSHandler(rxn_smirks_path: str = None) .. py:attribute:: reaction_smarts .. py:attribute:: reactant1_dict .. py:attribute:: reactant2_dict .. py:attribute:: product_smarts .. py:attribute:: n_reactants_per_reaction .. py:attribute:: pattern_products .. py:attribute:: pattern_reactant1 .. py:attribute:: pattern_reactant2 .. py:attribute:: matched_reactants :value: None .. py:attribute:: found_1 :value: None .. py:attribute:: found_2 :value: None .. py:attribute:: logger .. py:method:: fromReactionFullNameToReactantName(reactionName, reactantNum) .. py:method:: fromReactantNameToReactionFullName(reactantName) .. py:method:: from_SMARTS_to_patterns(smarts_dict) .. py:method:: 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] This function is used to assign the reactant number to input reactants using the reaction SMARTS. For now it only supports bimolecular reactions. .. py:method:: 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]] 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. .. py:method:: 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 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. .. py:method:: find_matching_atoms(reactant: rdkit.Chem.Mol, patt1: str, patt2: str, attachment_idx: set) -> Dict[str, Tuple[int] | bool] This function finds the matched atoms in a reactant against both reactant SMARTS. .. py:method:: 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]] Formats matched reactants for one reactant.