The CLI doesn't use ReadString/WriteString. If you want the CLI behaviour,
that's the Convert() method of OBConversion. These extra options will
probably work with that.

On Wed, 17 Apr 2019 at 09:30, Tim Dudgeon <tdudgeon...@gmail.com> wrote:

> Yes, but I don't see how that helps work out how to call it from Python.
> I was trying something like this:
>
> obConversion.AddOption("p", obConversion.GENOPTIONS, "3.0")
>
> That seems vaguely consistent with how to set the option from Python given
> how the CLI option works, but unfortunately it doesn't seem to work.
>
> Tim
> On 15/04/2019 13:03, Noel O'Boyle wrote:
>
> Hi Tim,
>
> Many of these options are just wrappers around API functions, so it's
> worthwhile taking a look at the API documentation. In this case, here's the
> link to the relevant docs:
>
> http://openbabel.org/api/2.3/classOpenBabel_1_1OBPhModel.shtml
>
> Regards,
> - Noel
>
> On Thu, 11 Apr 2019 at 16:11, Tim Dudgeon <tdudgeon...@gmail.com> wrote:
>
>> Another Python options question.
>> I can use the protonation option on the CLI:
>>
>> > echo "C1=C(NC=N1)C[C@@H](C(=O)O)N" | obabel -i smi -o mol -p 3
>> But I can't figure it out with the Python API:
>>
>> > import openbabel
>> >
>> > obConversion = openbabel.OBConversion()
>> > obConversion.SetInAndOutFormats("smi", "mol")
>> > mol = openbabel.OBMol()
>> > obConversion.AddOption("p", obConversion.GENOPTIONS, "3.0")
>> > obConversion.ReadString(mol, "C1=C(NC=N1)C[C@@H](C(=O)O)N")
>> > output = obConversion.WriteString(mol)
>> > print output
>> Output is generated but it's not protonated. Same if using OUTOPTIONS
>> instead of GENOPTIONS.
>>
>> Is the use of the options in Python documented anywhere?
>>
>>
>>
>>
>>
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to