Package: amsr
AMSRAnotherMolecularStringRepresentation,
inspired byH. Hiz, "A Linearization of Chemical Graphs,"J. Chem. Doc.4, 173-180 (1964)SMILESPATTYDeepSMILESSELFIESInstallingpip install amsrUsageimportamsramsr.ToMol("CNcncc5cNcN6C.oC.o")# caffeinetaxol_smi="CC1=C2[C@@]([C@]([C@H]([C@@H]3[C@]4([C@H](OC4)C[C@@H]([C@]3(C(=O)[C@@H]2OC(=O)C)C)O)OC(=O)C)OC(=O)c5ccccc5)(C[C@@H]1OC(=O)[C@H](O)[C@@H](NC(=O)c6ccccc6)c7ccccc7)O)(C)C"amsr.FromSmiles(taxol_smi)# CccCC`C`C`C'C`OC4.CC'C'6coC`8[OAc].C.O....[OAc].O[Bz].CC`6OcoC`O.C'N[Bz].[Ph]....O.C.Camsr.FromSmiles(taxol_smi,useGroups=False)# CccCC`C`C`C'C`OC4.CC'C'6coC`8OcoC..C.O....OcoC..Ococccccc6......CC`6OcoC`O.C'Ncocccccc6......cccccc6.........O.C.CDescriptionA molecular string representation in which every sequence of tokens generates a "reasonable" molecule.
You may have different ideas about what constitutes a reasonable molecule than this string representation.AtomsAtoms are represented by their symbol
enclosed in square brackets, as in SMILES.
For a one-letter symbol,
brackets may be omitted.  Atoms are assumed to have a fixed
valence that limits the number of covalently-bonded neighbors.
If an atom makes fewer bonds than its valence, hydrogens are assumed.AMSRmoleculeCmethaneOwater[Cl]hydrochloric acidChainsEach atom in a chain is bonded to the most recently added atom that
can still make bonds, according to its valence. Hydrogens may be added
explicitly like any other atom.  In the
example below, the fluorines are added to the second carbon; the chlorine
is then added to the first carbon, since the second can no longer bond.AMSRmoleculeCCFFF[Cl]2-chloro-1,1,1-trifluoroethaneBranchesBranches are formed automatically when atoms can no longer
make bonds.  They can also be made by "capping" or
"saturating" an atom with hydrogens, using a period.(capping hydrogens are applied to the most
recently-added atom that can still make bonds).
New atoms will then be bonded to those added earlier, forming a branch.AMSRmoleculeCCC.CisobutaneCC.CC.C.C2,2-dimethylbutaneRingsRings are denoted by a single digit
(or two or more digits enclosed in square brackets)
giving the size of the ring.
A new bond is formed between
the two most recently-added atoms that
can make bonds and when bonded will form a ring of that size.AMSRmoleculeCCO3oxiraneCCCCCC6cyclohexaneCCCCCCCCCCCC[12]cyclododecaneDouble bonds (sp2centers)Atoms making a double bond are indicated by changing
the symbol to lowercase (note that lowercase
does not mean "aromatic"; merely, "atom having one
fewer neighbor than its valence.")  Double bonds are
assigned by a matching algorithm.  If a perfect
matching cannot be found (for instance, in the case
of an odd number of contiguous lowercase symbols) a
maximal matching is chosen, non-matched atoms
remain singly bonded, and hydrogens are added.AMSRmoleculecoformaldehydecccccc6benzeneccoacetaldehyde(only one double bond added)Note that an oxygen with two neighbors or a nitrogen with three in an aromatic ring
is still denoted by a capital (not a lowercase) symbol,
although sp2-hybridized,
since its coordination number is still equal to its valence.AMSRmoleculeccccO5furanccccN5pyrroleRing selectionWhen more than one ring of a given size can be formed, one or more@signs immediately after
the digit will make ring-forming bonds with atoms appearing earlier in the
string, rather than the most recent.AMSRmoleculeccOcc5cccc6benzofuranccOcc5cccc6@isobenzofuranTriple bonds (sp centers)Atoms with two fewer neighbors than their valence are designated by a trailing colon:can make triple bonds (or more than one double bond).AMSRmoleculeC:N:hydrogen cyanideoC:ocarbon dioxideHypervalent atomsAtoms denoted by their symbol alone are assumed to have their lowest possible valence
(for instance, two for sulfur).  Higher valences are denoted by one or more exclamation points!.AMSRmoleculeCSCdimethyl sulfideCs!oCdimethyl sulfoxideS!!FFFFFFsulfur hexafluorideFormal charges, radical electrons, isotopesPositive/negative formal charges are designated by one or more of+/-.
Radical electrons are denoted by one or more asterisks*.  An isotopic mass is denoted by a number prefix
before the atomic symbol (in which case square brackets must be used even for a one-letter symbol).AMSRmolecule[Mg++]S!!:ooO-O-magnesium sulfateCC.C.CCCCC.C.N6O*(2,2,6,6-Tetramethylpiperidin-1-yl)oxyl or TEMPO[2H]O[2H]heavy waterTetrahedral stereochemistryTetrahedral stereochemistry is denoted by a single quote'meaning "clockwise"
or a backtick`meaning "counterclockwise," referring to the first three neighbors of
a stereocenter atoms as they appear in the string, with the last neighbor (or implicit hydrogen)
in back.AMSRmoleculeC`C.FO(1S)-1-fluoroethanolC'C.FO(1R)-1-fluoroethanolE/ZstereochemistryStereochemistry for a double bond is denoted by an underscore_meaning "trans" orE,
or caret^meaning "cis" orZ, between the two atoms making the bond,
where the reference neighboring atoms are those that appear earliest in the string.AMSRmoleculec[Br][Cl]_c[Cl](E)-1-bromo-1,2-dichloroethenec[Br][Cl]^c[Cl](Z)-1-Bromo-1,2-dichloroetheneGroupsThe following abbreviations may be used to represent various functional groups:[@],[Ac],[Bn],[Boc],[Bz],[CCl3],[CF3],[CHO],[CN],[COO-],[COOEt],[COOH],[COOMe],[Cbz],[Cy],[Et],[Ms],[NC],[NHAc],[NHMe],[NMe2],[NO2],[OAc],[OEt],[OMe],[OiBu],[PO3],[Ph],[Pip],[Piv],[SMe],[SO3],[Tf],[Tol],[Ts],[iBu],[iPr],[nBu],[nDec],[nHept],[nHex],[nNon],[nOct],[nPent],[nPr],[sBu],[tBu]AMSRmoleculeN+C'[Bn][COO-]L-phenylalaninecccccc6[iBu]..CC.[COOH]ibuprofenC[Ph][Et]coNcoNco6phenobarbitalMultiple moleculesMore than one molecule may be specified by separating with;.AMSRmoleculeocC.O[@][COOH];CcoN[@]..OaspirinandacetaminophenDevelopingThis repo uses pre-commit, so after cloning runpip install -r requirements.txtandpre-commit installprior to committing.