.. _molprop_examples_specificmolprop:

Specific Molecular Properties
=============================

The :ref:`OEFilter <OEMolProp_OEFilter>` object table can also be used to
retrieve specific molecular properties or filtering terms for which a
free function does not exist. The number of molecular properties is
large.  In addition, some properties are more experimental than others.
For these reasons :ref:`free functions <molprop_functions>` are not provided
for everything that can be calculated.  This example demonstrates how to
extract a property, the number of Lipinski violations, from the
:ref:`OEFilter <OEMolProp_OEFilter>` object molecular property table by
writing the table to a :ref:`oeosstream <OEPlatform_oeosstream>`.

.. warning::

   The exact number of fields the :ref:`OEFilter <OEMolProp_OEFilter>` object
   outputs depends on the :ref:`filter file <filter_files>` being
   used. The field will only be output if the filter rule is turned
   on. That is why this example will search the header line for the
   position of the "Lipinski violations" field. This key-value lookup
   is recommended for extracting specific fields from the filter table.


Command Line Interface
----------------------

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

.. oe:language:: c++

   .. code-block:: console

      prompt> specificmolprop --help

.. oe:language:: python

   .. code-block:: console

      prompt> python specificmolprop.py --help

.. oe:language:: java

   .. code-block:: console

      prompt> java SpecificMolProp --help

.. oe:language:: csharp

   .. code-block:: console

      prompt> SpecificMolProp --help


will generate the following output:

.. code-block:: console

   Simple parameter list
    filter options :
      -filtertype : filter type

    input/output options :
      -in : Input filename
      -out : Output filename


Code
----------------------

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`specificmolprop.py <../../../../wrappers/python/examples/molprop/specificmolprop.py>`

      ..    literalinclude:: ../../../../wrappers/python/examples/molprop/specificmolprop.py

   .. only:: oepdf

      .. oe:source:: specificmolprop.py
         :language: python


.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`specificmolprop.cpp <../../../../sublibs/tklibs/molprop/examples/specificmolprop.cpp>`

   .. only:: oepdf

      .. oe:source:: specificmolprop.cpp
         :language: c++

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SpecificMolProp.java <../../../../wrappers/java/examples/openeye/examples/oemolprop/SpecificMolProp.java>`

   .. only:: oepdf

      .. oe:source:: SpecificMolProp.java
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SpecificMolProp.cs <../../../../wrappers/csharp/Csharp-Examples/OEMolProp/SpecificMolProp.cs>`

   .. only:: oepdf

      .. oe:source:: SpecificMolProp.cs
         :language: csharp

.. seealso::

   * :oe:func:`OEMolProp::OEFilter` class
   * :oe:func:`OEMolProp::OEConfigureFilterParams` and :oe:func:`OEMolProp::OEConfigureFilterType` functions
   * :oe:func:`OEMolProp::OEGetFilterType` function


Examples
----------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> specificmolprop -in mcss.smi.gz -filtertype Lead

.. oe:language:: python

   .. code-block:: console

      prompt> python specificmolprop.py -in mcss.smi.gz -filtertype Lead

.. oe:language:: java

   .. code-block:: console

      prompt> java SpecificMolProp -in mcss.smi.gz -filtertype Lead

.. oe:language:: csharp

   .. code-block:: console

      prompt> SpecificMolProp -in mcss.smi.gz -filtertype Lead
