1 /* Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project 2 * 3 * Contact: cdk-devel@lists.sourceforge.net 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 2.1 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 package org.openscience.cdk.qsar.descriptors.molecular; 20 21 import org.junit.Assert; 22 import org.junit.Before; 23 import org.junit.Ignore; 24 import org.junit.Test; 25 import org.openscience.cdk.DefaultChemObjectBuilder; 26 import org.openscience.cdk.aromaticity.Aromaticity; 27 import org.openscience.cdk.aromaticity.ElectronDonation; 28 import org.openscience.cdk.exception.CDKException; 29 import org.openscience.cdk.graph.Cycles; 30 import org.openscience.cdk.interfaces.IAtomContainer; 31 import org.openscience.cdk.qsar.result.DoubleResult; 32 import org.openscience.cdk.smiles.SmilesParser; 33 34 import static org.hamcrest.Matchers.closeTo; 35 36 /** 37 * TestSuite that runs XlogP tests. 38 * 39 * @cdk.module test-qsarmolecular 40 */ 41 public class XLogPDescriptorTest extends MolecularDescriptorTest { 42 XLogPDescriptorTest()43 public XLogPDescriptorTest() {} 44 45 @Before setUp()46 public void setUp() throws Exception { 47 setDescriptor(XLogPDescriptor.class); 48 } 49 50 @Ignore 51 @Test testno688()52 public void testno688() throws ClassNotFoundException, CDKException, java.lang.Exception { 53 Object[] params = {new Boolean(true), new Boolean(false)}; 54 descriptor.setParameters(params); 55 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 56 IAtomContainer mol = sp.parseSmiles("O=C(O)c1[nH0]cccc1"); // xlogp training set molecule no688 57 assertAtomTypesPerceived(mol); 58 addExplicitHydrogens(mol); 59 //logger.debug("no688:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 60 Assert.assertEquals(-1.69, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 61 } 62 63 @Test testno1596()64 public void testno1596() throws ClassNotFoundException, CDKException, java.lang.Exception { 65 // the xlogp program value is 0.44 because of paralleled donor pair correction factor 66 Object[] params = {new Boolean(true), new Boolean(false)}; 67 descriptor.setParameters(params); 68 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 69 IAtomContainer mol = sp.parseSmiles("Nc2ccc(S(=O)(=O)c1ccc(N)cc1)cc2"); // xlogp training set molecule no1596 70 assertAtomTypesPerceived(mol); 71 addExplicitHydrogens(mol); 72 //logger.debug("no1596:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 73 Assert.assertEquals(0.86, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 74 } 75 76 @Test testno367()77 public void testno367() throws ClassNotFoundException, CDKException, java.lang.Exception { 78 Object[] params = {new Boolean(true), new Boolean(false)}; 79 descriptor.setParameters(params); 80 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 81 IAtomContainer mol = sp.parseSmiles("O=C(O)C(N)CCCN"); // xlogp training set molecule no367 82 assertAtomTypesPerceived(mol); 83 addExplicitHydrogens(mol); 84 //logger.debug("no367:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 85 Assert.assertEquals(-3.30, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 86 } 87 88 @Test testno1837()89 public void testno1837() throws ClassNotFoundException, CDKException, java.lang.Exception { 90 Object[] params = {new Boolean(true), new Boolean(false)}; 91 descriptor.setParameters(params); 92 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 93 IAtomContainer mol = sp.parseSmiles("O=P(N1CC1)(N2CC2)N3CC3"); // xlogp training set molecule no1837 94 assertAtomTypesPerceived(mol); 95 addExplicitHydrogens(mol); 96 //logger.debug("no1837:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 97 Assert.assertEquals(-1.19, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 98 } 99 100 @Test testno87()101 public void testno87() throws ClassNotFoundException, CDKException, java.lang.Exception { 102 Object[] params = {new Boolean(true), new Boolean(false)}; 103 descriptor.setParameters(params); 104 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 105 IAtomContainer mol = sp.parseSmiles("c1cc2ccc3ccc4ccc5cccc6c(c1)c2c3c4c56"); // xlogp training set molecule no87 106 assertAtomTypesPerceived(mol); 107 addExplicitHydrogens(mol); 108 //logger.debug("no87:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 109 Assert.assertEquals(7.00, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 110 } 111 112 @Test testno1782()113 public void testno1782() throws ClassNotFoundException, CDKException, java.lang.Exception { 114 Object[] params = {new Boolean(true), new Boolean(false)}; 115 descriptor.setParameters(params); 116 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 117 IAtomContainer mol = sp.parseSmiles("S1C2N(C(=O)C2NC(=O)C(c2ccccc2)C(=O)O)C(C(=O)O)C1(C)C"); // xlogp training set molecule no30 118 assertAtomTypesPerceived(mol); 119 addExplicitHydrogens(mol); 120 //logger.debug("no1782:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 121 Assert.assertEquals(1.84, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 122 } 123 124 @Test testno30()125 public void testno30() throws ClassNotFoundException, CDKException, java.lang.Exception { 126 Object[] params = {new Boolean(true), new Boolean(false)}; 127 descriptor.setParameters(params); 128 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 129 IAtomContainer mol = sp.parseSmiles("C(#Cc1ccccc1)c1ccccc1"); // xlogp training set molecule no30 130 assertAtomTypesPerceived(mol); 131 addExplicitHydrogens(mol); 132 //logger.debug("no30:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 133 Assert.assertEquals(4.62, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 134 } 135 136 @Ignore 137 @Test testno937()138 public void testno937() throws ClassNotFoundException, CDKException, java.lang.Exception { 139 Object[] params = {new Boolean(true), new Boolean(false)}; 140 descriptor.setParameters(params); 141 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 142 IAtomContainer mol = sp.parseSmiles("ClCC(O)C[nH0]1c([nH0]cc1[N+](=O)[O-])C"); // xlogp training set molecule no937 143 assertAtomTypesPerceived(mol); 144 addExplicitHydrogens(mol); 145 //logger.debug("no937:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 146 Assert.assertEquals(0.66, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 147 } 148 149 @Test testno990()150 public void testno990() throws ClassNotFoundException, CDKException, java.lang.Exception { 151 Object[] params = {new Boolean(true), new Boolean(false)}; 152 descriptor.setParameters(params); 153 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 154 IAtomContainer mol = sp.parseSmiles("FC(F)(F)c1ccc(cc1)C(=O)N"); // xlogp training set molecule no990 155 assertAtomTypesPerceived(mol); 156 addExplicitHydrogens(mol); 157 //logger.debug("no990:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 158 Assert.assertEquals(1.834, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 159 } 160 161 @Test testno1000()162 public void testno1000() throws ClassNotFoundException, CDKException, java.lang.Exception { 163 Object[] params = {new Boolean(true), new Boolean(false)}; 164 descriptor.setParameters(params); 165 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 166 IAtomContainer mol = sp.parseSmiles("Clc1cccc(c1)/C=C/[N+](=O)[O-]"); // xlogp training set molecule no1000 167 assertAtomTypesPerceived(mol); 168 addExplicitHydrogens(mol); 169 //logger.debug("no10000:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 170 Assert.assertEquals(2.809, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 171 } 172 173 @Test testApirinBug1296383()174 public void testApirinBug1296383() throws ClassNotFoundException, CDKException, java.lang.Exception { 175 Object[] params = {new Boolean(true), new Boolean(false)}; 176 descriptor.setParameters(params); 177 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 178 IAtomContainer mol = sp.parseSmiles("CC(=O)OC1=CC=CC=C1C(=O)O"); // aspirin 179 assertAtomTypesPerceived(mol); 180 addExplicitHydrogens(mol); 181 //logger.debug("Aspirin:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 182 Assert.assertEquals(1.422, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 183 } 184 185 @Test testno1429()186 public void testno1429() throws ClassNotFoundException, CDKException, java.lang.Exception { 187 Object[] params = {new Boolean(true), new Boolean(false)}; 188 descriptor.setParameters(params); 189 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 190 IAtomContainer mol = sp.parseSmiles("O=C(OC)CNC(=O)c1ccc(N)cc1"); // xlogp training set molecule no1429 191 assertAtomTypesPerceived(mol); 192 addExplicitHydrogens(mol); 193 //logger.debug("no1429:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 194 Assert.assertEquals(0.31, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 195 } 196 197 @Test testno1274()198 public void testno1274() throws ClassNotFoundException, CDKException, java.lang.Exception { 199 Object[] params = {new Boolean(true), new Boolean(false)}; 200 descriptor.setParameters(params); 201 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 202 IAtomContainer mol = sp.parseSmiles("O=[N+]([O-])c1ccc(cc1)CC(N)C(=O)O"); // xlogp training set molecule no1274 203 assertAtomTypesPerceived(mol); 204 addExplicitHydrogens(mol); 205 //logger.debug("no1274:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 206 Assert.assertEquals(-1.487, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 207 } 208 209 @Test testno454()210 public void testno454() throws ClassNotFoundException, CDKException, java.lang.Exception { 211 //xlogp program gives a result of -0.89, because one N is classified as in ring and not as amid 212 //if one takes a 5 or 7 ring than the program assignes amid ... strange 213 //sometimes amid is O=C-N-C=O sometimes not... 214 Object[] params = {new Boolean(true), new Boolean(false)}; 215 descriptor.setParameters(params); 216 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 217 IAtomContainer mol = sp.parseSmiles("O=C1NC(=O)C=CN1C1OC(CO)C(O)C1O"); // xlogp training set molecule no454 218 assertAtomTypesPerceived(mol); 219 addExplicitHydrogens(mol); 220 //logger.debug("no454:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 221 Assert.assertEquals(-2.11, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 222 } 223 224 @Test testno498()225 public void testno498() throws ClassNotFoundException, CDKException, java.lang.Exception { 226 //even here the amid assignment is very strange 227 Object[] params = {new Boolean(true), new Boolean(false)}; 228 descriptor.setParameters(params); 229 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 230 IAtomContainer mol = sp.parseSmiles("O=C1N(C)C=CC(=O)N1C"); // xlogp training set molecule no498 231 assertAtomTypesPerceived(mol); 232 addExplicitHydrogens(mol); 233 //logger.debug("no498:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 234 Assert.assertEquals(-0.59, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 235 } 236 237 @Test testAprindine()238 public void testAprindine() throws ClassNotFoundException, CDKException, java.lang.Exception { 239 //even here the amid assignment is very strange 240 Object[] params = {new Boolean(true), new Boolean(false)}; 241 descriptor.setParameters(params); 242 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 243 IAtomContainer mol = sp.parseSmiles("CCN(CC)CCCN(C2Cc1ccccc1C2)c3ccccc3"); // xlogp training set molecule Aprindine 244 assertAtomTypesPerceived(mol); 245 addExplicitHydrogens(mol); 246 //logger.debug("Aprindine:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 247 Assert.assertEquals(5.03, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 248 } 249 250 @Test test1844()251 public void test1844() throws ClassNotFoundException, CDKException, java.lang.Exception { 252 Object[] params = {new Boolean(true), new Boolean(false)}; 253 descriptor.setParameters(params); 254 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 255 // SMILES is in octet-rule version, PubChem has normalized one 256 IAtomContainer mol = sp.parseSmiles("Brc1cc(Cl)c(O[P+]([S-])(OC)OC)cc1Cl"); // xlogp training set molecule 1844 257 assertAtomTypesPerceived(mol); 258 addExplicitHydrogens(mol); 259 //logger.debug("no1844:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 260 Assert.assertEquals(5.22, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 261 } 262 263 @Test test1810()264 public void test1810() throws ClassNotFoundException, CDKException, java.lang.Exception { 265 Object[] params = {new Boolean(true), new Boolean(false)}; 266 descriptor.setParameters(params); 267 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 268 IAtomContainer mol = sp.parseSmiles("Clc1ccc2Sc3ccccc3N(CCCN3CCN(C)CC3)c2c1"); // xlogp training set molecule 1810 269 assertAtomTypesPerceived(mol); 270 addExplicitHydrogens(mol); 271 //logger.debug("no1810:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 272 Assert.assertEquals(4.56, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 1.0); //at: 16 273 } 274 275 /** 276 * @cdk.inchi InChI=1/C23H20N2O3S/c26-22-21(16-17-29(28)20-14-8-3-9-15-20)23(27)25(19-12-6-2-7-13-19)24(22)18-10-4-1-5-11-18/h1-15,21H,16-17H2 277 */ 278 @Test test1822()279 public void test1822() throws ClassNotFoundException, CDKException, java.lang.Exception { 280 Object[] params = {new Boolean(true), new Boolean(false)}; 281 descriptor.setParameters(params); 282 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 283 IAtomContainer mol = sp.parseSmiles("[S+]([O-])(CCC1C(=O)N(N(c2ccccc2)C1=O)c1ccccc1)c1ccccc1"); // xlogp training set molecule 1822 284 assertAtomTypesPerceived(mol); 285 addExplicitHydrogens(mol); 286 //logger.debug("no1822:"+((DoubleResult)descriptor.calculate(mol).getValue()).doubleValue()+"\n"); 287 Assert.assertEquals(2.36, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16 288 } 289 290 @Test testAromaticBenzene()291 public void testAromaticBenzene() throws java.lang.Exception { 292 Object[] params = {false, true}; 293 descriptor.setParameters(params); 294 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 295 IAtomContainer mol = sp.parseSmiles("C1=CC=CC=C1"); // benzene 296 Aromaticity aromaticity = new Aromaticity(ElectronDonation.daylight(), Cycles.all()); 297 aromaticity.apply(mol); 298 assertAtomTypesPerceived(mol); 299 addExplicitHydrogens(mol); 300 Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(2.02, 0.01)); 301 } 302 303 @Test testNonAromaticBenzene()304 public void testNonAromaticBenzene() throws java.lang.Exception { 305 Object[] params = {false, true}; 306 descriptor.setParameters(params); 307 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 308 IAtomContainer mol = sp.parseSmiles("C1=CC=CC=C1"); // benzene 309 assertAtomTypesPerceived(mol); 310 addExplicitHydrogens(mol); 311 Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(2.08, 0.01)); 312 } 313 314 @Test testPerceivedAromaticBenzene()315 public void testPerceivedAromaticBenzene() throws java.lang.Exception { 316 Object[] params = {true, true}; 317 descriptor.setParameters(params); 318 SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 319 IAtomContainer mol = sp.parseSmiles("C1=CC=CC=C1"); // benzene 320 assertAtomTypesPerceived(mol); 321 addExplicitHydrogens(mol); 322 Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(2.02, 0.01)); 323 } 324 } 325