Search in sources :

Example 1 with DataGroup

use of ambit2.core.groups.DataGroup 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);
}
Also used : ISGroup(ambit2.core.groups.ISGroup) DataGroup(ambit2.core.groups.DataGroup) IChemObject(org.openscience.cdk.interfaces.IChemObject) SuppleAtomContainer(ambit2.core.groups.SuppleAtomContainer) StructureRepeatingUnit(ambit2.core.groups.StructureRepeatingUnit) Test(org.junit.Test)

Aggregations

DataGroup (ambit2.core.groups.DataGroup)1 ISGroup (ambit2.core.groups.ISGroup)1 StructureRepeatingUnit (ambit2.core.groups.StructureRepeatingUnit)1 SuppleAtomContainer (ambit2.core.groups.SuppleAtomContainer)1 Test (org.junit.Test)1 IChemObject (org.openscience.cdk.interfaces.IChemObject)1