This list is closed, nobody may subscribe to it.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(10) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(3) |
Feb
(10) |
Mar
(5) |
Apr
(12) |
May
(8) |
Jun
(9) |
Jul
(3) |
Aug
(11) |
Sep
|
Oct
(26) |
Nov
(21) |
Dec
(20) |
2007 |
Jan
(10) |
Feb
(32) |
Mar
(14) |
Apr
(13) |
May
(44) |
Jun
(13) |
Jul
(18) |
Aug
(26) |
Sep
(17) |
Oct
(3) |
Nov
(10) |
Dec
(8) |
2008 |
Jan
(20) |
Feb
(8) |
Mar
(28) |
Apr
(18) |
May
(22) |
Jun
(13) |
Jul
(4) |
Aug
(2) |
Sep
(19) |
Oct
(17) |
Nov
(8) |
Dec
(10) |
2009 |
Jan
(4) |
Feb
(3) |
Mar
(12) |
Apr
(15) |
May
(7) |
Jun
(1) |
Jul
(13) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(14) |
Dec
(13) |
2010 |
Jan
(9) |
Feb
(6) |
Mar
(21) |
Apr
(12) |
May
(4) |
Jun
|
Jul
(2) |
Aug
(15) |
Sep
(3) |
Oct
(1) |
Nov
(18) |
Dec
(6) |
2011 |
Jan
(7) |
Feb
(13) |
Mar
(17) |
Apr
(7) |
May
(16) |
Jun
(21) |
Jul
(15) |
Aug
(11) |
Sep
(12) |
Oct
(3) |
Nov
(14) |
Dec
(4) |
2012 |
Jan
(10) |
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(1) |
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Noel O'B. <bao...@gm...> - 2008-05-21 12:44:54
|
2008/5/21 Nick England <nic...@gm...>: > Hello all, > > I am experiencing some odd behavoir with the python bindings. A simple > program to read in an index file: > > #! /usr/bin/env python > import openbabel > import pybel > allmols=[] > obconversion = openbabel.OBConversion() > obconversion.SetInFormat("fs") > obmol = openbabel.OBMol() > > notatend = obconversion.ReadFile(obmol,"index.fs") > > while notatend: > > allmols.append(obmol) > obmol=openbabel.OBMol() > notatend=obconversion.Read(obmol) > pybel.Molecule(obmol).write("smi","results.smi",True) > > is failing with the message: > "Not a valid input format" What line is failing? Try "success = obconversion.SetInFormat("fs")" and check its value. If the value is True, then the problem is not setting the format, but rather reading the file. Is the inputfile valid? Is it from the same operating system? If so, it sounds like a bug. Can you file one and provide the input file (use a short example, if possible). > However typing babel -Hfs and obconversion.GetSupportedInputFormat() > both list the fastsearch format as being present. The command babel > -ifs index.fs -osmi works fine, and the python program above works if > the format isn't fs. > I would also like to add the line > obconversion.AddOption('s',openbabel.OBConversion::GENOPTIONS,searchstring) > (but this is throwing a syntax error on the OBCoversion::GENOPTIONS > part, this is my first attempt at using python however so its not > unexpected!) Try using the interactive Python prompt: >>> dir(openbabel.OBConversion()) ['ALL', 'AddChemObject', 'AddOption', 'CloseOutFile', 'Convert', 'CopyOptions', ... GENOPTIONS', 'GetAuxConv', 'GetChemObject', 'GetDefaultFormat', 'GetInFilename', 'GetInFormat', 'GetInLen', 'GetInPos', 'GetInStream', 'GetOptionParams', 'GetOp ... 'thisown'] >>> openbabel.OBConversion.GENOPTIONS 2 > Any help would be appreciated! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Nick E. <nic...@gm...> - 2008-05-21 11:26:17
|
Hello all, I am experiencing some odd behavoir with the python bindings. A simple program to read in an index file: #! /usr/bin/env python import openbabel import pybel allmols=[] obconversion = openbabel.OBConversion() obconversion.SetInFormat("fs") obmol = openbabel.OBMol() notatend = obconversion.ReadFile(obmol,"index.fs") while notatend: allmols.append(obmol) obmol=openbabel.OBMol() notatend=obconversion.Read(obmol) pybel.Molecule(obmol).write("smi","results.smi",True) is failing with the message: "Not a valid input format" However typing babel -Hfs and obconversion.GetSupportedInputFormat() both list the fastsearch format as being present. The command babel -ifs index.fs -osmi works fine, and the python program above works if the format isn't fs. I would also like to add the line obconversion.AddOption('s',openbabel.OBConversion::GENOPTIONS,searchstring) (but this is throwing a syntax error on the OBCoversion::GENOPTIONS part, this is my first attempt at using python however so its not unexpected!) Any help would be appreciated! |
From: Noel O'B. <bao...@gm...> - 2008-05-07 11:07:43
|
For those of you who are using the development version of OpenBabel on Linux, I would appreciate feedback on the new draw() method of Molecules. This uses BKchem's OASA module to layout the 2D structure of a molecule and then depict it (on the screen, or written to a file). For example, pybel.readstring("smi", "CCN").draw() pops up a window showing the molecule. (See the docstring for more info) For this to work, you will need to get and unzip bkchem-0.12.0.tar.gz and point PYTHONPATH to bkchem-0.12.0/bkchem/oasa (I note that BKchem will be in the next version of Debian). OASA has a dependency on pycairo (python-cairo in Debian). If you want to popup a window (rather than just write to a file), you will need PIL and PIL extensions for Tk (python-imaging and python-imaging-tk in Debian). All these dependencies are optional. Noel |
From: Florian N. <fn...@ca...> - 2008-05-01 19:02:16
|
On 1 May 2008, at 19:24, Noel O'Boyle wrote: >> It comes back to my earlier question on openbabel-discuss of how >> to delete >> atoms. The solution pointed out by Tim (keeping a vector of the >> atoms, >> std::vector<OBAtom*>) would work fine, were I doing my programming >> in C++. > > Actually - this works fine. You can just store them in a Python list. > For example, in the following program I delete two atoms which are not > adjacent in the SMILES string without any problems: > [...] > So I think this solves your problem, right? > I just gave that a try, and it seems to work perfectly fine. That is clearly a way better solution that to keep the indices. But why keep the indices, if you can keep the whole atom? :) Learned something new! Thanks! > >> I do agree that wrapping all possible types of vectors is not very >> sustainable. But one of the nicer features of C++ STL containers >> is that one >> can store any kind of object in them - how then would you change the >> underlying OB implementation? C arrays of pointers to OBAtoms? >> Perhaps one >> could think of a general interface for accessing the std::vector >> components >> of OB from python? > The problem is that Python is C, not C++, and so doesn't support > templating. As a result, for every different template of a > std::vector, there needs to be completely different C code for > handling it. Anyway, this is more of a long-term problem...:-) > Yes, that is certainly true. But by giving up on these features you basically give up on OB being in C++... And C++ is quite nice because of these STL features. |
From: Noel O'B. <bao...@gm...> - 2008-05-01 18:24:24
|
> It comes back to my earlier question on openbabel-discuss of how to delete > atoms. The solution pointed out by Tim (keeping a vector of the atoms, > std::vector<OBAtom*>) would work fine, were I doing my programming in C++. Actually - this works fine. You can just store them in a Python list. For example, in the following program I delete two atoms which are not adjacent in the SMILES string without any problems: =================================== mol = pybel.readstring("smi", "C(C)(O)C(Cl)Br") print mol assert len(mol.atoms) == 6 # Delete the oxygen and the bromine atoms_to_delete = [mol.atoms[i].OBAtom for i in [2, -1]] mol.OBMol.DeleteAtom(atoms_to_delete[0]) assert len(mol.atoms) == 5 print mol mol.OBMol.DeleteAtom(atoms_to_delete[1]) assert len(mol.atoms) == 4 print mol =================================== gives the following output: =================================== C(C)(O)C(Cl)Br C(C)C(Cl)Br C(C)CCl =================================== So I think this solves your problem, right? > I do agree that wrapping all possible types of vectors is not very > sustainable. But one of the nicer features of C++ STL containers is that one > can store any kind of object in them - how then would you change the > underlying OB implementation? C arrays of pointers to OBAtoms? Perhaps one > could think of a general interface for accessing the std::vector components > of OB from python? The problem is that Python is C, not C++, and so doesn't support templating. As a result, for every different template of a std::vector, there needs to be completely different C code for handling it. Anyway, this is more of a long-term problem...:-) > Cheers, > > Flo > |
From: Florian N. <fn...@ca...> - 2008-05-01 17:35:15
|
On 1 May 2008, at 16:32, Noel O'Boyle wrote: > The short answer is that it's simply not possible at the moment. Why > do you need to do this? Maybe I can think of a workaround. > It comes back to my earlier question on openbabel-discuss of how to delete atoms. The solution pointed out by Tim (keeping a vector of the atoms, std::vector<OBAtom*>) would work fine, were I doing my programming in C++. The second solution, deleting atoms from higher to lower indices seems to work most of the time (I do have a suspicion that I might not always work), but consider the following case: Fragment to keep has indices 4,5,6,7,8,9,10. No doubt deleting all atoms with indices above 10 will not cause any troubles, but what about removal of atoms 1,2,3? Surely if I remove atom with index 1, another one will become atom index 1, hence the indices of the atom I want to keep have changed. Now one could keep track of how many atoms with an index below the lowest index to be kept have been removed, and correct for that, but that seems excessively cumbersome to me. Hence the reordering: when the fragment to be kept has indices 1 to N, then everything from N+1 upwards can be removed without having to care what it is. > The long answer is that this is because we don't create a wrapper for > std::vector of OBAtoms (we do wrap other objects though). I am > increasingly convinced that all std::vector methods in OpenBabel that > use objects of various types, should be replaced (for scripting > languages) with equivalents that simply involve std::vectors of > integers (for example, this could be done for RenumberAtoms). It's not > feasible to keep creating new wrappers for every type of std::vector. > I am happy to create a list of all such methods. > I do agree that wrapping all possible types of vectors is not very sustainable. But one of the nicer features of C++ STL containers is that one can store any kind of object in them - how then would you change the underlying OB implementation? C arrays of pointers to OBAtoms? Perhaps one could think of a general interface for accessing the std::vector components of OB from python? Cheers, Flo |
From: Noel O'B. <bao...@gm...> - 2008-05-01 15:32:51
|
The short answer is that it's simply not possible at the moment. Why do you need to do this? Maybe I can think of a workaround. The long answer is that this is because we don't create a wrapper for std::vector of OBAtoms (we do wrap other objects though). I am increasingly convinced that all std::vector methods in OpenBabel that use objects of various types, should be replaced (for scripting languages) with equivalents that simply involve std::vectors of integers (for example, this could be done for RenumberAtoms). It's not feasible to keep creating new wrappers for every type of std::vector. I am happy to create a list of all such methods. Noel 2008/4/30 Florian Nigsch <fn...@ca...>: > Hi all, > > How do I use OBMol.RenumberAtoms() in python? > > Assume I have 30 atoms, and I want to renumber them in reverse order, > i.e., 1 becomes 30, 2 becomes 29, ... > > -) I get a list with numbers 30, 29, ... 2, 1: > >>> l = range(1, 31) > >>> l.reverse() > >>> l > [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, > 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] > > -) I get a list of OBAtoms required for RenumberAtoms(): > >>> oblist = [mol.atoms[x-1].OBAtom for x in l] > > -) I try my luck with OBMol.RenumberAtoms(oblist) ... > >>> mol.OBMol.RenumberAtoms(oblist) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/openbabel.py", line 1941, in RenumberAtoms > def RenumberAtoms(*args): return _openbabel.OBMol_RenumberAtoms > (*args) > TypeError: in method 'OBMol_RenumberAtoms', argument 2 of type > 'std::vector<OpenBabel::OBAtom *,std::allocator<OpenBabel::OBAtom * > > > &' > > ... and fail, because OBMol::RenumberAtoms(std::vector< OBAtom * > & > v) wants a reference to a vector of pointers of OBAtoms, which my > list apparently is not. > > Any ideas how to make that work? A look at the openbabel module > source file didn't help me either in this case. > > Thanks a lot, > > Flo > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Florian N. <fn...@ca...> - 2008-04-30 17:31:39
|
Hi all, How do I use OBMol.RenumberAtoms() in python? Assume I have 30 atoms, and I want to renumber them in reverse order, i.e., 1 becomes 30, 2 becomes 29, ... -) I get a list with numbers 30, 29, ... 2, 1: >>> l = range(1, 31) >>> l.reverse() >>> l [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] -) I get a list of OBAtoms required for RenumberAtoms(): >>> oblist = [mol.atoms[x-1].OBAtom for x in l] -) I try my luck with OBMol.RenumberAtoms(oblist) ... >>> mol.OBMol.RenumberAtoms(oblist) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/openbabel.py", line 1941, in RenumberAtoms def RenumberAtoms(*args): return _openbabel.OBMol_RenumberAtoms (*args) TypeError: in method 'OBMol_RenumberAtoms', argument 2 of type 'std::vector<OpenBabel::OBAtom *,std::allocator<OpenBabel::OBAtom * > > &' ... and fail, because OBMol::RenumberAtoms(std::vector< OBAtom * > & v) wants a reference to a vector of pointers of OBAtoms, which my list apparently is not. Any ideas how to make that work? A look at the openbabel module source file didn't help me either in this case. Thanks a lot, Flo |
From: Noel O'B. <bao...@gm...> - 2008-04-29 20:25:58
|
2008/4/29 Noel O'Boyle <bao...@gm...>: > ---------- Forwarded message ---------- > From: Florian Nigsch <fn...@ca...> > Date: 2008/4/29 > Subject: pybel: Addition of hydrogens > To: Noel O'Boyle <bao...@gm...> > > > > Hi Noel, > > And here we go with the next question: > > 1) I read in a molecule (sildenafil), remove the hydrogens, get a > canonical smiles > (CCOc1ccc(cc1c1nc(=O)c2n(C)nc(CCC)c2[nH]1)S(=O)(=O)N1CCN(C)CC1) which > I keep to create the same molecule again later. > 2) I read the molecule back in from the smiles with pybel.readstring() > 3) I delete the hydrogens with OBMol.DeleteHydrogens() > 4) I match with pybel.Smarts("[R]~[!R]") - i.e., get anything > non-ring that is connected to a ring > 5) print [m.atoms[x-1].OBAtom.GetType() for (y,x) in SmartsMatch] and get > > ['O3', 'So2', 'O2', 'C3', 'C3', 'So2', 'C3'] - which is fine. > > If I leave out step 3, then I find > > ['O3', 'So2', 'O2', 'C3', 'C3', 'H', 'So2', 'C3'] > > and there is suddenly a hydrogen in there. Where does it come from? I note that the canonical smiles in step 1 also contains a hydrogen. I have a feeling that the hydrogen is necessary to specify the protonation state of the N in the ring. Maybe someone else can comment. > Does OpenBabel add hydrogens internally when reading in from a smiles? > Why does it only match one out of all possible ring-hydrogens (there > are about 8 I think)? > > Thanks a lot, > > Flo > |
From: Noel O'B. <bao...@gm...> - 2008-04-29 20:21:01
|
---------- Forwarded message ---------- From: Florian Nigsch <fn...@ca...> Date: 2008/4/29 Subject: pybel: Addition of hydrogens To: Noel O'Boyle <bao...@gm...> Hi Noel, And here we go with the next question: 1) I read in a molecule (sildenafil), remove the hydrogens, get a canonical smiles (CCOc1ccc(cc1c1nc(=O)c2n(C)nc(CCC)c2[nH]1)S(=O)(=O)N1CCN(C)CC1) which I keep to create the same molecule again later. 2) I read the molecule back in from the smiles with pybel.readstring() 3) I delete the hydrogens with OBMol.DeleteHydrogens() 4) I match with pybel.Smarts("[R]~[!R]") - i.e., get anything non-ring that is connected to a ring 5) print [m.atoms[x-1].OBAtom.GetType() for (y,x) in SmartsMatch] and get ['O3', 'So2', 'O2', 'C3', 'C3', 'So2', 'C3'] - which is fine. If I leave out step 3, then I find ['O3', 'So2', 'O2', 'C3', 'C3', 'H', 'So2', 'C3'] and there is suddenly a hydrogen in there. Where does it come from? Does OpenBabel add hydrogens internally when reading in from a smiles? Why does it only match one out of all possible ring-hydrogens (there are about 8 I think)? Thanks a lot, Flo |
From: <wa...@pu...> - 2008-04-11 04:35:39
|
Hey, I solved my problem. Somehow I was using an old version that did not include pybel. Thank you for your help, Matt Quoting Noel O'Boyle <bao...@gm...>: > Did you follow the instructions on the install page? If you carried > out Step B2, "python setup.py install", then there is no need to add > anything to your PYTHONPATH, and both "import openbabel" and "import > pybel" will work. > > If you are doing a local installation, then perhaps you forgot Step E2. > > Noel > > On 10/04/2008, wa...@pu... <wa...@pu...> wrote: > > Hello, > > > > I compiled the python bindings and added them to my PYTHONPATH. I can > "import > > openbabel" cannot "import pybel": > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > ImportError: No module named pybel > > > > I am very confused. I suspect I missed something simple. If you could > point me > > in the right direction, I would appreciate it. > > > > Thank you, > > Matt Walsh > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > > Don't miss this year's exciting event. There's still time to save $100. > > Use priority code J8TL2D2. > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > _______________________________________________ > > OpenBabel-scripting mailing list > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > > |
From: <wa...@pu...> - 2008-04-11 03:24:55
|
> Did you follow the instructions on the install page? If you carried > out Step B2, "python setup.py install", then there is no need to add > anything to your PYTHONPATH, and both "import openbabel" and "import > pybel" will work. > > If you are doing a local installation, then perhaps you forgot Step E2. > > Noel Thanks a lot for your help. This is baffling. I can can "import openbabel," but cannot "import pybel" in python. I followed the instructions. After it didn't work out I deleted everything and tried over three time altogether. I have the same problem each time. I am using Red Hat Enterprise 4 on my lab's server. I do not have root access. Maybe if you know more about what I am doing, you can help me understand what I am missing. He is the result of the python bindings part of the installation: ****************** export PATH=$PATH:/home/walshmj/artephius/sources/bin export PYTHONPATH=$PYTHONPATH:/home/walshmj/artephius/sources/lib/python2.3/site-packages export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/walshmj/artephius/sources/lib export OPENBABEL_INSTALL=/home/walshmj/artephius/sources -bash-3.00$ python setup.py build INFO: Using the value of $OPENBABEL_INSTALL (/home/walshmj/artephius/sources) running build running build_py creating build creating build/lib.linux-i686-2.3 copying openbabel.py -> build/lib.linux-i686-2.3 running build_ext building '_openbabel' extension creating build/temp.linux-i686-2.3 gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -D_GNU_SOURCE -fPIC -fPIC -I/home/walshmj/artephius/sources/include/openbabel-2.0 -I/home/walshmj/artephius/sources/include/openbabel-2.0/openbabel -I/usr/include/python2.3 -c openbabel_python.cpp -o build/temp.linux-i686-2.3/openbabel_python.o c++ -pthread -shared build/temp.linux-i686-2.3/openbabel_python.o -L/home/walshmj/artephius/sources/lib -lopenbabel -o build/lib.linux-i686-2.3/_openbabel.so -bash-3.00$ python setup.py install --prefix=/home/walshmj/artephius/sources INFO: Using the value of $OPENBABEL_INSTALL (/home/walshmj/artephius/sources) running install running build running build_py running build_ext running install_lib copying build/lib.linux-i686-2.3/_openbabel.so -> /home/walshmj/artephius/sources/lib/python2.3/site-packages -bash-3.00$ python Python 2.3.4 (#1, Nov 20 2007, 15:18:15) [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import openbabel ** no problem ** >>> import pybel ** one problem: ** Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named pybel ****************** I can't explain this. All of the other packages I install to that directory can be accessed. Thanks again for your help, Matt Walsh > > On 10/04/2008, wa...@pu... <wa...@pu...> wrote: > > Hello, > > > > I compiled the python bindings and added them to my PYTHONPATH. I can > "import > > openbabel" cannot "import pybel": > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > ImportError: No module named pybel > > > > I am very confused. I suspect I missed something simple. If you could > point me > > in the right direction, I would appreciate it. > > > > Thank you, > > Matt Walsh > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > > Don't miss this year's exciting event. There's still time to save $100. > > Use priority code J8TL2D2. > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > _______________________________________________ > > OpenBabel-scripting mailing list > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > > |
From: Noel O'B. <bao...@gm...> - 2008-04-10 22:03:20
|
Did you follow the instructions on the install page? If you carried out Step B2, "python setup.py install", then there is no need to add anything to your PYTHONPATH, and both "import openbabel" and "import pybel" will work. If you are doing a local installation, then perhaps you forgot Step E2. Noel On 10/04/2008, wa...@pu... <wa...@pu...> wrote: > Hello, > > I compiled the python bindings and added them to my PYTHONPATH. I can "import > openbabel" cannot "import pybel": > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > ImportError: No module named pybel > > I am very confused. I suspect I missed something simple. If you could point me > in the right direction, I would appreciate it. > > Thank you, > Matt Walsh > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: <wa...@pu...> - 2008-04-10 01:15:34
|
Hello, I compiled the python bindings and added them to my PYTHONPATH. I can "import openbabel" cannot "import pybel": Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named pybel I am very confused. I suspect I missed something simple. If you could point me in the right direction, I would appreciate it. Thank you, Matt Walsh |
From: lunchbox99 <lun...@tp...> - 2008-04-06 12:38:27
|
Lol, I'm such a newbie. Your solution is so much nicer! It prints in reverse order compared to OB gui but otherwise fine. Where I went wrong was I didn't have a clue how to read the OBFingerprint components derived from fps.fp but I could get the "on" bits from fps.bits. I couldn't think how to convert those bits directly to hex without first making the bitstring. I had a feeling it was very convoluted. Now that I re-read the class description for OBFingerprint, it does say "These fingerprints are condensed representation of molecules as a list of boolean values (actually bits in a vector<unsigned>) with length of a power of 2". I assume the key being "a list of Boolean values". Cheers for the help, mc -----Original Message----- From: Noel O'Boyle [mailto:bao...@gm...] Sent: Sunday, 6 April 2008 8:29 PM To: lunchbox99 Cc: ope...@li... Subject: Re: [OpenBabel-scripting] fingerprint to hex I'm at the ACS, so can't test this at the moment... It's not clear to me why you're converting the components of the OBFingerprint to a string representation of a binary number, and then to a string representation of a hexadecimal number. It would be easier to just print it out as hexadeciminal in the first place: print ["%x" % num for num in fps.fp] Remember that no matter how you represent it, it's still the same number. So there's no real reason to convert to a hexadeciminal string. It would be much more efficient to simply store the original number. A string of a integer (whether decimal, binary or hexadecimal) takes up more space than the integer itself, and needs to be converted back to an integer to perform any maths. Noel On 06/04/2008, lunchbox99 <lun...@tp...> wrote: > > > > > Now that the script works, you can just replace the bitstring slices with a > full length hex conversion if you like. > > The final script: > > > > import pybel, openbabel > > > > #read smiles using pybel > > mol=pybel.readstring('smi', > 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ > > (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ > > O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') > > mol.OBMol.AddHydrogens() > > > > #get list of "on" bits > > fps=mol.calcfp().bits > > > > #make binary string from bit list > > bitstring=list('0'*1024) > > for item in fps: > > bitstring[item-1]='1' > > > > #reverse bit order to match openbabel gui > > reverse_bitstring=''.join(reversed(bitstring)) > > > > #convert bitstring to hexadecimel > > print '%0256x'%(int(reverse_bitstring,2)) > > > > > > mc > > > > > > > > From: lunchbox99 [mailto:lun...@tp...] > Sent: Sunday, 6 April 2008 6:47 PM > To: 'lunchbox99'; > ope...@li... > Subject: RE: [OpenBabel-scripting] fingerprint to hex > > > > > OK found errors in my string slices - how embarrassing!! > > > > Revised hex conversion: > > > > #convert bitstring to hexadecimel > > for i in range(0, len(bitstring)-1,32): > > print '%08x'%(int(bitstring[i:i+32],2)), > > > > My script (fixed): > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > Openbabel GUI: > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > mc > > > > > > > > From: ope...@li... > [mailto:ope...@li...] > On Behalf Of lunchbox99 > Sent: Sunday, 6 April 2008 6:03 PM > To: ope...@li... > Subject: Re: [OpenBabel-scripting] fingerprint to hex > > > > Well I wrote a basic method to generate hex fingerprint strings like those > produced by the openbabel GUI. Not sure if there are built-in methods to do > this but it seems to work, sorta. > > > > import pybel, openbabel > > > > #read smiles using pybel > > mol=pybel.readstring('smi', > 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ > > (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ > > O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') > > mol.OBMol.AddHydrogens() #make explicit Hs > > > > #get list of on bits > > fps=mol.calcfp().bits > > > > #make bit string from bit list > > temp=list('0'*1024) > > for item in fps: > > temp[item-1]='1' > > print ''.join(temp) #bit string in native bit order > > print > > bitstring=''.join(reversed(temp)) #reverse bit order to > match openbabel gui output > > print bitstring > > print > > > > #convert bitstring to hexadecimel > > for i in range(1, len(bitstring),32): > > print '%08x'%(int(bitstring[i:i+31],2)), #slice 32 > bits, convert bin string to int, format as hex padding with zeros > > > > > > I deliberately used a large structure in this example to set a lot of bits > in the resulting fingerprint. Curiously, the output hex doesn't EXACTLY > match the fingerprint produced by the openbabel GUI. The fifth and fifth > last set of numbers are not exactly the same!? Other smaller examples are > identical. > > > > From my script: > > 00000040 01000020 00000800 00810100 00280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > 24000020 00000200 01000000 24a20000 00000000 > > > > From Openbabel GUI: > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > Anyone see a bug in my script? Is it a bug in openbabel GUI? Is there some > other reason? > > > > mc > > > > > > > > From: ope...@li... > [mailto:ope...@li...] > On Behalf Of lunchbox99 > Sent: Sunday, 6 April 2008 9:53 AM > To: ope...@li... > Subject: [OpenBabel-scripting] fingerprint to hex > > > > Does anyone know a simple method to convert an OB fingerprint to a > hexadecimal representation like the babel GUI produces? > > > > import pybel > > mol=pybel.readstring('smi', 'C1CCCCC1') > > fps=mol.calcfp() > > > > Now how to convert fps to hex string? > > > > eg, fp from the OB gui > > 00000000 01000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 40000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 02002000 00000001 00000000 00000000 00000000 00000010 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Register now and save $200. Hurry, offer ends at 11:59 p.m., > Monday, April 7! Use priority code J8TLD2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javao ne > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > |
From: Noel O'B. <bao...@gm...> - 2008-04-06 10:35:36
|
I'm at the ACS, so can't test this at the moment... It's not clear to me why you're converting the components of the OBFingerprint to a string representation of a binary number, and then to a string representation of a hexadecimal number. It would be easier to just print it out as hexadeciminal in the first place: print ["%x" % num for num in fps.fp] Remember that no matter how you represent it, it's still the same number. So there's no real reason to convert to a hexadeciminal string. It would be much more efficient to simply store the original number. A string of a integer (whether decimal, binary or hexadecimal) takes up more space than the integer itself, and needs to be converted back to an integer to perform any maths. Noel On 06/04/2008, lunchbox99 <lun...@tp...> wrote: > > > > > Now that the script works, you can just replace the bitstring slices with a > full length hex conversion if you like. > > The final script: > > > > import pybel, openbabel > > > > #read smiles using pybel > > mol=pybel.readstring('smi', > 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ > > (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ > > O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') > > mol.OBMol.AddHydrogens() > > > > #get list of "on" bits > > fps=mol.calcfp().bits > > > > #make binary string from bit list > > bitstring=list('0'*1024) > > for item in fps: > > bitstring[item-1]='1' > > > > #reverse bit order to match openbabel gui > > reverse_bitstring=''.join(reversed(bitstring)) > > > > #convert bitstring to hexadecimel > > print '%0256x'%(int(reverse_bitstring,2)) > > > > > > mc > > > > > > > > From: lunchbox99 [mailto:lun...@tp...] > Sent: Sunday, 6 April 2008 6:47 PM > To: 'lunchbox99'; > ope...@li... > Subject: RE: [OpenBabel-scripting] fingerprint to hex > > > > > OK found errors in my string slices - how embarrassing!! > > > > Revised hex conversion: > > > > #convert bitstring to hexadecimel > > for i in range(0, len(bitstring)-1,32): > > print '%08x'%(int(bitstring[i:i+32],2)), > > > > My script (fixed): > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > Openbabel GUI: > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > mc > > > > > > > > From: ope...@li... > [mailto:ope...@li...] > On Behalf Of lunchbox99 > Sent: Sunday, 6 April 2008 6:03 PM > To: ope...@li... > Subject: Re: [OpenBabel-scripting] fingerprint to hex > > > > Well I wrote a basic method to generate hex fingerprint strings like those > produced by the openbabel GUI. Not sure if there are built-in methods to do > this but it seems to work, sorta. > > > > import pybel, openbabel > > > > #read smiles using pybel > > mol=pybel.readstring('smi', > 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ > > (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ > > O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') > > mol.OBMol.AddHydrogens() #make explicit Hs > > > > #get list of on bits > > fps=mol.calcfp().bits > > > > #make bit string from bit list > > temp=list('0'*1024) > > for item in fps: > > temp[item-1]='1' > > print ''.join(temp) #bit string in native bit order > > print > > bitstring=''.join(reversed(temp)) #reverse bit order to > match openbabel gui output > > print bitstring > > print > > > > #convert bitstring to hexadecimel > > for i in range(1, len(bitstring),32): > > print '%08x'%(int(bitstring[i:i+31],2)), #slice 32 > bits, convert bin string to int, format as hex padding with zeros > > > > > > I deliberately used a large structure in this example to set a lot of bits > in the resulting fingerprint. Curiously, the output hex doesn't EXACTLY > match the fingerprint produced by the openbabel GUI. The fifth and fifth > last set of numbers are not exactly the same!? Other smaller examples are > identical. > > > > From my script: > > 00000040 01000020 00000800 00810100 00280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > 24000020 00000200 01000000 24a20000 00000000 > > > > From Openbabel GUI: > > 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 > 00206000 > > 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 > 00000020 > > 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 > 00404002 > > a4000020 00000200 01000000 24a20000 00000000 > > > > Anyone see a bug in my script? Is it a bug in openbabel GUI? Is there some > other reason? > > > > mc > > > > > > > > From: ope...@li... > [mailto:ope...@li...] > On Behalf Of lunchbox99 > Sent: Sunday, 6 April 2008 9:53 AM > To: ope...@li... > Subject: [OpenBabel-scripting] fingerprint to hex > > > > Does anyone know a simple method to convert an OB fingerprint to a > hexadecimal representation like the babel GUI produces? > > > > import pybel > > mol=pybel.readstring('smi', 'C1CCCCC1') > > fps=mol.calcfp() > > > > Now how to convert fps to hex string? > > > > eg, fp from the OB gui > > 00000000 01000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 40000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 02002000 00000001 00000000 00000000 00000000 00000010 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Register now and save $200. Hurry, offer ends at 11:59 p.m., > Monday, April 7! Use priority code J8TLD2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > |
From: lunchbox99 <lun...@tp...> - 2008-04-06 10:03:35
|
Now that the script works, you can just replace the bitstring slices with a full length hex conversion if you like. The final script: import pybel, openbabel #read smiles using pybel mol=pybel.readstring('smi', 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') mol.OBMol.AddHydrogens() #get list of "on" bits fps=mol.calcfp().bits #make binary string from bit list bitstring=list('0'*1024) for item in fps: bitstring[item-1]='1' #reverse bit order to match openbabel gui reverse_bitstring=''.join(reversed(bitstring)) #convert bitstring to hexadecimel print '%0256x'%(int(reverse_bitstring,2)) mc From: lunchbox99 [mailto:lun...@tp...] Sent: Sunday, 6 April 2008 6:47 PM To: 'lunchbox99'; ope...@li... Subject: RE: [OpenBabel-scripting] fingerprint to hex OK found errors in my string slices - how embarrassing!! Revised hex conversion: #convert bitstring to hexadecimel for i in range(0, len(bitstring)-1,32): print '%08x'%(int(bitstring[i:i+32],2)), My script (fixed): 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 Openbabel GUI: 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 mc From: ope...@li... [mailto:ope...@li...] On Behalf Of lunchbox99 Sent: Sunday, 6 April 2008 6:03 PM To: ope...@li... Subject: Re: [OpenBabel-scripting] fingerprint to hex Well I wrote a basic method to generate hex fingerprint strings like those produced by the openbabel GUI. Not sure if there are built-in methods to do this but it seems to work, sorta. import pybel, openbabel #read smiles using pybel mol=pybel.readstring('smi', 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') mol.OBMol.AddHydrogens() #make explicit Hs #get list of on bits fps=mol.calcfp().bits #make bit string from bit list temp=list('0'*1024) for item in fps: temp[item-1]='1' print ''.join(temp) #bit string in native bit order print bitstring=''.join(reversed(temp)) #reverse bit order to match openbabel gui output print bitstring print #convert bitstring to hexadecimel for i in range(1, len(bitstring),32): print '%08x'%(int(bitstring[i:i+31],2)), #slice 32 bits, convert bin string to int, format as hex padding with zeros I deliberately used a large structure in this example to set a lot of bits in the resulting fingerprint. Curiously, the output hex doesn't EXACTLY match the fingerprint produced by the openbabel GUI. The fifth and fifth last set of numbers are not exactly the same!? Other smaller examples are identical. >From my script: 00000040 01000020 00000800 00810100 00280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 24000020 00000200 01000000 24a20000 00000000 >From Openbabel GUI: 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 Anyone see a bug in my script? Is it a bug in openbabel GUI? Is there some other reason? mc From: ope...@li... [mailto:ope...@li...] On Behalf Of lunchbox99 Sent: Sunday, 6 April 2008 9:53 AM To: ope...@li... Subject: [OpenBabel-scripting] fingerprint to hex Does anyone know a simple method to convert an OB fingerprint to a hexadecimal representation like the babel GUI produces? import pybel mol=pybel.readstring('smi', 'C1CCCCC1') fps=mol.calcfp() Now how to convert fps to hex string? eg, fp from the OB gui 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 40000000 00000000 00000000 00000000 00000000 00000000 00000000 02002000 00000001 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |
From: lunchbox99 <lun...@tp...> - 2008-04-06 08:46:59
|
OK found errors in my string slices - how embarrassing!! Revised hex conversion: #convert bitstring to hexadecimel for i in range(0, len(bitstring)-1,32): print '%08x'%(int(bitstring[i:i+32],2)), My script (fixed): 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 Openbabel GUI: 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 mc From: ope...@li... [mailto:ope...@li...] On Behalf Of lunchbox99 Sent: Sunday, 6 April 2008 6:03 PM To: ope...@li... Subject: Re: [OpenBabel-scripting] fingerprint to hex Well I wrote a basic method to generate hex fingerprint strings like those produced by the openbabel GUI. Not sure if there are built-in methods to do this but it seems to work, sorta. import pybel, openbabel #read smiles using pybel mol=pybel.readstring('smi', 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') mol.OBMol.AddHydrogens() #make explicit Hs #get list of on bits fps=mol.calcfp().bits #make bit string from bit list temp=list('0'*1024) for item in fps: temp[item-1]='1' print ''.join(temp) #bit string in native bit order print bitstring=''.join(reversed(temp)) #reverse bit order to match openbabel gui output print bitstring print #convert bitstring to hexadecimel for i in range(1, len(bitstring),32): print '%08x'%(int(bitstring[i:i+31],2)), #slice 32 bits, convert bin string to int, format as hex padding with zeros I deliberately used a large structure in this example to set a lot of bits in the resulting fingerprint. Curiously, the output hex doesn't EXACTLY match the fingerprint produced by the openbabel GUI. The fifth and fifth last set of numbers are not exactly the same!? Other smaller examples are identical. >From my script: 00000040 01000020 00000800 00810100 00280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 24000020 00000200 01000000 24a20000 00000000 >From Openbabel GUI: 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 Anyone see a bug in my script? Is it a bug in openbabel GUI? Is there some other reason? mc From: ope...@li... [mailto:ope...@li...] On Behalf Of lunchbox99 Sent: Sunday, 6 April 2008 9:53 AM To: ope...@li... Subject: [OpenBabel-scripting] fingerprint to hex Does anyone know a simple method to convert an OB fingerprint to a hexadecimal representation like the babel GUI produces? import pybel mol=pybel.readstring('smi', 'C1CCCCC1') fps=mol.calcfp() Now how to convert fps to hex string? eg, fp from the OB gui 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 40000000 00000000 00000000 00000000 00000000 00000000 00000000 02002000 00000001 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |
From: lunchbox99 <lun...@tp...> - 2008-04-06 08:03:24
|
Well I wrote a basic method to generate hex fingerprint strings like those produced by the openbabel GUI. Not sure if there are built-in methods to do this but it seems to work, sorta. import pybel, openbabel #read smiles using pybel mol=pybel.readstring('smi', 'CC1CCC2(C(C3C(O2)CC4C3(CCC5C4CC=C6C5\ (CCC(C6)OC7C(C(C(C(O7)CO)OC8C(C(C(C(O8)C)OC9C(C(C(C(O9)CO)O)O)O)O)\ O)O)OC2C(C(C(C(O2)C)O)O)O)C)C)C)OC1') mol.OBMol.AddHydrogens() #make explicit Hs #get list of on bits fps=mol.calcfp().bits #make bit string from bit list temp=list('0'*1024) for item in fps: temp[item-1]='1' print ''.join(temp) #bit string in native bit order print bitstring=''.join(reversed(temp)) #reverse bit order to match openbabel gui output print bitstring print #convert bitstring to hexadecimel for i in range(1, len(bitstring),32): print '%08x'%(int(bitstring[i:i+31],2)), #slice 32 bits, convert bin string to int, format as hex padding with zeros I deliberately used a large structure in this example to set a lot of bits in the resulting fingerprint. Curiously, the output hex doesn't EXACTLY match the fingerprint produced by the openbabel GUI. The fifth and fifth last set of numbers are not exactly the same!? Other smaller examples are identical. >From my script: 00000040 01000020 00000800 00810100 00280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 24000020 00000200 01000000 24a20000 00000000 >From Openbabel GUI: 00000040 01000020 00000800 00810100 80280040 00000000 00002800 08000442 00206000 01100028 00000200 40008000 00020000 02800004 00080404 002a9008 00800000 00000020 1340a000 00008001 00100020 10001000 0500a000 08000010 00200400 00000000 00404002 a4000020 00000200 01000000 24a20000 00000000 Anyone see a bug in my script? Is it a bug in openbabel GUI? Is there some other reason? mc From: ope...@li... [mailto:ope...@li...] On Behalf Of lunchbox99 Sent: Sunday, 6 April 2008 9:53 AM To: ope...@li... Subject: [OpenBabel-scripting] fingerprint to hex Does anyone know a simple method to convert an OB fingerprint to a hexadecimal representation like the babel GUI produces? import pybel mol=pybel.readstring('smi', 'C1CCCCC1') fps=mol.calcfp() Now how to convert fps to hex string? eg, fp from the OB gui 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 40000000 00000000 00000000 00000000 00000000 00000000 00000000 02002000 00000001 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |
From: Noel O'B. <bao...@gm...> - 2008-04-06 02:26:53
|
fps in your example is a Pybel Fingerprint. The underlying OBFingerprint can be accessed using the .fp attribute. That is, in your example, fps.fp. Hope that helps. Noel On 06/04/2008, lunchbox99 <lun...@tp...> wrote: > > > > > Does anyone know a simple method to convert an OB fingerprint to a > hexadecimal representation like the babel GUI produces? > > > > import pybel > > mol=pybel.readstring('smi', 'C1CCCCC1') > > fps=mol.calcfp() > > > > Now how to convert fps to hex string? > > > > eg, fp from the OB gui > > 00000000 01000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 00000000 00000000 00000000 40000000 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 02002000 00000001 00000000 00000000 00000000 00000010 > > 00000000 00000000 00000000 00000000 00000000 00000000 > > 00000000 00000000 > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Register now and save $200. Hurry, offer ends at 11:59 p.m., > Monday, April 7! Use priority code J8TLD2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > |
From: lunchbox99 <lun...@tp...> - 2008-04-05 23:53:12
|
Does anyone know a simple method to convert an OB fingerprint to a hexadecimal representation like the babel GUI produces? import pybel mol=pybel.readstring('smi', 'C1CCCCC1') fps=mol.calcfp() Now how to convert fps to hex string? eg, fp from the OB gui 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 40000000 00000000 00000000 00000000 00000000 00000000 00000000 02002000 00000001 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 |
From: Noel O'B. <bao...@gm...> - 2008-04-01 14:55:13
|
This problem is fixed in the development version. In the meanwhile, a workaround is contained in the comments on my blog post at: http://baoilleach.blogspot.com/2007/07/pybel-hack-that-sd-file.html On 01/04/2008, bruno <bru...@un...> wrote: > Dear Noel and Geoff > We are trying to compute TPSA values using Pybel and compound > collection of 50,000 molecules, and the method does not empty the RAM > after each compound and thus the process gets killed when we reach the > hardware limit of the computer.... > > would you have suggestions where to make changes in the code to > circumvent this problem... > > many thanks > > Bruno and David > > > |
From: Jerome P. <j.p...@pa...> - 2008-04-01 09:31:49
|
Hi, The Mychem project propose many functions based on Open Babel for MySQL. For example, you have in the current release the fingerprint function, which permits you to store a fingerprint as a STRING. In the next release, the fingerprint will be available as a binary string, directly usable to calculate tanimoto coefficient. You can download Mychem on: http://sourceforge.net/project/showfiles.php?group_id=195099 A complete documentation is available from: http://sourceforge.net/project/showfiles.php?group_id=195099&package_id=249321 Do not hesitate to contact me for any question/comment, Jerome Pansanel Le Tuesday 01 April 2008 10:15:02 Noel O'Boyle, vous avez écrit : > For sure - all you need to do is to change it into some datatype that > MySQL accepts and stick it in the database. Depending on your speed > and efficiency requirements, you can do this either in a clever way or > any old way. > > A number of other projects have already used OpenBabel in this way > (probably in a clever way). Check out pgchem::tigress and mychem. > > Noel > > On 01/04/2008, Jurgens de Bruin <deb...@gm...> wrote: > > Hi > > > > I was wondering if it would be possible to store a openbabel fingerprint > > in a mysql database so it can be retrieved later and used to calculate a > > tanimoto coefficient. > > > > Thanx > > > > -- > > Regards/Groete/Mit freundlichen Grüßen/recuerdos/meilleures salutations/ > > distinti saluti/siong/duì yú/привет > > > > Jurgens de Bruin > > ------------------------------------------------------------------------- > > Check out the new SourceForge.net Marketplace. > > It's the best place to buy or sell services for > > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl > >ace _______________________________________________ > > OpenBabel-scripting mailing list > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplac >e _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting |
From: Noel O'B. <bao...@gm...> - 2008-04-01 08:15:00
|
For sure - all you need to do is to change it into some datatype that MySQL accepts and stick it in the database. Depending on your speed and efficiency requirements, you can do this either in a clever way or any old way. A number of other projects have already used OpenBabel in this way (probably in a clever way). Check out pgchem::tigress and mychem. Noel On 01/04/2008, Jurgens de Bruin <deb...@gm...> wrote: > Hi > > I was wondering if it would be possible to store a openbabel fingerprint in > a mysql database so it can be retrieved later and used to calculate a > tanimoto coefficient. > > Thanx > > -- > Regards/Groete/Mit freundlichen Grüßen/recuerdos/meilleures salutations/ > distinti saluti/siong/duì yú/привет > > Jurgens de Bruin > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > > |
From: Jurgens de B. <deb...@gm...> - 2008-04-01 07:03:03
|
Hi I was wondering if it would be possible to store a openbabel fingerprint in a mysql database so it can be retrieved later and used to calculate a tanimoto coefficient. Thanx -- Regards/Groete/Mit freundlichen Grüßen/recuerdos/meilleures salutations/ distinti saluti/siong/duì yú/привет Jurgens de Bruin |