Open Babel 3.1.1

For some reason, it is hard to understand the documentation and error messages.


obprop: error while loading shared libraries: libopenbabel.so.7: cannot open shared object file: No such file or directory

Add directory holding missing OpenBabel shared libraries to LD_LIBRARY_PATH

In this example the installation compilation left libopenbabel.so and the other OpenBabel shared runtime libraries in build/lib In tsch
setenv LD_LIBRARY_PATH lib:"$LD_LIBRARY_PATH"
will work when in the build directory but you may want to put a full path to libopenbabel.so etc.


obprop

obprop
Usage: obprop <filename>
Output format:
name NAME
formula  FORMULA
mol_weight MOLECULAR_WEIGHT
exact_mass ISOTOPIC MASS
canonical_SMILES STRING
InChI  STRING
num_atoms  NUM
num_bonds  NUM
num_residues  NUM
num_rotors NUM
sequence RESIDUE_SEQUENCE
num_rings NUMBER_OF_RING_(SSSR)
logP   NUM
PSA    POLAR_SURFACE_AREA
MR     MOLAR REFRACTIVITY$$$$
This is just a very long winded way of saying obprop does not have exactly one argument on its command line. Notice the missing new lines around the four dollars

Add a file name to obprop command line


file missing

obprop broken.smi
obprop: cannot read input file!
broken.smi does not exist.

Use correct file name


BABEL_LIBDIR missing

obprop omeprazole.smi
==============================
*** Open Babel Error  in LoadAllPlugins
  Unable to find OpenBabel plugins. Try setting the BABEL_LIBDIR environment variable.
obprop: conv.FormatFromExt(omeprazole.smi) null
Again the error message is trying to be helpful by being more verbose than necessary. The middle line is the important one. However when it says "plugins", it appears to mean the run time .so libraries discussed above.

Set BABEL_LIBDIR

Surprisingly it appears that Open Babel requires BABEL_LIBDIR to be set and set to point to the same directory as was used with solution 1 above. With unix tcsh something like
setenv BABEL_LIBDIR lib
may help when operating in the build directory but again you may want to put a full path to all the Open Babel .so files.


BABEL_DATADIR missing

obprop omeprazole.smiles
name             /cs/research/crest/home1/ucacbbl/omeprazole.smiles 1
formula          C17H19N3O3S
mol_weight       345.416
exact_mass       345.115
canonical_SMILES COc1ccc2c(c1)[nH]c(n2)S(=O)Cc1ncc(c(c1C)OC)C	

==============================
*** Open Babel Warning  in InChI code
  #1 :Omitted undefined stereo
InChI            InChI=1S/C17H19N3O3S/c1-10-8-18-15(11(2)16(10)23-4)9-24(21)17-19-13-6-5-12(22-3)7-14(13)20-17/h5-8H,9H2,1-4H3,(H,19,20)

num_atoms        43
num_bonds        45
num_residues     0
num_rotors       5
sequence         -
num_rings        3
==============================
*** Open Babel Error  in ParseFile
   Could not find contribution data file.
logP             0
==============================
*** Open Babel Error  in ParseFile
   Could not find contribution data file.
PSA              0
==============================
*** Open Babel Error  in ParseFile
   Could not find contribution data file.
MR               0
$$$$
All seems ok, except the three error messages for LogP (octanol/water partition coefficient), PSA (topological polar surface area) and MR (Molar Refractivity).

Set BABEL_DATADIR

Open Babel requires BABEL_DATADIR to be set (see solutions 1 and 4 above.) With unix tcsh, when operating in the build directory, something like
setenv BABEL_DATADIR ../openbabel-openbabel-3-1-1/data
may help but again you may want to put a full path.


Double Check LogP and PSA

obprop ~/omeprazole.smiles
name             /cs/research/crest/home1/ucacbbl/omeprazole.smiles 1
formula          C17H19N3O3S
mol_weight       345.416
exact_mass       345.115
canonical_SMILES COc1ccc2c(c1)[nH]c(n2)S(=O)Cc1ncc(c(c1C)OC)C	

==============================
*** Open Babel Warning  in InChI code
  #1 :Omitted undefined stereo
InChI            InChI=1S/C17H19N3O3S/c1-10-8-18-15(11(2)16(10)23-4)9-24(21)17-19-13-6-5-12(22-3)7-14(13)20-17/h5-8H,9H2,1-4H3,(H,19,20)

num_atoms        43
num_bonds        45
num_residues     0
num_rotors       5
sequence         -
num_rings        3
logP             3.7654
PSA              96.31
MR               93.6992
$$$$
All seems ok, however the EBI's ChEMBL gives different values for LogP and PSA (polar surface area). So some caution may be needed.


OpenBabel::tokenize find_first_not_of() makes startpos invalid

for (;;) fails to terminate when have reached end of string s so startpos may point to total junk. Mostly this means endpos is also junk and for (;;) harmlessly terminates having run once more than it aught to.

Rewrite tokenize ?


DLHandler::openLib() opens all files in BABEL_LIBDIR and does not close them

May be this is ok? However in 3.1.1 build/lib has 132 files all of which are opened and left open. Whereas it appears that all openLib() is doing is checking that the files exist. I seem to remember some systems where a program could only open a limited number (ie 20) of files simultaneously and failed if it tried to open more.

obprop_linked.exe: cannot read input format!

Dunno why. This was working. But now it fails: both when compiled with GNU g++ and running LLVM intermediate representation code .ll with lli


Can link image without shared library libopenbabel.so.7.0.0 but fails at run time

Failed to specialise to SDF or smiles only

Never found a way to use openbabel's obprop without using any shared run time libraries.


W.B.Langdon Back Started 19 September 2022. Last update $Date: 2022/09/27 15:55:47 $