InChI Question

InChI Question

Hello OpenBabel list,

a quick question regarding InChI support: on the corresponding wiki page it reads, "Experimental InChI read support was added in version 2.1, although this does not always support stereochemistry." Has this been improved meanwhile?

In a little experiment with wikidata's InChI string for D-alanine (1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m1/s1), I could not seem to successfully reproduce the stereochemistry.

a quick question regarding InChI support: on the corresponding wiki page it reads, "Experimental InChI read support was added in version 2.1, although this does not always support stereochemistry." Has this been improved meanwhile?

In a little experiment with wikidata's InChI string for D-alanine (1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m1/s1), I could not seem to successfully reproduce the stereochemistry.

The problem is that you have generated a 0D mol file:
e.g. obabel -iinchi
-:"InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m1/s1" -omol
...where the tetrahedral stereo is stored on the atom rather than on the bonds.

In other words, gen2D didn't work for you (all the atoms have 0
coordinates I'm guessing). I'm not familiar with DoTransformations,
but it should work fine via OBOp.FindType("gen2D") or so.

Re: InChI Question

Hi Noel,

thanks again for the quick reply and my apologies for my newb-ish mistakes in this field (on an unrelated note: inspecting the code, I realized that if anything I should have checked IsWedge() and IsHash() separately). So, IsChiral() is indeed true for the one relevant atom.

My goal in this, however, would have been to arrive at an OBMol with hash and/or wedge bonds. It seems there is some way to accomplish that using what is around in stereo/perception.cpp, but documentation seems to be rather scarce. I'm guessing I'll have to eventually mimic what OBDepict::DrawMolecule() does (or TetStereoToWedgeHash() called therein).

I'll keep exploring, but thanks again for clearing up that stereo-chemistry _is_ indeed processed.

Best,

Hendrik

On Friday, June 09, 2017 13:12:31 Noel O'Boyle wrote:

> The first question to check is whether we are reading the stereo correctly:

Re: InChI Question

Ok, to sum up, OBDepictPrivate::SetWedgeAndHash(OBMol*) is the function I want to use, which essentially amounts to copying it into my application. This function seems to be "dead code" (in the sense that it is not referenced anywhere) -- but still very useful for my scenario to have. Why not make it a public function somewhere in stereo/stereo.h?

Best,

Hendrik

On Saturday, June 10, 2017 21:14:08 Hendrik Vennekate wrote:

> Hi Noel,

>

> thanks again for the quick reply and my apologies for my newb-ish mistakes

> in this field (on an unrelated note: inspecting the code, I realized that

> if anything I should have checked IsWedge() and IsHash() separately). So,

> IsChiral() is indeed true for the one relevant atom.

>

> My goal in this, however, would have been to arrive at an OBMol with hash

> and/or wedge bonds. It seems there is some way to accomplish that using

> what is around in stereo/perception.cpp, but documentation seems to be

Re: InChI Question

Administrator

I haven't looked at the specifics, but sounds like a good idea.

I plan to rewrite some of the stereo API in the near future, and will
keep your suggestion in mind. Ideally, it would be nice to have the
possibility of retaining the exact input stereo without reperception
or reassigning bond wedges or hashes. This would make reading SMILES
strings (for example) much faster.