On 17 June 2010 15:23, Rob Soe <kym3p...@gmail.com> 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 <baoille...@gmail.com> wrote: >> >> 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 > > ------------------------------------------------------------------------------ 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