chemaxon.descriptors
Class CFParameters

java.lang.Object
  extended by chemaxon.descriptors.MDParameters
      extended by chemaxon.descriptors.CFParameters

public class CFParameters
extends MDParameters

Manages fingerprint parameters. This class reads, stores and provides parameters for ChemicalFingerprint class. These parameters together are called the chemical fingerprint configuration. The native format of such configuration is XML.

Since:
JChem 2.2
Author:
Miklos Vargyas, Peter Kovacs (pkovacs84)

Field Summary
static int DEFAULT_BITS_SET
           
static int DEFAULT_BOND_COUNT
           
static int DEFAULT_LENGTH
          default values for parameters
 
Fields inherited from class chemaxon.descriptors.MDParameters
asymmetryFactors, cellSize, cellwiseWeights, configFilePath, currentMetricIndex, data, decForm, DEFAULT_ASYMMETRY_FACTOR, DEFAULT_OUTPUT_PRECISION, DEFAULT_SCALE_FACTOR, DEFAULT_WEIGHT, defaultWeight, document, generator, internalSize, length, md, metricIndexes, normalized, outputPrecision, parametrizedMetricNodes, parametrizedMetrics, parametrizedMetricsNode, scaleFactors, screeningConfigurationNode, similarityNode, standardizer, standardizerConfigurationNode, thresholds, tverskyA, tverskyB, weights
 
Constructor Summary
CFParameters()
          Creates an empty object.
CFParameters(java.io.File configFile)
          Creates a new object based on a given configuration file.
CFParameters(java.lang.String XMLconfig)
          Creates a new object based on a given configuration string.
 
Method Summary
 void fromFile(java.io.File parameterFile)
          Sets parameters from an XML file.
 void fromString(java.lang.String parameterString)
          Sets parameters from a string representation.
protected  java.lang.String[] generate(Molecule m, MolecularDescriptor cd)
          Calls CFGenerator and generates the descriptor for the given molecule.
 int getBitCount()
          Gets the preset bit count (number of fingerprint bits to be set to 1) parameter.
 int getBondCount()
          Gets the preset path length (number of adjacent bonds) parameter.
 java.lang.String getDefaultDocumentFrame()
          Gets the default XML configuration string.
protected  int getNumberOfWeights(int parametrizedMetricIndex)
          Gets the number of weight factors used by the specified metric.
protected  void init()
          This method is called by the constructors before processing the XML configuration.
protected  void initGenerator()
          Initializes the fingerprint generator.
protected  void initParameters()
          Initializes those data members that depend on the XML configuration but are not directly taken from it.
protected  void processDocument(boolean all)
          Processes pars of the XML configuration specific to ChemicalFingerprint.
protected  void readValues(boolean all)
          Picks parameter values from the DOM tree.
 void setBitCount(int bitCount)
          Sets the bit count (number of fingerprint bits to be set to 1) parameter.
 void setBondCount(int bondCount)
          Sets the path length (number of adjacent bonds) parameter.
 void setLength(int length)
          Sets the length (number of cells) of the descriptor.
 
Methods inherited from class chemaxon.descriptors.MDParameters
addParameters, addParameters, addParametrizedMetric, addParametrizedMetricNode, addParametrizedMetricsNode, appendParametrizedMetric, checkDocumentVersion, getAsymmetryFactor, getCellSize, getCurrentMetricIndex, getData, getDecForm, getDefaultStandardizerConfiguration, getDescriptorTypeName, getInternalMetricIndex, getInternalSize, getLength, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getScaleFactor, getScalingHypothesis, getScreeningConfigurationString, getThreshold, getThreshold, getTverskyAlpha, getTverskyBeta, getWeights, importNodes, isAsymmetric, isCellwiseWeights, isNormalized, isScaled, isStandardizationMandatory, isWeighted, readFromXmlFile, readFromXmlString, readMetricParameters, readMetricWeights, setAsymmetryFactor, setCellSize, setCellwiseWeights, setCreateStatistics, setCurrentParametrizedMetric, setNormalized, setOutputPrecision, setParameters, setParameters, setScaleFactor, setScalingHypothesis, setThreshold, setWeights, standardize, toString, toString, writeMetricParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
default values for parameters

See Also:
Constant Field Values

DEFAULT_BOND_COUNT

public static final int DEFAULT_BOND_COUNT
See Also:
Constant Field Values

DEFAULT_BITS_SET

public static final int DEFAULT_BITS_SET
See Also:
Constant Field Values
Constructor Detail

