This is for marking the molecule as 2D (i.e. having 2D coordinates associated with it). After reading a SMILES it should be marked as 0D.
- Noel On 18 June 2013 19:48, Craig James <cja...@emolecules.com> wrote: > (forgot to cc list the first time...) > > > On Tue, Jun 18, 2013 at 10:34 AM, Noel O'Boyle <baoille...@gmail.com> wrote: >> >> I understand where the expected output is coming from, but where's the >> 'wrong' output coming from? > > > Sorry for not making that clear ... the "expected" output is from obabel, > and the "wrong" output is from my C++ program. > >> >> >> You have pmol_conv_ich->SetInAndOutFormats("inchi", "inchi"); >> >> This does mean you are reading one of those InChIs and roundtripping >> it? Or are you reading the SMILES somewhere else and using this >> OBConversion object? > > > The latter ... there's a separate OBConversion object with in/out formats of > "smi". > > OK, I think I found the problem. In my code that parses the SMILES I found > this: > > pmol->SetDimension(2); // workaround for OpenBabel bug: discards > // chirality if this isn't set. > > This must have been put in there a long time ago, and I have no idea if it's > still relevant or not. If I take it out, the InChI strings are created > properly. > > However, I can't find any meaningful documentation about what SetDimension() > is supposed to do or how it's used. I suspect I had to add SetDimension() > because of this code in canon.cpp: > > // Determine stereochemistry from coordinates if needed > if (!mol->HasChiralityPerceived()) { > switch (mol->GetDimension()) { > case 2: > mol->DeleteData(OBGenericDataType::StereoData); > TetrahedralFrom2D(mol, stereoUnits); > CisTransFrom2D(mol, stereoUnits); > break; > case 3: > mol->DeleteData(OBGenericDataType::StereoData); > TetrahedralFrom3D(mol, stereoUnits); > CisTransFrom3D(mol, stereoUnits); > break; > default: > TetrahedralFrom0D(mol, stereoUnits); > CisTransFrom0D(mol, stereoUnits); > break; > } > } > > ... but who knows? I'll have to dig into it a bit more... > > Thanks, > Craig > > > >> >> - Noel >> >> On 18 June 2013 16:45, Craig James <cja...@emolecules.com> wrote: >> > I'm getting different InChI strings from obabel than when I invoke the >> > InChI >> > format directly from C++ code. It looks like it has to do with options >> > ... >> > but my code isn't setting any I/O options for the InChI writer. Here's >> > the >> > output from my test program: >> > >> > ERROR: incorrect InChI: >> > expected: >> > >> > 'InChI=1S/C15H17NO5/c1-10(14(18)20-2)16-13(17)9-6-11-4-7-12(8-5-11)15(19)21-3/h4-10H,1-3H3,(H,16,17)/b9-6+/t10-/m0/s1' >> > got: >> > >> > 'InChI=1S/C15H17NO5/c1-10(14(18)20-2)16-13(17)9-6-11-4-7-12(8-5-11)15(19)21-3/h4-10H,1-3H3,(H,16,17)' >> > SMILES is: 'COC(=O)[C@@H](NC(=O)/C=C/c1ccc(cc1)C(=O)OC)C >> > >> > The "expected" string is from "obabel -i smi -o inchi". Note that it >> > seems >> > to be stereo information that differs between the two. >> > >> > The C++ code I'm using is pretty simple: >> > >> > OBConversion *pmol_conv_ich = NULL; >> > pmol_conv_ich = new OBConversion(); >> > pmol_conv_ich->SetInAndOutFormats("inchi", "inchi"); >> > ... >> > string inchi = pmol_conv_ich->WriteString(pmol, true); >> > >> > I don't set any options on pmol_conf_ich. The SMILES shown above is >> > from >> > the same pmol OBMol object. >> > >> > Why is this output different from obabel's output? >> > >> > Thanks, >> > Craig >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > This SF.net email is sponsored by Windows: >> > >> > Build for Windows Store. >> > >> > http://p.sf.net/sfu/windows-dev2dev >> > _______________________________________________ >> > OpenBabel-Devel mailing list >> > OpenBabel-Devel@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/openbabel-devel >> > > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > OpenBabel-Devel mailing list > OpenBabel-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-devel > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel