use of ambit2.core.groups.ComponentGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testMixture.
@Test
public void testMixture() throws Exception {
IChemObject mol = readSGroup("mixture_unordered.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(11, sca.getBondCount());
Assert.assertEquals(15 + 4, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(4, superatom.size());
for (int i = 0; i < superatom.size(); i++) {
if (superatom.get(i) instanceof ComponentGroup) {
Assert.assertNotNull(superatom.get(i));
Assert.assertNull(((ComponentGroup) superatom.get(i)).getOrder());
} else if (superatom.get(i) instanceof ContainerGroup) {
Assert.assertEquals(3, ((ContainerGroup) superatom.get(i)).getComponents().size());
}
}
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, false, 15, 11, true);
verify((IAtomContainer) mol, superatom, true, 15, 11, true);
}
use of ambit2.core.groups.ComponentGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testFormulation.
@Test
public void testFormulation() throws Exception {
IChemObject mol = readSGroup("mixture_ordered.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(29, sca.getBondCount());
Assert.assertEquals(31 + 3, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(3, superatom.size());
for (int i = 0; i < superatom.size(); i++) {
if (superatom.get(i) instanceof ComponentGroup) {
Assert.assertNotNull(superatom.get(i));
Assert.assertNotNull(((ComponentGroup) superatom.get(i)).getOrder());
System.out.println(((ComponentGroup) superatom.get(i)).getSubscript());
} else if (superatom.get(i) instanceof ContainerGroup) {
Assert.assertEquals(2, ((ContainerGroup) superatom.get(i)).getComponents().size());
Assert.assertEquals(ContainerGroup.SGROUP_MIXTURE.FORMULATION, ((ContainerGroup) superatom.get(i)).getType());
Assert.assertEquals("f", ((ContainerGroup) superatom.get(i)).getSubscript());
}
}
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, false, 31, 29, false);
verify((IAtomContainer) mol, superatom, true, 31, 29, false);
}
use of ambit2.core.groups.ComponentGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testCopolymer.
@Test
public void testCopolymer() throws Exception {
IChemObject mol = readSGroup("copolymer.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(20, sca.getBondCount());
Assert.assertEquals(20 + 2, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(2, superatom.size());
for (int i = 0; i < superatom.size(); i++) {
if (superatom.get(i) instanceof ComponentGroup) {
Assert.assertNotNull(superatom.get(i));
Assert.assertNull(((ComponentGroup) superatom.get(i)).getOrder());
} else if (superatom.get(i) instanceof ContainerGroup) {
Assert.assertEquals(1, ((ContainerGroup) superatom.get(i)).getComponents().size());
}
}
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, false, 20, 20, true);
verify((IAtomContainer) mol, superatom, true, 20, 20, true);
}
Aggregations