Unique SMILES generation changes after calling getChirality

User 6ef33138f9

13-03-2007 20:21:22

We've found a very strange problem with unique SMILES generation. This is somewhat related to a previous post:


http://chemaxon.com/forum/ftopic2434.html





What we discovered is that unique SMILES generated for some compounds can be different if Molecule.getChirality() is called anywhere on a chiral atom -- even in a completely different molecule!





Here's some sample code. I tested this with the latest 4.1.6 version released today. In this example, we have a SMILES that should be unique.


Importing it into a molecule and re-exporting as unique SMILES produces the same SMILES, as expected -- unless you happen to call Molecule.getChirality first.





Code:



      // Getting the chirality for a chiral atom seems to affect the


      // behavior of the unique SMILES generation


      Molecule dummyMolecule = MolImporter.importMol("[C@H](N)(S)(O)");


      dummyMolecule.getChirality(0);      // Removing this line (or changing "0" to "1") makes the code below work!





      // This is the original SMILES that should be unique


      String originalSmiles = "[CH3:2][CH2:3][C:4](=[O:5])[NH:6][CH2:7][CH:8]1[CH2:9][CH2:10][N:11]([CH2:12]1)[C:33]2=[C:13]([C:29]3=[C:30]([C:34](=[O:35])[C:26](=[CH:27][N:28]3[CH2:19][CH:20]4[CH2:21][CH2:22]4)[C:24]([OH:23])=[O:25])[C:31]([NH2:18])=[C:32]2[F:1])[C:14]([F:15])([F:16])[F:17]";


      Molecule mol = MolImporter.importMol(originalSmiles);


      


      // Make it unique (again).  We expect this to be the same as the original SMILES


      // above, but the call to getChirality(0) above changes the behavior.


      String uniqueSmiles = mol.toFormat("smiles:u-a");


      assertEquals(originalSmiles, uniqueSmiles);  // Fails unless the getChirality line above is removed








There are a few obvious questions:





- How could calling Molecule.getChirality on an unrelated molecule affect the unique SMILES generation? There must be some kind of global state that is initialized or changed when calling getChirality on a chiral atom.





- Are there any other methods besides getChirality that could have similar effects?





- Can you provide a workaround or fix for this problem? Consistent generation of unique SMILES is absolutely critical for our product. (And we can't avoid calling getChirality.)





Thanks,


Chris

ChemAxon 25dcd765a3

19-03-2007 10:49:06

Thank you for the report, we are still examining the problem.

User f359e526a1

22-03-2007 07:45:23

Seems managed to fix it, will ask Tamas to create a 4.1.7 pre-release of Marvin.

User f359e526a1

26-03-2007 07:28:23

Hello, you can find the new Marvin and JChem at





http://www.chemaxon.com/test/marvin/index.html


http://www.chemaxon.com/download.php?d=/data/download/jchem/test





hoping it is all right, please give a try.





Szilva