I'was having related problems when manually building an OBMol from external data like Matthew, so I've tested calculating descriptors, and I found I get a bunch of Nan's, too.

My data contains coordinates, elements and bond orders, so I add to the molecule both OBAtom's and OBBond's (in between BeginModify() and EndModify()).

Adding hydrogens after that was totally messed up, so I looked into it and I noticed a difference in the values obtained with GetImplicitValence()/GetValence() when building the molecule VS reading it with Pybel.

Even adding this didn't solve the problem:

 obmol.SetImplicitValencePerceived = False
 obmol.SetHybridizationPerceived = False
 obmol.UnsetImplicitValencePerceived()
 obmol.UnsetHydrogensAdded()
 obmol.PerceiveBondOrders()

Thanks,

S



On 08/14/2017 12:27 PM, Matthew Kennedy wrote:
I tested both these cases.

1) If I call mol.ConnectTheDots() then cast the OBMol to a pybel.Molecule, calcdesc() still returns nan for SMILES/INCHI/SMARTS, but the OBMol.numBonds gets set to the appropriate number. 2) If I call mol.PerceiveBondOrder() then cast the OBMol to a pybel.Molecule, calcdesc() still returns nan for SMILES/INCHI/SMARTS, but the OBMol.numBonds doesn't get changed, still reads 0. 3) If I call pybelMol.write("inchi") it returns the correct (or at least the same one as Babel command line) inchi string if I have previously called ConnectTheDots().

Thanks for the help!


On Mon, Aug 14, 2017 at 3:07 PM, Geoffrey Hutchison <geoff.hutchi...@gmail.com <mailto:geoff.hutchi...@gmail.com>> wrote:

    > I am attempting to begin using pybel/openbabel to calculate inchi strings 
on the fly without having to write temporary files and use command line open babel.

    Try this as a workaround:

    inchi = pybelmol.write(‘inchi’)
    smiles = pybelmol.write(‘can’)

    I’m wondering if there’s something subtly wrong with the install - these 
should be
    able to write the InChI and canonical SMILES.

    -Geoff




--
Matthew Kennedy, Ph. D.
matthew.kenned...@gmail.com <mailto:matthew.kenned...@gmail.com>
404-376-0969
------------------------------------------------------------------------------------------
NOTE: This message was trained as non-spam. If this is wrong, please correct the training as soon as possible.
Spam <https://trap.scripps.edu/canit/b.php?i=01TVpNSyH&m=7e471a935c4a&c=s>
Not spam <https://trap.scripps.edu/canit/b.php?i=01TVpNSyH&m=7e471a935c4a&c=n>
Forget previous vote 
<https://trap.scripps.edu/canit/b.php?i=01TVpNSyH&m=7e471a935c4a&c=f>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot



_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


--

 Stefano Forli, PhD

 Assistant Professor
 Dept. of Integrative Structural
 and Computational Biology, MB-112A
 The Scripps Research Institute
 10550  North Torrey Pines Road
 La Jolla,  CA 92037-1000,  USA.

    tel: +1 (858)784-2055
    fax: +1 (858)784-2860
    email: fo...@scripps.edu
    http://www.scripps.edu/~forli/


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to