On 01/06/2012 13:37, Noel O'Boyle wrote:
> I think there's a bug in IsOption caused by mishandling of options
> with parameters:
>
>>>> import pybel
>>>> ob = pybel.ob
>>>> mol = pybel.readstring("smi", "CC(=O)Cl").OBMol
>>>> conv = ob.OBConversion()
>>>> conv.SetOutFormat("inchi")
> True
>>>> print conv.WriteString(mol)
> InChI=1S/C2H3ClO/c1-2(3)4/h1H3
>
>>>> conv.SetOptions("X'FixedH'", conv.OUTOPTIONS)
>>>> print conv.WriteString(mol)
> InChI=1/C2H3ClO/c1-2(3)4/h1H3
> Molecules and #0 are different
>
> The "Molecules and #0 are different" should not be there. This is
> triggered by the "e" output option, which it thinks has been
> specified. When I run the C++ equivalent through the debugger, I see
> that it thinks that IsOption("e") is not NULL. I don't quite know how
> the OpMap works though so maybe Chris, could you take a look?
OBConversion::SetOptions() is an obsolete function which handles
multiple concatenated single character options without parameters.
(That's all there was when it was written.)
What you want is OBConversion::AddOption(const char* opt, Option_type
opttyp, const char* txt) where opt is a single or multicharacter option
name and the optional txt are its space separated parameters.
With obabel the extra InChI options would look like
obabel "-:CC(=O)Cl" -oinchi -xX "FixedH RecMet"
There should not be extra single quotes inside the parameter "FixedH
RecMet". -xF is an easier way to ask for a fixed hydrogen layer (and
actually did the work in your example).
The SetOptions function is confusing but cannot be removed in this
release. I'll see about making it just giving an error message.
Chris
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel