Class NearestNeighborsClustering

java.lang.Object
chemaxon.clustering.AbstractClusteringMethod
chemaxon.clustering.NearestNeighborsClustering
Direct Known Subclasses:
JarvisPatrickClustering

@PublicApi public class NearestNeighborsClustering extends AbstractClusteringMethod
Compares two sets of objects (like compound libraries) using diversity and dissimilarity calculations.

This class can be used from command-line or from the API.

  • Comparing all individual compounds of a set with a library.
  • Comparing two libraries.
  • Library self-dissimilarity test: comparing all individual compounds of a set with the rest of the compounds.

An example for running NearestNeighborsClustering:

 var nn = new NearestNeighborsClustering();
 nn.setInput(file);
 nn.setOutput(System.out);
 nn.setDimensions(0);
 nn.setFpSize(0);
 nn.setIdGeneration(true);
 nn.setThreshold(0.1f);
 nn.run();
 

  • Constructor Details

    • NearestNeighborsClustering

      public NearestNeighborsClustering()
  • Method Details

    • setInput

      public void setInput(ConnectionHandler conh, String querySQL) throws SQLException
      Sets input as an SQL query.
      Parameters:
      conh - ConnectionHandler object opened to the database
      querySQL - an SQL SELECT statement used as data source
      Throws:
      SQLException
      Since:
      JChem 1.6.2
    • setInput

      public void setInput(File file) throws FileNotFoundException
      Sets input as a File.
      Parameters:
      file - the File to be used for input
      Throws:
      FileNotFoundException
      Since:
      JChem 1.6.2
    • setInput

      public void setInput(String fileName) throws FileNotFoundException
      Sets input as a file, specified by its path.
      Parameters:
      fileName - the path of File to be used for input
      Throws:
      FileNotFoundException
      Since:
      JChem 1.6.2
    • setInput

      public void setInput(InputStream is)
      Sets input as an InputStream
      Parameters:
      is - the InputStream to be used for input
      Since:
      JChem 1.6.2
    • setThreshold

      public void setThreshold(float threshold)
      Sets the threshold value.
      Parameters:
      threshold - the threshold value to be used
      Since:
      JChem 1.6.2
    • getThreshold

      public float getThreshold()
      Gets the threshold value.
      Returns:
      the current threshold value
      Since:
      JChem 1.6.2
    • run

      public void run() throws ClusteringException, IOException, SQLException
      Starts processing.
      Throws:
      ClusteringException
      IOException
      SQLException
      Since:
      JChem 1.6.2