:orphan:

.. _section_example_fastrocs_shapedistancematrix:

Shape Distance Matrix
=====================

Calculates the distance between all molecules in a database with
themselves. There will only be one entry per molecule, though all
conformers will be considered in the comparison. This means the
conformer used in a particular row or column of the matrix will not be
consistent. The complete distance matrix is written out to the
clusters.csv in comma separated format, useful for feeding into
downstream clustering software.

.. note::

   The values output will be a "distance", not the tanimotos. That
   means a perfect match is '0.0', not 1.0 or 2.0 respectively. The
   default is to use Tanimoto Combo. The ``-shapeOnly`` flag can be
   used to get only the shape distance. 

.. warning::

   This will generate O(N^2) amount of data and runtime. This is not a
   cheap script to run. This script can generally handle 1,000s to
   10,000s in a reasonable timeframe on a modern GPU and a machine
   with decent memory and disk space.

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

.. oe:language:: c++

   .. code-block:: console

      prompt> shapedistancematrix [-shapeOnly] [-dbase] <database> [-matrix] <clusters.csv>

   .. only:: oehtml

      .. admonition:: Download code

         :download:`shapedistancematrix.cpp <../../../../../sublibs/tklibs/fastrocs/examples/shapedistancematrix.cpp>`

   .. only:: oepdf

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

.. oe:language:: python

   .. code-block:: console

      prompt> ShapeDistanceMatrix.py [-shapeOnly] [-dbase] <database> [-matrix] <clusters.csv>

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ShapeDistanceMatrix.py <../../../../../wrappers/python/examples/fastrocs/ShapeDistanceMatrix.py>`

      .. :ref:`Full listing. <listing-ShapeDistanceMatrix.py>`

      .. literalinclude:: ../../../../../wrappers/python/examples/fastrocs/ShapeDistanceMatrix.py



   .. only:: oepdf

      .. oe:source:: ShapeDistanceMatrix.py
         :language: python

.. oe:language:: java

   .. code-block:: console

      prompt> ShapeDistanceMatrix.java [-shapeOnly] [-dbase] <database> [-matrix] <clusters.csv>

   .. only:: oehtml

      .. admonition:: Download code

         :download:`ShapeDistanceMatrix.java <../../../../../wrappers/java/examples/openeye/examples/oefastrocs/ShapeDistanceMatrix.java>`

   .. only:: oepdf

      .. oe:source:: ShapeDistanceMatrix.java
         :language: java
