/** * Determine the stereocenter atoms in the provided container based on * connectivity. * * <blockquote><pre>{@code * IAtomContainer container = ...; * Stereocenters centers = Stereocenters.of(container); * for (int i = 0; i < container.getAtomCount(); i++) { * if (centers.isStereocenter(i)) { * * } * } * }</pre></blockquote> * * @param container input container * @return the stereocenters */ public static Stereocenters of(IAtomContainer container) { EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(container); int[][] g = GraphUtil.toAdjList(container, bondMap); Stereocenters stereocenters = new Stereocenters(container, g, bondMap); stereocenters.checkSymmetry(); return stereocenters; }
void test(IAtomContainer container, Stereocenters.Type type, String mesg, boolean hnorm) { assertThat(mesg, Stereocenters.of(container).elementType(0), is(type)); if (hnorm) { AtomContainerManipulator.convertImplicitToExplicitHydrogens(container); assertThat(mesg + " (unsupressed hydrogens)", Stereocenters.of(container).elementType(0), is(type)); } }
int q = charge(atom); switch (atomicNumber(atom)) { case 0: // stop the nulls on pseudo atoms messing up anything else return Type.None; if (x == 3 && v == 4 && q == 1) return Type.Tricoordinate; if (x == 4 && h == 0 && (q == 0 && v == 5 || q == 1 && v == 4)) return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; return x == 3 && h == 0 && (isBridgeHead(i) || inThreeMemberRing(i)) ? Type.Tetracoordinate : Type.None; case 15: // phosphorus if (x == 4 && (q == 0 && v == 5 && h == 0 || q == 1 && v == 4)) return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; case 16: // sulphur if (h > 0) return Type.None; if (q == 0 && ((v == 4 && x == 3) || (v == 6 && x == 4))) return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; if (q == 1 && ((v == 3 && x == 3) || (v == 5 && x == 4))) return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; return Type.None; return Type.None; case 33: // arsenic if (x == 4 && q == 1 && v == 4) return verifyTerminalHCount(i) ? Type.Tetracoordinate : Type.None; return Type.None;
void checkSymmetry() { if (!checkSymmetry) { checkSymmetry = true; numStereoElements = createElements(); int[] symmetry = toIntArray(Canon.symmetry(container, g)); labelTrueCenters(symmetry); labelIsolatedPara(symmetry); } }
private boolean isBridgeHead(int v) { if (getRingDegree(v) < 3) return false; IAtom atom = container.getAtom(v); for (IBond bond : container.getConnectedBondsList(atom)) if (isFusedBond(bond)) return false; return true; }
Stereocenters centers = new Stereocenters(container, graph, bondMap); if (check) { centers.checkSymmetry(); switch (centers.elementType(v)) { if (centers.elementType(w) == Stereocenters.Type.Tricoordinate) { List<IBond> dbs = getCumulatedDbs(container.getBond(container.getAtom(w), container.getAtom(v))); IBond bond = bondMap.get(v, w); if (w > v && centers.elementType(w) == Stereocenters.Type.Tricoordinate && bond.getOrder() == IBond.Order.SINGLE && !isInSmallRing(bond, 6) && centers.checkSymmetry(); for (int v = 0; v < graph.length; v++) { switch (centers.elementType(v)) { if (!centers.isStereocenter(v)) continue; for (int w : graph[v]) { IBond bond = bondMap.get(v, w); if (w > v && bond.getOrder() == IBond.Order.DOUBLE) { if (centers.elementType(w) == Stereocenters.Type.Tricoordinate && centers.isStereocenter(w) && !isInSmallRing(bond, 7)) { IStereoElement element = createGeometric(v, w, centers); if (element != null) elements.add(element);
if (ringSearch.cyclic(v)) continue; if (stereocenters.elementType(v) != Tetracoordinate) continue; if (!stereocenters.isStereocenter(v)) continue;
int idx = indexNeighbor(container.getAtom(w)); atoms[idx][counts[idx]++] = w; found = found || (idx > 0 && counts[idx] > 1); for (int w : g[atoms[i][j]]) { IAtom atom = container.getAtom(w); if (atomicNumber(atom) == 1 && atom.getMassNumber() == null) { hCount++;
IAtom beg = bond.getBegin(); IAtom end = bond.getEnd(); if (getRingDegree(container.indexOf(beg)) < 3 && getRingDegree(container.indexOf(end)) < 3) return false; boolean[] avisit = new boolean[container.getBondCount()]; if (count == 0) { count++; visitPart(avisit, nbr); } else { if (!avisit[container.indexOf(nbr)])
if (atomicNumber(container.getAtom(w)) == 1 && container.getAtom(w).getMassNumber() == null) h++; switch (supportedType(i, v, d, h, x)) { case Bicoordinate: stereocenters[i] = Stereocenter.Potential;
/** * Index the atom by element to a number between 0-5. This allows us to * quickly count up neighbors we need to and the ignore those we don't * (defaults to 0). * * @param atom an atom to get the element index of * @return the element index */ private static int indexNeighbor(IAtom atom) { switch (atomicNumber(atom)) { case 7: // N return 1; case 8: // O return 2; case 16: // S return 3; case 34: // Se return 4; case 52: // Te return 5; default: return 0; } }
/** * Create a perception method for the provided container, graph * representation and bond map. * * @param container native CDK structure representation * @param graph graph representation (adjacency list) * @param bondMap fast lookup bonds by atom index */ Stereocenters(IAtomContainer container, int[][] graph, EdgeToBondMap bondMap) { this.container = container; this.bondMap = bondMap; this.g = graph; this.ringSearch = new RingSearch(container, graph); this.elements = new StereoElement[g.length]; this.stereocenters = new Stereocenter[g.length]; this.numStereoElements = createElements(); }
EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(m); int[][] graph = GraphUtil.toAdjList(m, bondMap); Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
int[][] graph = GraphUtil.toAdjList(m, bondMap); Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
int[][] graph = GraphUtil.toAdjList(m, bondMap); Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);
int[][] graph = GraphUtil.toAdjList(m, bondMap); Stereocenters stereocenters = new Stereocenters(m, graph, bondMap); stereocenters.checkSymmetry(); CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap, stereocenters);