1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
|
/*
* $Id: ChemReactionTests.java 131 2011-01-20 22:01:29Z ebakke $
*
* Copyright (c) 2010, Novartis Institutes for BioMedical Research Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Novartis Institutes for BioMedical Research Inc.
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.RDKit;
import static org.junit.Assert.*;
import java.io.*;
import java.util.ArrayList;
import org.junit.*;
public class ChemReactionTests extends GraphMolTest {
private ArrayList<String> tmpFiles = new ArrayList<String>();
private File baseTestPath;
@Before
public void setUp() {
File base = getRdBase();
baseTestPath = new File(base, "Code" + File.separator + "GraphMol" + File.separator +
"ChemReactions" + File.separator + "testData");
}
@After
public void tearDown() throws Exception {
for (String fn : tmpFiles) {
new File(fn).delete();
}
}
@Test
public void test1Basics() {
ChemicalReaction rxn = new ChemicalReaction();
assertEquals( 0,rxn.getNumReactantTemplates() );
assertEquals( 0,rxn.getNumProductTemplates() );
ROMol r1 = RWMol.MolFromSmarts("[C:1](=[O:2])O");
rxn.addReactantTemplate(r1);
assertEquals( 1,rxn.getNumReactantTemplates() );
r1 = RWMol.MolFromSmarts("[N;!$(N-C=O):3]");
rxn.addReactantTemplate(r1);
assertEquals( 2,rxn.getNumReactantTemplates() );
r1 = RWMol.MolFromSmarts("[C:1](=[O:2])[N:3]");
rxn.addProductTemplate(r1);
assertEquals( 1,rxn.getNumProductTemplates() );
ROMol_Vect reacts = new ROMol_Vect();
for (String react : new String[] {"C(=O)O","N"})
reacts.add(RWMol.MolFromSmiles(react));
// Need this init call since the reaction has been built
// "manually"
rxn.initReactantMatchers();
ROMol_Vect_Vect prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 3,prods.get(0).get(0).getNumAtoms() );
assertEquals( true, RDKFuncs.isMoleculeReactantOfReaction(rxn,reacts.get(0)) );
assertEquals( false, RDKFuncs.isMoleculeReactantOfReaction(rxn,prods.get(0).get(0)) );
assertEquals( true, RDKFuncs.isMoleculeProductOfReaction(rxn,prods.get(0).get(0)) );
assertEquals( false, RDKFuncs.isMoleculeProductOfReaction(rxn,reacts.get(0)) );
}
@Test
public void test2DaylightParser() {
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]");
assertNotNull(rxn );;
assertEquals( 2,rxn.getNumReactantTemplates() );
assertEquals( 1,rxn.getNumProductTemplates() );
assertTrue(rxn.getImplicitPropertiesFlag());
ROMol_Vect reacts = new ROMol_Vect();
for (String react : new String[] {"C(=O)O","N"})
reacts.add(RWMol.MolFromSmiles(react));
// Do not need the initReactantMatchers call here
ROMol_Vect_Vect prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 3,prods.get(0).get(0).getNumAtoms() );
reacts.clear();
for (String react : new String[] {"CC(=O)OC","CN"})
reacts.add(RWMol.MolFromSmiles(react));
// Do not need the initReactantMatchers call here
prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 5,prods.get(0).get(0).getNumAtoms() );
}
@Test
public void test3MDLParsers() throws Exception {
File rxnFile = new File(baseTestPath, "AmideBond.rxn");
String fileN = rxnFile.getPath();
ChemicalReaction rxn = ChemicalReaction.ReactionFromRxnFile(fileN);
assertNotNull(rxn );;
assertEquals( 2,rxn.getNumReactantTemplates() );
assertEquals( 1,rxn.getNumProductTemplates() );
assertFalse(rxn.getImplicitPropertiesFlag());
ROMol_Vect reacts = new ROMol_Vect();
for (String react : new String[] {"C(=O)O","N"})
reacts.add(RWMol.MolFromSmiles(react));
// Do not need the initReactantMatchers call here
ROMol_Vect_Vect prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 3,prods.get(0).get(0).getNumAtoms() );
String rxnBlock = "";
BufferedReader f = new BufferedReader(new FileReader(rxnFile));
String line;
try{
while ((line = f.readLine()) != null)
rxnBlock += line + "\n"; // ok only for small numbers of lines
} finally {
f.close();
}
rxn = ChemicalReaction.ReactionFromRxnBlock(rxnBlock);
assertNotNull(rxn );;
assertEquals( 2,rxn.getNumReactantTemplates() );
assertEquals( 1,rxn.getNumProductTemplates() );
reacts.clear();
for (String react : new String[] {"C(=O)O","N"})
reacts.add(RWMol.MolFromSmiles(react));
// Do not need the initReactantMatchers call here
prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 3,prods.get(0).get(0).getNumAtoms() );
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_1() {
ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])Q.[N:3]>>[C:1](=[O:2])[N:3]");
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_2() {
ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]Q");
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_3() {
ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]>>CC");
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_4() {
String rxnBlock =
"$RXN" + "\n" +
"" + "\n" +
" ISIS 082120061354" + "\n" +
"" + "\n" +
" 3 1" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 3 2 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" -1.4340 -0.6042 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" -0.8639 -0.9333 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0" + "\n" +
" -1.4340 0.0542 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 1 3 2 0 0 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 1 0 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 2.2125 -0.7833 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 3 2 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 9.5282 -0.8083 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
" 8.9579 -0.4792 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" 8.9579 0.1792 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 2 3 2 0 0 0 0" + "\n" +
"M END";
ChemicalReaction.ReactionFromRxnBlock(rxnBlock);
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_5() {
String rxnBlock =
"$RXN" + "\n" +
"" + "\n" +
" ISIS 082120061354" + "\n" +
"" + "\n" +
" 2 1" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 4 2 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" -1.4340 -0.6042 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" -0.8639 -0.9333 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0" + "\n" +
" -1.4340 0.0542 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 1 3 2 0 0 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 1 0 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 2.2125 -0.7833 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 3 2 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 9.5282 -0.8083 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
" 8.9579 -0.4792 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" 8.9579 0.1792 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 2 3 2 0 0 0 0" + "\n" +
"M END" + "\n" ;
ChemicalReaction.ReactionFromRxnBlock(rxnBlock);
}
@Test (expected=ChemicalReactionParserException.class)
public void test4ErrorHandling_6() {
String rxnBlock =
"$RXN" + "\n" +
"" + "\n" +
" ISIS 082120061354" + "\n" +
"" + "\n" +
" 2 1" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 3 2 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" -1.4340 -0.6042 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" -0.8639 -0.9333 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0" + "\n" +
" -1.4340 0.0542 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 1 3 2 0 0 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 1 0 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 2.2125 -0.7833 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
"M END" + "\n" +
"$MOL" + "\n" +
"" + "\n" +
" -ISIS- 08210613542D" + "\n" +
"" + "\n" +
" 3 1 0 0 0 0 0 0 0 0999 V2000" + "\n" +
" 9.5282 -0.8083 0.0000 N 0 0 0 0 0 0 0 0 0 3 0 0" + "\n" +
" 8.9579 -0.4792 0.0000 C 0 0 0 0 0 0 0 0 0 2 0 0" + "\n" +
" 8.9579 0.1792 0.0000 O 0 0 0 0 0 0 0 0 0 1 0 0" + "\n" +
" 1 2 1 0 0 0 0" + "\n" +
" 2 3 2 0 0 0 0" + "\n" +
"M END" + "\n";
ChemicalReaction.ReactionFromRxnBlock(rxnBlock);
}
@Test
public void test5Validation() {
ChemicalReaction rxn = ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]");
assertNotNull(rxn);
Int_Pair validationResults = rxn.validateReaction();
assertEquals(0, validationResults.getFirst());
assertEquals(0, validationResults.getSecond());
rxn = ChemicalReaction.ReactionFromSmarts("[C:1](=[O:1])O.[N:3]>>[C:1](=[O:2])[N:3]");
assertNotNull(rxn);
validationResults = rxn.validateReaction();
assertEquals(1, validationResults.getFirst());
assertEquals(1, validationResults.getSecond());
rxn = ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])[O:4].[N:3]>>[C:1](=[O:2])[N:3]");
assertNotNull(rxn);
}
@Test (expected=ChemicalReactionException.class)
public void test6Exceptions_1() {
ChemicalReaction rxn = ChemicalReaction.ReactionFromSmarts("[C:1]Cl>>[C:1]");
assertNotNull(rxn);
rxn.runReactants(new ROMol_Vect());
}
@Test (expected=ChemicalReactionException.class)
public void test6Exceptions_2() {
ChemicalReaction rxn = ChemicalReaction.ReactionFromSmarts("[C:1]Cl>>[C:1]");
assertNotNull(rxn);
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(RWMol.MolFromSmiles("CC"));
reactants.add(RWMol.MolFromSmiles("C"));
rxn.runReactants(reactants);
}
@Test
public void test6Exceptions_3() {
ChemicalReaction rxn = ChemicalReaction.ReactionFromSmarts("[C:1]Cl>>[C:1]");
assertNotNull(rxn);
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(RWMol.MolFromSmiles("CCCl"));
ROMol_Vect_Vect products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
assertEquals( 1,products.get(0).size() );
}
@Test
public void test8Properties() {
ChemicalReaction rxn = ChemicalReaction.ReactionFromSmarts("[O:1]>>[O:1][3#0]");
assertNotNull(rxn );;
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(RWMol.MolFromSmiles("CO"));
ROMol_Vect_Vect ps = rxn.runReactants(reactants);
assertEquals( 1,ps.size() );
assertEquals( 1,ps.get(0).size() );
// Can sanitize only RWMol objects
RWMol p00 = new RWMol(ps.get(0).get(0));
RDKFuncs.sanitizeMol(p00);
assertEquals( 3,p00.getAtomWithIdx(1).getIsotope());
}
@Test
public void test9AromaticityTransfer () {
ROMol mol = RWMol.MolFromSmiles("c1ccc(C2C3(Cc4c(cccc4)C2)CCCC3)cc1");
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[A:1]1~[*:2]~[*:3]~[*:4]~[*:5]~[A:6]-;@1>>[*:1]~[*:2]~[*:3]~[*:4]~[*:5]~[*:6]");
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(mol);
ROMol_Vect_Vect products = rxn.runReactants(reactants);
assertEquals( 6,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
RWMol prod = new RWMol(products.get(prodSet).get(0));
prod.sanitizeMol();
}
}
@Test
public void test10DotSeparation() {
ROMol mol = RWMol.MolFromSmiles("C1ON1");
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[C:1]1[O:2][N:3]1>>([C:1]1[O:2].[N:3]1)");
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(mol);
ROMol_Vect_Vect products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
assertEquals( 3,products.get(prodSet).get(0).getNumAtoms() );
assertEquals( 2,products.get(prodSet).get(0).getNumBonds() );
}
}
@Test
public void test11ImplicitProperties() {
ROMol mol = RWMol.MolFromSmiles("CCO");
ROMol mol2 = RWMol.MolFromSmiles("C[CH-]O");
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[C:1]O>>[C:1]");
ROMol_Vect reactants = new ROMol_Vect();
reactants.add(mol);
ROMol_Vect_Vect products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
assertEquals("CC",products.get(prodSet).get(0).MolToSmiles());
}
reactants.clear();
reactants.add(mol2);
products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
assertEquals("[CH2-]C",products.get(prodSet).get(0).MolToSmiles());
}
rxn.setImplicitPropertiesFlag(false);
products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
assertEquals("CC",products.get(prodSet).get(0).MolToSmiles());
}
reactants.clear();
reactants.add(mol2);
products = rxn.runReactants(reactants);
assertEquals( 1,products.size() );
for (int prodSet = 0; prodSet < products.size(); prodSet++) {
assertEquals( 1,products.get(prodSet).size() );
assertEquals("CC",products.get(prodSet).get(0).MolToSmiles());
}
}
// @Test
public void test99MemoryLeak() {
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[C:1](=[O:2])O.[N:3]>>[C:1](=[O:2])[N:3]");
assertNotNull(rxn );;
assertEquals( 2,rxn.getNumReactantTemplates() );
assertEquals( 1,rxn.getNumProductTemplates() );
assertTrue(rxn.getImplicitPropertiesFlag());
ROMol_Vect reacts = new ROMol_Vect();
for (String react : new String[] {"C(=O)O","N"})
reacts.add(RWMol.MolFromSmiles(react));
// Do not need the initReactantMatchers call here
for(Integer i=0;i<1000000;i++){
ROMol_Vect_Vect prods = rxn.runReactants(reacts);;
assertEquals( 1,prods.size() );
assertEquals( 1,prods.get(0).size() );
assertEquals( 3,prods.get(0).get(0).getNumAtoms() );
//prods.get(0).get(0).delete();
//prods.get(0).delete();
//prods.delete();
}
}
@Test
public void test100RunSingleReactant() {
ChemicalReaction rxn =
ChemicalReaction.ReactionFromSmarts("[N;$(N-[#6]):3]=[C;$(C=S):1].[N;$(N[#6]);!$(N=*);!$([N-]);!$(N#*);!$([ND3]);!$([ND4]);!$(N[O,N]);!$(N[C,S]=[S,O,N]):2]>>[N:3]-[C:1]-[N+0:2]");
ROMol reag1 = RWMol.MolFromSmiles("C=CCN=C=S");
ROMol reag2 = RWMol.MolFromSmiles("NCc1ncc(Cl)cc1Br");
ROMol_Vect_Vect prods0 = rxn.runReactant(reag1, 0);
ROMol expected_result0 = RWMol.MolFromSmiles("C=CCNC(N)=S");
ROMol expected_sidechain0 = RWMol.MolFromSmiles("[1*:1]=S.[3*:3]CC=C");
assertEquals( 1, prods0.size() );
assertEquals( 1, prods0.get(0).size() );
assertEquals( 1, prods0.size() );
assertEquals( 1, prods0.get(0).size() );
assertEquals( expected_result0.MolToSmiles(), prods0.get(0).get(0).MolToSmiles() );
assertEquals( expected_sidechain0.MolToSmiles(),
ChemicalReaction.ReduceProductToSideChains(prods0.get(0).get(0)).MolToSmiles());
ROMol_Vect_Vect prods1 = rxn.runReactant(reag2, 1);
ROMol expected_result1 = RWMol.MolFromSmiles("NCNCc1ncc(Cl)cc1Br");
ROMol expected_sidechain1 = RWMol.MolFromSmiles("[2*:2]Cc1ncc(Cl)cc1Br");
ROMol expected_sidechain1_nodummies = RWMol.MolFromSmiles("Cc1ncc(Cl)cc1Br");
assertEquals( 1, prods1.size() );
assertEquals( 1, prods1.get(0).size() );
assertEquals( 1, prods1.size() );
assertEquals( 1, prods1.get(0).size() );
assertEquals( expected_result1.MolToSmiles(), prods1.get(0).get(0).MolToSmiles() );
assertEquals( expected_sidechain1.MolToSmiles(),
ChemicalReaction.ReduceProductToSideChains(prods1.get(0).get(0)).MolToSmiles());
assertEquals( expected_sidechain1_nodummies.MolToSmiles(),
ChemicalReaction.ReduceProductToSideChains(
prods1.get(0).get(0),false).MolToSmiles());
}
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("org.RDKit.ChemReactionTests");
}
}
|