Molecular Property Table

The OEFilter object allows for the calculation of all the molecular properties it uses during the filtering process without actually applying the filter. This may be useful for caching the OEFilter object results into a database. The OEFilter.SetTable method can be used to specify where to write a tab-delimited table of every property in the associated filter file. This example demonstrates how to write the tabular output to standard out.

Note

A tab-delimited file format was chosen to integrate better with Unix commandline utilities. For example, this allows for quick and easy filter experimentation with the awk command line utility. The following snippet will print the number of molecules (plus one for the header) with a molecular weight greater than 200.

> python molproptable.py -in drugs.sdf -filtertype Lead > drugs.txt
> cat drugs.txt | awk -F\t '{if ($12 > 200) { print $12 }}' | wc -l

Furthermore, all database programs have utilities for importing tab-delimited files. Loading the filter results into a third-party database would provide very speedy filter experimentation since the properties would only have to be calculated once and then cached in the database.

Command Line Interface

A description of the command line interface can be obtained by executing the program with the –help argument.

prompt> python molproptable.py --help

will generate the following output:

Simple parameter list
 filter options :
   -filtertype : filter type

 input/output options :
   -in : Input filename

 other options :
   -verbose : Error level of messages

Code

Download code

molproptable.py

Examples

prompt> python molpropsdtable.py -in drugs.sdf -filtertype Lead