Search in sources :

Example 1 with ISGroup

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

Example 2 with ISGroup

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

Example 3 with ISGroup

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

Example 4 with ISGroup

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

Example 5 with ISGroup

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);
}
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

ISGroup (ambit2.core.groups.ISGroup)14 SuppleAtomContainer (ambit2.core.groups.SuppleAtomContainer)14 IChemObject (org.openscience.cdk.interfaces.IChemObject)14 Test (org.junit.Test)13 ComponentGroup (ambit2.core.groups.ComponentGroup)3 ContainerGroup (ambit2.core.groups.ContainerGroup)3 DataGroup (ambit2.core.groups.DataGroup)1 MonomerGroup (ambit2.core.groups.MonomerGroup)1 MultipleGroup (ambit2.core.groups.MultipleGroup)1 StructureRepeatingUnit (ambit2.core.groups.StructureRepeatingUnit)1 IAtom (org.openscience.cdk.interfaces.IAtom)1