On 17 June 2010 14:47, Rob Soe <kym3p...@gmail.com> 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 > <tim.vandermeer...@gmail.com> wrote: >> >> On Tue, Jun 8, 2010 at 12:06 AM, Rob Soe <kym3p...@gmail.com> 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 >> > <ge...@geoffhutchison.net> 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 >> > OpenBabel-discuss@lists.sourceforge.net >> > 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 > OpenBabel-discuss@lists.sourceforge.net > 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 OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss