use of ambit2.core.groups.ISGroup 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.ISGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testGeneric.
@Test
public void testGeneric() throws Exception {
IChemObject mol = readSGroup("generic.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(11, sca.getBondCount());
Assert.assertEquals(19, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(2, superatom.size());
Assert.assertNotNull(superatom.get(0));
Assert.assertNotNull(superatom.get(1));
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, false, 17, 11, false);
verify((IAtomContainer) mol, superatom, true, 17, 11, false);
}
use of ambit2.core.groups.ISGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testChitin.
/**
* CAS 1398-61-4 Chitin
* @throws Exception
*/
@Test
public void testChitin() throws Exception {
IChemObject mol = readSGroup("sru.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(49, sca.getBondCount());
Assert.assertEquals(47 + 1, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(1, superatom.size());
Assert.assertNotNull(superatom.get(0));
sca.setFiltered(true);
Assert.assertEquals(SGROUP_CONNECTIVITY.HT, ((IChemObject) superatom.get(0)).getProperty(ISGroup.SGROUP_CONNECTIVITY));
logger.fine(superatom.get(0).getSubscript());
verify((IAtomContainer) mol, superatom, false, 47, 49, false);
verify((IAtomContainer) mol, superatom, true, 47, 49, false);
int sru = 0;
for (IAtom atom : superatom.get(0).getAtoms(true)) {
sru++;
}
Assert.assertEquals(16, sru);
}
use of ambit2.core.groups.ISGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testMonomer.
@Test
public void testMonomer() throws Exception {
IChemObject mol = readSGroup("monomer.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(2, sca.getBondCount());
Assert.assertEquals(3 + 1, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(1, superatom.size());
Assert.assertNotNull(superatom.get(0));
Assert.assertEquals("mon", superatom.get(0).getSubscript());
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, false, 3, 2, false);
verify((IAtomContainer) mol, superatom, true, 3, 2, false);
}
use of ambit2.core.groups.ISGroup in project ambit-mirror by ideaconsult.
the class MDLV2000ReaderExtendedTest method testRGroup.
@Test
public void testRGroup() throws Exception {
IChemObject mol = readSGroup("rgroup.mol");
Assert.assertNotNull(mol);
Assert.assertTrue(mol instanceof SuppleAtomContainer);
SuppleAtomContainer sca = (SuppleAtomContainer) mol;
sca.setFiltered(false);
Assert.assertEquals(18, sca.getBondCount());
Assert.assertEquals(19 + 2, sca.getAtomCount());
List<ISGroup> superatom = getGroup(sca);
Assert.assertNotNull(superatom);
Assert.assertEquals(2, superatom.size());
int sru = 0;
int dat = 0;
for (int i = 0; i < superatom.size(); i++) {
if (superatom.get(i) instanceof StructureRepeatingUnit) {
Assert.assertEquals("3,5-7", superatom.get(i).getSubscript());
sru++;
} else if (superatom.get(i) instanceof DataGroup) {
dat++;
Assert.assertNotNull(((DataGroup) superatom.get(i)).getMulticenter());
}
}
Assert.assertEquals(1, sru);
Assert.assertEquals(1, dat);
sca.setFiltered(true);
verify((IAtomContainer) mol, superatom, true, 19, 18, true);
verify((IAtomContainer) mol, superatom, false, 19, 18, true);
}
Aggregations