Package chemaxon.descriptors
Class CDParameters
java.lang.Object
chemaxon.descriptors.MDParameters
chemaxon.descriptors.CDParameters
Manages parameters the
CustomDescriptor
class.- Since:
- JChem 2.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
descriptor type constantsprotected int
descriptor typestatic final int
static final int
protected org.dom4j.Element
node in the DOM tree built from the XML configuration 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
ConstructorDescriptionCreates an empty object.CDParameters
(int type) Creates an empty object of the given type.CDParameters
(File configFile) Creates a new descriptor configured from the given file.CDParameters
(String XMLconfig) Creates a new object based on a given configuration string. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets parameters from an XML file.void
fromString
(String parameterString) Sets parameters from a string representation.Gets the XML configuration string.int
Gets the type of the descriptor.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
This method is void in this class as custom descriptors are opaque, their internal structure is not known.protected void
Initializes data members that depend on the XML configuration but are not directly taken from it.protected void
processDocument
(boolean all) Processes parts of the XML configuration that are specific toCustomDescriptor
.protected void
readValues
(boolean all) Picks parameter values from the DOM tree.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
-
Field Details
-
BINARY_DESCRIPTOR
public static final int BINARY_DESCRIPTORdescriptor type constants- See Also:
-
INTEGER_DESCRIPTOR
public static final int INTEGER_DESCRIPTOR- See Also:
-
FLOAT_DESCRIPTOR
public static final int FLOAT_DESCRIPTOR- See Also:
-
descrType
protected int descrTypedescriptor type -
parameters
protected org.dom4j.Element parametersnode in the DOM tree built from the XML configuration
-
-
Constructor Details
-
CDParameters
public CDParameters()Creates an empty object. The type of the descriptor is not yet determined. -
CDParameters
public CDParameters(int type) Creates an empty object of the given type. Initializes to default values. -
CDParameters
Creates a new descriptor configured from the given file.- Parameters:
configFile
- XML configuration file- Throws:
MDParametersException
- missing or bad XML configuration
-
CDParameters
Creates a new object based on a given configuration string.- Parameters:
XMLconfig
- XML configuration string- Throws:
MDParametersException
- missing or bad XML configuration
-
-
Method Details
-
fromString
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 classMDParameters
- Parameters:
parameterString
- parameters in string- Throws:
MDParametersException
- when the parameter string is not well-formed
-
fromFile
Sets parameters from an XML file. Derived classes may overload this and define their own format (even other than XML).- Overrides:
fromFile
in classMDParameters
- Parameters:
parameterFile
- initialized parameter file- Throws:
MDParametersException
- failed to process parameter file
-
setLength
Description copied from class:MDParameters
Sets the length (number of cells) of the descriptor.- Overrides:
setLength
in classMDParameters
- Parameters:
length
- the required length (cell count)- Throws:
MDParametersException
- if argument is not positive
-
initGenerator
This method is void in this class as custom descriptors are opaque, their internal structure is not known. Derived classes that implement user defined or 3rd party descriptors should overload this function and provide the procedure for descriptor generation.- Throws:
MDParametersException
-
init
protected void init()This method is called by the constructors before processing the XML configuration. It creates aCustomDescriptor
object defined inMDParameters.md
. Metircs defined by the descirptor class are retrieved through this object. -
initParameters
protected void initParameters()Initializes data members that depend on the XML configuration but are not directly taken from it.- Overrides:
initParameters
in classMDParameters
-
getDescrType
public int getDescrType()Gets the type of the descriptor.- Returns:
- type of the descriptor (BINARY_DESCRIPTOR, INTEGER_DESCRIPTOR or FLOAT_DESCRIPTOR)
-
getNumberOfWeights
Gets the number of weight factors used by the specified metric. T- Overrides:
getNumberOfWeights
in classMDParameters
- Parameters:
parametrizedMetricIndex
- parametrized metric index- Returns:
- number of weights the metric uses
- Throws:
IllegalArgumentException
- if the given parameter is not a valid metric index
-
getDefaultDocumentFrame
Gets the XML configuration string. This is needed when the optional XML configuration is not specified.- Overrides:
getDefaultDocumentFrame
in classMDParameters
- Returns:
- default XML configuration string of the CDParameters class
-
processDocument
Processes parts of the XML configuration that are specific toCustomDescriptor
. Find thenode in the DOM tree and leaves the rest of the work to the parent class. - Overrides:
processDocument
in classMDParameters
- Parameters:
all
- indicates if the entire document has to be processed in which case the existing configuration is overwritten- Throws:
MDParametersException
-
readValues
Picks parameter values from the DOM tree.- Overrides:
readValues
in classMDParameters
- Parameters:
all
- indicates if the entire document has to be processed in which case the existing configuration is overwritten- Throws:
MDParametersException
-