CFParameters

public CFParameters()
Creates an empty object. Initializes fingerprint parameters to default values.


CFParameters

public CFParameters(java.io.File configFile)
             throws MDParametersException
Creates a new object based on a given configuration file.

Parameters:
configFile - XML configuration file
Throws:
MDParametersException - missing or bad XML configuration

CFParameters

public CFParameters(java.lang.String XMLconfig)
             throws MDParametersException
Creates a new object based on a given configuration string.

Parameters:
XMLconfig - XML configuration string
Throws:
MDParametersException - missing or bad XML configuration
Method Detail

fromString

public void fromString(java.lang.String parameterString)
                throws MDParametersException
Sets parameters from a string representation. This method processes an XML format, but derived classes may overload this and define their own format.

Overrides:
fromString in class MDParameters
Parameters:
parameterString - parameters in string
Throws:
MDParametersException - when the parameter string is not well-formed

fromFile

public void fromFile(java.io.File parameterFile)
              throws MDParametersException
Sets parameters from an XML file. Derived classes may overload this and define their own format (even other than XML).

Overrides:
fromFile in class MDParameters
Parameters:
parameterFile - initialized parameter file
Throws:
MDParametersException - failed to process parameter file

setLength

public void setLength(int length)
               throws MDParametersException
Description copied from class: MDParameters
Sets the length (number of cells) of the descriptor.

Overrides:
setLength in class MDParameters
Parameters:
length - the required length (cell count)
Throws:
MDParametersException - if argument is not positive

setBondCount

public void setBondCount(int bondCount)
Sets the path length (number of adjacent bonds) parameter.

Parameters:
bondCount - the bond count parameter

setBitCount

public void setBitCount(int bitCount)
Sets the bit count (number of fingerprint bits to be set to 1) parameter.

Parameters:
bitCount - the bit count parameter

initGenerator

protected void initGenerator()
                      throws MDParametersException
Initializes the fingerprint generator.

Throws:
MDParametersException

init

protected void init()
This method is called by the constructors before processing the XML configuration. It creates a ChemicalFingerprint object stored in MDParameters.md.


initParameters

protected void initParameters()
Initializes those data members that depend on the XML configuration but are not directly taken from it.

Overrides:
initParameters in class MDParameters

generate

protected java.lang.String[] generate(Molecule m,
                                      MolecularDescriptor cd)
                               throws MDGeneratorException
Calls CFGenerator and generates the descriptor for the given molecule.

Parameters:
m - a molecular structure
cd - the chemical descriptor generated for the given molecule, an output parameter
Returns:
names of Molecule Property-s (SDfile tags) set by the generator
Throws:
MDGeneratorException - when failed to generate descriptor

getBondCount

public int getBondCount()
Gets the preset path length (number of adjacent bonds) parameter.

Returns:
the bond count parameter

getBitCount

public int getBitCount()
Gets the preset bit count (number of fingerprint bits to be set to 1) parameter.

Returns:
the bit count parameter

getNumberOfWeights

protected int getNumberOfWeights(int parametrizedMetricIndex)
                          throws java.lang.IllegalArgumentException
Gets the number of weight factors used by the specified metric. This method can be applied to the dissimilarity metrics provided by the MolecularDescriptor class or its derived classes, but not to parametrized metric.

Overrides:
getNumberOfWeights in class MDParameters
Parameters:
parametrizedMetricIndex - parametrized metric index
Returns:
number of weights the metric uses
Throws:
java.lang.IllegalArgumentException - if the given parameter is not a valid metric index

getDefaultDocumentFrame

public java.lang.String getDefaultDocumentFrame()
Gets the default XML configuration string. This is needed when the optional ChemicalFingerprint XML configuration is not specified.

Overrides:
getDefaultDocumentFrame in class MDParameters
Returns:
default XML configuration string of the CFParameters class
Since:
JChem 2.3

processDocument

protected void processDocument(boolean all)
                        throws MDParametersException
Processes pars of the XML configuration specific to ChemicalFingerprint. Find the node in the DOM tree and leaves the rest of the work to the parent class.

Overrides:
processDocument in class MDParameters
Parameters:
all - indicates if the entire document has to be processed in which case the existing configuration is overwritten
Throws:
MDParametersException

readValues

protected void readValues(boolean all)
                   throws MDParametersException
Picks parameter values from the DOM tree.

Overrides:
readValues in class MDParameters
Parameters:
all - indicates if the entire document has to be processed in which case the existing configuration is overwritten
Throws:
MDParametersException