Adding extra information to OBMol

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

Adding extra information to OBMol

Rob Soe
Hi all,

I have one molecule read from SDF and I can successfully store it and extract its information using standard OpenBabel function such as GetTitle(), etc.

I'd like to add information to this molecule, let's say, an arbitrary floating number as its random ID.

I saw OBMol class has SetData (OBGenericData *d) and GetData() function but I couldn't find an example how to use such function.

May I know if there is a working example using such functions?

Thanks so much!
Rob

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Noel O'Boyle
Administrator
You need create an OBPairData (a subclass of OBGenericData), and apply
it to the molecule using OBMol.SetData. I usually grep the OpenBabel
source for examples of things.

- Noel

On 7 June 2010 19:12, Rob Soe <[hidden email]> wrote:

> Hi all,
>
> I have one molecule read from SDF and I can successfully store it and
> extract its information using standard OpenBabel function such as
> GetTitle(), etc.
>
> I'd like to add information to this molecule, let's say, an arbitrary
> floating number as its random ID.
>
> I saw OBMol class has SetData (OBGenericData *d) and GetData() function but
> I couldn't find an example how to use such function.
>
> May I know if there is a working example using such functions?
>
> Thanks so much!
> Rob
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Geoffrey Hutchison
> You need create an OBPairData (a subclass of OBGenericData), and apply
> it to the molecule using OBMol.SetData. I usually grep the OpenBabel
> source for examples of things.

There are also working examples in the API documentation, e.g. (see the Detailed Description):

http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml

Cheers,
-Geoff
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Chris Morley-3
In reply to this post by Rob Soe
On 07/06/2010 19:12, Rob Soe wrote:

>
> I'd like to add information to this molecule, let's say, an arbitrary
> floating number as its random ID.
>
> I saw OBMol class has SetData
> <http://openbabel.org/dev-api/classOpenBabel_1_1OBBase.shtml#db6b0ec89bfea783825b3b466e4dbc00>
> (OBGenericData
> <http://openbabel.org/dev-api/classOpenBabel_1_1OBGenericData.shtml> *d)
> and GetData() function but I couldn't find an example how to use such
> function.
>
> May I know if there is a working example using such functions?

If your data can be represented by two strings - a name(aka key or
attribute) and a value - the simplest way is to use OBPairData. This
class derived from OBGenericData is used for the properties in SDF
files. The code OpenBabel uses for reading them (in mdlformat.cpp near
lines 558 and 824) provides a working example.

Any OBPairData attached to a molecule would be written to an SDF
output file, which may or may not be an advantage. In the next OB
version, this can be suppressed by making the DataOrigin 'local'.

Chris




------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Rob Soe
In reply to this post by Geoffrey Hutchison
Hi,
Thanks a lot for the suggestions.

I have this plan that I am trying to work out. I am planning to use OBSetData() and use SetAttribute() to set a string (converted from a float number that I want to associate the molecule with).

Here is the code: 

//Float to String conversion
  ostringstream buffer;
    double temp=0.987;
    buffer << temp;
    string strTemp = buffer.str();
//End

//Storing data using OBSetData()
    OBSetData *sim = new OBSetData();
    sim->SetAttribute(strTemp.c_str());
    mol.SetData(sim);
//End

So now the 'mol' should have the attribute data?

I am not sure how I can access such attribute data. I tried to use mol.getData() but it seems not working.

Thanks!
Rob

On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison <[hidden email]> wrote:
> You need create an OBPairData (a subclass of OBGenericData), and apply
> it to the molecule using OBMol.SetData. I usually grep the OpenBabel
> source for examples of things.

There are also working examples in the API documentation, e.g. (see the Detailed Description):

http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml

Cheers,
-Geoff


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Tim Vandermeersch
On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <[hidden email]> wrote:

> Hi,
> Thanks a lot for the suggestions.
>
> I have this plan that I am trying to work out. I am planning to use
> OBSetData() and use SetAttribute() to set a string (converted from a float
> number that I want to associate the molecule with).
>
> Here is the code:
>
> //Float to String conversion
>   ostringstream buffer;
>     double temp=0.987;
>     buffer << temp;
>     string strTemp = buffer.str();
> //End
>
> //Storing data using OBSetData()
>     OBSetData *sim = new OBSetData();
>     sim->SetAttribute(strTemp.c_str());
>     mol.SetData(sim);
> //End
>
> So now the 'mol' should have the attribute data?

Yes, but the attribute is the name for your data. SetValue and
GetValue should be used for setting the temperature.

sim->SettAttribute("temp");
sim->SetValue(strTemp.c_str())
mol.SetData(sim)

To retrieve:

OBSetData *data = mol.GetData("temp");

Tim

> I am not sure how I can access such attribute data. I tried to use
> mol.getData() but it seems not working.
>
> Thanks!
> Rob
>
> On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison
> <[hidden email]> wrote:
>>
>> > You need create an OBPairData (a subclass of OBGenericData), and apply
>> > it to the molecule using OBMol.SetData. I usually grep the OpenBabel
>> > source for examples of things.
>>
>> There are also working examples in the API documentation, e.g. (see the
>> Detailed Description):
>>
>> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>>
>> Cheers,
>> -Geoff
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Rob Soe
Hi
Thanks a lot for the suggestions. I can now set and retrieve such data.

Currently, I am trying to save the fingerprint information to each molecule. I am using GetFingerprint() (from OBFingerprint) and it generates a vector of unsigned int (vector<unsigned int>).

May I ask which OBGenericData class I should use to store such vector info?

Thanks so much for your help.
Rob

On Tue, Jun 8, 2010 at 11:15 PM, Tim Vandermeersch <[hidden email]> wrote:
On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <[hidden email]> wrote:
> Hi,
> Thanks a lot for the suggestions.
>
> I have this plan that I am trying to work out. I am planning to use
> OBSetData() and use SetAttribute() to set a string (converted from a float
> number that I want to associate the molecule with).
>
> Here is the code:
>
> //Float to String conversion
>   ostringstream buffer;
>     double temp=0.987;
>     buffer << temp;
>     string strTemp = buffer.str();
> //End
>
> //Storing data using OBSetData()
>     OBSetData *sim = new OBSetData();
>     sim->SetAttribute(strTemp.c_str());
>     mol.SetData(sim);
> //End
>
> So now the 'mol' should have the attribute data?

Yes, but the attribute is the name for your data. SetValue and
GetValue should be used for setting the temperature.

sim->SettAttribute("temp");
sim->SetValue(strTemp.c_str())
mol.SetData(sim)

To retrieve:

OBSetData *data = mol.GetData("temp");

Tim

> I am not sure how I can access such attribute data. I tried to use
> mol.getData() but it seems not working.
>
> Thanks!
> Rob
>
> On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison
> <[hidden email]> wrote:
>>
>> > You need create an OBPairData (a subclass of OBGenericData), and apply
>> > it to the molecule using OBMol.SetData. I usually grep the OpenBabel
>> > source for examples of things.
>>
>> There are also working examples in the API documentation, e.g. (see the
>> Detailed Description):
>>
>> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>>
>> Cheers,
>> -Geoff
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Noel O'Boyle
Administrator
On 17 June 2010 14:47, Rob Soe <[hidden email]> wrote:
> Hi
> Thanks a lot for the suggestions. I can now set and retrieve such data.
>
> Currently, I am trying to save the fingerprint information to each molecule.
> I am using GetFingerprint() (from OBFingerprint) and it generates a vector
> of unsigned int (vector<unsigned int>).
>
> May I ask which OBGenericData class I should use to store such vector info?

Have you considered simply using a STL container such as a std::map
from OBMol to OBFingerprint? Or simply iterating over a set of
molecules and push_back the OBFingerprint onto a vector?

> Thanks so much for your help.
> Rob
>
> On Tue, Jun 8, 2010 at 11:15 PM, Tim Vandermeersch
> <[hidden email]> wrote:
>>
>> On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <[hidden email]> wrote:
>> > Hi,
>> > Thanks a lot for the suggestions.
>> >
>> > I have this plan that I am trying to work out. I am planning to use
>> > OBSetData() and use SetAttribute() to set a string (converted from a
>> > float
>> > number that I want to associate the molecule with).
>> >
>> > Here is the code:
>> >
>> > //Float to String conversion
>> >   ostringstream buffer;
>> >     double temp=0.987;
>> >     buffer << temp;
>> >     string strTemp = buffer.str();
>> > //End
>> >
>> > //Storing data using OBSetData()
>> >     OBSetData *sim = new OBSetData();
>> >     sim->SetAttribute(strTemp.c_str());
>> >     mol.SetData(sim);
>> > //End
>> >
>> > So now the 'mol' should have the attribute data?
>>
>> Yes, but the attribute is the name for your data. SetValue and
>> GetValue should be used for setting the temperature.
>>
>> sim->SettAttribute("temp");
>> sim->SetValue(strTemp.c_str())
>> mol.SetData(sim)
>>
>> To retrieve:
>>
>> OBSetData *data = mol.GetData("temp");
>>
>> Tim
>>
>> > I am not sure how I can access such attribute data. I tried to use
>> > mol.getData() but it seems not working.
>> >
>> > Thanks!
>> > Rob
>> >
>> > On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison
>> > <[hidden email]> wrote:
>> >>
>> >> > You need create an OBPairData (a subclass of OBGenericData), and
>> >> > apply
>> >> > it to the molecule using OBMol.SetData. I usually grep the OpenBabel
>> >> > source for examples of things.
>> >>
>> >> There are also working examples in the API documentation, e.g. (see the
>> >> Detailed Description):
>> >>
>> >> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>> >>
>> >> Cheers,
>> >> -Geoff
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> > lucky parental unit.  See the prize list and enter to win:
>> > http://p.sf.net/sfu/thinkgeek-promo
>> > _______________________________________________
>> > OpenBabel-discuss mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>> >
>> >
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Rob Soe
Hi
Thanks for the suggestion. I may try using STL map. But here is a summary of what I am trying to do.

I am actually trying to optimize my code where I have N molecules and I am trying to compare every nth molecule to all N molecules and calculate Tanimoto (Tc) similarity scores.

So each time I am trying to compare, I have to get/generate the fingerprints of such pair of molecules every time I loop. So I am thinking my program may run faster if I first calculate fingerprint in advance and store them as extra info and just retrieve it whenever I am about to compare (to compute Tc score). In that way I don't have to regenerate the fingerprints again and again.

Thanks so much,
Rob

On Thu, Jun 17, 2010 at 10:04 AM, Noel O'Boyle <[hidden email]> wrote:
On 17 June 2010 14:47, Rob Soe <[hidden email]> wrote:
> Hi
> Thanks a lot for the suggestions. I can now set and retrieve such data.
>
> Currently, I am trying to save the fingerprint information to each molecule.
> I am using GetFingerprint() (from OBFingerprint) and it generates a vector
> of unsigned int (vector<unsigned int>).
>
> May I ask which OBGenericData class I should use to store such vector info?

Have you considered simply using a STL container such as a std::map
from OBMol to OBFingerprint? Or simply iterating over a set of
molecules and push_back the OBFingerprint onto a vector?

> Thanks so much for your help.
> Rob
>
> On Tue, Jun 8, 2010 at 11:15 PM, Tim Vandermeersch
> <[hidden email]> wrote:
>>
>> On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <[hidden email]> wrote:
>> > Hi,
>> > Thanks a lot for the suggestions.
>> >
>> > I have this plan that I am trying to work out. I am planning to use
>> > OBSetData() and use SetAttribute() to set a string (converted from a
>> > float
>> > number that I want to associate the molecule with).
>> >
>> > Here is the code:
>> >
>> > //Float to String conversion
>> >   ostringstream buffer;
>> >     double temp=0.987;
>> >     buffer << temp;
>> >     string strTemp = buffer.str();
>> > //End
>> >
>> > //Storing data using OBSetData()
>> >     OBSetData *sim = new OBSetData();
>> >     sim->SetAttribute(strTemp.c_str());
>> >     mol.SetData(sim);
>> > //End
>> >
>> > So now the 'mol' should have the attribute data?
>>
>> Yes, but the attribute is the name for your data. SetValue and
>> GetValue should be used for setting the temperature.
>>
>> sim->SettAttribute("temp");
>> sim->SetValue(strTemp.c_str())
>> mol.SetData(sim)
>>
>> To retrieve:
>>
>> OBSetData *data = mol.GetData("temp");
>>
>> Tim
>>
>> > I am not sure how I can access such attribute data. I tried to use
>> > mol.getData() but it seems not working.
>> >
>> > Thanks!
>> > Rob
>> >
>> > On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison
>> > <[hidden email]> wrote:
>> >>
>> >> > You need create an OBPairData (a subclass of OBGenericData), and
>> >> > apply
>> >> > it to the molecule using OBMol.SetData. I usually grep the OpenBabel
>> >> > source for examples of things.
>> >>
>> >> There are also working examples in the API documentation, e.g. (see the
>> >> Detailed Description):
>> >>
>> >> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>> >>
>> >> Cheers,
>> >> -Geoff
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> > lucky parental unit.  See the prize list and enter to win:
>> > http://p.sf.net/sfu/thinkgeek-promo
>> > _______________________________________________
>> > OpenBabel-discuss mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>> >
>> >
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Adding extra information to OBMol

Noel O'Boyle
Administrator
On 17 June 2010 15:23, Rob Soe <[hidden email]> wrote:

> Hi
> Thanks for the suggestion. I may try using STL map. But here is a summary of
> what I am trying to do.
>
> I am actually trying to optimize my code where I have N molecules and I am
> trying to compare every nth molecule to all N molecules and calculate
> Tanimoto (Tc) similarity scores.
>
> So each time I am trying to compare, I have to get/generate the fingerprints
> of such pair of molecules every time I loop. So I am thinking my program may
> run faster if I first calculate fingerprint in advance and store them as
> extra info and just retrieve it whenever I am about to compare (to compute
> Tc score). In that way I don't have to regenerate the fingerprints again and
> again.

Right. What I would do is store the Fingerprints in a vector, and when
I want to compare molecule 11 with molecule 15, I would simply access
fp_vector[15] and fp_vector.get[11]. I'm not sure but I would expect a
map to be both slower and use more memory.

> Thanks so much,
> Rob
>
> On Thu, Jun 17, 2010 at 10:04 AM, Noel O'Boyle <[hidden email]> wrote:
>>
>> On 17 June 2010 14:47, Rob Soe <[hidden email]> wrote:
>> > Hi
>> > Thanks a lot for the suggestions. I can now set and retrieve such data.
>> >
>> > Currently, I am trying to save the fingerprint information to each
>> > molecule.
>> > I am using GetFingerprint() (from OBFingerprint) and it generates a
>> > vector
>> > of unsigned int (vector<unsigned int>).
>> >
>> > May I ask which OBGenericData class I should use to store such vector
>> > info?
>>
>> Have you considered simply using a STL container such as a std::map
>> from OBMol to OBFingerprint? Or simply iterating over a set of
>> molecules and push_back the OBFingerprint onto a vector?
>>
>> > Thanks so much for your help.
>> > Rob
>> >
>> > On Tue, Jun 8, 2010 at 11:15 PM, Tim Vandermeersch
>> > <[hidden email]> wrote:
>> >>
>> >> On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <[hidden email]> wrote:
>> >> > Hi,
>> >> > Thanks a lot for the suggestions.
>> >> >
>> >> > I have this plan that I am trying to work out. I am planning to use
>> >> > OBSetData() and use SetAttribute() to set a string (converted from a
>> >> > float
>> >> > number that I want to associate the molecule with).
>> >> >
>> >> > Here is the code:
>> >> >
>> >> > //Float to String conversion
>> >> >   ostringstream buffer;
>> >> >     double temp=0.987;
>> >> >     buffer << temp;
>> >> >     string strTemp = buffer.str();
>> >> > //End
>> >> >
>> >> > //Storing data using OBSetData()
>> >> >     OBSetData *sim = new OBSetData();
>> >> >     sim->SetAttribute(strTemp.c_str());
>> >> >     mol.SetData(sim);
>> >> > //End
>> >> >
>> >> > So now the 'mol' should have the attribute data?
>> >>
>> >> Yes, but the attribute is the name for your data. SetValue and
>> >> GetValue should be used for setting the temperature.
>> >>
>> >> sim->SettAttribute("temp");
>> >> sim->SetValue(strTemp.c_str())
>> >> mol.SetData(sim)
>> >>
>> >> To retrieve:
>> >>
>> >> OBSetData *data = mol.GetData("temp");
>> >>
>> >> Tim
>> >>
>> >> > I am not sure how I can access such attribute data. I tried to use
>> >> > mol.getData() but it seems not working.
>> >> >
>> >> > Thanks!
>> >> > Rob
>> >> >
>> >> > On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison
>> >> > <[hidden email]> wrote:
>> >> >>
>> >> >> > You need create an OBPairData (a subclass of OBGenericData), and
>> >> >> > apply
>> >> >> > it to the molecule using OBMol.SetData. I usually grep the
>> >> >> > OpenBabel
>> >> >> > source for examples of things.
>> >> >>
>> >> >> There are also working examples in the API documentation, e.g. (see
>> >> >> the
>> >> >> Detailed Description):
>> >> >>
>> >> >> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>> >> >>
>> >> >> Cheers,
>> >> >> -Geoff
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------------
>> >> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> >> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> >> > lucky parental unit.  See the prize list and enter to win:
>> >> > http://p.sf.net/sfu/thinkgeek-promo
>> >> > _______________________________________________
>> >> > OpenBabel-discuss mailing list
>> >> > [hidden email]
>> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>> >> >
>> >> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> > lucky parental unit.  See the prize list and enter to win:
>> > http://p.sf.net/sfu/thinkgeek-promo
>> > _______________________________________________
>> > OpenBabel-discuss mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>> >
>> >
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss