.. _section_example_oechem_searchfastss:

Perform SMARTS search on substructure database file
================================================================================

A program that searches substructure search database using a :term:`SMARTS` pattern.
For more explanation, see :oe:func:`OEChem::OESubSearchDatabase` class.

.. figure:: ../images/FastSSSearch.*
   :width: 350 pt
   :align: center

   **Schematic representation of using substructure search database**

.. admonition:: Code Example

   * :ref:`section_example_oechem_makefastss` example

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> searchfastss --help

.. oe:language:: python

   .. code-block:: console

      prompt> python searchfastss.py --help

will generate the following output:

.. code-block:: console

   Simple parameter list
    input/output options
      -database : Input substructure search database filename
      -smarts : SMARTS pattern, quote for safety

    other options
      -maxmatches : The maximum number of matches returned in case of parameters
                    (-titles) and (-out)
      -nrthreads : Number of processors used (zero means all available)

    search types
      -count : Output count of number matched
      -out : Output molecule filename of matches
      -titles : Output title of matches


Example
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> searchfastss -db ss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1" -out matches.ism
      prompt> searchfastss -db ss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1" -count
      prompt> searchfastss -db ss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1" -titles

.. oe:language:: python

   .. code-block:: console

      prompt> searchfastss.py -db ss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1" -out matches.ism
      prompt> searchfastss.py -db ss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1" -count
      prompt> searchfastss.py -dbss-search-dataset-SMARTS.oeb -s "C1CC[O,N]CC1"  -titles

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

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`searchfastss.cpp <../../../../../sublibs/tklibs/oechem/examples/searchfastss.cpp>`

   .. only:: oepdf

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`searchfastss.py <../../../../../wrappers/python/examples/oechem/searchfastss.py>`

      .. literalinclude:: ../../../../../wrappers/python/examples/oechem/searchfastss.py


   .. only:: oepdf

      .. oe:source:: searchfastss.py
         :language: python

.. seealso::

   * :ref:`OESubSearchDatabase <OEChem_OESubSearchDatabase>` class
   * :ref:`OESubSearchQuery <OEChem_OESubSearchQuery>` class
   * :ref:`OESubSearchResult <OEChem_OESubSearchResult>` class
   * :ref:`OEConsoleProgressTracer <OESystem_OEConsoleProgressTracer>` class
   * :oe:func:`OEChem::OEGetSubSearchScreenType` function
   * :oe:func:`OEChem::OEIsValidSubSearchDatabase` function
   * :oe:func:`OEChem::OESubSearchStatusToName` function
