Package chemaxon.descriptors
Class ReactionFingerprint
java.lang.Object
chemaxon.descriptors.MolecularDescriptor
chemaxon.descriptors.ReactionFingerprint
- All Implemented Interfaces:
Cloneable
ReactionFingerprint class.- Since:
- JChem 3.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intnumber of bits set in the fingerprint (sometimes this is called the darkness, but that seems to be less plausible)protected int[]storage for the fingerprintFields inherited from class chemaxon.descriptors.MolecularDescriptor
params -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, empty instance of ReactionFingerprint without allocating internal storage.Copy constructor.ReactionFingerprint(RFParameters params) Creates a new instance of ReactionFingerprint according to the parameters given.ReactionFingerprint(String params) Creates a new instance of ReactionFingerprint according to the parameters given. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()Clears the fingerprint: sets all bins to store zero value.clone()Creates a copy with identical internal state.voidfromData(byte[] dbRepr) Builds a fingerprint from an external data format, created by a previous call totoData().voidfromFloatArray(float[] descr) Builds fingerprint from its float array representation.final voidfromString(String cfp) Builds a fingerprint from its string representation created bytoString().String[]Creates the ReactionFingerprint descriptor for the given Molecule.intGets the brightness of the fingerprint.static int[]getChemicalHashedFingerprint(int[] reactionFingerprint, int length) Creates chemical hashed fingerpint from reaction fingerprint.floatReturns the tanimoto distance of the reaction centers.intfloat[]Gets the default dissimilarity threshold values for all dissimilarity metrics defined.intGets the index of the default metric.floatgetDefaultThreshold(int metricIndex) Gets a metric dependent default threshold value.floatCalculates the dissimilarity between two reaction fingerprints using the default distance measure.floatgetDissimilarity(MolecularDescriptor fp2, int metricIndex) Calculates the dissimilarity between two reaction fingerprints using the specified distance metric.String[]Gets the dissimilarity metric namesString[]Gets the dissimilarity metric parameter names -> no parameters.String[]Gets the dissimilarity metric parameter names -> no parameters.String[]Gets the dissimilarity metric parameter names -> no parameters.int[]Gets the dissimilarity metric parameter number -> no parameters.String[]Gets the dissimilarity metric parameter ranges -> no parameters.floatCalculates the lower bound estimate of the dissimilarity from the given fingerprint.floatReturns the tanimoto distance of the reaction centers and their neighbouring atoms and bonds.getName()Gets the nice name of theReactionFingerprintdescriptor object.Gets the name of the parameters class corresponding to the descriptor.floatReturns the tanimoto distance of the product sides.floatReturns the tanimoto distance of the reactant sides.Gets the short name of the descriptor.floatReturns the tanimoto distance of the reaction centers, their immediate neighbour atoms and bonds, and the neighbours' neighbouring atoms and bonds.booleanReturnstrueif reaction molecule was not mapped completely during reaction fingerprint generation.booleanChecks if this fingerprint is a subset of another fingerprint that is passed as method parameter.voidsetParameters(MDParameters parameters) Sets parameters, allocates internal storage if needed and cleans the descriptor.voidsetParameters(String parameters) Sets the parameters of an already createdReactionFingerprintobject.Converts the fingerprint into a 0,1 string.byte[]toData()Converts a reaction fingerprint object into a byte array.final StringConverts the fingerprint into a tab separated string.final float[]Creates the float array representation of the fingerprint.final StringtoString()Converts the fingerprint into a readable string.Methods inherited from class chemaxon.descriptors.MolecularDescriptor
generate, getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDissimilarityMetricIndex, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, needsConfig, newInstance, newInstance, newInstanceFromXML, setScreeningConfiguration
-
Field Details
-
fp
protected int[] fpstorage for the fingerprint -
brightness
protected int brightnessnumber of bits set in the fingerprint (sometimes this is called the darkness, but that seems to be less plausible)
-
-
Constructor Details
-
ReactionFingerprint
public ReactionFingerprint()Creates a new, empty instance of ReactionFingerprint without allocating internal storage. -
ReactionFingerprint
Creates a new instance of ReactionFingerprint according to the parameters given.- Parameters:
params- parameters used in fingerprint generation and handling
-
ReactionFingerprint
Creates a new instance of ReactionFingerprint according to the parameters given.- Parameters:
params- parameter settings
-
ReactionFingerprint
Copy constructor. An identical copy of the reaction fingerprint passed is created. The old and the new instances share the sameRFParametersobject.- Parameters:
rfp- fingerprint to be copied
-
-
Method Details
-
clone
Creates a copy with identical internal state. The new instances share the sameRFParametersobject with the copied one.- Specified by:
clonein classMolecularDescriptor- Returns:
- the newly created object
-
getName
Gets the nice name of theReactionFingerprintdescriptor object. This name is not the same as the class name: it is nicer, and more meaningful for end-users.- Overrides:
getNamein classMolecularDescriptor- Returns:
- the nice, external name for ReactionFingerprint descriptor class objects
-
getShortName
Gets the short name of the descriptor. This name appears in text outputs.- Overrides:
getShortNamein classMolecularDescriptor- Returns:
- the short name used in text outputs (tables etc.)
-
getParametersClassName
Gets the name of the parameters class corresponding to the descriptor.- Overrides:
getParametersClassNamein classMolecularDescriptor- Returns:
- the name of the parameters class
-
getBrightness
public int getBrightness()Gets the brightness of the fingerprint. Actually, sometimes this is called the darkness. To be precise, this methods gets the numbers of 1 (one) bits in the fingerprint.- Returns:
- number of bits set to 1
-
setParameters
Sets parameters, allocates internal storage if needed and cleans the descriptor.- Overrides:
setParametersin classMolecularDescriptor- Parameters:
parameters- fingerprint parameters
-
setParameters
Sets the parameters of an already createdReactionFingerprintobject.- Specified by:
setParametersin classMolecularDescriptor- Parameters:
parameters- parameter settings for the descriptor- Throws:
MDParametersException- any XML error
-
toData
public byte[] toData()Converts a reaction fingerprint object into a byte array. This format can be reffered to as an "external representation" since it servers as the data format for storing fingerprints in databases..
Use thefromData()method to build the fingerprint from this "external" representation.- Specified by:
toDatain classMolecularDescriptor- Returns:
- byte array representation of the fingerprint object
-
fromData
public void fromData(byte[] dbRepr) Builds a fingerprint from an external data format, created by a previous call totoData().- Specified by:
fromDatain classMolecularDescriptor- Parameters:
dbRepr- "external" representation of ReactionFingerprint
-
clear
public final void clear()Clears the fingerprint: sets all bins to store zero value. -
toString
Converts the fingerprint into a readable string. This is the default external text format of the fingerprint, which can also be stored into an SDfile.- Specified by:
toStringin classMolecularDescriptor- Returns:
- string representation of the fingerprint
-
toDecimalString
Converts the fingerprint into a tab separated string.- Specified by:
toDecimalStringin classMolecularDescriptor- Returns:
- string representation of the fingerprint
-
toBinaryString
Converts the fingerprint into a 0,1 string.- Overrides:
toBinaryStringin classMolecularDescriptor- Returns:
- binary string representation of the fingerprint
-
fromString
Builds a fingerprint from its string representation created bytoString().- Specified by:
fromStringin classMolecularDescriptor- Parameters:
cfp- fingerprint string- Throws:
ParseException
-
toFloatArray
public final float[] toFloatArray()Creates the float array representation of the fingerprint. This array contains all values of the fingerprint (including all zeros) in the elements of the array.- Specified by:
toFloatArrayin classMolecularDescriptor- Returns:
- a float array representation of the fingerprint
-
fromFloatArray
Builds fingerprint from its float array representation. Typically used when a hypothesis is created.- Specified by:
fromFloatArrayin classMolecularDescriptor- Parameters:
descr- fingerprint represented in a float array (e.g. generated bytoFloatArray())- Throws:
RuntimeException
-
generate
Creates the ReactionFingerprint descriptor for the given Molecule. Calls the generator created by the correspondingMDParametersclass.- Overrides:
generatein classMolecularDescriptor- Returns:
- property names set in the molecule passed during generation
- Throws:
MDGeneratorException- when failed to generate descriptor
-
isReactionMappingIncomplete
public boolean isReactionMappingIncomplete()Returnstrueif reaction molecule was not mapped completely during reaction fingerprint generation. Should be called aftergenerate(Molecule).- Returns:
trueif the reaction molecule was not mapped completely- Since:
- JChem 5.1.2
-
getDissimilarityMetrics
Gets the dissimilarity metric names- Specified by:
getDissimilarityMetricsin classMolecularDescriptor- Returns:
- the metrics array
-
getDissimilarityMetricsParamNum
public int[] getDissimilarityMetricsParamNum()Gets the dissimilarity metric parameter number -> no parameters.- Returns:
- the metrics array
-
getDissimilarityMetricsParamNames
Gets the dissimilarity metric parameter names -> no parameters.- Returns:
- the metrics array
-
getDissimilarityMetricsParamRanges
Gets the dissimilarity metric parameter ranges -> no parameters.- Returns:
- the metrics array
-
getDissimilarityMetricsParamDefault
Gets the dissimilarity metric parameter names -> no parameters.- Returns:
- the metrics array
-
getDissimilarityMetricsParamHelp
Gets the dissimilarity metric parameter names -> no parameters.- Returns:
- the metrics array
-
getDefaultDissimilarityMetricThresholds
public float[] getDefaultDissimilarityMetricThresholds()Gets the default dissimilarity threshold values for all dissimilarity metrics defined.- Specified by:
getDefaultDissimilarityMetricThresholdsin classMolecularDescriptor- Returns:
- array of dissimilarity threshold values
-
getDefaultMetricIndex
public int getDefaultMetricIndex()Gets the index of the default metric. In the case of this class this is Tanimoto.- Overrides:
getDefaultMetricIndexin classMolecularDescriptor- Returns:
- metric index of the default metric
-
getDefaultThreshold
public float getDefaultThreshold(int metricIndex) Gets a metric dependent default threshold value. Ideally, this value should be based on statistics, though the actual value is not too critical, since these are only used in user interfaces to simplify the use of applications for beginners.- Overrides:
getDefaultThresholdin classMolecularDescriptor- Parameters:
metricIndex- index of a parameterized metric
-
getCommonBitCount
-
getReactantTanimoto
Returns the tanimoto distance of the reactant sides.- Parameters:
f- the distance fromfis calculated- Returns:
- the tanimoto distance (dissimilarity coefficient)
-
getProductTanimoto
Returns the tanimoto distance of the product sides.- Parameters:
f- the distance fromfis calculated- Returns:
- the tanimoto distance (dissimilarity coefficient)
-
getCoarseReactionTanimoto
Returns the tanimoto distance of the reaction centers. The direction of the reaction is considered.- Parameters:
f- the distance fromfis calculated- Returns:
- the tanimoto distance (dissimilarity coefficient)
-
getMediumReactionTanimoto
Returns the tanimoto distance of the reaction centers and their neighbouring atoms and bonds. The direction of the reaction is considered.- Parameters:
f- the distance fromfis calculated- Returns:
- the tanimoto distance (dissimilarity coefficient)
-
getStrictReactionTanimoto
Returns the tanimoto distance of the reaction centers, their immediate neighbour atoms and bonds, and the neighbours' neighbouring atoms and bonds. The direction of the reaction is considered.- Parameters:
f- the distance fromfis calculated- Returns:
- the tanimoto distance (dissimilarity coefficient)
-
getDissimilarity
Calculates the dissimilarity between two reaction fingerprints using the default distance measure.- Specified by:
getDissimilarityin classMolecularDescriptor- Parameters:
fp2- the other reaction fingerprint- Returns:
- dissimilarity ratio
-
getDissimilarity
Calculates the dissimilarity between two reaction fingerprints using the specified distance metric. The index of the required metric can be obtained by calling.getMetricIndex( String metricName )
New metrics implemented by this class have to be added at the end of the existing ones.- Specified by:
getDissimilarityin classMolecularDescriptor- Parameters:
fp2- the reaction fingerprint from which the distance is measuredmetricIndex- index of the metric to be used- Returns:
- the dissimilarity ratio
- See Also:
-
getLowerBound
Calculates the lower bound estimate of the dissimilarity from the given fingerprint. In the case ofReactionFingerprinta good estimate for the minimum distance cannot be obtained efficiently (that is, significantly faster than calculating the proper distance) therefore 0 is returned. This trivial distance bound estimation will lead to callinggetDistance.- Overrides:
getLowerBoundin classMolecularDescriptor- Parameters:
fp2- reaction fingerprint from which distance is measured- Returns:
- estimate of the minimum distance
-
isSubSetOf
Checks if this fingerprint is a subset of another fingerprint that is passed as method parameter. A binary fingerprint is considered to be a subset of another if none of its bits is larger than that of the other's.- Parameters:
f- a descriptor which is supposed to be a superset- Returns:
- true if this descriptor is a subset of the parameter
-
getChemicalHashedFingerprint
public static int[] getChemicalHashedFingerprint(int[] reactionFingerprint, int length) Creates chemical hashed fingerpint from reaction fingerprint.- Parameters:
reactionFingerprint- the fingeprint as was generated by ReactionFingerprint, may contain additional data (e.g. structural keys) at the endlength- the length of the FP part in integers to consider (the remainder will be ignored, e.g. structural keys)- Returns:
- the chemical hashed fingerprint of the total reaction
-
getAliasNames
-