epam / Indigo

Universal cheminformatics toolkit, utilities and database search tools
http://lifescience.opensource.epam.com
Apache License 2.0
291 stars 100 forks source link

`IndigoException: molecule: invalid connectivity given: -1` when ionizing ChEMBL SMILES #1173

Open eloyfelix opened 1 year ago

eloyfelix commented 1 year ago

I was willing to play a bit with pKa models in Indigo when I found this issue.

Steps to Reproduce

from indigo import Indigo

indigo = Indigo()

indigo.setOption("pKa-model", "advanced")
indigo.setOption("pKa-model-level", 5)
indigo.setOption("pKa-model-min-level", 2)
pH = 7.4
pH_toll = 0.5

# RDKit generated SMILES (aspirin from ChEMBL database)
smiles = "CC(=O)Oc1ccccc1C(=O)O"

mol = indigo.loadMolecule(smiles)
mol.ionize(pH, pH_toll)
IndigoException: molecule: invalid connectivity given: -1

Same happens for other SMILES like paracetamol CC(=O)Nc1ccc(O)cc1. I imagined there is some generalized issue.

Expected behavior Molecule to be ionized.

Actual behavior Indigo throwing a connectivity error.

Indigo version
Indigo built from: https://github.com/epam/Indigo/commit/2d696a21414e2c9cdb5952bcba21e0f7139a975f

Additional context It would be also nice to have some extended documentation about the pKa models in Indigo. There is a lack of open source pKa calculators and having the ones in Indigo better documented I think it could bring some users. I would be happy to compare the results with current ChEMBL pKa calcualted values.

AliaksandrDziarkach commented 7 months ago

Error occured only after

indigo.setOption("pKa-model", "advanced")

Whithout this options - no error occured

AliaksandrDziarkach commented 7 months ago

Current realization cannot ionize molecule in advanced mode if it contains any aromatic atom. Please use dearomatize before ionize.

AlexeyGirin commented 2 months ago

Moved to Refined Backlog since no fix over 5 versions