Search in sources :

Example 1 with CIP_CHIRALITY

use of org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY in project cdk by cdk.

the class CIPToolTest method testOla28.

@Test
public void testOla28() throws Exception {
    String filename = "mol28.cml";
    InputStream ins = this.getClass().getResourceAsStream(filename);
    CMLReader reader = new CMLReader(ins);
    IChemFile file = reader.read(new ChemFile());
    reader.close();
    IAtomContainer mol = ChemFileManipulator.getAllAtomContainers(file).get(0);
    for (IAtom atom : mol.atoms()) {
        List<IAtom> neighbors = mol.getConnectedAtomsList(atom);
        if (neighbors.size() == 4) {
            Stereo stereo = StereoTool.getStereo(neighbors.get(0), neighbors.get(1), neighbors.get(2), neighbors.get(3));
            ITetrahedralChirality stereoCenter = new TetrahedralChirality(mol.getAtom(0), neighbors.toArray(new IAtom[] {}), stereo);
            CIP_CHIRALITY chirality = CIPTool.getCIPChirality(mol, stereoCenter);
        }
    }
}
Also used : ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) TetrahedralChirality(org.openscience.cdk.stereo.TetrahedralChirality) CMLReader(org.openscience.cdk.io.CMLReader) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) CIP_CHIRALITY(org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY) InputStream(java.io.InputStream) IChemFile(org.openscience.cdk.interfaces.IChemFile) ChemFile(org.openscience.cdk.silent.ChemFile) IChemFile(org.openscience.cdk.interfaces.IChemFile) Stereo(org.openscience.cdk.interfaces.ITetrahedralChirality.Stereo) ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 2 with CIP_CHIRALITY

use of org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY in project cdk by cdk.

the class CIPToolTest method testGetCIPChirality_Anti_ILigancyFourChirality.

@Test
public void testGetCIPChirality_Anti_ILigancyFourChirality() {
    ILigand[] antiLigands = new ILigand[] { ligands[0], ligands[1], ligands[3], ligands[2] };
    List<IAtom> ligandAtoms = new ArrayList<>();
    for (ILigand ligand : antiLigands) ligandAtoms.add(ligand.getLigandAtom());
    ITetrahedralChirality chirality = new TetrahedralChirality(molecule.getAtom(1), ligandAtoms.toArray(new IAtom[] {}), Stereo.ANTI_CLOCKWISE);
    CIP_CHIRALITY rsChirality = CIPTool.getCIPChirality(molecule, chirality);
    Assert.assertEquals(CIP_CHIRALITY.S, rsChirality);
}
Also used : ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) TetrahedralChirality(org.openscience.cdk.stereo.TetrahedralChirality) CIP_CHIRALITY(org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY) ArrayList(java.util.ArrayList) ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 3 with CIP_CHIRALITY

use of org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY in project cdk by cdk.

the class CIPToolTest method testGetCIPChirality.

@Test
public void testGetCIPChirality() {
    LigancyFourChirality chirality = new LigancyFourChirality(molecule.getAtom(1), ligands, Stereo.CLOCKWISE);
    CIP_CHIRALITY rsChirality = CIPTool.getCIPChirality(chirality);
    Assert.assertEquals(CIP_CHIRALITY.S, rsChirality);
}
Also used : CIP_CHIRALITY(org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY) Test(org.junit.Test)

Example 4 with CIP_CHIRALITY

use of org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY in project cdk by cdk.

the class CIPToolTest method testGetCIPChirality_DoubleBond_Opposite.

@Test
public void testGetCIPChirality_DoubleBond_Opposite() throws Exception {
    IAtomContainer container = new SmilesParser(SilentChemObjectBuilder.getInstance()).parseSmiles("CCC(C)=C(C)CC");
    CIP_CHIRALITY label = CIPTool.getCIPChirality(container, new DoubleBondStereochemistry(container.getBond(container.getAtom(2), container.getAtom(4)), new IBond[] { container.getBond(container.getAtom(2), container.getAtom(3)), container.getBond(container.getAtom(4), container.getAtom(6)) }, IDoubleBondStereochemistry.Conformation.OPPOSITE));
    assertThat(label, is(CIPTool.CIP_CHIRALITY.Z));
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) DoubleBondStereochemistry(org.openscience.cdk.stereo.DoubleBondStereochemistry) IDoubleBondStereochemistry(org.openscience.cdk.interfaces.IDoubleBondStereochemistry) CIP_CHIRALITY(org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY) IBond(org.openscience.cdk.interfaces.IBond) Test(org.junit.Test)

Example 5 with CIP_CHIRALITY

use of org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY in project cdk by cdk.

the class CIPToolTest method testGetCIPChirality_Anti.

@Test
public void testGetCIPChirality_Anti() {
    ILigand[] antiLigands = new ILigand[] { ligands[0], ligands[1], ligands[3], ligands[2] };
    LigancyFourChirality chirality = new LigancyFourChirality(molecule.getAtom(1), antiLigands, Stereo.ANTI_CLOCKWISE);
    CIP_CHIRALITY rsChirality = CIPTool.getCIPChirality(chirality);
    Assert.assertEquals(CIP_CHIRALITY.S, rsChirality);
}
Also used : CIP_CHIRALITY(org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 CIP_CHIRALITY (org.openscience.cdk.geometry.cip.CIPTool.CIP_CHIRALITY)7 IAtom (org.openscience.cdk.interfaces.IAtom)3 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)3 ITetrahedralChirality (org.openscience.cdk.interfaces.ITetrahedralChirality)3 TetrahedralChirality (org.openscience.cdk.stereo.TetrahedralChirality)3 ArrayList (java.util.ArrayList)2 IBond (org.openscience.cdk.interfaces.IBond)2 IDoubleBondStereochemistry (org.openscience.cdk.interfaces.IDoubleBondStereochemistry)2 SmilesParser (org.openscience.cdk.smiles.SmilesParser)2 DoubleBondStereochemistry (org.openscience.cdk.stereo.DoubleBondStereochemistry)2 InputStream (java.io.InputStream)1 IChemFile (org.openscience.cdk.interfaces.IChemFile)1 Stereo (org.openscience.cdk.interfaces.ITetrahedralChirality.Stereo)1 CMLReader (org.openscience.cdk.io.CMLReader)1 ChemFile (org.openscience.cdk.silent.ChemFile)1