#245 Error in SmilesGenerator

Needs_Review
closed
nobody
cdk-1.2.x (46)
5
2012-10-28
2010-08-05
No

The SmilesGenerator creates a wrong SMILES string for this molecule BrC1C(Br)C(Br)C(Br)C(Br)C1Br
The SMILES created is C1C(C(C(C(C1Br)Br)Br)Br)BrBr but the correct SMILES string is C1(C(C(C(C(C1Br)Br)Br)Br)Br)Br.
The SMILES generator is missing a parenthesis around the first branching and creates a molecue with the two bromines connected to each other.

I traced through the code and found what I think is the problem. In the ParseChain method, around line 1535 the code checks to see if the parent has a ring break with the atoms of the branch and if the connected bond count for the parent is less than 4. I think that this logic will not work if the parent atom is the very first atom. The code should check to see if the parent atom is the very first atom and if it is then the connected bonds count should be checked for less than 3 instead of 4.

Hope this makes sense.
-Raj

Discussion

  • Saravanaraj N Ayyampalayam

    I have a patch for this issue that fixes it. I will mail it to the cdkpatches_at_gmail com address.

     
  • Egon Willighagen

    Dear Raj, this is the patch attached to this report, correct? Thanx!

     
  • Egon Willighagen

    I suggest to aim this fix at CDK 1.2.x...

     
  • Saravanaraj N Ayyampalayam

    Yes, the patch is the file attached to this report.

     
  • Egon Willighagen

    The patch looks sane to me, but in order for this fix to go into CDK 1.2.x we need a unit test. I'll attach one, but it does not fail without the fix. Put differently, I do not know how to reproduce the problem.

    Raj, please check my patch with the unit test and tell me what I am doing wrong in this test, and/or write a unit test that fails without your bug fix.

     
  • Rajarshi Guha

    Rajarshi Guha - 2010-08-29

    I applied the unti test ot cdk-1.2.x but skipped the fix. But the test passes, so I can't reproduce the problem.

    Also, when the unit test patch is updated, please ensure that the unit test goes into org.openscience.cdk.smiles.SmilesGeneratorTest

     
  • Saravanaraj N Ayyampalayam

    I attached a patch with a unit test to reproduce the bug.

     
  • Egon Willighagen

    Raj, thanx! I could confirm the bug, and the effect of your patch. It's been applied to cdk-1.2.x now.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks