How should I use "cansmi" and "cansmiNS" descriptors?

I tried in pybel:

In [44]: import pybel
In [45]: mol = pybel.readstring("smi", "c1ccccc1O")
In [46]: mol.calcdesc(["cansmi", "cansmiNS"])
Out[46]: {'cansmi': nan, 'cansmiNS': nan}

In [47]: 


I tried stepping through the pybel implementation manually

In [35]: import openbabel as ob
In [36]: mol = ob.OBMol()
In [37]: obconv = ob.OBConversion()
In [38]: obconv.SetInFormat("smi")
Out[38]: True

 ([39] was an oopsie)

In [40]: obconv.ReadString(mol, "c1ccccc1O")
Out[40]: True

In [41]: ob.OBDescriptor.FindType("cansmi").Predict(mol)
Out[41]: nan


The descriptor framework does work:

In [42]: ob.OBDescriptor.FindType("MR").Predict(mol)
Out[42]: 28.465


Since the function returns a string instead of a float,
it appears that I should call GetStringValue(). But how?


In [70]: ob.OBDescriptor.FindType("cansmi").GetStringValue(mol.OBMol)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

/Users/dalke/cvses/propbox/<ipython console> in <module>()

NotImplementedError: Wrong number of arguments for overloaded function 
'OBDescriptor_GetStringValue'.
 Possible C/C++ prototypes are:
   GetStringValue(OpenBabel::OBDescriptor *,OpenBabel::OBBase *,std::string 
&,std::string *)
   GetStringValue(OpenBabel::OBDescriptor *,OpenBabel::OBBase *,std::string &)


I can't figure out what I should use to pass in a std::string& from Python.

So my questions are:
 - how do I figure out which return type is expected, so I know
     which descriptor method to call, and
 - how do I get string value from the descriptor API?

Best regards,

                                Andrew
                                da...@dalkescientific.com



------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to