chemaxon.descriptors
Class SimilarityCalculatorFactory
java.lang.Object
chemaxon.descriptors.SimilarityCalculatorFactory
public class SimilarityCalculatorFactory
- extends java.lang.Object
This factory creates a similarity calculator object according to the user defined parameters.
A series of fingerprint similarity calculation can be performed with the user defined metrics of
this object after defining the query structure.
Example Usage:
SimilarityCalculator sc = SimilarityCalculatorFactory.create("TVERSKY;0.33;0.99");
The filed separator ";" is used as defined in SimilarityCalculatorFactory.SEPARATOR.
int[] query = precalculated fingerprint; bitstring represented as int array.
sc.setQueryFingerprint(query);
// here can be a loop that iterates on target fingerprints
int[] target = precalculated fingerprint; bitstring represented as int array.
float similarity = sc.getSimilarity(target);
float disssimilarity = sc.getDissimilarity(target);
// target loop ends
- Since:
- JChem 5.2.2.
- Author:
- Adrian Kalaszi
|
Field Summary |
static java.lang.String |
SEPARATOR
This character is used to separate fields of the parameter string. |
|
Method Summary |
static SimilarityCalculator<int[]> |
create(java.lang.String params)
Creates a similarity calculator object according to the user defined parameters. |
static SimilarityCalculator<int[]> |
create(java.lang.String params,
int from,
int to)
Creates a similarity calculator object according to the user defined parameters. |
static java.text.NumberFormat |
getNumberFormat()
|
static float |
parse(java.lang.String number)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEPARATOR
public static java.lang.String SEPARATOR
- This character is used to separate fields of the parameter string.
create
public static SimilarityCalculator<int[]> create(java.lang.String params)
throws java.text.ParseException
- Creates a similarity calculator object according to the user defined parameters.
The query fingerprint can be set using the setQueryFingerprint method of the returned object.
- Parameters:
params - Define similarity function type and its possible parameters.
There is a brief and a detailed notation. Use only one of them at the same time.
The fields are separated with ";" by default but this SEPARATOR can be changed. Everything is case insensitive.
Brief: (sequence sensitive)
- At first position there must the metrics name stand:
TANIMOTO, TVERSKY, DICE, EUCLIDEAN, NORMALIZED_EUCLIDEAN, SUBSTRUCTURE, SUPERSTRUCTURE, DEFAULT
the default metrics type is now Tanimoto.
- At the third and fourth position the alpha parameter for query and beta for target is expeceted
if Tversky index is selected.If not given, default parameter values are 1-1 resulting in TANIMOTO metric.
-e.g.: TVERSKY;0.33;0.99 or DICE
Detailed: (sequence insensitive)
- Metrics name is given using the the prefix: "metrics=" (without quotation mark)
TANIMOTO, TVERSKY, DICE, EUCLIDEAN, NORMALIZED_EUCLIDEAN, SUBSTRUCTURE, SUPERSTRUCTURE
- to set Tversky weight for query use tverskyWeightForQuery=
- to set Tversky weight for target use tverskyWeightForTarget=
If the weight was not given, the default "1" is used.
-e.g. metrics=TVERSKY;tverskyWeightForQuery=0.33;tverskyWeightForTarget=0.99
- Returns:
- SimilarityCalculator that is paramtrized according to the given metrics.
- Throws:
java.text.ParseException - if input string error
create
public static SimilarityCalculator<int[]> create(java.lang.String params,
int from,
int to)
throws java.text.ParseException
- Creates a similarity calculator object according to the user defined parameters.
The query fingerprint can be set at using the setQueryFingerprint method of the returning object.
- Parameters:
params - Defines similarity function type and its possible parameters. See: create( String params )from - The starting position from which the integer array is examined (inclusive)to - The ending position to which the integer array is examined (exclusive)
- Returns:
- SimilarityCalculator that is paramtrized according to the given metrics.
- Throws:
java.text.ParseException - if input string error
parse
public static float parse(java.lang.String number)
throws java.text.ParseException
- Throws:
java.text.ParseException
getNumberFormat
public static java.text.NumberFormat getNumberFormat()