From: Noel O'B. <bao...@gm...> - 2009-04-27 14:34:57
|
You're almost there. The result is in $fp. BTW, if you are interested in writing up some Perl recipes (e.g. the code below) on the wiki, it would be greatly appreciated. It would help other users avoid the same pitfalls. -- Noel 2009/4/27 Matt Ketterer <mke...@iu...>: > > Hi Noel, > Yes openbabel does work. I got perl to stop barking at me by taking away > the "new" in front of the fingerprint class as I see it is static. I'm > still unsure of how to return or print the value. I was trying to follow > the python implementation at > http://www.nabble.com/Re%3A-fingerprints-from-Python-td22189375.html#a22189375 > but am not sure how to manipulate the vector that was used. > > [matt@localhost Desktop]$ echo "C(=O)CCl" | babel -ismi -ofpt -xfFP2 >> 7 bits set > 00000000 00000000 00000000 00000000 00000000 00000300 > 00000000 00000000 00000000 08000000 00000000 40000000 > 00008004 00000000 00000000 00020000 > 1 molecule converted > 19 audit log messages > > #!/usr/bin/perl > use Chemistry::OpenBabel; > > my $smiles = "C(=O)CCl"; > my $obMol = new Chemistry::OpenBabel::OBMol; > my $obConversion = new Chemistry::OpenBabel::OBConversion; > $obConversion->SetInFormat("smi"); > $obConversion->ReadString($obMol,$smiles); > my $fingerprinter = > Chemistry::OpenBabel::OBFingerprint::FindFingerprint("FP2"); > > my $fp = new Chemistry::OpenBabel::vectorUnsignedInt(); > my $thumb = $fingerprinter->GetFingerprint($obMol, $fp); > print "$thumb\n"; #only returns 1 > > > > > > > > baoilleach wrote: >> >> Hello Matt, >> >> Did you download OpenBabel 2.2.1, remove any previous OpenBabel >> installation, and install globally or locally following the instructions >> at >> http://openbabel.org/wiki/Install_(source_code)? >> >> Does using babel work? E.g. >> bash-3.2$ echo "C(=O)CCl" | babel -ismi -ofpt -xfFP2 >>> 7 bits set >> 00000000 00000000 00000000 00000000 00000000 00000000 >> 00000000 00000000 00000000 00000000 00000000 40000000 >> 00008000 00000000 00000000 00000000 00000000 00000000 >> 00000000 00000000 00000000 00000300 00000000 00000000 >> 00000000 08000000 00000000 00000000 00000004 00000000 >> 00000000 00020000 >> 1 molecule converted >> 12 audit log messages >> >> OBFingerprint::FindFingerprint("FP2") should work fine if babel can find >> FP2. You should test your perl script in an empty directory. >> >> - Noel >> >> >> 2009/4/27 Matt Ketterer <mke...@iu...> >> >>> >>> I downloaded a fresh install and installed the wrappers and in the Perl >>> script I do see that it includes the header file for fingerprints but I >>> just >>> wanted to know if anyone else has had trouble pulling up methods from >>> this >>> class. when I do the OBFingerprint::GetDefault() or >>> OBFingerprint::FindFingerprint("FP2") it states that it might not be >>> loaded. >>> Thx, >>> Matt >>> >>> >>> >>> Matt Ketterer wrote: >>> > >>> > I am somewhat confused on how to obtain fingerprints using perl. I >>> tried >>> > doing a simple SetInAndOutFormats("smi","fpt") and then write the >>> molecule >>> > out but got a segmentation fault, while it worked for other formats >>> such >>> > as smiles to molfile. I am also unfamiliar with using the >>> > OBConversion.convert() function, as it complained that input and output >>> > was not set. >>> > >>> > I know that pybel is available and could use that although I am already >>> > using perl to parse pubchem data into a flat file before it goes into >>> my >>> > postgresql database and would like to calculate fingerprints from the >>> > smiles of each line on the fly before it goes in. >>> > Thanks for any help. >>> > >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Using-Fingerprinter-with-perl-tp23238185p23251252.html >>> Sent from the openbabel-scripting mailing list archive at Nabble.com. >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> Check out the new simplified licensign option that enables unlimited >>> royalty-free distribution of the report engine for externally facing >>> server and web deployment. >>> http://p.sf.net/sfu/businessobjects >>> _______________________________________________ >>> OpenBabel-scripting mailing list >>> Ope...@li... >>> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >>> >> >> ------------------------------------------------------------------------------ >> Crystal Reports - New Free Runtime and 30 Day Trial >> Check out the new simplified licensign option that enables unlimited >> royalty-free distribution of the report engine for externally facing >> server and web deployment. >> http://p.sf.net/sfu/businessobjects >> _______________________________________________ >> OpenBabel-scripting mailing list >> Ope...@li... >> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >> >> > > -- > View this message in context: http://www.nabble.com/Using-Fingerprinter-with-perl-tp23238185p23256721.html > Sent from the openbabel-scripting mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensign option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |