3
* $Date: 2007-02-01 20:46:29 +0100 (Thu, 01 Feb 2007) $
6
* Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project
8
* Contact: cdk-devel@lists.sourceforge.net
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public License
12
* as published by the Free Software Foundation; either version 2.1
13
* of the License, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
package org.openscience.cdk.qsar.descriptors.molecular;
26
import org.openscience.cdk.exception.CDKException;
27
import org.openscience.cdk.interfaces.IAtomContainer;
28
import org.openscience.cdk.qsar.DescriptorSpecification;
29
import org.openscience.cdk.qsar.DescriptorValue;
30
import org.openscience.cdk.qsar.IMolecularDescriptor;
31
import org.openscience.cdk.qsar.result.DoubleResult;
32
import org.openscience.cdk.qsar.result.IDescriptorResult;
33
import org.openscience.cdk.qsar.result.IntegerResult;
36
* This Class contains a method that returns the number failures of the
37
* Lipinski's Rule Of 5.
38
* See <a href="http://www.lifechemicals.com/eng/services/HTS/five/">http://www.lifechemicals.com/eng/services/HTS/five/</a>.
40
* <p>This descriptor uses these parameters:
45
* <td>Description</td>
48
* <td>checkAromaticity</td>
50
* <td>True is the aromaticity has to be checked</td>
54
* Returns a single value named <i>LipinskiFailures</i>.
57
* @cdk.created 2004-11-03
59
* @cdk.set qsar-descriptors
60
* @cdk.dictref qsar-descriptors:lipinskifailures
62
* @cdk.keyword Lipinski
63
* @cdk.keyword rule-of-five
64
* @cdk.keyword descriptor
66
public class RuleOfFiveDescriptor implements IMolecularDescriptor {
67
private boolean checkAromaticity = false;
71
* Constructor for the RuleOfFiveDescriptor object.
73
public RuleOfFiveDescriptor() { }
76
* Returns a <code>Map</code> which specifies which descriptor
77
* is implemented by this class.
79
* These fields are used in the map:
81
* <li>Specification-Reference: refers to an entry in a unique dictionary
82
* <li>Implementation-Title: anything
83
* <li>Implementation-Identifier: a unique identifier for this version of
85
* <li>Implementation-Vendor: CDK, JOELib, or anything else
88
* @return An object containing the descriptor specification
90
public DescriptorSpecification getSpecification() {
91
return new DescriptorSpecification(
92
"http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#lipinskifailures",
93
this.getClass().getName(),
94
"$Id: RuleOfFiveDescriptor.java 7844 2007-02-01 19:46:29Z rajarshi $",
95
"The Chemistry Development Kit");
100
* Sets the parameters attribute of the RuleOfFiveDescriptor object.
102
* There is only one parameter, which should be a Boolean indicating whether
103
* aromaticity should be checked or has already been checked. The name of the paramete
104
* is checkAromaticity.
106
*@param params Parameter is only one: a boolean.
107
*@throws CDKException if more than 1 parameter or a non-Boolean parameter is specified
110
public void setParameters(Object[] params) throws CDKException {
111
if (params.length != 1) {
112
throw new CDKException("RuleOfFiveDescriptor expects one parameter");
114
if (!(params[0] instanceof Boolean)) {
115
throw new CDKException("The first parameter must be of type Boolean");
117
// ok, all should be fine
118
checkAromaticity = ((Boolean) params[0]).booleanValue();
123
* Gets the parameters attribute of the RuleOfFiveDescriptor object.
125
*@return The parameters value
128
public Object[] getParameters() {
129
// return the parameters as used for the descriptor calculation
130
Object[] params = new Object[1];
131
params[0] = new Boolean(checkAromaticity);
137
* the method take a boolean checkAromaticity: if the boolean is true, it means that
138
* aromaticity has to be checked.
140
*@param mol AtomContainer for which this descriptor is to be calculated
141
*@return The number of failures of the Lipinski rule
142
*@throws CDKException if the following descriptors throw an exception:
143
* {@link org.openscience.cdk.qsar.descriptors.molecular.XLogPDescriptor}, {@link HBondAcceptorCountDescriptor}, {@link HBondDonorCountDescriptor},
144
* {@link org.openscience.cdk.qsar.descriptors.molecular.WeightDescriptor}, {@link org.openscience.cdk.qsar.descriptors.molecular.RotatableBondsCountDescriptor},
146
public DescriptorValue calculate(IAtomContainer mol) throws CDKException {
148
int lipinskifailures = 0;
150
IMolecularDescriptor xlogP = new XLogPDescriptor();
151
Object[] xlogPparams = {
152
new Boolean(checkAromaticity),
155
xlogP.setParameters(xlogPparams);
156
double xlogPvalue = ((DoubleResult)xlogP.calculate(mol).getValue()).doubleValue();
158
IMolecularDescriptor acc = new HBondAcceptorCountDescriptor();
159
Object[] hBondparams = { new Boolean(checkAromaticity) };
160
acc.setParameters(hBondparams);
161
int acceptors = ((IntegerResult)acc.calculate(mol).getValue()).intValue();
163
IMolecularDescriptor don = new HBondDonorCountDescriptor();
164
don.setParameters(hBondparams);
165
int donors = ((IntegerResult)don.calculate(mol).getValue()).intValue();
167
IMolecularDescriptor mw = new WeightDescriptor();
168
Object[] mwparams = {new String("")};
169
mw.setParameters(mwparams);
170
double mwvalue = ((DoubleResult)mw.calculate(mol).getValue()).doubleValue();
172
IMolecularDescriptor rotata = new RotatableBondsCountDescriptor();
173
rotata.setParameters(hBondparams);
174
int rotatablebonds = ((IntegerResult)rotata.calculate(mol).getValue()).intValue();
176
if(xlogPvalue > 5.0) { lipinskifailures += 1; }
177
if(acceptors > 10) { lipinskifailures += 1; }
178
if(donors > 5) { lipinskifailures += 1; }
179
if(mwvalue > 500.0) { lipinskifailures += 1; }
180
if(rotatablebonds > 10.0) { lipinskifailures += 1; }
183
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(lipinskifailures),
184
new String[] {"LipinksiFailures"});
188
* Returns the specific type of the DescriptorResult object.
190
* The return value from this method really indicates what type of result will
191
* be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result
192
* can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method
193
* allows you to do the same thing, without actually calculating the descriptor.
195
* @return an object that implements the {@link org.openscience.cdk.qsar.result.IDescriptorResult} interface indicating
196
* the actual type of values returned by the descriptor in the {@link org.openscience.cdk.qsar.DescriptorValue} object
198
public IDescriptorResult getDescriptorResultType() {
199
return new IntegerResult(1);
204
* Gets the parameterNames attribute of the RuleOfFiveDescriptor object.
206
*@return The parameterNames value
208
public String[] getParameterNames() {
209
String[] params = new String[1];
210
params[0] = "checkAromaticity";
217
* Gets the parameterType attribute of the RuleOfFiveDescriptor object.
219
*@param name The name of the parameter. In this case it is 'checkAromaticity'.
220
*@return An Object of class equal to that of the parameter being requested
222
public Object getParameterType(String name) {
223
return new Boolean(true);