Package chemaxon.clustering
Class Ward
- java.lang.Object
-
- chemaxon.clustering.Common
-
- chemaxon.clustering.Ward
-
@PublicAPI public class Ward extends Common
Uses Ward's minimum variance method for clustering molecules based on molecular fingerprints or other descriptors.
This class can be used from command-line or from the API.
See the documentation for details.An example for running Ward:
ConnectionHandler ch; String selectString; ... Ward ward=new Ward(); ward.setInput(ch, selectString); ward.setOutput(System.out); ward.setDimensions(0); ward.setFpSize(512); ward.setClusterCount(10); ward.setCentralShown(false); ward.setSingletonNegative(false); ward.setStatNeeded(true); ward.setOnlyStat(false); ward.setStatStream(System.out); ward.setKelleyStats("kelley_results.txt"); ward.setMode(Ward.RNN_AND_CLUSTERING); // execution mode ward.setIdGeneration(true); ward.run();
- Since:
- JChem 1.6.2
-
-
Field Summary
Fields Modifier and Type Field Description static int
ONLY_CLUSTERING
static int
ONLY_RNN
static int
RNN_AND_CLUSTERING
-
Constructor Summary
Constructors Constructor Description Ward()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getCentralShown()
Indicates whether central objects are displayed.int
getClusterCount()
Gets the number of clusters.int
getMode()
Gets the clustering mode.boolean
isSingletonNegative()
Indicates whether singeltons get negative cluster id-s.static void
main(String[] args)
The command line version entry point.void
run()
Starts processing.void
setCentralShown(boolean b)
Specifies if cluster centers should be diplayed.void
setClusterCount(int count)
Sets the number of clusters.void
setInput(ConnectionHandler conh, String querySQL)
Sets input as an SQL query.void
setInput(File file)
Sets input as a File.void
setInput(InputStream is)
Sets input as an InputStreamvoid
setInput(String fileName)
Sets input as a file, specified by its path.void
setKelleyStats(File file)
Directs Kelley statistics to a File.void
setKelleyStats(PrintStream ps)
Directs Kelley statistics to a PrintStream.void
setKelleyStats(String fileName)
Directs Kelley statistics to a File specified with a name.void
setMode(int mode)
Sets the clustering mode.void
setSingletonNegative(boolean b)
Specifies whether singletons get negative cluste id-s.-
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
-
-
-
-
Field Detail
-
RNN_AND_CLUSTERING
public static final int RNN_AND_CLUSTERING
- See Also:
- Constant Field Values
-
ONLY_RNN
public static final int ONLY_RNN
- See Also:
- Constant Field Values
-
ONLY_CLUSTERING
public static final int ONLY_CLUSTERING
- See Also:
- Constant Field Values
-
-
Method Detail
-
setInput
public void setInput(ConnectionHandler conh, String querySQL) throws SQLException
Sets input as an SQL query.- Parameters:
conh
- ConnectionHandler object opened to the databasequerySQL
- 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
-
setCentralShown
public void setCentralShown(boolean b)
Specifies if cluster centers should be diplayed.- Parameters:
b
- if set totrue
, central objects are calculated and shown in output.- Since:
- JChem 1.6.2
-
getCentralShown
public boolean getCentralShown()
Indicates whether central objects are displayed.- Returns:
true
if central objects are calculated and shown in output.- Since:
- JChem 1.6.2
-
setKelleyStats
public void setKelleyStats(PrintStream ps)
Directs Kelley statistics to a PrintStream.- Parameters:
ps
- the PrintStream where Kelley statistics directed to, ornull
,if no Kelley statistics needed.- Since:
- JChem 1.6.2
-
setKelleyStats
public void setKelleyStats(File file) throws FileNotFoundException
Directs Kelley statistics to a File.- Parameters:
file
- the File where Kelley statistics directed to, ornull
,if no Kelley statistics needed.- Throws:
FileNotFoundException
- Since:
- JChem 1.6.2
-
setKelleyStats
public void setKelleyStats(String fileName) throws FileNotFoundException
Directs Kelley statistics to a File specified with a name.- Parameters:
fileName
- the path of the file where Kelley statistics directed to, ornull
,if no Kelley statistics needed.- Throws:
FileNotFoundException
- Since:
- JChem 1.6.2
-
setSingletonNegative
public void setSingletonNegative(boolean b)
Specifies whether singletons get negative cluste id-s.- Parameters:
b
- If set totrue
, singeltons get negative cluster id-s.- Since:
- JChem 1.6.2
-
isSingletonNegative
public boolean isSingletonNegative()
Indicates whether singeltons get negative cluster id-s.- Returns:
true
, if singeltons get negative cluster id-s.- Since:
- JChem 1.6.2
-
setClusterCount
public void setClusterCount(int count)
Sets the number of clusters.- Parameters:
count
- the number of clusters- Since:
- JChem 1.6.2
-
getClusterCount
public int getClusterCount()
Gets the number of clusters.- Returns:
- the number of clusters
- Since:
- JChem 1.6.2
-
setMode
public void setMode(int mode)
Sets the clustering mode.- Parameters:
mode
- clustering mode constant
Selectable modes:- RNN_AND_CLUSTERING
- ONLY_RNN
- ONLY_CLUSTERING
- Since:
- JChem 1.6.2
-
getMode
public int getMode()
Gets the clustering mode.- Returns:
- one of the folloing constants:
- RNN_AND_CLUSTERING
- ONLY_RNN
- ONLY_CLUSTERING
- Since:
- JChem 1.6.2
-
run
public void run() throws chemaxon.clustering.ClusteringException, IOException, SQLException, chemaxon.clustering.InvalidLicenseKeyException
Starts processing.- Throws:
chemaxon.clustering.ClusteringException
IOException
SQLException
chemaxon.clustering.InvalidLicenseKeyException
- Since:
- JChem 1.6.2
-
main
public static void main(String[] args)
The command line version entry point. Parameter parsing, initialization then start.
-
-