Using Chemistry::OpenBabel::OBDescriptor::FindType in Perl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Chemistry::OpenBabel::OBDescriptor::FindType in Perl

David Rose-9
Hi:

 I'm trying to obtain some descriptors (e.g. TPSA, logP) using the Chemistry::OpenBabel perl bindings.  I can get TPSA and logP values from the command line using obprop, but when I try to do so programmatically, I find that no matter what I ask for, FindType() returns undef.  For example:

use strict;
use Chemistry::OpenBabel;
my $oblogp = Chemistry::OpenBabel::OBDescriptor::FindType("logP");

If I run this, there are no errors reported but $oblogp always has the value undef.  This is true for every descriptor type I've tried ('TPSA','atoms','bonds','L5', etc.).  Sort-of-similar methods on OBMol (e.g. NumAtoms) work fine, so it is not the case that Chemistry::OpenBabel is not working at all. 

I would be grateful for any ideas why this might be the case.

Thanks,
David Rose

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
OpenBabel-scripting mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
Reply | Threaded
Open this post in threaded view
|

Re: Using Chemistry::OpenBabel::OBDescriptor::FindType in Perl

Fredrik Wallner
Hi,

Due to how the plugins work in OpenBabel, they are sometimes not loaded until an OBConversion object has been instantiated, so my suggestion would be to add ”my $obconv = new Chemistry::OpenBabel::OBConversion;” as line 3 in your script.

Kind regards,
Fredrik

> 12 juli 2016 kl. 20:52 skrev David Rose <[hidden email]>:
>
> Hi:
>
>  I'm trying to obtain some descriptors (e.g. TPSA, logP) using the Chemistry::OpenBabel perl bindings.  I can get TPSA and logP values from the command line using obprop, but when I try to do so programmatically, I find that no matter what I ask for, FindType() returns undef.  For example:
>
> use strict;
> use Chemistry::OpenBabel;
> my $oblogp = Chemistry::OpenBabel::OBDescriptor::FindType("logP");
>
> If I run this, there are no errors reported but $oblogp always has the value undef.  This is true for every descriptor type I've tried ('TPSA','atoms','bonds','L5', etc.).  Sort-of-similar methods on OBMol (e.g. NumAtoms) work fine, so it is not the case that Chemistry::OpenBabel is not working at all.
>
> I would be grateful for any ideas why this might be the case.
>
> Thanks,
> David Rose
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity planning
> reports.http://sdm.link/zohodev2dev_______________________________________________
> OpenBabel-scripting mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
OpenBabel-scripting mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
Reply | Threaded
Open this post in threaded view
|

Re: Using Chemistry::OpenBabel::OBDescriptor::FindType in Perl

Noel O'Boyle
Administrator
In reply to this post by David Rose-9
No problem, but best to cc the list to avoid Fredrik answering too :-)
By the way, openbabel-scripting is now obsolete and you should use
openbabel-discuss in future.

On 13 July 2016 at 15:25, David Rose <[hidden email]> wrote:

> That did it.  Thanks for you help.
>
> Dave.
>
> On Wed, Jul 13, 2016 at 7:37 AM, Noel O'Boyle <[hidden email]> wrote:
>>
>> I think you need to force the plugins to be loaded. I typically do
>> this by instantiating an OBConversion object first.
>>
>> On 12 July 2016 at 19:52, David Rose <[hidden email]> wrote:
>> > Hi:
>> >
>> >  I'm trying to obtain some descriptors (e.g. TPSA, logP) using the
>> > Chemistry::OpenBabel perl bindings.  I can get TPSA and logP values from
>> > the
>> > command line using obprop, but when I try to do so programmatically, I
>> > find
>> > that no matter what I ask for, FindType() returns undef.  For example:
>> >
>> > use strict;
>> > use Chemistry::OpenBabel;
>> > my $oblogp = Chemistry::OpenBabel::OBDescriptor::FindType("logP");
>> >
>> > If I run this, there are no errors reported but $oblogp always has the
>> > value
>> > undef.  This is true for every descriptor type I've tried
>> > ('TPSA','atoms','bonds','L5', etc.).  Sort-of-similar methods on OBMol
>> > (e.g.
>> > NumAtoms) work fine, so it is not the case that Chemistry::OpenBabel is
>> > not
>> > working at all.
>> >
>> > I would be grateful for any ideas why this might be the case.
>> >
>> > Thanks,
>> > David Rose
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > What NetFlow Analyzer can do for you? Monitors network bandwidth and
>> > traffic
>> > patterns at an interface-level. Reveals which users, apps, and protocols
>> > are
>> > consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>> > J-Flow, sFlow and other flows. Make informed decisions using capacity
>> > planning
>> > reports.http://sdm.link/zohodev2dev
>> > _______________________________________________
>> > OpenBabel-scripting mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>> >
>
>

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
OpenBabel-scripting mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
Reply | Threaded
Open this post in threaded view
|

Re: Using Chemistry::OpenBabel::OBDescriptor::FindType in Perl

David Rose-9
In reply to this post by Fredrik Wallner
Hi Fredrik:

  I tried that, and it solved my problem.   Thanks for your help!

Dave  

Sent from my iPhone

> On Jul 14, 2016, at 3:42 AM, Fredrik Wallner <[hidden email]> wrote:
>
> Hi,
>
> Due to how the plugins work in OpenBabel, they are sometimes not loaded until an OBConversion object has been instantiated, so my suggestion would be to add ”my $obconv = new Chemistry::OpenBabel::OBConversion;” as line 3 in your script.
>
> Kind regards,
> Fredrik
>
>> 12 juli 2016 kl. 20:52 skrev David Rose <[hidden email]>:
>>
>> Hi:
>>
>> I'm trying to obtain some descriptors (e.g. TPSA, logP) using the Chemistry::OpenBabel perl bindings.  I can get TPSA and logP values from the command line using obprop, but when I try to do so programmatically, I find that no matter what I ask for, FindType() returns undef.  For example:
>>
>> use strict;
>> use Chemistry::OpenBabel;
>> my $oblogp = Chemistry::OpenBabel::OBDescriptor::FindType("logP");
>>
>> If I run this, there are no errors reported but $oblogp always has the value undef.  This is true for every descriptor type I've tried ('TPSA','atoms','bonds','L5', etc.).  Sort-of-similar methods on OBMol (e.g. NumAtoms) work fine, so it is not the case that Chemistry::OpenBabel is not working at all.
>>
>> I would be grateful for any ideas why this might be the case.
>>
>> Thanks,
>> David Rose
>> ------------------------------------------------------------------------------
>> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
>> patterns at an interface-level. Reveals which users, apps, and protocols are
>> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>> J-Flow, sFlow and other flows. Make informed decisions using capacity planning
>> reports.http://sdm.link/zohodev2dev_______________________________________________
>> OpenBabel-scripting mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
OpenBabel-scripting mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting