@PublicAPI public class ReactionFingerprint extends MolecularDescriptor
ReactionFingerprint
class.Modifier and Type | Field and Description |
---|---|
protected int |
brightness
number of bits set in the fingerprint
(sometimes this is called
the darkness, but that seems to be less plausible)
|
protected int[] |
fp
storage for the fingerprint
|
params
Constructor and Description |
---|
ReactionFingerprint()
Creates a new, empty instance of ReactionFingerprint without allocating internal
storage.
|
ReactionFingerprint(ReactionFingerprint rfp)
Copy constructor.
|
ReactionFingerprint(RFParameters params)
Creates a new instance of ReactionFingerprint according to the parameters given.
|
ReactionFingerprint(java.lang.String params)
Creates a new instance of ReactionFingerprint according to the
parameters given.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the fingerprint: sets all bins to store zero value.
|
ReactionFingerprint |
clone()
Creates a copy with identical internal state.
|
void |
fromData(byte[] dbRepr)
Builds a fingerprint from an external data format, created by a previous
call to
toData() . |
void |
fromFloatArray(float[] descr)
Builds fingerprint from its float array representation.
|
void |
fromString(java.lang.String cfp)
Builds a fingerprint from its string representation created by
toString() . |
java.lang.String[] |
generate(Molecule m)
Creates the ReactionFingerprint descriptor for the given Molecule.
|
java.util.List<java.lang.String> |
getAliasNames() |
int |
getBrightness()
Gets the brightness of the fingerprint.
|
static int[] |
getChemicalHashedFingerprint(int[] reactionFingerprint,
int length)
Creates chemical hashed fingerpint from reaction fingerprint.
|
float |
getCoarseReactionTanimoto(ReactionFingerprint f)
Returns the tanimoto distance of the reaction centers.
|
int |
getCommonBitCount(ReactionFingerprint f) |
float[] |
getDefaultDissimilarityMetricThresholds()
Gets the default dissimilarity threshold values for all dissimilarity
metrics defined.
|
int |
getDefaultMetricIndex()
Gets the index of the default metric.
|
float |
getDefaultThreshold(int metricIndex)
Gets a metric dependent default threshold value.
|
float |
getDissimilarity(MolecularDescriptor fp2)
Calculates the dissimilarity between two reaction fingerprints using
the default distance measure.
|
float |
getDissimilarity(MolecularDescriptor fp2,
int metricIndex)
Calculates the dissimilarity between two reaction fingerprints using
the specified distance metric.
|
java.lang.String[] |
getDissimilarityMetrics()
Gets the dissimilarity metric names
|
java.lang.String[] |
getDissimilarityMetricsParamDefault()
Gets the dissimilarity metric parameter names -> no parameters.
|
java.lang.String[] |
getDissimilarityMetricsParamHelp()
Gets the dissimilarity metric parameter names -> no parameters.
|
java.lang.String[] |
getDissimilarityMetricsParamNames()
Gets the dissimilarity metric parameter names -> no parameters.
|
int[] |
getDissimilarityMetricsParamNum()
Gets the dissimilarity metric parameter number -> no parameters.
|
java.lang.String[] |
getDissimilarityMetricsParamRanges()
Gets the dissimilarity metric parameter ranges -> no parameters.
|
float |
getLowerBound(MolecularDescriptor fp2)
Calculates the lower bound estimate of the dissimilarity from the given
fingerprint.
|
float |
getMediumReactionTanimoto(ReactionFingerprint f)
Returns the tanimoto distance of the reaction centers and their neighbouring atoms
and bonds.
|
java.lang.String |
getName()
Gets the nice name of the
ReactionFingerprint descriptor
object. |
java.lang.String |
getParametersClassName()
Gets the name of the parameters class corresponding to the descriptor.
|
float |
getProductTanimoto(ReactionFingerprint f)
Returns the tanimoto distance of the product sides.
|
float |
getReactantTanimoto(ReactionFingerprint f)
Returns the tanimoto distance of the reactant sides.
|
java.lang.String |
getShortName()
Gets the short name of the descriptor.
|
float |
getStrictReactionTanimoto(ReactionFingerprint f)
Returns the tanimoto distance of the reaction centers, their immediate neighbour atoms
and bonds, and the neighbours' neighbouring atoms and bonds.
|
boolean |
isReactionMappingIncomplete()
Returns
true if reaction molecule was not mapped completely during reaction fingerprint generation. |
boolean |
isSubSetOf(ReactionFingerprint f)
Checks if this fingerprint is a subset of another fingerprint that is
passed as method parameter.
|
static void |
main(java.lang.String[] argv) |
void |
setParameters(MDParameters parameters)
Sets parameters, allocates internal storage if needed and cleans
the descriptor.
|
void |
setParameters(java.lang.String parameters)
Sets the parameters of an already created
ReactionFingerprint object. |
java.lang.String |
toBinaryString()
Converts the fingerprint into a 0,1 string.
|
byte[] |
toData()
Converts a reaction fingerprint object into a byte array.
|
java.lang.String |
toDecimalString()
Converts the fingerprint into a tab separated string.
|
float[] |
toFloatArray()
Creates the float array representation of the fingerprint.
|
java.lang.String |
toString()
Converts the fingerprint into a readable string.
|
generate, getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDissimilarityMetricIndex, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, needsConfig, newInstance, newInstance, newInstanceFromXML, newInstanceSupplier, setScreeningConfiguration
protected int[] fp
protected int brightness
public ReactionFingerprint()
public ReactionFingerprint(RFParameters params)
params
- parameters used in fingerprint generation and handlingpublic ReactionFingerprint(java.lang.String params)
params
- parameter settingspublic ReactionFingerprint(ReactionFingerprint rfp)
RFParameters
object.rfp
- fingerprint to be copiedpublic ReactionFingerprint clone()
RFParameters
object with the copied one.clone
in class MolecularDescriptor
public java.lang.String getName()
ReactionFingerprint
descriptor
object. This name is not the same as the class name: it is nicer, and
more meaningful for end-users.getName
in class MolecularDescriptor
public java.lang.String getShortName()
getShortName
in class MolecularDescriptor
public java.lang.String getParametersClassName()
getParametersClassName
in class MolecularDescriptor
public int getBrightness()
public void setParameters(MDParameters parameters)
setParameters
in class MolecularDescriptor
parameters
- fingerprint parameterspublic void setParameters(java.lang.String parameters) throws MDParametersException
ReactionFingerprint
object.setParameters
in class MolecularDescriptor
parameters
- parameter settings for the descriptorMDParametersException
- any XML errorpublic byte[] toData()
fromData()
method to build the fingerprint from
this "external" representation.toData
in class MolecularDescriptor
public void fromData(byte[] dbRepr)
toData()
.fromData
in class MolecularDescriptor
dbRepr
- "external" representation of ReactionFingerprintpublic final void clear()
public final java.lang.String toString()
toString
in class MolecularDescriptor
public final java.lang.String toDecimalString()
toDecimalString
in class MolecularDescriptor
public java.lang.String toBinaryString()
toBinaryString
in class MolecularDescriptor
public final void fromString(java.lang.String cfp) throws java.text.ParseException
toString()
.fromString
in class MolecularDescriptor
cfp
- fingerprint stringjava.text.ParseException
public final float[] toFloatArray()
toFloatArray
in class MolecularDescriptor
public void fromFloatArray(float[] descr) throws java.lang.RuntimeException
fromFloatArray
in class MolecularDescriptor
descr
- fingerprint represented in a float array
(e.g. generated by toFloatArray()
)java.lang.RuntimeException
public java.lang.String[] generate(Molecule m) throws MDGeneratorException
MDParameters
class.generate
in class MolecularDescriptor
MDGeneratorException
- when failed to generate descriptorpublic boolean isReactionMappingIncomplete()
true
if reaction molecule was not mapped completely during reaction fingerprint generation.
Should be called after generate(Molecule)
.true
if the reaction molecule was not mapped completelypublic java.lang.String[] getDissimilarityMetrics()
getDissimilarityMetrics
in class MolecularDescriptor
public int[] getDissimilarityMetricsParamNum()
public java.lang.String[] getDissimilarityMetricsParamNames()
public java.lang.String[] getDissimilarityMetricsParamRanges()
public java.lang.String[] getDissimilarityMetricsParamDefault()
public java.lang.String[] getDissimilarityMetricsParamHelp()
public float[] getDefaultDissimilarityMetricThresholds()
getDefaultDissimilarityMetricThresholds
in class MolecularDescriptor
public int getDefaultMetricIndex()
getDefaultMetricIndex
in class MolecularDescriptor
public float getDefaultThreshold(int metricIndex)
getDefaultThreshold
in class MolecularDescriptor
metricIndex
- index of a parameterized metricpublic int getCommonBitCount(ReactionFingerprint f)
public float getReactantTanimoto(ReactionFingerprint f)
f
- the distance from f
is calculatedpublic float getProductTanimoto(ReactionFingerprint f)
f
- the distance from f
is calculatedpublic float getCoarseReactionTanimoto(ReactionFingerprint f)
f
- the distance from f
is calculatedpublic float getMediumReactionTanimoto(ReactionFingerprint f)
f
- the distance from f
is calculatedpublic float getStrictReactionTanimoto(ReactionFingerprint f)
f
- the distance from f
is calculatedpublic float getDissimilarity(MolecularDescriptor fp2)
getDissimilarity
in class MolecularDescriptor
fp2
- the other reaction fingerprintpublic float getDissimilarity(MolecularDescriptor fp2, int metricIndex)
getMetricIndex
( String metricName )
. getDissimilarity
in class MolecularDescriptor
fp2
- the reaction fingerprint from which the distance
is measuredmetricIndex
- index of the metric to be usedMDParameters
,
PFParameters
public float getLowerBound(MolecularDescriptor fp2)
ReactionFingerprint a 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 calling getDistance
.
getLowerBound
in class MolecularDescriptor
fp2
- reaction fingerprint from which distance is measuredpublic boolean isSubSetOf(ReactionFingerprint f)
f
- a descriptor which is supposed to be a supersetpublic static int[] getChemicalHashedFingerprint(int[] reactionFingerprint, int length)
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)public static void main(java.lang.String[] argv)
public java.util.List<java.lang.String> getAliasNames()