polymerist.polymers.monomers.specification ========================================== .. py:module:: polymerist.polymers.monomers.specification .. autoapi-nested-parse:: Implementations of the canonical monomer substructure SMARTS specification defined in https://doi.org/10.26434/chemrxiv-2023-f2zxd-v2 Attributes ---------- .. autoapisummary:: polymerist.polymers.monomers.specification.LOGGER polymerist.polymers.monomers.specification.COMPLIANT_ATOM_SMARTS polymerist.polymers.monomers.specification.ABERRANT_RDKIT_ATOM_SMARTS Functions --------- .. autoapisummary:: polymerist.polymers.monomers.specification.disambiguate_formal_charge polymerist.polymers.monomers.specification.chem_info_from_match polymerist.polymers.monomers.specification.compliant_atom_query_from_info polymerist.polymers.monomers.specification.compliant_atom_query_from_rdatom polymerist.polymers.monomers.specification.compliant_atom_query_from_re_match polymerist.polymers.monomers.specification.compliant_mol_SMARTS Module Contents --------------- .. py:data:: LOGGER .. py:data:: COMPLIANT_ATOM_SMARTS .. py:data:: ABERRANT_RDKIT_ATOM_SMARTS .. py:function:: disambiguate_formal_charge(sign: str, magnitude: str) -> int Convert a (possibly implicit) sign and magnitude of a SMILES-compliant atom formal charge entry to an explicit signed integer value (e.g. "+" -> +1, "--" -> -2) :Parameters: * **sign** (*str ("", "+", or "-"*) -- The string (possibly empty) representing the sign of the formal charge * **magnitude** (*str ("" or digit string)*) -- The string (possibly empty) representing the magnitude of the formal charge (digits only) :returns: **formal_charge** -- The explicit signed integer value of the formal charge Will raise ValueError if sign and magnitude passed cannot be coerced into the appropriate types :rtype: int .. py:function:: chem_info_from_match(match: re.Match) -> dict[str, Union[int, str, None]] Generate chemical information dict (with proper types) from an atom query regex match .. py:function:: compliant_atom_query_from_info(atomic_num: int, degree: int, atom_map_num: int, formal_charge: int = 0, isotope: int = 0, as_atom: bool = False) -> Union[str, rdkit.Chem.QueryAtom] Construct a monomer-spec compliant atom SMARTS string directly from chemical information .. py:function:: compliant_atom_query_from_rdatom(rdatom: rdkit.Chem.Atom, as_atom: bool = False) -> Union[str, rdkit.Chem.QueryAtom] Construct a monomer-spec compliant atom SMARTS string from an RDKit Atom .. py:function:: compliant_atom_query_from_re_match(match: re.Match) -> str Construct a monomer-spec compliant atom SMARTS string from a RegEx string match of a compliant or aberrant atom .. py:function:: compliant_mol_SMARTS(smarts: Union[polymerist.smileslib.cleanup.Smiles, polymerist.smileslib.cleanup.Smarts]) -> str Convert a generic SMARTS string into a monomer specification-compliant one For details on specification, see https://doi-org.colorado.idm.oclc.org/10.1021/acs.jcim.3c01691 :Parameters: **smarts** (*Union[Smiles, Smarts]*) -- The SMARTS (or, by virtue of superset, SMILES) string to convert :returns: **compliant_smarts** -- The structurally-correspondent monomer specification-compliant SMARTS string :rtype: Smarts