/** * Check if atom or neighbour atom is part of a ring * *@param ac Description of the Parameter *@param atom Description of the Parameter *@return The hydrogenCount value */ private boolean checkRingLink(IRingSet ringSet, IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); if (ringSet.contains(atom)) { return true; } for (IAtom neighbour : neighbours) { if (ringSet.contains(neighbour)) { return true; } } return false; }
/** * Gets the ringSetOfAtom attribute of the ModelBuilder3D object. * *@return The ringSetOfAtom value */ private IRingSet getRingSetOfAtom(List ringSystems, IAtom atom) { IRingSet ringSetOfAtom = null; for (int i = 0; i < ringSystems.size(); i++) { if (((IRingSet) ringSystems.get(i)).contains(atom)) { return (IRingSet) ringSystems.get(i); } } return ringSetOfAtom; }
/** * Check if atom or neighbour atom is part of a ring * *@param ac Description of the Parameter *@param atom Description of the Parameter *@return The hydrogenCount value */ private boolean checkRingLink(IRingSet ringSet, IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); if (ringSet.contains(atom)) { return true; } for (IAtom neighbour : neighbours) { if (ringSet.contains(neighbour)) { return true; } } return false; }
/** * Get the ring system of which the given atom is part of * * @param ringSystems a List of ring systems to be searched * @param ringAtom the ring atom to be search in the ring system. * @return the ring system the given atom is part of */ private IRingSet getRingSystemOfAtom(List ringSystems, IAtom ringAtom) { IRingSet ringSet = null; for (int f = 0; f < ringSystems.size(); f++) { ringSet = (IRingSet) ringSystems.get(f); if (ringSet.contains(ringAtom)) { return ringSet; } } return null; }
/** * Get the ring system of which the given atom is part of * * @param ringSystems a List of ring systems to be searched * @param ringAtom the ring atom to be search in the ring system. * @return the ring system the given atom is part of */ private IRingSet getRingSystemOfAtom(List ringSystems, IAtom ringAtom) { IRingSet ringSet = null; for (int f = 0; f < ringSystems.size(); f++) { ringSet = (IRingSet) ringSystems.get(f); if (ringSet.contains(ringAtom)) { return ringSet; } } return null; }
if (allRings != null && allRings.contains(atom)) { // it's in a ring atom.setFlag(CDKConstants.ISINRING, true); atom.setFlag(CDKConstants.ISALIPHATIC, false);
if (allRings != null && allRings.contains(atom)) { // it's in a ring atom.setFlag(CDKConstants.ISINRING, true); atom.setFlag(CDKConstants.ISALIPHATIC, false);
/** * Perform a walk in the given RingSet, starting at a given Ring and * recursively searching for other Rings connected to this ring. By doing * this it finds all rings in the RingSet connected to the start ring, * putting them in newRs, and removing them from rs. * *@param rs The RingSet to be searched *@param ring The ring to start with *@param newRs The RingSet containing all Rings connected to ring *@return newRs The RingSet containing all Rings connected to ring */ private static IRingSet walkRingSystem(IRingSet rs, IRing ring, IRingSet newRs) { IRing tempRing; IRingSet tempRings = rs.getConnectedRings(ring); // logger.debug("walkRingSystem -> tempRings.size(): " + tempRings.size()); rs.removeAtomContainer(ring); for (IAtomContainer container : tempRings.atomContainers()) { tempRing = (IRing) container; if (!newRs.contains(tempRing)) { newRs.addAtomContainer(tempRing); newRs.add(walkRingSystem(rs, tempRing, newRs)); } } return newRs; }
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }
if (rs.contains(atom)) { IRingSet rsAtom = rs.getRings(atom); for (int ringSetIndex = 0; ringSetIndex < rsAtom.getAtomContainerCount(); ringSetIndex++) {
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }
if (rs.contains(atom)) { IRingSet rsAtom = rs.getRings(atom); for (int ringSetIndex = 0; ringSetIndex < rsAtom.getAtomContainerCount(); ringSetIndex++) {
if (ringSetMolecule.contains(atom)) { NumberOfRingAtoms = NumberOfRingAtoms + 1; atom.setFlag(CDKConstants.ISINRING, true);
if (ringSetMolecule.contains(atom)) { NumberOfRingAtoms = NumberOfRingAtoms + 1; atom.setFlag(CDKConstants.ISINRING, true);
if (ringSetMolecule.contains(atom2)) { ringSetA = ringSetMolecule.getRings(atom2); RingSetManipulator.sort(ringSetA);
/** * * @param ringBond * @param singleRings * @return */ public static IRingSet getSmallestRingSet(IBond ringBond, IRingSet singleRings) { IRingSet rs = new RingSet(); for (IAtomContainer ring : singleRings.atomContainers()) { if (ring.contains(ringBond.getAtom(0)) && ring.contains(ringBond.getAtom(1))) { if (rs.getAtomContainerCount() == 0) { rs.addAtomContainer(ring); continue; } for (IAtomContainer smallestRing : rs.atomContainers()) { if (ring.getAtomCount() == smallestRing.getAtomCount()) { if (!rs.contains(ring)) { rs.addAtomContainer(ring); } } else if (ring.getAtomCount() < smallestRing.getAtomCount()) { rs.removeAllAtomContainers(); rs.addAtomContainer(ring); } } } } return rs; }
ringset.addAtomContainer(ring2); Assert.assertTrue(ringset.contains(ring1Atom1)); Assert.assertTrue(ringset.contains(ring1Atom2)); Assert.assertTrue(ringset.contains(sharedAtom1)); Assert.assertTrue(ringset.contains(sharedAtom2)); Assert.assertTrue(ringset.contains(ring2Atom1)); Assert.assertTrue(ringset.contains(ring2Atom2));