Class NearestNeighbors

java.lang.Object
chemaxon.clustering.Common
chemaxon.clustering.NearestNeighbors
Direct Known Subclasses:
JarvisPatrick

@PublicApi public class NearestNeighbors extends Common
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 NearestNeighbours:


 ConnectionHandler ch;
 String selectString;
 ...
 NearestNeighbors nn=new NearestNeighbors();
 nn.setInput(ch, selectString);
 nn.setOutput(System.out);
 nn.setDimensions(0);
 nn.setFpSize(0);
 nn.setIdGeneration(true);
 nn.setThreshold(0.1f);
 nn.run();
 

Since:
JChem 1.6.2
  • Constructor Details

    • NearestNeighbors

      public NearestNeighbors()
  • 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

      Starts processing.
      Throws:
      ClusteringException
      IOException
      SQLException
      InvalidLicenseKeyException
      Since:
      JChem 1.6.2
    • main

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JAN_01_2025) public static void main(String[] args)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This main method will be removed, CLI interfaces should not be used directly from Java code.
      The command line version entry point. Parameter parsing, initialization then start.