|
From: Jens T. <j.m...@dl...> - 2007-05-10 15:49:08
|
Hi, I'm trying to enable our ccp1gui code (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we no longer have to support so many formats. I've got most of the machinery in place, but am a bit stuck on how to dynamically determine what input formats are supported by openbabel. I originally tried to use OBConversion.GetNextFormat, but ran into the ground fairly quickly. I then discovered the post at: http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting which suggest that I should be able to get what I want using GetSupportedInputFormat(), however, I'm currently pretty clueless as to how I extract the information from the object. I get something back as shown below, but I'd appreciated any advice on what I then need to do with it. Many thanks, Jens wlandhcp243:~ jmht$ python Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import openbabel >>> obc = openbabel.OBConversion() >>> f = obc.GetSupportedInputFormat() >>> print f <Swig Object of type 'std::vector<std::string,std::allocator<std::string > > *' at 0x61c2c0> |
|
From: Noel O'B. <bao...@gm...> - 2007-05-11 15:58:41
|
Hello again Jens, Good to hear from you on this list... :-) On 10/05/07, Jens Thomas <j.m...@dl...> wrote: > Hi, > > I'm trying to enable our ccp1gui code > (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we > no longer have to support so many formats. > > I've got most of the machinery in place, but am a bit stuck on how to > dynamically determine what input formats are supported by openbabel. > > I originally tried to use OBConversion.GetNextFormat, but ran into the > ground fairly quickly. I then discovered the post at: > > http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting > > which suggest that I should be able to get what I want using > GetSupportedInputFormat(), however, I'm currently pretty clueless as to > how I extract the information from the object. I get something back as > shown below, but I'd appreciated any advice on what I then need to do > with it. > > Many thanks, > > Jens > > > wlandhcp243:~ jmht$ python > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import openbabel > >>> obc = openbabel.OBConversion() > >>> f = obc.GetSupportedInputFormat() > >>> print f > <Swig Object of type 'std::vector<std::string,std::allocator<std::string > > > *' at 0x61c2c0> I'm in an internet cafe at the moment, and so don't have access to a complete compiler tool chain. However, it is possible that 'f' behaves like an array. That is, a std::vector in C++ is pretty much the same as a list in Python. Try "dir(f)". There's probably a Size() method. Try f[0], f[1], etc. If it doesn't work I'll sort it out next week, and wrap it nicely in pybel, so that users won't see all this Swig Object stuff. Let me know how this goes, Noel (O'Boyle) > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
|
From: Noel O'B. <bao...@gm...> - 2007-05-12 11:15:57
|
Actually, a vector of std::strings had not yet been swigified, so I
needed to added to a line to openbabel-python.i to set it up (not yet
checked in). However, there's an additional problem, which Jerome may
like to address.
The data that's returned is similar to:
('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
whereas it would make more sense to me either to return:
('acr', 'alc', ...)
or
a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
'Alchemy format']
Note that the text [Read-only] is not really necessary in a list of
supported input formats.
Since this function was added for the benefit of scripting interfaces,
it makes sense to make it as easy as possible to access the list of
formats.
Noel
On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> Hello again Jens,
>
> Good to hear from you on this list... :-)
>
> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> > Hi,
> >
> > I'm trying to enable our ccp1gui code
> > (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> > no longer have to support so many formats.
> >
> > I've got most of the machinery in place, but am a bit stuck on how to
> > dynamically determine what input formats are supported by openbabel.
> >
> > I originally tried to use OBConversion.GetNextFormat, but ran into the
> > ground fairly quickly. I then discovered the post at:
> >
> > http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
> >
> > which suggest that I should be able to get what I want using
> > GetSupportedInputFormat(), however, I'm currently pretty clueless as to
> > how I extract the information from the object. I get something back as
> > shown below, but I'd appreciated any advice on what I then need to do
> > with it.
> >
> > Many thanks,
> >
> > Jens
> >
> >
> > wlandhcp243:~ jmht$ python
> > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import openbabel
> > >>> obc = openbabel.OBConversion()
> > >>> f = obc.GetSupportedInputFormat()
> > >>> print f
> > <Swig Object of type 'std::vector<std::string,std::allocator<std::string
> > > > *' at 0x61c2c0>
>
> I'm in an internet cafe at the moment, and so don't have access to a
> complete compiler tool chain. However, it is possible that 'f' behaves
> like an array. That is, a std::vector in C++ is pretty much the same
> as a list in Python. Try "dir(f)". There's probably a Size() method.
> Try f[0], f[1], etc. If it doesn't work I'll sort it out next week,
> and wrap it nicely in pybel, so that users won't see all this Swig
> Object stuff.
>
> Let me know how this goes,
> Noel (O'Boyle)
>
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > OpenBabel-scripting mailing list
> > Ope...@li...
> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
> >
>
|
|
From: Noel O'B. <bao...@gm...> - 2007-05-12 11:48:35
|
After looking at the C++ code, I realise that maybe returning a list
of strings is the only choice for SupportedInputFormat. Anyway, in the
meanwhile I've added some code to pybel, so that if you access
pybel.informats or outformats, you will get a dictionary of supported
formats.
On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
> Actually, a vector of std::strings had not yet been swigified, so I
> needed to added to a line to openbabel-python.i to set it up (not yet
> checked in). However, there's an additional problem, which Jerome may
> like to address.
>
> The data that's returned is similar to:
> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>
> whereas it would make more sense to me either to return:
> ('acr', 'alc', ...)
> or
> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
> 'Alchemy format']
>
> Note that the text [Read-only] is not really necessary in a list of
> supported input formats.
>
> Since this function was added for the benefit of scripting interfaces,
> it makes sense to make it as easy as possible to access the list of
> formats.
>
> Noel
>
> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> > Hello again Jens,
> >
> > Good to hear from you on this list... :-)
> >
> > On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> > > Hi,
> > >
> > > I'm trying to enable our ccp1gui code
> > > (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> > > no longer have to support so many formats.
> > >
> > > I've got most of the machinery in place, but am a bit stuck on how to
> > > dynamically determine what input formats are supported by openbabel.
> > >
> > > I originally tried to use OBConversion.GetNextFormat, but ran into the
> > > ground fairly quickly. I then discovered the post at:
> > >
> > > http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
> > >
> > > which suggest that I should be able to get what I want using
> > > GetSupportedInputFormat(), however, I'm currently pretty clueless as to
> > > how I extract the information from the object. I get something back as
> > > shown below, but I'd appreciated any advice on what I then need to do
> > > with it.
> > >
> > > Many thanks,
> > >
> > > Jens
> > >
> > >
> > > wlandhcp243:~ jmht$ python
> > > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> > > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>> import openbabel
> > > >>> obc = openbabel.OBConversion()
> > > >>> f = obc.GetSupportedInputFormat()
> > > >>> print f
> > > <Swig Object of type 'std::vector<std::string,std::allocator<std::string
> > > > > *' at 0x61c2c0>
> >
> > I'm in an internet cafe at the moment, and so don't have access to a
> > complete compiler tool chain. However, it is possible that 'f' behaves
> > like an array. That is, a std::vector in C++ is pretty much the same
> > as a list in Python. Try "dir(f)". There's probably a Size() method.
> > Try f[0], f[1], etc. If it doesn't work I'll sort it out next week,
> > and wrap it nicely in pybel, so that users won't see all this Swig
> > Object stuff.
> >
> > Let me know how this goes,
> > Noel (O'Boyle)
> >
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > OpenBabel-scripting mailing list
> > > Ope...@li...
> > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
> > >
> >
>
|
|
From: Chris M. <c.m...@ds...> - 2007-05-12 18:04:29
|
In the revamped code for formats (and other plugins) recently committed
to SVN HEAD (for the next OB version) I tried to maintain backward
compatibility as far as possible. So OBConversion::SupportedInputFormat()
works as before but, you'll be pleased to hear, without the '[Read-only]'.
But in an effort to provide more choice on the form of the output, there
are three functions which provide a list of formats(or other plugin
classes): OBPlugin::ListAsVector, ListAsString and List. The first two
were intended to be compatible with scripting, although I need some
advice here. ListAsString returns a (big) std::string, but ListAsVector
has a parameter which is a reference to a std::vector. If this is
incompatible with scripting languages I should change it.
All three have a parameter which can control what is in the output. For
example if it contains "verbose" it output the whole description, not
just the first line. So it would be easy to add code (4 extra lines) to
output only the IDs if that would be useful:
ListAsVector("formats","in/ids", stringvector)
Post-processing in pybel I'm sure is useful, but if the C++ code was
adequate it could serve other scripting languages as well.
Chris
Noel O'Boyle wrote:
> After looking at the C++ code, I realise that maybe returning a list
> of strings is the only choice for SupportedInputFormat. Anyway, in the
> meanwhile I've added some code to pybel, so that if you access
> pybel.informats or outformats, you will get a dictionary of supported
> formats.
>
> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> Actually, a vector of std::strings had not yet been swigified, so I
>> needed to added to a line to openbabel-python.i to set it up (not yet
>> checked in). However, there's an additional problem, which Jerome may
>> like to address.
>>
>> The data that's returned is similar to:
>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>>
>> whereas it would make more sense to me either to return:
>> ('acr', 'alc', ...)
>> or
>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
>> 'Alchemy format']
>>
>> Note that the text [Read-only] is not really necessary in a list of
>> supported input formats.
>>
>> Since this function was added for the benefit of scripting interfaces,
>> it makes sense to make it as easy as possible to access the list of
>> formats.
>>
>> Noel
>>
>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
>>> Hello again Jens,
>>>
>>> Good to hear from you on this list... :-)
>>>
>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
>>>> Hi,
>>>>
>>>> I'm trying to enable our ccp1gui code
>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
>>>> no longer have to support so many formats.
>>>>
>>>> I've got most of the machinery in place, but am a bit stuck on how to
>>>> dynamically determine what input formats are supported by openbabel.
>>>>
>>>> I originally tried to use OBConversion.GetNextFormat, but ran into the
>>>> ground fairly quickly. I then discovered the post at:
>>>>
>>>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
>>>>
>>>> which suggest that I should be able to get what I want using
>>>> GetSupportedInputFormat(), however, I'm currently pretty clueless as to
>>>> how I extract the information from the object. I get something back as
>>>> shown below, but I'd appreciated any advice on what I then need to do
>>>> with it.
|
|
From: Jerome P. <j.p...@pa...> - 2007-05-12 17:49:38
|
Hi,
Le samedi 12 mai 2007 13:15, Noel O'Boyle a =E9crit=A0:
> Actually, a vector of std::strings had not yet been swigified, so I
> needed to added to a line to openbabel-python.i to set it up (not yet
> checked in). However, there's an additional problem, which Jerome may
> like to address.
>
> The data that's returned is similar to:
> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>
> whereas it would make more sense to me either to return:
> ('acr', 'alc', ...)
> or
> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
> 'Alchemy format']
I think this solution is better, as you get also a short description about =
the=20
format.
> Note that the text [Read-only] is not really necessary in a list of
> supported input formats.
Of course !
> Since this function was added for the benefit of scripting interfaces,
> it makes sense to make it as easy as possible to access the list of
> formats.
>
> Noel
I can send you a new patch for the function if you want, based on the last =
svn=20
version.
Jerome
> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> > Hello again Jens,
> >
> > Good to hear from you on this list... :-)
> >
> > On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> > > Hi,
> > >
> > > I'm trying to enable our ccp1gui code
> > > (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> > > no longer have to support so many formats.
> > >
> > > I've got most of the machinery in place, but am a bit stuck on how to
> > > dynamically determine what input formats are supported by openbabel.
> > >
> > > I originally tried to use OBConversion.GetNextFormat, but ran into the
> > > ground fairly quickly. I then discovered the post at:
> > >
> > > http://sourceforge.net/mailarchive/forum.php?thread_name=3D2007021911=
05.2
> > >5888.j.pansanel%40pansanel.net&forum_name=3Dopenbabel-scripting
> > >
> > > which suggest that I should be able to get what I want using
> > > GetSupportedInputFormat(), however, I'm currently pretty clueless as =
to
> > > how I extract the information from the object. I get something back as
> > > shown below, but I'd appreciated any advice on what I then need to do
> > > with it.
> > >
> > > Many thanks,
> > >
> > > Jens
> > >
> > >
> > > wlandhcp243:~ jmht$ python
> > > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> > > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> > > Type "help", "copyright", "credits" or "license" for more information.
> > >
> > > >>> import openbabel
> > > >>> obc =3D openbabel.OBConversion()
> > > >>> f =3D obc.GetSupportedInputFormat()
> > > >>> print f
> > >
> > > <Swig Object of type
> > > 'std::vector<std::string,std::allocator<std::string
> > >
> > > > > *' at 0x61c2c0>
> >
> > I'm in an internet cafe at the moment, and so don't have access to a
> > complete compiler tool chain. However, it is possible that 'f' behaves
> > like an array. That is, a std::vector in C++ is pretty much the same
> > as a list in Python. Try "dir(f)". There's probably a Size() method.
> > Try f[0], f[1], etc. If it doesn't work I'll sort it out next week,
> > and wrap it nicely in pybel, so that users won't see all this Swig
> > Object stuff.
> >
> > Let me know how this goes,
> > Noel (O'Boyle)
> >
> > > ---------------------------------------------------------------------=
=2D-
> > >-- This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > OpenBabel-scripting mailing list
> > > Ope...@li...
> > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
|
|
From: Noel O'B. <bao...@gm...> - 2007-05-13 10:25:35
|
On 12/05/07, Chris Morley <c.m...@ds...> wrote:
> In the revamped code for formats (and other plugins) recently committed
> to SVN HEAD (for the next OB version) I tried to maintain backward
> compatibility as far as possible. So OBConversion::SupportedInputFormat()
> works as before but, you'll be pleased to hear, without the '[Read-only]'.
Sounds good but SWIG doesn't like the new code. When I try to compile
openbabel_python.cpp, I get:
../../include/openbabel/fingerprint.h:48: error: 'static
std::map<const char*, OpenBabel::OBPlugin*,
OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
cannot be overloaded
../../include/openbabel/fingerprint.h:43: error: with 'static
std::map<const char*, OpenBabel::OBPlugin*,
OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
../../include/openbabel/fingerprint.h:53: error: 'static
OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
be overloaded
../../include/openbabel/fingerprint.h:43: error: with 'static
OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
../../include/openbabel/fingerprint.h: In constructor
'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
../../include/openbabel/fingerprint.h:63: error: no match for
'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
/usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
_Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
OpenBabel::OBPlugin::CharPtrLess, _Alloc =
std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
> But in an effort to provide more choice on the form of the output, there
> are three functions which provide a list of formats(or other plugin
> classes): OBPlugin::ListAsVector, ListAsString and List. The first two
> were intended to be compatible with scripting, although I need some
> advice here. ListAsString returns a (big) std::string, but ListAsVector
> has a parameter which is a reference to a std::vector. If this is
> incompatible with scripting languages I should change it.
There's no problem with vectors in general; these are simply
translated to lists by SWIG.
> All three have a parameter which can control what is in the output. For
> example if it contains "verbose" it output the whole description, not
> just the first line. So it would be easy to add code (4 extra lines) to
> output only the IDs if that would be useful:
> ListAsVector("formats","in/ids", stringvector)
>
> Post-processing in pybel I'm sure is useful, but if the C++ code was
> adequate it could serve other scripting languages as well.
I think so too. In the meanwhile, I would like to push out a Windows
Python release based on 2.1.0 with the current pybel enhancements. I'm
going to try to get this together this weekend and do some testing.
Noel
> Chris
>
> Noel O'Boyle wrote:
> > After looking at the C++ code, I realise that maybe returning a list
> > of strings is the only choice for SupportedInputFormat. Anyway, in the
> > meanwhile I've added some code to pybel, so that if you access
> > pybel.informats or outformats, you will get a dictionary of supported
> > formats.
> >
> > On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
> >> Actually, a vector of std::strings had not yet been swigified, so I
> >> needed to added to a line to openbabel-python.i to set it up (not yet
> >> checked in). However, there's an additional problem, which Jerome may
> >> like to address.
> >>
> >> The data that's returned is similar to:
> >> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
> >>
> >> whereas it would make more sense to me either to return:
> >> ('acr', 'alc', ...)
> >> or
> >> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
> >> 'Alchemy format']
> >>
> >> Note that the text [Read-only] is not really necessary in a list of
> >> supported input formats.
> >>
> >> Since this function was added for the benefit of scripting interfaces,
> >> it makes sense to make it as easy as possible to access the list of
> >> formats.
> >>
> >> Noel
> >>
> >> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> >>> Hello again Jens,
> >>>
> >>> Good to hear from you on this list... :-)
> >>>
> >>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> >>>> Hi,
> >>>>
> >>>> I'm trying to enable our ccp1gui code
> >>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> >>>> no longer have to support so many formats.
> >>>>
> >>>> I've got most of the machinery in place, but am a bit stuck on how to
> >>>> dynamically determine what input formats are supported by openbabel.
> >>>>
> >>>> I originally tried to use OBConversion.GetNextFormat, but ran into the
> >>>> ground fairly quickly. I then discovered the post at:
> >>>>
> >>>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
> >>>>
> >>>> which suggest that I should be able to get what I want using
> >>>> GetSupportedInputFormat(), however, I'm currently pretty clueless as to
> >>>> how I extract the information from the object. I get something back as
> >>>> shown below, but I'd appreciated any advice on what I then need to do
> >>>> with it.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> OpenBabel-scripting mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>
|
|
From: Jens T. <j.m...@dl...> - 2007-05-14 14:19:54
|
Hi Noel, Jerome and Chris,
Firstly, many thanks for the quick response and warm welcome to the
list! Please accept my apologies for not replying sooner, but I've been
away without access to email.
I've tried checking out the latest version of openbabel from SVN onto my
Ubuntu box (Dapper on a Pentium 4) so that I can try some of the changes
you've committed. I ran a normal configure (./configure), but the make
currently fails with:
make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest'
make[2]: Entering directory `/home/jmht/openbabel/test'
g++ -DHAVE_CONFIG_H -I. -I../src -I../include
-DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD -MP -MF
.deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp
mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip
roundtrip.o ../src/libopenbabel.la -ldl -lm
mkdir .libs
g++ -g -O2 -o .libs/roundtrip roundtrip.o ../src/.libs/libopenbabel.so
-ldl -lm -Wl,--rpath -Wl,/usr/local/lib
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBFormat::FormatFromMIME(char const*)'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBPlugin::Display(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, char const*, char const*)'
../src/.libs/libopenbabel.so: undefined reference to `vtable for
OpenBabel::OBDescriptor'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*,
std::basic_istream<char, std::char_traits<char> >&, bool)'
../src/.libs/libopenbabel.so: undefined reference to `vtable for
OpenBabel::OBPlugin'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBPlugin::ListAsVector(char const*, char const*,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >&)'
../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
OpenBabel::OBPlugin'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*,
std::basic_istream<char, std::char_traits<char> >&, bool)'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBFormat::RegisterFormat(char const*, char const*)'
../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
OpenBabel::OBDescriptor'
../src/.libs/libopenbabel.so: undefined reference to
`OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)'
collect2: ld returned 1 exit status
make[2]: *** [roundtrip] Error 1
I'm not that familiar with C++ and so am bit stuck as to how to sort
this one out.
Do you have any suggestions?
Best wishes,
Jens
Noel O'Boyle wrote:
> On 12/05/07, Chris Morley <c.m...@ds...> wrote:
>
>> In the revamped code for formats (and other plugins) recently committed
>> to SVN HEAD (for the next OB version) I tried to maintain backward
>> compatibility as far as possible. So OBConversion::SupportedInputFormat()
>> works as before but, you'll be pleased to hear, without the '[Read-only]'.
>>
> Sounds good but SWIG doesn't like the new code. When I try to compile
> openbabel_python.cpp, I get:
>
> ../../include/openbabel/fingerprint.h:48: error: 'static
> std::map<const char*, OpenBabel::OBPlugin*,
> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> cannot be overloaded
> ../../include/openbabel/fingerprint.h:43: error: with 'static
> std::map<const char*, OpenBabel::OBPlugin*,
> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> ../../include/openbabel/fingerprint.h:53: error: 'static
> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
> be overloaded
> ../../include/openbabel/fingerprint.h:43: error: with 'static
> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
> ../../include/openbabel/fingerprint.h: In constructor
> 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
> ../../include/openbabel/fingerprint.h:63: error: no match for
> 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
> /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
> std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
> _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
> OpenBabel::OBPlugin::CharPtrLess, _Alloc =
> std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
>
>
>> But in an effort to provide more choice on the form of the output, there
>> are three functions which provide a list of formats(or other plugin
>> classes): OBPlugin::ListAsVector, ListAsString and List. The first two
>> were intended to be compatible with scripting, although I need some
>> advice here. ListAsString returns a (big) std::string, but ListAsVector
>> has a parameter which is a reference to a std::vector. If this is
>> incompatible with scripting languages I should change it.
>>
> There's no problem with vectors in general; these are simply
> translated to lists by SWIG.
>
>
>> All three have a parameter which can control what is in the output. For
>> example if it contains "verbose" it output the whole description, not
>> just the first line. So it would be easy to add code (4 extra lines) to
>> output only the IDs if that would be useful:
>> ListAsVector("formats","in/ids", stringvector)
>>
>> Post-processing in pybel I'm sure is useful, but if the C++ code was
>> adequate it could serve other scripting languages as well.
>>
> I think so too. In the meanwhile, I would like to push out a Windows
> Python release based on 2.1.0 with the current pybel enhancements. I'm
> going to try to get this together this weekend and do some testing.
>
> Noel
>
>
>> Chris
>>
>> Noel O'Boyle wrote:
>>
>>> After looking at the C++ code, I realise that maybe returning a list
>>> of strings is the only choice for SupportedInputFormat. Anyway, in the
>>> meanwhile I've added some code to pybel, so that if you access
>>> pybel.informats or outformats, you will get a dictionary of supported
>>> formats.
>>>
>>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
>>>
>>>> Actually, a vector of std::strings had not yet been swigified, so I
>>>> needed to added to a line to openbabel-python.i to set it up (not yet
>>>> checked in). However, there's an additional problem, which Jerome may
>>>> like to address.
>>>>
>>>> The data that's returned is similar to:
>>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>>>>
>>>> whereas it would make more sense to me either to return:
>>>> ('acr', 'alc', ...)
>>>> or
>>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
>>>> 'Alchemy format']
>>>>
>>>> Note that the text [Read-only] is not really necessary in a list of
>>>> supported input formats.
>>>>
>>>> Since this function was added for the benefit of scripting interfaces,
>>>> it makes sense to make it as easy as possible to access the list of
>>>> formats.
>>>>
>>>> Noel
>>>>
>>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
>>>>
>>>>> Hello again Jens,
>>>>>
>>>>> Good to hear from you on this list... :-)
>>>>>
>>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to enable our ccp1gui code
>>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
>>>>>> no longer have to support so many formats.
>>>>>>
>>>>>> I've got most of the machinery in place, but am a bit stuck on how to
>>>>>> dynamically determine what input formats are supported by openbabel.
>>>>>>
>>>>>> I originally tried to use OBConversion.GetNextFormat, but ran into the
>>>>>> ground fairly quickly. I then discovered the post at:
>>>>>>
>>>>>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
>>>>>>
>>>>>> which suggest that I should be able to get what I want using
>>>>>> GetSupportedInputFormat(), however, I'm currently pretty clueless as to
>>>>>> how I extract the information from the object. I get something back as
>>>>>> shown below, but I'd appreciated any advice on what I then need to do
>>>>>> with it.
>>>>>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> OpenBabel-scripting mailing list
>> Ope...@li...
>> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>>
>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> OpenBabel-scripting mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>
>
|
|
From: Noel O'B. <bao...@gm...> - 2007-05-14 14:25:41
|
I've already noticed that the latest SVN is not compatible with SWIG
due to changes introducted at r1954. You'll need to check out r1953,
and use "svn merge -r 1957:1958" to patch with r1958.
Noel
On 14/05/07, Jens Thomas <j.m...@dl...> wrote:
> Hi Noel, Jerome and Chris,
>
> Firstly, many thanks for the quick response and warm welcome to the
> list! Please accept my apologies for not replying sooner, but I've been
> away without access to email.
>
> I've tried checking out the latest version of openbabel from SVN onto my
> Ubuntu box (Dapper on a Pentium 4) so that I can try some of the changes
> you've committed. I ran a normal configure (./configure), but the make
> currently fails with:
>
> make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest'
> make[2]: Entering directory `/home/jmht/openbabel/test'
> g++ -DHAVE_CONFIG_H -I. -I../src -I../include
> -DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD -MP -MF
> .deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp
> mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po
> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip
> roundtrip.o ../src/libopenbabel.la -ldl -lm
> mkdir .libs
> g++ -g -O2 -o .libs/roundtrip roundtrip.o ../src/.libs/libopenbabel.so
> -ldl -lm -Wl,--rpath -Wl,/usr/local/lib
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBFormat::FormatFromMIME(char const*)'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBPlugin::Display(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >&, char const*, char const*)'
> ../src/.libs/libopenbabel.so: undefined reference to `vtable for
> OpenBabel::OBDescriptor'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*,
> std::basic_istream<char, std::char_traits<char> >&, bool)'
> ../src/.libs/libopenbabel.so: undefined reference to `vtable for
> OpenBabel::OBPlugin'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBPlugin::ListAsVector(char const*, char const*,
> std::vector<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >, std::allocator<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > > >&)'
> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
> OpenBabel::OBPlugin'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&)'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*,
> std::basic_istream<char, std::char_traits<char> >&, bool)'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBFormat::RegisterFormat(char const*, char const*)'
> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
> OpenBabel::OBDescriptor'
> ../src/.libs/libopenbabel.so: undefined reference to
> `OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&)'
> collect2: ld returned 1 exit status
> make[2]: *** [roundtrip] Error 1
>
> I'm not that familiar with C++ and so am bit stuck as to how to sort
> this one out.
>
> Do you have any suggestions?
>
> Best wishes,
>
> Jens
>
>
> Noel O'Boyle wrote:
> > On 12/05/07, Chris Morley <c.m...@ds...> wrote:
> >
> >> In the revamped code for formats (and other plugins) recently committed
> >> to SVN HEAD (for the next OB version) I tried to maintain backward
> >> compatibility as far as possible. So OBConversion::SupportedInputFormat()
> >> works as before but, you'll be pleased to hear, without the '[Read-only]'.
> >>
> > Sounds good but SWIG doesn't like the new code. When I try to compile
> > openbabel_python.cpp, I get:
> >
> > ../../include/openbabel/fingerprint.h:48: error: 'static
> > std::map<const char*, OpenBabel::OBPlugin*,
> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> > cannot be overloaded
> > ../../include/openbabel/fingerprint.h:43: error: with 'static
> > std::map<const char*, OpenBabel::OBPlugin*,
> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> > ../../include/openbabel/fingerprint.h:53: error: 'static
> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
> > be overloaded
> > ../../include/openbabel/fingerprint.h:43: error: with 'static
> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
> > ../../include/openbabel/fingerprint.h: In constructor
> > 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
> > ../../include/openbabel/fingerprint.h:63: error: no match for
> > 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
> > /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
> > std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
> > _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
> > OpenBabel::OBPlugin::CharPtrLess, _Alloc =
> > std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
> >
> >
> >> But in an effort to provide more choice on the form of the output, there
> >> are three functions which provide a list of formats(or other plugin
> >> classes): OBPlugin::ListAsVector, ListAsString and List. The first two
> >> were intended to be compatible with scripting, although I need some
> >> advice here. ListAsString returns a (big) std::string, but ListAsVector
> >> has a parameter which is a reference to a std::vector. If this is
> >> incompatible with scripting languages I should change it.
> >>
> > There's no problem with vectors in general; these are simply
> > translated to lists by SWIG.
> >
> >
> >> All three have a parameter which can control what is in the output. For
> >> example if it contains "verbose" it output the whole description, not
> >> just the first line. So it would be easy to add code (4 extra lines) to
> >> output only the IDs if that would be useful:
> >> ListAsVector("formats","in/ids", stringvector)
> >>
> >> Post-processing in pybel I'm sure is useful, but if the C++ code was
> >> adequate it could serve other scripting languages as well.
> >>
> > I think so too. In the meanwhile, I would like to push out a Windows
> > Python release based on 2.1.0 with the current pybel enhancements. I'm
> > going to try to get this together this weekend and do some testing.
> >
> > Noel
> >
> >
> >> Chris
> >>
> >> Noel O'Boyle wrote:
> >>
> >>> After looking at the C++ code, I realise that maybe returning a list
> >>> of strings is the only choice for SupportedInputFormat. Anyway, in the
> >>> meanwhile I've added some code to pybel, so that if you access
> >>> pybel.informats or outformats, you will get a dictionary of supported
> >>> formats.
> >>>
> >>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
> >>>
> >>>> Actually, a vector of std::strings had not yet been swigified, so I
> >>>> needed to added to a line to openbabel-python.i to set it up (not yet
> >>>> checked in). However, there's an additional problem, which Jerome may
> >>>> like to address.
> >>>>
> >>>> The data that's returned is similar to:
> >>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
> >>>>
> >>>> whereas it would make more sense to me either to return:
> >>>> ('acr', 'alc', ...)
> >>>> or
> >>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
> >>>> 'Alchemy format']
> >>>>
> >>>> Note that the text [Read-only] is not really necessary in a list of
> >>>> supported input formats.
> >>>>
> >>>> Since this function was added for the benefit of scripting interfaces,
> >>>> it makes sense to make it as easy as possible to access the list of
> >>>> formats.
> >>>>
> >>>> Noel
> >>>>
> >>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> >>>>
> >>>>> Hello again Jens,
> >>>>>
> >>>>> Good to hear from you on this list... :-)
> >>>>>
> >>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I'm trying to enable our ccp1gui code
> >>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> >>>>>> no longer have to support so many formats.
> >>>>>>
> >>>>>> I've got most of the machinery in place, but am a bit stuck on how to
> >>>>>> dynamically determine what input formats are supported by openbabel.
> >>>>>>
> >>>>>> I originally tried to use OBConversion.GetNextFormat, but ran into the
> >>>>>> ground fairly quickly. I then discovered the post at:
> >>>>>>
> >>>>>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
> >>>>>>
> >>>>>> which suggest that I should be able to get what I want using
> >>>>>> GetSupportedInputFormat(), however, I'm currently pretty clueless as to
> >>>>>> how I extract the information from the object. I get something back as
> >>>>>> shown below, but I'd appreciated any advice on what I then need to do
> >>>>>> with it.
> >>>>>>
> >> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by DB2 Express
> >> Download DB2 Express C - the FREE version of DB2 express and take
> >> control of your XML. No limits. Just data. Click to get it now.
> >> http://sourceforge.net/powerbar/db2/
> >> _______________________________________________
> >> OpenBabel-scripting mailing list
> >> Ope...@li...
> >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
> >>
> >>
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > OpenBabel-scripting mailing list
> > Ope...@li...
> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
> >
> >
>
>
|
|
From: Noel O'B. <bao...@gm...> - 2007-05-14 15:50:23
|
I think the Makefiles need to be updated. That is, there's been a
pluginiter.h --> plugin.h transition. After installing automake-1.9
and libtool, and editing a Makefile.am, it overwrites the Makefile.in,
but the top level "make" just fails. This is possibly because the
version of libtool I have access to is a couple of years out of date
(1.5.6).
Noel
On 13/05/07, Noel O'Boyle <bao...@gm...> wrote:
> On 12/05/07, Chris Morley <c.m...@ds...> wrote:
> > In the revamped code for formats (and other plugins) recently committed
> > to SVN HEAD (for the next OB version) I tried to maintain backward
> > compatibility as far as possible. So OBConversion::SupportedInputFormat()
> > works as before but, you'll be pleased to hear, without the '[Read-only]'.
> Sounds good but SWIG doesn't like the new code. When I try to compile
> openbabel_python.cpp, I get:
>
> ../../include/openbabel/fingerprint.h:48: error: 'static
> std::map<const char*, OpenBabel::OBPlugin*,
> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> cannot be overloaded
> ../../include/openbabel/fingerprint.h:43: error: with 'static
> std::map<const char*, OpenBabel::OBPlugin*,
> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
> ../../include/openbabel/fingerprint.h:53: error: 'static
> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
> be overloaded
> ../../include/openbabel/fingerprint.h:43: error: with 'static
> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
> ../../include/openbabel/fingerprint.h: In constructor
> 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
> ../../include/openbabel/fingerprint.h:63: error: no match for
> 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
> /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
> std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
> _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
> OpenBabel::OBPlugin::CharPtrLess, _Alloc =
> std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
>
> > But in an effort to provide more choice on the form of the output, there
> > are three functions which provide a list of formats(or other plugin
> > classes): OBPlugin::ListAsVector, ListAsString and List. The first two
> > were intended to be compatible with scripting, although I need some
> > advice here. ListAsString returns a (big) std::string, but ListAsVector
> > has a parameter which is a reference to a std::vector. If this is
> > incompatible with scripting languages I should change it.
> There's no problem with vectors in general; these are simply
> translated to lists by SWIG.
>
> > All three have a parameter which can control what is in the output. For
> > example if it contains "verbose" it output the whole description, not
> > just the first line. So it would be easy to add code (4 extra lines) to
> > output only the IDs if that would be useful:
> > ListAsVector("formats","in/ids", stringvector)
> >
> > Post-processing in pybel I'm sure is useful, but if the C++ code was
> > adequate it could serve other scripting languages as well.
> I think so too. In the meanwhile, I would like to push out a Windows
> Python release based on 2.1.0 with the current pybel enhancements. I'm
> going to try to get this together this weekend and do some testing.
>
> Noel
>
> > Chris
> >
> > Noel O'Boyle wrote:
> > > After looking at the C++ code, I realise that maybe returning a list
> > > of strings is the only choice for SupportedInputFormat. Anyway, in the
> > > meanwhile I've added some code to pybel, so that if you access
> > > pybel.informats or outformats, you will get a dictionary of supported
> > > formats.
> > >
> > > On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
> > >> Actually, a vector of std::strings had not yet been swigified, so I
> > >> needed to added to a line to openbabel-python.i to set it up (not yet
> > >> checked in). However, there's an additional problem, which Jerome may
> > >> like to address.
> > >>
> > >> The data that's returned is similar to:
> > >> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
> > >>
> > >> whereas it would make more sense to me either to return:
> > >> ('acr', 'alc', ...)
> > >> or
> > >> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
> > >> 'Alchemy format']
> > >>
> > >> Note that the text [Read-only] is not really necessary in a list of
> > >> supported input formats.
> > >>
> > >> Since this function was added for the benefit of scripting interfaces,
> > >> it makes sense to make it as easy as possible to access the list of
> > >> formats.
> > >>
> > >> Noel
> > >>
> > >> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
> > >>> Hello again Jens,
> > >>>
> > >>> Good to hear from you on this list... :-)
> > >>>
> > >>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
> > >>>> Hi,
> > >>>>
> > >>>> I'm trying to enable our ccp1gui code
> > >>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so that we
> > >>>> no longer have to support so many formats.
> > >>>>
> > >>>> I've got most of the machinery in place, but am a bit stuck on how to
> > >>>> dynamically determine what input formats are supported by openbabel.
> > >>>>
> > >>>> I originally tried to use OBConversion.GetNextFormat, but ran into the
> > >>>> ground fairly quickly. I then discovered the post at:
> > >>>>
> > >>>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
> > >>>>
> > >>>> which suggest that I should be able to get what I want using
> > >>>> GetSupportedInputFormat(), however, I'm currently pretty clueless as to
> > >>>> how I extract the information from the object. I get something back as
> > >>>> shown below, but I'd appreciated any advice on what I then need to do
> > >>>> with it.
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > OpenBabel-scripting mailing list
> > Ope...@li...
> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
> >
>
|
|
From: Chris M. <c.m...@ds...> - 2007-05-14 16:08:14
|
The new files are:
include/openbabel/descriptor.h, include/openbabel/format.h
include/openbabel/plugin.h, src/descriptor.cpp
src/filters.cpp, src/format.cpp, src/plugin.cpp
Removed file:
include/openbabel/pluginiter.h
Noel O'Boyle wrote:
> I think the Makefiles need to be updated. That is, there's been a
> pluginiter.h --> plugin.h transition. After installing automake-1.9
> and libtool, and editing a Makefile.am, it overwrites the Makefile.in,
> but the top level "make" just fails. This is possibly because the
> version of libtool I have access to is a couple of years out of date
> (1.5.6).
>
> Noel
>
> On 13/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> On 12/05/07, Chris Morley <c.m...@ds...> wrote:
>> > In the revamped code for formats (and other plugins) recently committed
>> > to SVN HEAD (for the next OB version) I tried to maintain backward
>> > compatibility as far as possible. So
>> OBConversion::SupportedInputFormat()
>> > works as before but, you'll be pleased to hear, without the
>> '[Read-only]'.
>> Sounds good but SWIG doesn't like the new code. When I try to compile
>> openbabel_python.cpp, I get:
>>
>> ../../include/openbabel/fingerprint.h:48: error: 'static
>> std::map<const char*, OpenBabel::OBPlugin*,
>> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
>> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
>> cannot be overloaded
>> ../../include/openbabel/fingerprint.h:43: error: with 'static
>> std::map<const char*, OpenBabel::OBPlugin*,
>> OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
>> const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
>> ../../include/openbabel/fingerprint.h:53: error: 'static
>> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
>> be overloaded
>> ../../include/openbabel/fingerprint.h:43: error: with 'static
>> OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
>> ../../include/openbabel/fingerprint.h: In constructor
>> 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
>> ../../include/openbabel/fingerprint.h:63: error: no match for
>> 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
>> /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
>> std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
>> _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
>> OpenBabel::OBPlugin::CharPtrLess, _Alloc =
>> std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
>>
>> > But in an effort to provide more choice on the form of the output,
>> there
>> > are three functions which provide a list of formats(or other plugin
>> > classes): OBPlugin::ListAsVector, ListAsString and List. The first two
>> > were intended to be compatible with scripting, although I need some
>> > advice here. ListAsString returns a (big) std::string, but ListAsVector
>> > has a parameter which is a reference to a std::vector. If this is
>> > incompatible with scripting languages I should change it.
>> There's no problem with vectors in general; these are simply
>> translated to lists by SWIG.
>>
>> > All three have a parameter which can control what is in the output. For
>> > example if it contains "verbose" it output the whole description, not
>> > just the first line. So it would be easy to add code (4 extra lines) to
>> > output only the IDs if that would be useful:
>> > ListAsVector("formats","in/ids", stringvector)
>> >
>> > Post-processing in pybel I'm sure is useful, but if the C++ code was
>> > adequate it could serve other scripting languages as well.
>> I think so too. In the meanwhile, I would like to push out a Windows
>> Python release based on 2.1.0 with the current pybel enhancements. I'm
>> going to try to get this together this weekend and do some testing.
>>
>> Noel
>>
>> > Chris
>> >
>> > Noel O'Boyle wrote:
>> > > After looking at the C++ code, I realise that maybe returning a list
>> > > of strings is the only choice for SupportedInputFormat. Anyway, in
>> the
>> > > meanwhile I've added some code to pybel, so that if you access
>> > > pybel.informats or outformats, you will get a dictionary of supported
>> > > formats.
>> > >
>> > > On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> > >> Actually, a vector of std::strings had not yet been swigified, so I
>> > >> needed to added to a line to openbabel-python.i to set it up (not
>> yet
>> > >> checked in). However, there's an additional problem, which Jerome
>> may
>> > >> like to address.
>> > >>
>> > >> The data that's returned is similar to:
>> > >> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>> > >>
>> > >> whereas it would make more sense to me either to return:
>> > >> ('acr', 'alc', ...)
>> > >> or
>> > >> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
>> > >> 'Alchemy format']
>> > >>
>> > >> Note that the text [Read-only] is not really necessary in a list of
>> > >> supported input formats.
>> > >>
>> > >> Since this function was added for the benefit of scripting
>> interfaces,
>> > >> it makes sense to make it as easy as possible to access the list of
>> > >> formats.
>> > >>
>> > >> Noel
>> > >>
>> > >> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> > >>> Hello again Jens,
>> > >>>
>> > >>> Good to hear from you on this list... :-)
>> > >>>
>> > >>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
>> > >>>> Hi,
>> > >>>>
>> > >>>> I'm trying to enable our ccp1gui code
>> > >>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so
>> that we
>> > >>>> no longer have to support so many formats.
>> > >>>>
>> > >>>> I've got most of the machinery in place, but am a bit stuck on
>> how to
>> > >>>> dynamically determine what input formats are supported by
>> openbabel.
>> > >>>>
>> > >>>> I originally tried to use OBConversion.GetNextFormat, but ran
>> into the
>> > >>>> ground fairly quickly. I then discovered the post at:
>> > >>>>
>> > >>>>
>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
>>
>> > >>>>
>> > >>>> which suggest that I should be able to get what I want using
>> > >>>> GetSupportedInputFormat(), however, I'm currently pretty
>> clueless as to
>> > >>>> how I extract the information from the object. I get something
>> back as
>> > >>>> shown below, but I'd appreciated any advice on what I then need
>> to do
>> > >>>> with it.
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > OpenBabel-scripting mailing list
>> > Ope...@li...
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>> >
>>
>
|
|
From: Jens T. <j.m...@dl...> - 2007-05-15 17:30:26
|
Hello!
It's taken me a little while to grind through all the usual little
hiccups that come when building an unfamiliar code straight out of the
repository, but I've now got what (I think) is the correct version.
I checked out the code at r1954 and patched with r1958 as suggested by Noel.
However, I'm not getting anything from pybel.informats or
OBConversion.GetSupportedInputFormats as shown below:
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybel
>>> pybel.informats
{}
>>> pybel.outformats
{}
>>> import openbabel
>>> obc = openbabel.OBConversion()
>>> i= obc.GetSupportedInputFormat()
>>> print i
()
>>> dir(i)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__',
'__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__',
'__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__']
Is there some sort of initialisation I need to do to get the dictionary
populated?
Many thanks,
Jens
Noel O'Boyle wrote:
> I've already noticed that the latest SVN is not compatible with SWIG
> due to changes introducted at r1954. You'll need to check out r1953,
> and use "svn merge -r 1957:1958" to patch with r1958.
>
> Noel
>
> On 14/05/07, Jens Thomas <j.m...@dl...> wrote:
>> Hi Noel, Jerome and Chris,
>>
>> Firstly, many thanks for the quick response and warm welcome to the
>> list! Please accept my apologies for not replying sooner, but I've been
>> away without access to email.
>>
>> I've tried checking out the latest version of openbabel from SVN onto my
>> Ubuntu box (Dapper on a Pentium 4) so that I can try some of the changes
>> you've committed. I ran a normal configure (./configure), but the make
>> currently fails with:
>>
>> make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest'
>> make[2]: Entering directory `/home/jmht/openbabel/test'
>> g++ -DHAVE_CONFIG_H -I. -I../src -I../include
>> -DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD -MP -MF
>> .deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp
>> mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po
>> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip
>> roundtrip.o ../src/libopenbabel.la -ldl -lm
>> mkdir .libs
>> g++ -g -O2 -o .libs/roundtrip roundtrip.o ../src/.libs/libopenbabel.so
>> -ldl -lm -Wl,--rpath -Wl,/usr/local/lib
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBFormat::FormatFromMIME(char const*)'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBPlugin::Display(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >&, char const*, char
>> const*)'
>> ../src/.libs/libopenbabel.so: undefined reference to `vtable for
>> OpenBabel::OBDescriptor'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*,
>> std::basic_istream<char, std::char_traits<char> >&, bool)'
>> ../src/.libs/libopenbabel.so: undefined reference to `vtable for
>> OpenBabel::OBPlugin'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBPlugin::ListAsVector(char const*, char const*,
>> std::vector<std::basic_string<char, std::char_traits<char>,
>> std::allocator<char> >, std::allocator<std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > > >&)'
>> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
>> OpenBabel::OBPlugin'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*,
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>> const&)'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*,
>> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>> >&)'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*,
>> std::basic_istream<char, std::char_traits<char> >&, bool)'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBFormat::RegisterFormat(char const*, char const*)'
>> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for
>> OpenBabel::OBDescriptor'
>> ../src/.libs/libopenbabel.so: undefined reference to
>> `OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*,
>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>> const&)'
>> collect2: ld returned 1 exit status
>> make[2]: *** [roundtrip] Error 1
>>
>> I'm not that familiar with C++ and so am bit stuck as to how to sort
>> this one out.
>>
>> Do you have any suggestions?
>>
>> Best wishes,
>>
>> Jens
>>
>>
>> Noel O'Boyle wrote:
>> > On 12/05/07, Chris Morley <c.m...@ds...> wrote:
>> >
>> >> In the revamped code for formats (and other plugins) recently
>> committed
>> >> to SVN HEAD (for the next OB version) I tried to maintain backward
>> >> compatibility as far as possible. So
>> OBConversion::SupportedInputFormat()
>> >> works as before but, you'll be pleased to hear, without the
>> '[Read-only]'.
>> >>
>> > Sounds good but SWIG doesn't like the new code. When I try to compile
>> > openbabel_python.cpp, I get:
>> >
>> > ../../include/openbabel/fingerprint.h:48: error: 'static
>> > std::map<const char*, OpenBabel::OBPlugin*,
>> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
>> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
>> > cannot be overloaded
>> > ../../include/openbabel/fingerprint.h:43: error: with 'static
>> > std::map<const char*, OpenBabel::OBPlugin*,
>> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char*
>> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()'
>> > ../../include/openbabel/fingerprint.h:53: error: 'static
>> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot
>> > be overloaded
>> > ../../include/openbabel/fingerprint.h:43: error: with 'static
>> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()'
>> > ../../include/openbabel/fingerprint.h: In constructor
>> > 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)':
>> > ../../include/openbabel/fingerprint.h:63: error: no match for
>> > 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]'
>> > /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp&
>> > std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with
>> > _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare =
>> > OpenBabel::OBPlugin::CharPtrLess, _Alloc =
>> > std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >]
>> >
>> >
>> >> But in an effort to provide more choice on the form of the output,
>> there
>> >> are three functions which provide a list of formats(or other plugin
>> >> classes): OBPlugin::ListAsVector, ListAsString and List. The first
>> two
>> >> were intended to be compatible with scripting, although I need some
>> >> advice here. ListAsString returns a (big) std::string, but
>> ListAsVector
>> >> has a parameter which is a reference to a std::vector. If this is
>> >> incompatible with scripting languages I should change it.
>> >>
>> > There's no problem with vectors in general; these are simply
>> > translated to lists by SWIG.
>> >
>> >
>> >> All three have a parameter which can control what is in the
>> output. For
>> >> example if it contains "verbose" it output the whole description, not
>> >> just the first line. So it would be easy to add code (4 extra
>> lines) to
>> >> output only the IDs if that would be useful:
>> >> ListAsVector("formats","in/ids", stringvector)
>> >>
>> >> Post-processing in pybel I'm sure is useful, but if the C++ code was
>> >> adequate it could serve other scripting languages as well.
>> >>
>> > I think so too. In the meanwhile, I would like to push out a Windows
>> > Python release based on 2.1.0 with the current pybel enhancements. I'm
>> > going to try to get this together this weekend and do some testing.
>> >
>> > Noel
>> >
>> >
>> >> Chris
>> >>
>> >> Noel O'Boyle wrote:
>> >>
>> >>> After looking at the C++ code, I realise that maybe returning a list
>> >>> of strings is the only choice for SupportedInputFormat. Anyway,
>> in the
>> >>> meanwhile I've added some code to pybel, so that if you access
>> >>> pybel.informats or outformats, you will get a dictionary of
>> supported
>> >>> formats.
>> >>>
>> >>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> >>>
>> >>>> Actually, a vector of std::strings had not yet been swigified, so I
>> >>>> needed to added to a line to openbabel-python.i to set it up
>> (not yet
>> >>>> checked in). However, there's an additional problem, which
>> Jerome may
>> >>>> like to address.
>> >>>>
>> >>>> The data that's returned is similar to:
>> >>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... )
>> >>>>
>> >>>> whereas it would make more sense to me either to return:
>> >>>> ('acr', 'alc', ...)
>> >>>> or
>> >>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc':
>> >>>> 'Alchemy format']
>> >>>>
>> >>>> Note that the text [Read-only] is not really necessary in a list of
>> >>>> supported input formats.
>> >>>>
>> >>>> Since this function was added for the benefit of scripting
>> interfaces,
>> >>>> it makes sense to make it as easy as possible to access the list of
>> >>>> formats.
>> >>>>
>> >>>> Noel
>> >>>>
>> >>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote:
>> >>>>
>> >>>>> Hello again Jens,
>> >>>>>
>> >>>>> Good to hear from you on this list... :-)
>> >>>>>
>> >>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote:
>> >>>>>
>> >>>>>> Hi,
>> >>>>>>
>> >>>>>> I'm trying to enable our ccp1gui code
>> >>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so
>> that we
>> >>>>>> no longer have to support so many formats.
>> >>>>>>
>> >>>>>> I've got most of the machinery in place, but am a bit stuck on
>> how to
>> >>>>>> dynamically determine what input formats are supported by
>> openbabel.
>> >>>>>>
>> >>>>>> I originally tried to use OBConversion.GetNextFormat, but ran
>> into the
>> >>>>>> ground fairly quickly. I then discovered the post at:
>> >>>>>>
>> >>>>>>
>> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting
>>
>> >>>>>>
>> >>>>>> which suggest that I should be able to get what I want using
>> >>>>>> GetSupportedInputFormat(), however, I'm currently pretty
>> clueless as to
>> >>>>>> how I extract the information from the object. I get something
>> back as
>> >>>>>> shown below, but I'd appreciated any advice on what I then
>> need to do
>> >>>>>> with it.
>> >>>>>>
>> >>
>> -------------------------------------------------------------------------
>>
>> >> This SF.net email is sponsored by DB2 Express
>> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> control of your XML. No limits. Just data. Click to get it now.
>> >> http://sourceforge.net/powerbar/db2/
>> >> _______________________________________________
>> >> OpenBabel-scripting mailing list
>> >> Ope...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>> >>
>> >>
>> >
>> >
>> -------------------------------------------------------------------------
>>
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > OpenBabel-scripting mailing list
>> > Ope...@li...
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>> >
>> >
>>
>>
>
|
|
From: Noel O'B. <bao...@gm...> - 2007-05-16 21:01:27
|
The good news is that all the Python stuff seems to be working fine (no initialisation necessary). The bad news is that the C++ stuff isn't working properly. I'm betting that if you try "babel -H" and look under "The following file formats are recognized", you will see nothing there. Which is what you're also seeing in python. To verify, try to convert a file using babel. This is because the file formats are loaded dynamically as plugins, so there can be problems if you compile with particular settings. How exactly are you compiling the software? Did you follow the instructions on the web exactly (see http://openbabel.sourceforge.net/wiki/Install_%28source_code%29), or are you doing something different? I'm using an old version of Ubuntu myself, so there's no reason we can't get it to work. Regards Noel On 15/05/07, Jens Thomas <j.m...@dl...> wrote: > Hello! > > It's taken me a little while to grind through all the usual little > hiccups that come when building an unfamiliar code straight out of the > repository, but I've now got what (I think) is the correct version. > > I checked out the code at r1954 and patched with r1958 as suggested by Noel. > > However, I'm not getting anything from pybel.informats or > OBConversion.GetSupportedInputFormats as shown below: > > > Python 2.4.3 (#2, Oct 6 2006, 07:52:30) > [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import pybel > >>> pybel.informats > {} > >>> pybel.outformats > {} > >>> import openbabel > >>> obc = openbabel.OBConversion() > >>> i= obc.GetSupportedInputFormat() > >>> print i > () > >>> dir(i) > ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', > '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', > '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', > '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', > '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__'] > > > Is there some sort of initialisation I need to do to get the dictionary > populated? > > Many thanks, > > Jens > > Noel O'Boyle wrote: > > I've already noticed that the latest SVN is not compatible with SWIG > > due to changes introducted at r1954. You'll need to check out r1953, > > and use "svn merge -r 1957:1958" to patch with r1958. > > > > Noel > > > > On 14/05/07, Jens Thomas <j.m...@dl...> wrote: > >> Hi Noel, Jerome and Chris, > >> > >> Firstly, many thanks for the quick response and warm welcome to the > >> list! Please accept my apologies for not replying sooner, but I've been > >> away without access to email. > >> > >> I've tried checking out the latest version of openbabel from SVN onto my > >> Ubuntu box (Dapper on a Pentium 4) so that I can try some of the changes > >> you've committed. I ran a normal configure (./configure), but the make > >> currently fails with: > >> > >> make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest' > >> make[2]: Entering directory `/home/jmht/openbabel/test' > >> g++ -DHAVE_CONFIG_H -I. -I../src -I../include > >> -DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD -MP -MF > >> .deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp > >> mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po > >> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip > >> roundtrip.o ../src/libopenbabel.la -ldl -lm > >> mkdir .libs > >> g++ -g -O2 -o .libs/roundtrip roundtrip.o ../src/.libs/libopenbabel.so > >> -ldl -lm -Wl,--rpath -Wl,/usr/local/lib > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBFormat::FormatFromMIME(char const*)' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBPlugin::Display(std::basic_string<char, > >> std::char_traits<char>, std::allocator<char> >&, char const*, char > >> const*)' > >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for > >> OpenBabel::OBDescriptor' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*, > >> std::basic_istream<char, std::char_traits<char> >&, bool)' > >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for > >> OpenBabel::OBPlugin' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBPlugin::ListAsVector(char const*, char const*, > >> std::vector<std::basic_string<char, std::char_traits<char>, > >> std::allocator<char> >, std::allocator<std::basic_string<char, > >> std::char_traits<char>, std::allocator<char> > > >&)' > >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for > >> OpenBabel::OBPlugin' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*, > >> std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> const&)' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*, > >> std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> >&)' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*, > >> std::basic_istream<char, std::char_traits<char> >&, bool)' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBFormat::RegisterFormat(char const*, char const*)' > >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for > >> OpenBabel::OBDescriptor' > >> ../src/.libs/libopenbabel.so: undefined reference to > >> `OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*, > >> std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> const&)' > >> collect2: ld returned 1 exit status > >> make[2]: *** [roundtrip] Error 1 > >> > >> I'm not that familiar with C++ and so am bit stuck as to how to sort > >> this one out. > >> > >> Do you have any suggestions? > >> > >> Best wishes, > >> > >> Jens > >> > >> > >> Noel O'Boyle wrote: > >> > On 12/05/07, Chris Morley <c.m...@ds...> wrote: > >> > > >> >> In the revamped code for formats (and other plugins) recently > >> committed > >> >> to SVN HEAD (for the next OB version) I tried to maintain backward > >> >> compatibility as far as possible. So > >> OBConversion::SupportedInputFormat() > >> >> works as before but, you'll be pleased to hear, without the > >> '[Read-only]'. > >> >> > >> > Sounds good but SWIG doesn't like the new code. When I try to compile > >> > openbabel_python.cpp, I get: > >> > > >> > ../../include/openbabel/fingerprint.h:48: error: 'static > >> > std::map<const char*, OpenBabel::OBPlugin*, > >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char* > >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' > >> > cannot be overloaded > >> > ../../include/openbabel/fingerprint.h:43: error: with 'static > >> > std::map<const char*, OpenBabel::OBPlugin*, > >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const char* > >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' > >> > ../../include/openbabel/fingerprint.h:53: error: 'static > >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' cannot > >> > be overloaded > >> > ../../include/openbabel/fingerprint.h:43: error: with 'static > >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' > >> > ../../include/openbabel/fingerprint.h: In constructor > >> > 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)': > >> > ../../include/openbabel/fingerprint.h:63: error: no match for > >> > 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]' > >> > /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: _Tp& > >> > std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with > >> > _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare = > >> > OpenBabel::OBPlugin::CharPtrLess, _Alloc = > >> > std::allocator<std::pair<const char* const, OpenBabel::OBPlugin*> >] > >> > > >> > > >> >> But in an effort to provide more choice on the form of the output, > >> there > >> >> are three functions which provide a list of formats(or other plugin > >> >> classes): OBPlugin::ListAsVector, ListAsString and List. The first > >> two > >> >> were intended to be compatible with scripting, although I need some > >> >> advice here. ListAsString returns a (big) std::string, but > >> ListAsVector > >> >> has a parameter which is a reference to a std::vector. If this is > >> >> incompatible with scripting languages I should change it. > >> >> > >> > There's no problem with vectors in general; these are simply > >> > translated to lists by SWIG. > >> > > >> > > >> >> All three have a parameter which can control what is in the > >> output. For > >> >> example if it contains "verbose" it output the whole description, not > >> >> just the first line. So it would be easy to add code (4 extra > >> lines) to > >> >> output only the IDs if that would be useful: > >> >> ListAsVector("formats","in/ids", stringvector) > >> >> > >> >> Post-processing in pybel I'm sure is useful, but if the C++ code was > >> >> adequate it could serve other scripting languages as well. > >> >> > >> > I think so too. In the meanwhile, I would like to push out a Windows > >> > Python release based on 2.1.0 with the current pybel enhancements. I'm > >> > going to try to get this together this weekend and do some testing. > >> > > >> > Noel > >> > > >> > > >> >> Chris > >> >> > >> >> Noel O'Boyle wrote: > >> >> > >> >>> After looking at the C++ code, I realise that maybe returning a list > >> >>> of strings is the only choice for SupportedInputFormat. Anyway, > >> in the > >> >>> meanwhile I've added some code to pybel, so that if you access > >> >>> pybel.informats or outformats, you will get a dictionary of > >> supported > >> >>> formats. > >> >>> > >> >>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote: > >> >>> > >> >>>> Actually, a vector of std::strings had not yet been swigified, so I > >> >>>> needed to added to a line to openbabel-python.i to set it up > >> (not yet > >> >>>> checked in). However, there's an additional problem, which > >> Jerome may > >> >>>> like to address. > >> >>>> > >> >>>> The data that's returned is similar to: > >> >>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... ) > >> >>>> > >> >>>> whereas it would make more sense to me either to return: > >> >>>> ('acr', 'alc', ...) > >> >>>> or > >> >>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc': > >> >>>> 'Alchemy format'] > >> >>>> > >> >>>> Note that the text [Read-only] is not really necessary in a list of > >> >>>> supported input formats. > >> >>>> > >> >>>> Since this function was added for the benefit of scripting > >> interfaces, > >> >>>> it makes sense to make it as easy as possible to access the list of > >> >>>> formats. > >> >>>> > >> >>>> Noel > >> >>>> > >> >>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote: > >> >>>> > >> >>>>> Hello again Jens, > >> >>>>> > >> >>>>> Good to hear from you on this list... :-) > >> >>>>> > >> >>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote: > >> >>>>> > >> >>>>>> Hi, > >> >>>>>> > >> >>>>>> I'm trying to enable our ccp1gui code > >> >>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so > >> that we > >> >>>>>> no longer have to support so many formats. > >> >>>>>> > >> >>>>>> I've got most of the machinery in place, but am a bit stuck on > >> how to > >> >>>>>> dynamically determine what input formats are supported by > >> openbabel. > >> >>>>>> > >> >>>>>> I originally tried to use OBConversion.GetNextFormat, but ran > >> into the > >> >>>>>> ground fairly quickly. I then discovered the post at: > >> >>>>>> > >> >>>>>> > >> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting > >> > >> >>>>>> > >> >>>>>> which suggest that I should be able to get what I want using > >> >>>>>> GetSupportedInputFormat(), however, I'm currently pretty > >> clueless as to > >> >>>>>> how I extract the information from the object. I get something > >> back as > >> >>>>>> shown below, but I'd appreciated any advice on what I then > >> need to do > >> >>>>>> with it. > >> >>>>>> > >> >> > >> ------------------------------------------------------------------------- > >> > >> >> This SF.net email is sponsored by DB2 Express > >> >> Download DB2 Express C - the FREE version of DB2 express and take > >> >> control of your XML. No limits. Just data. Click to get it now. > >> >> http://sourceforge.net/powerbar/db2/ > >> >> _______________________________________________ > >> >> OpenBabel-scripting mailing list > >> >> Ope...@li... > >> >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > >> >> > >> >> > >> > > >> > > >> ------------------------------------------------------------------------- > >> > >> > This SF.net email is sponsored by DB2 Express > >> > Download DB2 Express C - the FREE version of DB2 express and take > >> > control of your XML. No limits. Just data. Click to get it now. > >> > http://sourceforge.net/powerbar/db2/ > >> > _______________________________________________ > >> > OpenBabel-scripting mailing list > >> > Ope...@li... > >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > >> > > >> > > >> > >> > > > > |
|
From: Jens T. <j.m...@dl...> - 2007-05-17 11:21:02
|
Hi Noel, I've just worked out that the problem arose because I hadn't installed anything and was running it directly from the build directory. I assume it looks in a set directory for the files to dynamically configure the supported formats. Can this be changed with an environment variable? Anyway, it's not important as once I'd installed everything into a directory structure it then worked fine. I should probably mention that I hit problems with the default version of SWIG on Ubuntu wasn't able to handle the "-naturalvar" flag, so I had to install swig 1.3.31 to get the build to work. Many thanks for your help. Jens Noel O'Boyle wrote: > The good news is that all the Python stuff seems to be working fine > (no initialisation necessary). The bad news is that the C++ stuff > isn't working properly. > > I'm betting that if you try "babel -H" and look under "The following > file formats are recognized", you will see nothing there. Which is > what you're also seeing in python. To verify, try to convert a file > using babel. This is because the file formats are loaded dynamically > as plugins, so there can be problems if you compile with particular > settings. > > How exactly are you compiling the software? Did you follow the > instructions on the web exactly (see > http://openbabel.sourceforge.net/wiki/Install_%28source_code%29), or > are you doing something different? I'm using an old version of Ubuntu > myself, so there's no reason we can't get it to work. > > Regards > Noel > > On 15/05/07, Jens Thomas <j.m...@dl...> wrote: >> Hello! >> >> It's taken me a little while to grind through all the usual little >> hiccups that come when building an unfamiliar code straight out of the >> repository, but I've now got what (I think) is the correct version. >> >> I checked out the code at r1954 and patched with r1958 as suggested >> by Noel. >> >> However, I'm not getting anything from pybel.informats or >> OBConversion.GetSupportedInputFormats as shown below: >> >> >> Python 2.4.3 (#2, Oct 6 2006, 07:52:30) >> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import pybel >> >>> pybel.informats >> {} >> >>> pybel.outformats >> {} >> >>> import openbabel >> >>> obc = openbabel.OBConversion() >> >>> i= obc.GetSupportedInputFormat() >> >>> print i >> () >> >>> dir(i) >> ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', >> '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', >> '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', >> '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', >> '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__'] >> >> >> Is there some sort of initialisation I need to do to get the dictionary >> populated? >> >> Many thanks, >> >> Jens >> >> Noel O'Boyle wrote: >> > I've already noticed that the latest SVN is not compatible with SWIG >> > due to changes introducted at r1954. You'll need to check out r1953, >> > and use "svn merge -r 1957:1958" to patch with r1958. >> > >> > Noel >> > >> > On 14/05/07, Jens Thomas <j.m...@dl...> wrote: >> >> Hi Noel, Jerome and Chris, >> >> >> >> Firstly, many thanks for the quick response and warm welcome to the >> >> list! Please accept my apologies for not replying sooner, but I've >> been >> >> away without access to email. >> >> >> >> I've tried checking out the latest version of openbabel from SVN >> onto my >> >> Ubuntu box (Dapper on a Pentium 4) so that I can try some of the >> changes >> >> you've committed. I ran a normal configure (./configure), but the >> make >> >> currently fails with: >> >> >> >> make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest' >> >> make[2]: Entering directory `/home/jmht/openbabel/test' >> >> g++ -DHAVE_CONFIG_H -I. -I../src -I../include >> >> -DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD >> -MP -MF >> >> .deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp >> >> mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po >> >> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip >> >> roundtrip.o ../src/libopenbabel.la -ldl -lm >> >> mkdir .libs >> >> g++ -g -O2 -o .libs/roundtrip roundtrip.o >> ../src/.libs/libopenbabel.so >> >> -ldl -lm -Wl,--rpath -Wl,/usr/local/lib >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBFormat::FormatFromMIME(char const*)' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBPlugin::Display(std::basic_string<char, >> >> std::char_traits<char>, std::allocator<char> >&, char const*, char >> >> const*)' >> >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for >> >> OpenBabel::OBDescriptor' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*, >> >> std::basic_istream<char, std::char_traits<char> >&, bool)' >> >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for >> >> OpenBabel::OBPlugin' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBPlugin::ListAsVector(char const*, char const*, >> >> std::vector<std::basic_string<char, std::char_traits<char>, >> >> std::allocator<char> >, std::allocator<std::basic_string<char, >> >> std::char_traits<char>, std::allocator<char> > > >&)' >> >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for >> >> OpenBabel::OBPlugin' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*, >> >> std::basic_string<char, std::char_traits<char>, >> std::allocator<char> > >> >> const&)' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*, >> >> std::basic_string<char, std::char_traits<char>, std::allocator<char> >> >> >&)' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*, >> >> std::basic_istream<char, std::char_traits<char> >&, bool)' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBFormat::RegisterFormat(char const*, char const*)' >> >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for >> >> OpenBabel::OBDescriptor' >> >> ../src/.libs/libopenbabel.so: undefined reference to >> >> `OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*, >> >> std::basic_string<char, std::char_traits<char>, >> std::allocator<char> > >> >> const&)' >> >> collect2: ld returned 1 exit status >> >> make[2]: *** [roundtrip] Error 1 >> >> >> >> I'm not that familiar with C++ and so am bit stuck as to how to sort >> >> this one out. >> >> >> >> Do you have any suggestions? >> >> >> >> Best wishes, >> >> >> >> Jens >> >> >> >> >> >> Noel O'Boyle wrote: >> >> > On 12/05/07, Chris Morley <c.m...@ds...> wrote: >> >> > >> >> >> In the revamped code for formats (and other plugins) recently >> >> committed >> >> >> to SVN HEAD (for the next OB version) I tried to maintain backward >> >> >> compatibility as far as possible. So >> >> OBConversion::SupportedInputFormat() >> >> >> works as before but, you'll be pleased to hear, without the >> >> '[Read-only]'. >> >> >> >> >> > Sounds good but SWIG doesn't like the new code. When I try to >> compile >> >> > openbabel_python.cpp, I get: >> >> > >> >> > ../../include/openbabel/fingerprint.h:48: error: 'static >> >> > std::map<const char*, OpenBabel::OBPlugin*, >> >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const >> char* >> >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' >> >> > cannot be overloaded >> >> > ../../include/openbabel/fingerprint.h:43: error: with 'static >> >> > std::map<const char*, OpenBabel::OBPlugin*, >> >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const >> char* >> >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' >> >> > ../../include/openbabel/fingerprint.h:53: error: 'static >> >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' >> cannot >> >> > be overloaded >> >> > ../../include/openbabel/fingerprint.h:43: error: with 'static >> >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' >> >> > ../../include/openbabel/fingerprint.h: In constructor >> >> > 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)': >> >> > ../../include/openbabel/fingerprint.h:63: error: no match for >> >> > 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]' >> >> > /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: >> _Tp& >> >> > std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) >> [with >> >> > _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare = >> >> > OpenBabel::OBPlugin::CharPtrLess, _Alloc = >> >> > std::allocator<std::pair<const char* const, >> OpenBabel::OBPlugin*> >] >> >> > >> >> > >> >> >> But in an effort to provide more choice on the form of the output, >> >> there >> >> >> are three functions which provide a list of formats(or other >> plugin >> >> >> classes): OBPlugin::ListAsVector, ListAsString and List. The first >> >> two >> >> >> were intended to be compatible with scripting, although I need >> some >> >> >> advice here. ListAsString returns a (big) std::string, but >> >> ListAsVector >> >> >> has a parameter which is a reference to a std::vector. If this is >> >> >> incompatible with scripting languages I should change it. >> >> >> >> >> > There's no problem with vectors in general; these are simply >> >> > translated to lists by SWIG. >> >> > >> >> > >> >> >> All three have a parameter which can control what is in the >> >> output. For >> >> >> example if it contains "verbose" it output the whole >> description, not >> >> >> just the first line. So it would be easy to add code (4 extra >> >> lines) to >> >> >> output only the IDs if that would be useful: >> >> >> ListAsVector("formats","in/ids", stringvector) >> >> >> >> >> >> Post-processing in pybel I'm sure is useful, but if the C++ >> code was >> >> >> adequate it could serve other scripting languages as well. >> >> >> >> >> > I think so too. In the meanwhile, I would like to push out a >> Windows >> >> > Python release based on 2.1.0 with the current pybel >> enhancements. I'm >> >> > going to try to get this together this weekend and do some testing. >> >> > >> >> > Noel >> >> > >> >> > >> >> >> Chris >> >> >> >> >> >> Noel O'Boyle wrote: >> >> >> >> >> >>> After looking at the C++ code, I realise that maybe returning >> a list >> >> >>> of strings is the only choice for SupportedInputFormat. Anyway, >> >> in the >> >> >>> meanwhile I've added some code to pybel, so that if you access >> >> >>> pybel.informats or outformats, you will get a dictionary of >> >> supported >> >> >>> formats. >> >> >>> >> >> >>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote: >> >> >>> >> >> >>>> Actually, a vector of std::strings had not yet been >> swigified, so I >> >> >>>> needed to added to a line to openbabel-python.i to set it up >> >> (not yet >> >> >>>> checked in). However, there's an additional problem, which >> >> Jerome may >> >> >>>> like to address. >> >> >>>> >> >> >>>> The data that's returned is similar to: >> >> >>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... ) >> >> >>>> >> >> >>>> whereas it would make more sense to me either to return: >> >> >>>> ('acr', 'alc', ...) >> >> >>>> or >> >> >>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc': >> >> >>>> 'Alchemy format'] >> >> >>>> >> >> >>>> Note that the text [Read-only] is not really necessary in a >> list of >> >> >>>> supported input formats. >> >> >>>> >> >> >>>> Since this function was added for the benefit of scripting >> >> interfaces, >> >> >>>> it makes sense to make it as easy as possible to access the >> list of >> >> >>>> formats. >> >> >>>> >> >> >>>> Noel >> >> >>>> >> >> >>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote: >> >> >>>> >> >> >>>>> Hello again Jens, >> >> >>>>> >> >> >>>>> Good to hear from you on this list... :-) >> >> >>>>> >> >> >>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote: >> >> >>>>> >> >> >>>>>> Hi, >> >> >>>>>> >> >> >>>>>> I'm trying to enable our ccp1gui code >> >> >>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so >> >> that we >> >> >>>>>> no longer have to support so many formats. >> >> >>>>>> >> >> >>>>>> I've got most of the machinery in place, but am a bit stuck on >> >> how to >> >> >>>>>> dynamically determine what input formats are supported by >> >> openbabel. >> >> >>>>>> >> >> >>>>>> I originally tried to use OBConversion.GetNextFormat, but ran >> >> into the >> >> >>>>>> ground fairly quickly. I then discovered the post at: >> >> >>>>>> >> >> >>>>>> >> >> >> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting >> >> >> >> >> >>>>>> >> >> >>>>>> which suggest that I should be able to get what I want using >> >> >>>>>> GetSupportedInputFormat(), however, I'm currently pretty >> >> clueless as to >> >> >>>>>> how I extract the information from the object. I get something >> >> back as >> >> >>>>>> shown below, but I'd appreciated any advice on what I then >> >> need to do >> >> >>>>>> with it. >> >> >>>>>> >> >> >> >> >> >> ------------------------------------------------------------------------- >> >> >> >> >> >> This SF.net email is sponsored by DB2 Express >> >> >> Download DB2 Express C - the FREE version of DB2 express and take >> >> >> control of your XML. No limits. Just data. Click to get it now. >> >> >> http://sourceforge.net/powerbar/db2/ >> >> >> _______________________________________________ >> >> >> OpenBabel-scripting mailing list >> >> >> Ope...@li... >> >> >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >> >> >> >> >> >> >> >> > >> >> > >> >> >> ------------------------------------------------------------------------- >> >> >> >> >> > This SF.net email is sponsored by DB2 Express >> >> > Download DB2 Express C - the FREE version of DB2 express and take >> >> > control of your XML. No limits. Just data. Click to get it now. >> >> > http://sourceforge.net/powerbar/db2/ >> >> > _______________________________________________ >> >> > OpenBabel-scripting mailing list >> >> > Ope...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >> >> > >> >> > >> >> >> >> >> > >> >> > |
|
From: Noel O'B. <bao...@gm...> - 2007-05-17 11:46:12
|
On 17/05/07, Jens Thomas <j.m...@dl...> wrote: > Hi Noel, > > I've just worked out that the problem arose because I hadn't installed > anything and was running it directly from the build directory. I assume > it looks in a set directory for the files to dynamically configure the > supported formats. Can this be changed with an environment variable? The answer is yes.You need to set LD_LIBRARY_PATH to point to the directory containing libopenbabel.so, etc. You still need to run "make install" beforehand, though, to install all the formats to the correct location. I describe both "local" and "global" intalls on the wiki page. > Anyway, it's not important as once I'd installed everything into a > directory structure it then worked fine. > I should probably mention that I hit problems with the default version > of SWIG on Ubuntu wasn't able to handle the "-naturalvar" flag, so I had > to install swig 1.3.31 to get the build to work. I will add this to the install notes. > Many thanks for your help. > > Jens > > Noel O'Boyle wrote: > > The good news is that all the Python stuff seems to be working fine > > (no initialisation necessary). The bad news is that the C++ stuff > > isn't working properly. > > > > I'm betting that if you try "babel -H" and look under "The following > > file formats are recognized", you will see nothing there. Which is > > what you're also seeing in python. To verify, try to convert a file > > using babel. This is because the file formats are loaded dynamically > > as plugins, so there can be problems if you compile with particular > > settings. > > > > How exactly are you compiling the software? Did you follow the > > instructions on the web exactly (see > > http://openbabel.sourceforge.net/wiki/Install_%28source_code%29), or > > are you doing something different? I'm using an old version of Ubuntu > > myself, so there's no reason we can't get it to work. > > > > Regards > > Noel > > > > On 15/05/07, Jens Thomas <j.m...@dl...> wrote: > >> Hello! > >> > >> It's taken me a little while to grind through all the usual little > >> hiccups that come when building an unfamiliar code straight out of the > >> repository, but I've now got what (I think) is the correct version. > >> > >> I checked out the code at r1954 and patched with r1958 as suggested > >> by Noel. > >> > >> However, I'm not getting anything from pybel.informats or > >> OBConversion.GetSupportedInputFormats as shown below: > >> > >> > >> Python 2.4.3 (#2, Oct 6 2006, 07:52:30) > >> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 > >> Type "help", "copyright", "credits" or "license" for more information. > >> >>> import pybel > >> >>> pybel.informats > >> {} > >> >>> pybel.outformats > >> {} > >> >>> import openbabel > >> >>> obc = openbabel.OBConversion() > >> >>> i= obc.GetSupportedInputFormat() > >> >>> print i > >> () > >> >>> dir(i) > >> ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', > >> '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', > >> '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', > >> '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', > >> '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__'] > >> > >> > >> Is there some sort of initialisation I need to do to get the dictionary > >> populated? > >> > >> Many thanks, > >> > >> Jens > >> > >> Noel O'Boyle wrote: > >> > I've already noticed that the latest SVN is not compatible with SWIG > >> > due to changes introducted at r1954. You'll need to check out r1953, > >> > and use "svn merge -r 1957:1958" to patch with r1958. > >> > > >> > Noel > >> > > >> > On 14/05/07, Jens Thomas <j.m...@dl...> wrote: > >> >> Hi Noel, Jerome and Chris, > >> >> > >> >> Firstly, many thanks for the quick response and warm welcome to the > >> >> list! Please accept my apologies for not replying sooner, but I've > >> been > >> >> away without access to email. > >> >> > >> >> I've tried checking out the latest version of openbabel from SVN > >> onto my > >> >> Ubuntu box (Dapper on a Pentium 4) so that I can try some of the > >> changes > >> >> you've committed. I ran a normal configure (./configure), but the > >> make > >> >> currently fails with: > >> >> > >> >> make[2]: Leaving directory `/home/jmht/openbabel/test/cmltest' > >> >> make[2]: Entering directory `/home/jmht/openbabel/test' > >> >> g++ -DHAVE_CONFIG_H -I. -I../src -I../include > >> >> -DTESTDATADIR="\"../test/files/\"" -g -O2 -MT roundtrip.o -MD > >> -MP -MF > >> >> .deps/roundtrip.Tpo -c -o roundtrip.o roundtrip.cpp > >> >> mv -f .deps/roundtrip.Tpo .deps/roundtrip.Po > >> >> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o roundtrip > >> >> roundtrip.o ../src/libopenbabel.la -ldl -lm > >> >> mkdir .libs > >> >> g++ -g -O2 -o .libs/roundtrip roundtrip.o > >> ../src/.libs/libopenbabel.so > >> >> -ldl -lm -Wl,--rpath -Wl,/usr/local/lib > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBFormat::FormatFromMIME(char const*)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBPlugin::Display(std::basic_string<char, > >> >> std::char_traits<char>, std::allocator<char> >&, char const*, char > >> >> const*)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for > >> >> OpenBabel::OBDescriptor' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBDescriptor::Compare(OpenBabel::OBBase*, > >> >> std::basic_istream<char, std::char_traits<char> >&, bool)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to `vtable for > >> >> OpenBabel::OBPlugin' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBPlugin::ListAsVector(char const*, char const*, > >> >> std::vector<std::basic_string<char, std::char_traits<char>, > >> >> std::allocator<char> >, std::allocator<std::basic_string<char, > >> >> std::char_traits<char>, std::allocator<char> > > >&)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for > >> >> OpenBabel::OBPlugin' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBDescriptor::AddProperties(OpenBabel::OBBase*, > >> >> std::basic_string<char, std::char_traits<char>, > >> std::allocator<char> > > >> >> const&)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBDescriptor::GetStringValue(OpenBabel::OBBase*, > >> >> std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> >> >&)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBDescriptor::FilterCompare(OpenBabel::OBBase*, > >> >> std::basic_istream<char, std::char_traits<char> >&, bool)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBFormat::RegisterFormat(char const*, char const*)' > >> >> ../src/.libs/libopenbabel.so: undefined reference to `typeinfo for > >> >> OpenBabel::OBDescriptor' > >> >> ../src/.libs/libopenbabel.so: undefined reference to > >> >> `OpenBabel::OBDescriptor::DeleteProperties(OpenBabel::OBBase*, > >> >> std::basic_string<char, std::char_traits<char>, > >> std::allocator<char> > > >> >> const&)' > >> >> collect2: ld returned 1 exit status > >> >> make[2]: *** [roundtrip] Error 1 > >> >> > >> >> I'm not that familiar with C++ and so am bit stuck as to how to sort > >> >> this one out. > >> >> > >> >> Do you have any suggestions? > >> >> > >> >> Best wishes, > >> >> > >> >> Jens > >> >> > >> >> > >> >> Noel O'Boyle wrote: > >> >> > On 12/05/07, Chris Morley <c.m...@ds...> wrote: > >> >> > > >> >> >> In the revamped code for formats (and other plugins) recently > >> >> committed > >> >> >> to SVN HEAD (for the next OB version) I tried to maintain backward > >> >> >> compatibility as far as possible. So > >> >> OBConversion::SupportedInputFormat() > >> >> >> works as before but, you'll be pleased to hear, without the > >> >> '[Read-only]'. > >> >> >> > >> >> > Sounds good but SWIG doesn't like the new code. When I try to > >> compile > >> >> > openbabel_python.cpp, I get: > >> >> > > >> >> > ../../include/openbabel/fingerprint.h:48: error: 'static > >> >> > std::map<const char*, OpenBabel::OBPlugin*, > >> >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const > >> char* > >> >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' > >> >> > cannot be overloaded > >> >> > ../../include/openbabel/fingerprint.h:43: error: with 'static > >> >> > std::map<const char*, OpenBabel::OBPlugin*, > >> >> > OpenBabel::OBPlugin::CharPtrLess, std::allocator<std::pair<const > >> char* > >> >> > const, OpenBabel::OBPlugin*> > >& OpenBabel::OBFingerprint::Map()' > >> >> > ../../include/openbabel/fingerprint.h:53: error: 'static > >> >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' > >> cannot > >> >> > be overloaded > >> >> > ../../include/openbabel/fingerprint.h:43: error: with 'static > >> >> > OpenBabel::OBFingerprint*& OpenBabel::OBFingerprint::Default()' > >> >> > ../../include/openbabel/fingerprint.h: In constructor > >> >> > 'OpenBabel::OBFingerprint::OBFingerprint(std::string, bool)': > >> >> > ../../include/openbabel/fingerprint.h:63: error: no match for > >> >> > 'operator[]' in 'OpenBabel::OBFingerprint::Map()[ID]' > >> >> > /usr/include/c++/4.0.2/bits/stl_map.h:331: note: candidates are: > >> _Tp& > >> >> > std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) > >> [with > >> >> > _Key = const char*, _Tp = OpenBabel::OBPlugin*, _Compare = > >> >> > OpenBabel::OBPlugin::CharPtrLess, _Alloc = > >> >> > std::allocator<std::pair<const char* const, > >> OpenBabel::OBPlugin*> >] > >> >> > > >> >> > > >> >> >> But in an effort to provide more choice on the form of the output, > >> >> there > >> >> >> are three functions which provide a list of formats(or other > >> plugin > >> >> >> classes): OBPlugin::ListAsVector, ListAsString and List. The first > >> >> two > >> >> >> were intended to be compatible with scripting, although I need > >> some > >> >> >> advice here. ListAsString returns a (big) std::string, but > >> >> ListAsVector > >> >> >> has a parameter which is a reference to a std::vector. If this is > >> >> >> incompatible with scripting languages I should change it. > >> >> >> > >> >> > There's no problem with vectors in general; these are simply > >> >> > translated to lists by SWIG. > >> >> > > >> >> > > >> >> >> All three have a parameter which can control what is in the > >> >> output. For > >> >> >> example if it contains "verbose" it output the whole > >> description, not > >> >> >> just the first line. So it would be easy to add code (4 extra > >> >> lines) to > >> >> >> output only the IDs if that would be useful: > >> >> >> ListAsVector("formats","in/ids", stringvector) > >> >> >> > >> >> >> Post-processing in pybel I'm sure is useful, but if the C++ > >> code was > >> >> >> adequate it could serve other scripting languages as well. > >> >> >> > >> >> > I think so too. In the meanwhile, I would like to push out a > >> Windows > >> >> > Python release based on 2.1.0 with the current pybel > >> enhancements. I'm > >> >> > going to try to get this together this weekend and do some testing. > >> >> > > >> >> > Noel > >> >> > > >> >> > > >> >> >> Chris > >> >> >> > >> >> >> Noel O'Boyle wrote: > >> >> >> > >> >> >>> After looking at the C++ code, I realise that maybe returning > >> a list > >> >> >>> of strings is the only choice for SupportedInputFormat. Anyway, > >> >> in the > >> >> >>> meanwhile I've added some code to pybel, so that if you access > >> >> >>> pybel.informats or outformats, you will get a dictionary of > >> >> supported > >> >> >>> formats. > >> >> >>> > >> >> >>> On 12/05/07, Noel O'Boyle <bao...@gm...> wrote: > >> >> >>> > >> >> >>>> Actually, a vector of std::strings had not yet been > >> swigified, so I > >> >> >>>> needed to added to a line to openbabel-python.i to set it up > >> >> (not yet > >> >> >>>> checked in). However, there's an additional problem, which > >> >> Jerome may > >> >> >>>> like to address. > >> >> >>>> > >> >> >>>> The data that's returned is similar to: > >> >> >>>> ('acr -- ACR format [Read-only]', 'alc -- Alchemy format', ... ) > >> >> >>>> > >> >> >>>> whereas it would make more sense to me either to return: > >> >> >>>> ('acr', 'alc', ...) > >> >> >>>> or > >> >> >>>> a std::map (i.e. a Python dict) of ['acr' : 'ACR format', 'alc': > >> >> >>>> 'Alchemy format'] > >> >> >>>> > >> >> >>>> Note that the text [Read-only] is not really necessary in a > >> list of > >> >> >>>> supported input formats. > >> >> >>>> > >> >> >>>> Since this function was added for the benefit of scripting > >> >> interfaces, > >> >> >>>> it makes sense to make it as easy as possible to access the > >> list of > >> >> >>>> formats. > >> >> >>>> > >> >> >>>> Noel > >> >> >>>> > >> >> >>>> On 11/05/07, Noel O'Boyle <bao...@gm...> wrote: > >> >> >>>> > >> >> >>>>> Hello again Jens, > >> >> >>>>> > >> >> >>>>> Good to hear from you on this list... :-) > >> >> >>>>> > >> >> >>>>> On 10/05/07, Jens Thomas <j.m...@dl...> wrote: > >> >> >>>>> > >> >> >>>>>> Hi, > >> >> >>>>>> > >> >> >>>>>> I'm trying to enable our ccp1gui code > >> >> >>>>>> (http://sourceforge.net/projects/ccp1gui/) to use openbabel so > >> >> that we > >> >> >>>>>> no longer have to support so many formats. > >> >> >>>>>> > >> >> >>>>>> I've got most of the machinery in place, but am a bit stuck on > >> >> how to > >> >> >>>>>> dynamically determine what input formats are supported by > >> >> openbabel. > >> >> >>>>>> > >> >> >>>>>> I originally tried to use OBConversion.GetNextFormat, but ran > >> >> into the > >> >> >>>>>> ground fairly quickly. I then discovered the post at: > >> >> >>>>>> > >> >> >>>>>> > >> >> > >> http://sourceforge.net/mailarchive/forum.php?thread_name=200702191105.25888.j.pansanel%40pansanel.net&forum_name=openbabel-scripting > >> > >> >> > >> >> >>>>>> > >> >> >>>>>> which suggest that I should be able to get what I want using > >> >> >>>>>> GetSupportedInputFormat(), however, I'm currently pretty > >> >> clueless as to > >> >> >>>>>> how I extract the information from the object. I get something > >> >> back as > >> >> >>>>>> shown below, but I'd appreciated any advice on what I then > >> >> need to do > >> >> >>>>>> with it. > >> >> >>>>>> > >> >> >> > >> >> > >> ------------------------------------------------------------------------- > >> > >> >> > >> >> >> This SF.net email is sponsored by DB2 Express > >> >> >> Download DB2 Express C - the FREE version of DB2 express and take > >> >> >> control of your XML. No limits. Just data. Click to get it now. > >> >> >> http://sourceforge.net/powerbar/db2/ > >> >> >> _______________________________________________ > >> >> >> OpenBabel-scripting mailing list > >> >> >> Ope...@li... > >> >> >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > >> ------------------------------------------------------------------------- > >> > >> >> > >> >> > This SF.net email is sponsored by DB2 Express > >> >> > Download DB2 Express C - the FREE version of DB2 express and take > >> >> > control of your XML. No limits. Just data. Click to get it now. > >> >> > http://sourceforge.net/powerbar/db2/ > >> >> > _______________________________________________ > >> >> > OpenBabel-scripting mailing list > >> >> > Ope...@li... > >> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > >> > > > > |