ChemAxon Extended SMILES and SMARTS (CXSMILES) has become more popular in recent years for its ability to capture additional information on top of the core structural connectivity.
At NextMove Software we think it’s great and have increasingly used CXSMILES over the years to capture information more precisely.
Such structures can be captured as CXSMILES:
c12cccc1C=CC=C2.*[Zr](*)(Cl)Cl.c12cccc1C=CC=C2 |m:9:0.1.2.3.4,11:184.108.40.206.18| US20150376312A1 (2) [c-]12cccc1C=CC=C2.*[Zr++](*)(Cl)Cl.[c-]12cccc1C=CC=C2 |m:9:0.1.2.3.4,11:220.127.116.11.18| US20150376312A1 (2) C1CCOC1.C(Cl)Cl |Sg:c:0,1,2,3,4::,Sg:c:5,6,7::,Sg:mix:0,1,2,3,4,5,6,7::,SgH:2:0.1| 20% THF/DCM [N+](=O)([O-])C1=CC=C(C(=O)O[C@H]2[C@H](CCCC2)N2N=C(C(=C2)NC(=O)C=2C=NN3C2N=CC=C3)C3=C(C=CC(=C3)Cl)OC)C=C1 |r| US20200002345A1 Ex 136
Originally created by ChemAxon as a way to to store a CTfile (i.e. MOLfile) in SMILES without losing information – It has evolved to be useful on its own right. Recent versions of the Enamine REAL use it for stereochemistry groups and there are efforts by InChI to better represent inorganic, mixtures, and reactions which could make use of it. Since CXSMILES has started to gain traction with more toolkits supporting the format it is becoming a convenient lingua franca for advanced chemical representations.
The following toolkits support CXSMILES to various degrees:
ChemAxon provides public documentation on CXSMILES but there are corner cases and some wonky areas I want to discuss. I planned to get this captured in one post but quickly realised the first topic alone is enough on it’s own. I will update this links below as new posts appear:
- Bond Indexes
- Component Grouping
- Enhanced Stereo Canonicalisation
- SRU Ambiguity
- Atom Labels
- EPAM Highlight Extension
- Dative bond valence
- Multi- vs Variable- attachment
- Wish-list – beyond CXSMILES
- Partial feature set
- More compact coordinates
- cis/trans- stereo groups
Atoms and bonds in CXSMILES are referenced by index (0 <= idx < n) which is the position in the SMILES string:
CC=CC |c:1| CC=CC |t:1| CC=CC |ctu:1|
In this case it’s easy to see, there are three bonds at index:
0, 1, 2. The bond at index
1 is specified as cis (
c:) or trans (
t:) or unspecified (
ctu:). As a linear notation, some bonds get written twice. Does the index increment twice? Is the ring open (first occurrence) or ring close (second occurrence) the “reference”?
Using a dot-disconnection trick we can reorder the previous example and probe behaviour of what ChemAxon accepts:
C1C.CC=1 |c:0| wrong C1C.CC=1 |c:2| correct C=1C.CC1 |c:0| wrong C=1C.CC1 |c:2| correct - less desirable IMO
The “correct” choice is |c:2| – the closure bond is the reference. I should note this is somewhat an artefact of how the SMILES is parsed. A useful efficiency trick in SMILES is to use partial bonds (leave one atom temporarily undefined) which in this case would give you the incorrect index unless extra steps were taken.
A similar issue exists in vanilla SMILES when bond types mismatch:
C/1=C/C.C/1. The bond that takes precedent is toolkit dependent, hopefully you would get a warning or error.
In case you don’t like the dot-disconnection being used like that, here is one in a macro cycle:
C=1CCCCCCCCCC1 |c:0| wrong C1CCCCCCCCCC=1 |c:10| correct
The double counting question is already answered since it was
|c:2| and not
|c:3| but to confirm bonds do not get counted twice:
C1CCCCC1C=CC |c:8| wrong C1CCCCC1C=CC |c:7| correct
Double bond configurations in rings are rare but bond indexes also apply to dative/hydrogen bonds and it is important there is consensus on how it works.
SMILES already supports cis/trans specification so why does CXSMILES add this? It turns out to avoid error propagation you need to be able to specify unknown configuration and this is not always possible in normal SMILES. SMILES uses
"\" – it looks pretty but causes problems. Pause for a second and see if you can write the SMILES for the following structure:
Maybe you wrote something like this:
Indeed most toolkits will do exactly that! Unfortunately we’ve added information that wasn’t there and inadvertently defined the middle bond. It is actually possible if you add explicit hydrogens:
But this only gets you so far, what if we had nitrogens? CXSMILES allows us to encode this unambiguously:
This may seem like a narrow corner case but if you try to parse PubChem you will find a lot of them – or rather inconsistency warnings. Here are some warnings from CDK:
Ignoring invalid directional bonds C1=C/C/2=C/N=C3/C(=C/4\C(=N/C=C/5/C(=C2/C=C1)/C=CC=C5)C=CC=C4)/C=CC=C3 5379414 ^ ^ Ignoring invalid directional bonds CO/C(=C(\C#N)/C=C(/C=C(/C(=O)OC)\C#N)/C=C(/C(=O)OC)\C#N)/O 5720097 ^ ^
Depending on the traversal and bond direction assignment we may accidentally define the configuration of this bond and no warning would be generated or alternatively it will come out with an “invalid” syntax.
It’s problematic and Daylight had planned to address it. At the user group meeting in 2005 a Futures talk makes references to preliminary work on SMILES5: “A unification of the EZ stereo representation with atom-based stereo is proposed. This will allow better specification of multiple conjugated EZ centers and also allows more robust specification of relative stereochemistry.”.
It may have looked something like this:
C[C@H]=[C@H]C=C[C@H]=[C@H]C cis,cis- C[C@H]=[C@H]C=C[C@H]=[C@@H]C cis,trans- C[C@H]=[C@H]C=C[C@@H]=[C@H]C cis,trans-
I actually added support for this in CDK but in hindsight I think using CXSMILES is simpler but less elegant:
CC=CC=CC=CC |c:1,5| C/C=C\C=C\C=C/C |ctu:3| C/C=C\C=C\C=C/C |c:1,5,ctu:3|
Which is best depends on the application – ignoring the CXSMILES you either get no configuration or the wrong configuration. With CXSMILES these should all canonicalise to the same thing.