This directory contains a set of tools aimed to help people for their day to day work.
All the tools use the Open Babel library, and all are written in a single source code files of around 200 lines.

All these utilities work in the same way, they all require a SMART pattern and at least one input files, they guess the input file format from the filename extention, and they print the results to the standard output. 
See below for more details

###############################################################################
OBGREP

obgrep is a more advanced version of the SMART grep program which was at the end of the OELIB 'Primer.html'. 

the following lines are printed in the terminal when obgrep is executed without any argument:
> obgrep
Usage: /usr/local/bin/obgrep [options] "PATTERN" <filename>
Options:
   -v    Invert the matching, print non-matching molecules
   -c    Print the number of matched molecules
   -f    Full match, print matching-molecules when the number
         of heavy atoms is equal to the number of PATTERN atoms


Since some examples are better than a long explaination, here are some command lines to perform some queries in a database of SMILES (database.smi)

> obgrep "CN" database.smi        # Print all the molecules with a methylamine group

> obgrep -v "CN" database.smi     # Print all the molecules without a methylamine group

> obgrep -v -c "CN" database.smi  # Print the number of molecules without a methylamine group

> obgrep -f "CN" database.smi     # Print methylamine
> obgrep -f "C[N,O]" database.smi # Print methylamine and methanol


###############################################################################
OBFIT

obfit uses the qtrfit function of the library to superimpose two molecules. Its most interesting feature is that the atoms to fit are defined by the SMART pattern given by the user. I found it pretty useful to align congeneric series of molecules on a common structural scaffold for 3D-QSAR studies. Probably, It can be useful for the overlay of outputs of conformational sampling.
here is an example:
obfit "N1(C)CCCCC1" fixed.sdf moving.sdf

align all the molecules of 'moving.sdf' on a single molecule of 'fixed.sdf' by superimposing them on its N-methylpiperidyl moiety.
If a molecule in 'moving.sdf' doesn't have the N-methylpiperidyl substructure, it is printed on the terminal without any transformation.

###############################################################################
OBROTATE

obrotate rotates the tortional angle of a molecules so that its angle value is equal to the one defined by the user. In other words, it does the same as what would do a user setting an angle in a mollecular modelling package, but much faster and in batch mode.
Let's say that you want to define the conformation of a lot of molecules with a pyridyl scaffold and substituted with an aliphatic chain at 3-position, for example for docking or 3D-QSAR puposes.
To set the value of the first tortional to 90 degrees, the command line would be:
obrotate "c1ccncc1CCC" pyridines.sdf 5 6 7 8 90

6 and 7 define the bond to rotate in the SMART pattern, i.e. c1C bond, 5 and 8 are the atoms of the SMART pattern used to set the angle value. The two atoms used to set the angle value do not have to be connected to the atoms of the bond to rotate, for example, the following line:
obrotate "c1ccncc1CCC" pyridines.sdf 4 6 7 8 90

produces the same output, but uses the nitrogen atom as a reference for the angle value instead of the aromatic carbon. The order of the atom's definition matters, so the program knows which part of the molecule is moving and which part is kept fixed, i.e.:
obrotate "c1ccncc1CCC" pyridines.sdf 5 6 7 8 90

keeps the pyridyl ring fixed and moves the aliphatic chain while
obrotate "c1ccncc1CCC" pyridines.sdf 8 7 6 5 90

keeps the aliphatic chain fixed and moves the pyridyl ring

###############################################################################


Fabien Fontaine, 22d of October 2003
