19package denoptim.fitness.descriptors;
21import org.openscience.cdk.exception.CDKException;
22import org.openscience.cdk.fingerprint.IBitFingerprint;
23import org.openscience.cdk.fingerprint.IFingerprinter;
24import org.openscience.cdk.fingerprint.SubstructureFingerprinter;
25import org.openscience.cdk.interfaces.IAtomContainer;
26import org.openscience.cdk.qsar.AbstractMolecularDescriptor;
27import org.openscience.cdk.qsar.DescriptorSpecification;
28import org.openscience.cdk.qsar.DescriptorValue;
29import org.openscience.cdk.qsar.IMolecularDescriptor;
30import org.openscience.cdk.qsar.result.DoubleResult;
31import org.openscience.cdk.qsar.result.DoubleResultType;
32import org.openscience.cdk.qsar.result.IDescriptorResult;
33import org.openscience.cdk.similarity.Tanimoto;
35import denoptim.fitness.IDenoptimDescriptor;
52 private static final String[]
PARAMNAMES =
new String[] {
53 "substructuressmarts",
"referenceFingerprint"};
55 private static final String[]
NAMES = {
"TanimotoSimilarityBySubstructure"};
85 return new DescriptorSpecification(
"Denoptim source code",
86 this.getClass().getName(), paramID,
"DENOPTIM project");
109 return IBitFingerprint.class;
111 return String[].class;
113 throw new IllegalArgumentException(
"No parameter for name: "+name);
130 if (params.length != 2)
132 throw new IllegalArgumentException(
""
133 +
"TanimotoMolSimilarityBySubstructure requires two "
136 if (!(params[1] instanceof IBitFingerprint))
138 throw new IllegalArgumentException(
"Parameter does not implemet "
139 +
"IBitFingerprint.");
141 if (!(params[0] instanceof String[]))
143 throw new IllegalArgumentException(
"Parameter is not String[] ("
144 + params[0].getClass().getName() +
").");
158 Object[] params =
new Object[2];
182 throw new IllegalStateException(
"Reference fingerprint not set. "
183 +
"Cannot calculate Tanimoto similarity.");
187 throw new IllegalStateException(
"Fingerprinter not set. "
188 +
"Cannot calculate Tanimoto similarity.");
195 }
catch (IllegalArgumentException e)
198 result =
new DoubleResult(Double.NaN);
199 }
catch (CDKException e)
202 result =
new DoubleResult(Double.NaN);
218 return new DoubleResultType();
227 return "Tanimoto Molecular Similarity By Substructures";
236 return "The Tanimoto Molecular Similarity By Susbtructure "
237 +
"considers a given set of substructures to calculate "
238 +
"the Tanimoto similarity between the "
239 +
"reference fingerprint given upon definition of the "
240 +
"descriptor (see parameters), and the fingerprint of a "
241 +
"molecule given as "
242 +
"argument when calculating the value of the descriptor. "
243 +
"Fingerprints are obtained from a new instance of"
244 +
"<code>SubstructureFingerprinter</code> defined by the "
245 +
"list of SMARTS strings given "
246 +
"as parameter <code>" +
PARAMNAMES[0] +
"</code>.";
255 return new String[] {
"molecular"};
Calculates the molecular similarity against a target compound the fingerprint of which is given as pa...
void setParameters(Object[] params)
Set the parameters attribute of TanimotoMolSimilarityBySubstructure object.
IFingerprinter fingerprinter
String[] getDescriptorNames()
String[] getParameterNames()
Gets the parameterNames attribute of the TanimotoMolSimilarityBySubstructure object.
static final String[] PARAMNAMES
String getDictionaryTitle()
Gets the title of this descriptor as it should be in the dictionary.the title
IDescriptorResult getDescriptorResultType()
static final String[] NAMES
Object getParameterType(String name)
DescriptorValue calculate(IAtomContainer mol)
DescriptorSpecification getSpecification()
Get the specification attribute of Tanimoto molecular similarity.
IBitFingerprint referenceFingerprint
TanimotoMolSimilarityBySubstructure()
Constructor for a TanimotoMolSimilarity object.
String[] substructuressmarts
String getDictionaryDefinition()
Get a string that describes the descriptor in detail.Might contain mathematical formulation....
String[] getDictionaryClass()
Get the classification of this descriptor.A descriptor can belong to one or more classes simultaneous...
This interface forces descriptors that are not defined in the CDK ontology to provide information tha...