Class SimilarityCalculatorFactory

java.lang.Object
chemaxon.descriptors.SimilarityCalculatorFactory

@PublicApi public class SimilarityCalculatorFactory extends 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.
  • Field Details

    • SEPARATOR

      public static final String SEPARATOR
      This character is used to separate fields of the parameter string.
      See Also:
  • Method Details

    • create

      public static SimilarityCalculator<int[]> create(String params) throws 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:
      ParseException - if input string error
    • create

      public static SimilarityCalculator<int[]> create(String params, int from, int to) throws 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:
      ParseException - if input string error
    • parse

      public static float parse(String number) throws ParseException
      Throws:
      ParseException
    • getNumberFormat

      public static NumberFormat getNumberFormat()