I am not a chemist, in fact, I come from a computer science background, however, I am working on a project that involves using machine learning for SMILES generation. My question is, how many characters are used in the SMILES notation and what are they? I looked it up with no success!
-
5$\begingroup$ For more than two decades, Wikipedia dedicates an entry about SMILES, including references to primary references (including Weiniger's seminal paper in 1988). There are multiple variations of SMILES (e.g., unique, canonical, inchified; see e.g. here), and other string notations (like the more recent InChI), too. $\endgroup$– ButtonwoodCommented Oct 23, 2021 at 9:11
-
2$\begingroup$ It's also worth mentioning that for generative ML applications, DeepSMILES or SELFIES are consistently better. $\endgroup$– Geoff HutchisonCommented Oct 24, 2021 at 0:27
-
$\begingroup$ Thank you for this information. However, I still cannot find any source listing all the characters used in the SMILES notation. $\endgroup$– mac179Commented Oct 24, 2021 at 6:10
1 Answer
A brief glance on the documentation by Daylight suggests for the typical organic molecules:
you need all characters to represent a chemical element by the symbol in the periodic table of elements. Likely, this condenses to
[A-Za-z]
. Note, though, while upper caseC
and lower casec
both refers to carbon, the second one is part of an aromatic system; e.g.C1CCCCC1
about cyclohexane, butc1ccccn1
about pyridine.coverage of all
[0-9]
, because you may refer explicitly to isotopes if necessary, e.g.[13C]
about $\ce{^{13}C}$.=
and#
marks double and triple bonds. Single bonds may be noted by-
(but often are implicit); on occasion you meet:
.stereochemical configuartion may be indicated by
/
and\
around double bonds (used pairwise) about (cis/trans) relationships; or more general (E/Z). For sterogenic centres (mainly carbonC
, but not limited to this [e.g., sulfoxides]) you need the individual@
or@@
to indicate them as either (S), or (R), respectively. Depending on the intended use, these four indicators may be absent or partially missing.Pairwise, parentheses
(
/)
and square brackets[
/]
are used. E.g.,C(O)C
is about ethanol, whileCOC
describes dimethyl ether. With the brackets you mark start and end of the elements with more than a single letter; e.g.,[Sn]
about tin, whileS
were about sulfur andn
were about an aromatic nitrogen.Brackets are in place to mark charges, like
[Fe+2]
or[Fe++]
(functional equivalent) about $\ce{Fe^{2+}}$, or[OH-]
about $\ce{OH^-}$.there are complex ring closures (e.g., in buckyball fullerenes) described with the
%
sign. (Credit to@Geoff Hutchison
to pointing to this detail.)You need the full stop / period
.
to join e.g., multiple molecules or ions into one SMILES string, like for sodium acetate:[Na+].[O-]C(=O)C
If you stop here, the set of A-Za-z0-9=#:+-[]()/\@.%
is a key space of 76 characters.
The lower part of the document documents some keywords reserved to describe the spatial constitution of complexes of transition metal complexes, and the use of >
to encode reactions.
Noel M O'Boyle wrote a paper about the methods to identify a canonical SMILES representation of (organic) structures which provides insight here, too.
Towards a Universal SMILES representation - A standard method to generate canonical SMILES based on the InChI in J. Cheminf. 2012; doi 10.1186/1758-2946-4-22.
-
4$\begingroup$ Great summary. You forgot % for extended ring closure, e.g.
C2%13%24
because some systems need more than just one digit for ring closures (e.g., fullerenes, other complex ring systems) $\endgroup$ Commented Oct 24, 2021 at 23:11 -
1$\begingroup$ @GeoffHutchison Thank you for pointing the
%
. So far, I didn't use SMILES about fullerenes and it was a new for me. $\endgroup$ Commented Oct 25, 2021 at 17:17