Package chemaxon.clustering
Class Compare
java.lang.Object
chemaxon.clustering.Common
chemaxon.clustering.Compare
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.
See the documentation for details.
This class can be used from command-line or from the API.
See the documentation for details.
An example for running Compare:
ConnectionHandler ch; String selectString1; String selectString2; ... Compare cp=new Compare(); cp.setInput1(ch, selectString1 ); cp.setInput2(ch, selectString2 ); cp.setOutput(System.out); cp.setDimensions(0); cp.setFpSize(512); cp.setStatNeeded(true); cp.setOnlyStat(false); cp.setStatStream(System.out); cp.setIdGeneration(true); cp.setThreshold(0.1f); cp.setOnlyDissimilarListed(true); cp.setDifferentIdsOnly(true); cp.run();
- Since:
- JChem 1.6.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the maximum allowed number of similar objects for a compound.float
Gets the threshold value.boolean
Indicates whether compounds with different id-s compared only.boolean
Indicates whether only dissimilar objects are printed.boolean
Indicates, whether the list similar objects should be ordered by distance (closest first).boolean
Indicates whether similar objects listed from the first set.static void
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.void
run()
Starts processing.void
setDifferentIdsOnly
(boolean b) Specifies whether compounds with identical id should be compared.void
setInput1
(ConnectionHandler conh, String querySQL) Sets the first compound library (first set) as an SQL query.void
Sets the first compound library (first set) as a file.void
setInput1
(InputStream is) Sets the first compound library (first set) as an InputStreamvoid
Sets the first compound library (first set) as a file, specified by the file's path.void
setInput2
(ConnectionHandler conh, String querySQL) Sets the second compound library (second set) as an SQL query.void
Sets the second compound library (second set) as a file.void
setInput2
(InputStream is) Sets the second compound library (second set) as an InputStreamvoid
Sets the second compound library (second set) as a file, specified by the file's path.void
setMaxSimilar
(int maxSimilar) Sets the maximum allowed number of similar objects for a compound.void
setOnlyDissimilarListed
(boolean b) Specifies, if only dissimilar objects are to be printed.void
setOrderSimilarObjects
(boolean orderSimilarObjects) Specifies, whether the list similar objects should be ordered by distance (closest first).void
setSimilarListed
(boolean b) Specifies if similar objects are to be listed from the first set.void
setThreshold
(float threshold) Sets the threshold value.Methods inherited from class chemaxon.clustering.Common
getDimensions, getElapsedTime, getFpSize, getIdGeneration, getStartTime, getStatStream, getWeights, isOnlyStat, isStatNeeded, setDimensions, setFpSize, setIdGeneration, setOnlyStat, setOutput, setOutput, setOutput, setOutput, setStatNeeded, setStatStream, setWeights
-
Constructor Details
-
Compare
public Compare()
-
-
Method Details
-
setInput1
Sets the first compound library (first set) as an SQL query.- Parameters:
conh
- ConnectionHandler object opened to the databasequerySQL
- an SQL SELECT statement used as data source- Throws:
SQLException
-
setInput2
Sets the second compound library (second set) as an SQL query.- Parameters:
conh
- ConnectionHandler object opened to the databasequerySQL
- an SQL SELECT statement used as data source- Throws:
SQLException
-
setInput1
Sets the first compound library (first set) as a file.- Parameters:
file
- the File to be used for input- Throws:
FileNotFoundException
-
setInput2
Sets the second compound library (second set) as a file.- Parameters:
file
- the File to be used for input- Throws:
FileNotFoundException
-
setInput1
Sets the first compound library (first set) as a file, specified by the file's path.- Parameters:
fileName
- the path of the input file- Throws:
FileNotFoundException
-
setInput2
Sets the second compound library (second set) as a file, specified by the file's path.- Parameters:
fileName
- the path of the input file- Throws:
FileNotFoundException
-
setInput1
Sets the first compound library (first set) as an InputStream- Parameters:
is
- the InputStream to be used for input
-
setInput2
Sets the second compound library (second set) as an InputStream- Parameters:
is
- the InputStream to be used for input
-
setThreshold
public void setThreshold(float threshold) Sets the threshold value.- Parameters:
threshold
- the threshold value to be set
-
getThreshold
public float getThreshold()Gets the threshold value.- Returns:
- the threshold value currently set
-
setOnlyDissimilarListed
public void setOnlyDissimilarListed(boolean b) Specifies, if only dissimilar objects are to be printed.- Parameters:
b
- if set totrue
only dissimilar objects are printed, otherwise all objects are listed
-
isOnlyDissimilarListed
public boolean isOnlyDissimilarListed()Indicates whether only dissimilar objects are printed.- Returns:
true
, if only dissimilar objects are printed,false
otherwise
-
setSimilarListed
public void setSimilarListed(boolean b) Specifies if similar objects are to be listed from the first set.- Parameters:
b
- if set totrue
, similar objects are printed from the first set
-
isSimilarListed
public boolean isSimilarListed()Indicates whether similar objects listed from the first set.- Returns:
true
, if similar objects are printed from the first set
-
setDifferentIdsOnly
public void setDifferentIdsOnly(boolean b) Specifies whether compounds with identical id should be compared.- Parameters:
b
- if set totrue
, compounds with different id-s compared only. Otherwise all compounds are compared.
-
isDifferentIdsOnly
public boolean isDifferentIdsOnly()Indicates whether compounds with different id-s compared only.- Returns:
- true, if compunds with identical id-s are not compared
-
setMaxSimilar
public void setMaxSimilar(int maxSimilar) Sets the maximum allowed number of similar objects for a compound. If set to 0 (default), the number of similar objects is unlimited.- Parameters:
maxSimilar
- the maximum number of similar neighbors
-
getMaxSimilar
public int getMaxSimilar()Gets the maximum allowed number of similar objects for a compound. If 0 (default), the number of similar objects is unlimited.- Returns:
- the maximum number of similar neighbors
-
setOrderSimilarObjects
public void setOrderSimilarObjects(boolean orderSimilarObjects) Specifies, whether the list similar objects should be ordered by distance (closest first).- Parameters:
orderSimilarObjects
- if set totrue
, the list of similar objects should be ordered by distance in the output. Default value isfalse
.
-
isOrderSimilarObjects
public boolean isOrderSimilarObjects()Indicates, whether the list similar objects should be ordered by distance (closest first).- Returns:
true
, if the list of similar objects will be ordered by distance in the output. Default value isfalse
.
-
run
Starts processing. -
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.- Parameters:
args
- the command line parameters
-