/** * Access the parity (odd/even) parity of the double bond configuration ( * together/opposite). * * @param element double bond element * @return together = -1, opposite = +1 */ private static int parity(IStereoElement element) { switch (element.getConfigOrder()) { case IStereoElement.TOGETHER: return -1; case IStereoElement.OPPOSITE: return +1; default: return 0; } }
/** * Access the parity (odd/even) parity of the double bond configuration ( * together/opposite). * * @param element double bond element * @return together = -1, opposite = +1 */ private static int parity(IStereoElement element) { switch (element.getConfigOrder()) { case IStereoElement.TOGETHER: return -1; case IStereoElement.OPPOSITE: return +1; default: return 0; } }
private void rubricTetrahedralsCdk() { for (IStereoElement se : mol.stereoElements()) { if (se.getConfigClass() == IStereoElement.Tetrahedral) { @SuppressWarnings("unchecked") final IStereoElement<IAtom, IAtom> th = (IStereoElement<IAtom, IAtom>) se; final IAtom focus = th.getFocus(); final List<IAtom> carriers = th.getCarriers(); int[] adj = new int[4]; for (int i = 0; i < 4; i++) { if (focus.equals(carriers.get(i))) adj[i] = -1; // impl H else adj[i] = mol.indexOf(carriers.get(i)); } switch (th.getConfigOrder()) { case IStereoElement.LEFT: int i = adj[2]; adj[2] = adj[3]; adj[3] = i; tetra[mol.indexOf(focus)] = adj; break; case IStereoElement.RIGHT: tetra[mol.indexOf(focus)] = adj; break; default: } } } }
@Test public void oh1() throws Exception { IAtomContainer mol = load("C[Co@](F)(Cl)(Br)(I)S"); Iterator<IStereoElement> ses =mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(Octahedral.class)); assertThat(se.getConfigOrder(), is(1)); }
@Test public void oh8() throws Exception { IAtomContainer mol = load("C[Co@OH8](F)(Br)(Cl)(I)S"); Iterator<IStereoElement> ses =mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(Octahedral.class)); assertThat(se.getConfigOrder(), is(8)); }
continue; boolean flipped = begBonds.contains(firstCarrier) != endBonds.contains(secondCarrier); int cfg = flipped ? se.getConfigOrder() ^ 0x3 : se.getConfigOrder(); ring.addStereoElement(new DoubleBondStereochemistry(stereoBond, new IBond[]{begBonds.get(0), endBonds.get(0)},
continue; boolean flipped = begBonds.contains(firstCarrier) != endBonds.contains(secondCarrier); int cfg = flipped ? se.getConfigOrder() ^ 0x3 : se.getConfigOrder(); ring.addStereoElement(new DoubleBondStereochemistry(stereoBond, new IBond[]{begBonds.get(0), endBonds.get(0)},
cfg = IStereoElement.OPPOSITE; if (cfg == se.getConfigOrder()) { nCorrectStereo++; } else {
cfg = IStereoElement.OPPOSITE; if (cfg == se.getConfigOrder()) { nCorrectStereo++; } else {
@Test public void roundTripExtendedCisTrans() throws CDKException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("C/C=C=C=C/C"); assertThat(new SmilesGenerator(SmiFlavor.Stereo).create(mol), is("C/C=C=C=C/C")); for (IStereoElement se : mol.stereoElements()) { se.setConfigOrder(se.getConfigOrder() ^ 0x3); // flip } assertThat(new SmilesGenerator(SmiFlavor.Stereo).create(mol), is("C/C=C=C=C\\C")); }
se.getConfigClass() == IStereoElement.TH && optset.contains(STEREOCHEMISTRY)) { expr.and(new Expr(STEREOCHEMISTRY, se.getConfigOrder())); qstereo.add(se); if (se != null && optset.contains(STEREOCHEMISTRY)) { expr.and(new Expr(STEREOCHEMISTRY, se.getConfigOrder())); qstereo.add(se);
@Test public void normalize() throws InvalidSmilesException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("Cl[Pt@SP3](Cl)([NH3])[NH3]"); Iterator<IStereoElement> ses = mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(SquarePlanar.class)); assertThat(se.getConfigOrder(), is(3)); SquarePlanar sp = (SquarePlanar) se; SquarePlanar spNorm = sp.normalize(); assertThat(spNorm.getCarriers(), is(Arrays.asList( mol.getAtom(0), mol.getAtom(2), mol.getAtom(4), mol.getAtom(3) ))); }
@Test public void normalize() throws InvalidSmilesException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("C[As@TB3](Cl)(Cl)(C)Cl"); Iterator<IStereoElement> ses = mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(TrigonalBipyramidal.class)); assertThat(se.getConfigOrder(), is(3)); TrigonalBipyramidal tb = (TrigonalBipyramidal) se; TrigonalBipyramidal tbNorm = tb.normalize(); assertThat(tbNorm.getCarriers(), is(Arrays.asList( mol.getAtom(0), mol.getAtom(2), mol.getAtom(3), mol.getAtom(5), mol.getAtom(4) ))); }
@Test public void normalizeOh() throws InvalidSmilesException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("C[Co@OH8](F)(Br)(Cl)(I)S"); Iterator<IStereoElement> ses = mol.stereoElements().iterator(); assertTrue(ses.hasNext()); IStereoElement se = ses.next(); assertThat(se, instanceOf(Octahedral.class)); assertThat(se.getConfigOrder(), is(8)); Octahedral oh = (Octahedral) se; Octahedral ohNorm = oh.normalize(); assertThat(ohNorm.getCarriers(), is(Arrays.asList( mol.getAtom(0), mol.getAtom(2), mol.getAtom(4), mol.getAtom(3), mol.getAtom(5), mol.getAtom(6) ))); }
assertThat(s1.getFocus(), is(s2.getFocus())); assertThat(s1.getCarriers(), is(s2.getCarriers())); assertThat(s1.getConfigOrder(), is(IStereoElement.RIGHT)); assertThat(s2.getConfigOrder(), is(IStereoElement.LEFT)); assertThat(s3.getFocus(), is(s2.getFocus())); assertThat(s3.getCarriers(), is(s2.getCarriers())); assertThat(s3.getConfigOrder(), is(s2.getConfigOrder())); assertThat(s4.getFocus(), is(s1.getFocus())); assertThat(s4.getCarriers(), is(s1.getCarriers())); assertThat(s4.getConfigOrder(), is(s1.getConfigOrder()));