use of org.openscience.cdk.io.iterator.IteratingSMILESReader in project cdk by cdk.
the class RecursiveTest method testBasicAmineOnDrugs_cdkAromaticModel.
@Category(SlowTest.class)
@Test
public void testBasicAmineOnDrugs_cdkAromaticModel() throws Exception {
String filename = "drugs.smi";
InputStream ins = this.getClass().getResourceAsStream(filename);
IteratingSMILESReader reader = new IteratingSMILESReader(ins, DefaultChemObjectBuilder.getInstance());
SMARTSQueryTool sqt = new SMARTSQueryTool("[NX3;H2,H1;!$(NC=O)]", DefaultChemObjectBuilder.getInstance());
sqt.setAromaticity(new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet()));
int nmatch = 0;
int nmol = 0;
READ: while (reader.hasNext()) {
IAtomContainer container = reader.next();
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
// model
for (IAtom atom : container.atoms()) {
if (atom.getAtomTypeName() == null) {
continue READ;
}
}
if (sqt.matches(container)) {
nmatch++;
}
nmol++;
}
reader.close();
Assert.assertEquals(141, nmol);
Assert.assertEquals(4, nmatch);
}
Aggregations