test_class.declarator: dbst
test_class.modifier: private static
test_class.original_string: private static DeduceBondSystemTool dbst;
test_class.type: DeduceBondSystemTool
test_class.var_name: dbst
test_class.file: legacy/src/test/java/org/openscience/cdk/smiles/DeduceBondSystemToolTest.java
test_class.identifier: DeduceBondSystemToolTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test(timeout = 1000)
      public void testPyrrole_Silent() throws Exception {
          String smiles = "c2ccc3n([H])c1ccccc1c3(c2)";
          SmilesParser smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance());
          smilesParser.kekulise(false);
          IAtomContainer molecule = smilesParser.parseSmiles(smiles);
          AtomContainerManipulator.setSingleOrDoubleFlags(molecule);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
          molecule = dbst.fixAromaticBondOrders(molecule);
          Assert.assertNotNull(molecule);
  
          molecule = (IAtomContainer) AtomContainerManipulator.removeHydrogens(molecule);
  
          int doubleBondCount = 0;
          for (int i = 0; i < molecule.getBondCount(); i++) {
              IBond bond = molecule.getBond(i);
              Assert.assertTrue(bond.getFlag(CDKConstants.ISAROMATIC));
              if (bond.getOrder() == Order.DOUBLE) doubleBondCount++;
          }
          Assert.assertEquals(6, doubleBondCount);
      }
test_case.class_method_signature: DeduceBondSystemToolTest.testPyrrole_Silent()
test_case.full_signature: @Test(timeout = 1000) public void testPyrrole_Silent()
test_case.identifier: testPyrrole_Silent
test_case.invocations: getInstance kekulise parseSmiles setSingleOrDoubleFlags percieveAtomTypesAndConfigureAtoms fixAromaticBondOrders assertNotNull removeHydrogens getBondCount getBond assertTrue getFlag getOrder assertEquals
test_case.modifiers: @Test(timeout = 1000) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPyrrole_Silent()
focal_class.declarator: allRingsFinder
focal_class.modifier: private
focal_class.original_string: private AllRingsFinder      allRingsFinder;
focal_class.type: AllRingsFinder
focal_class.var_name: allRingsFinder
focal_class.declarator: logger      = LoggingToolFactory.createLoggingTool(DeduceBondSystemTool.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger      = LoggingToolFactory.createLoggingTool(DeduceBondSystemTool.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.declarator: listOfRings = null
focal_class.modifier: private
focal_class.original_string: private List<Integer[]>     listOfRings = null;
focal_class.type: List<Integer[]>
focal_class.var_name: listOfRings
focal_class.declarator: interrupted
focal_class.modifier: private
focal_class.original_string: private boolean             interrupted;
focal_class.type: boolean
focal_class.var_name: interrupted
focal_class.file: legacy/src/main/java/org/openscience/cdk/smiles/DeduceBondSystemTool.java
focal_class.identifier: DeduceBondSystemTool
focal_class.class_method_signature: DeduceBondSystemTool.DeduceBondSystemTool()
focal_class.full_signature: public  DeduceBondSystemTool()
focal_class.identifier: DeduceBondSystemTool
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  DeduceBondSystemTool()
focal_class.class_method_signature: DeduceBondSystemTool.DeduceBondSystemTool(AllRingsFinder ringFinder)
focal_class.full_signature: public  DeduceBondSystemTool(AllRingsFinder ringFinder)
focal_class.identifier: DeduceBondSystemTool
focal_class.modifiers: public
focal_class.parameters: (AllRingsFinder ringFinder)
focal_class.signature:  DeduceBondSystemTool(AllRingsFinder ringFinder)
focal_class.class_method_signature: DeduceBondSystemTool.isOK(IAtomContainer m)
focal_class.full_signature: public boolean isOK(IAtomContainer m)
focal_class.identifier: isOK
focal_class.modifiers: public
focal_class.parameters: (IAtomContainer m)
focal_class.return: boolean
focal_class.signature: boolean isOK(IAtomContainer m)
focal_class.class_method_signature: DeduceBondSystemTool.fixAromaticBondOrders(IAtomContainer atomContainer)
focal_class.full_signature: public IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer)
focal_class.identifier: fixAromaticBondOrders
focal_class.modifiers: public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: IAtomContainer
focal_class.signature: IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer)
focal_class.class_method_signature: DeduceBondSystemTool.FixPyridineNOxides(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.full_signature: private void FixPyridineNOxides(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.identifier: FixPyridineNOxides
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer atomContainer, IRingSet ringSet)
focal_class.return: void
focal_class.signature: void FixPyridineNOxides(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.class_method_signature: DeduceBondSystemTool.applyBonds(IAtomContainer m, List<String> al)
focal_class.full_signature: private void applyBonds(IAtomContainer m, List<String> al)
focal_class.identifier: applyBonds
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m, List<String> al)
focal_class.return: void
focal_class.signature: void applyBonds(IAtomContainer m, List<String> al)
focal_class.class_method_signature: DeduceBondSystemTool.fiveMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.full_signature: private void fiveMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.identifier: fiveMemberedRingPossibilities
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.return: void
focal_class.signature: void fiveMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.class_method_signature: DeduceBondSystemTool.sixMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.full_signature: private void sixMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.identifier: sixMemberedRingPossibilities
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.return: void
focal_class.signature: void sixMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.class_method_signature: DeduceBondSystemTool.sevenMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.full_signature: private void sevenMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.identifier: sevenMemberedRingPossibilities
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.return: void
focal_class.signature: void sevenMemberedRingPossibilities(IAtomContainer m, IRing r, List<List<List<String>>> MasterList)
focal_class.class_method_signature: DeduceBondSystemTool.getBadCount(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.full_signature: private int getBadCount(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.identifier: getBadCount
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer atomContainer, IRingSet ringSet)
focal_class.return: int
focal_class.signature: int getBadCount(IAtomContainer atomContainer, IRingSet ringSet)
focal_class.class_method_signature: DeduceBondSystemTool.inRingSet(IAtom atom, IRingSet ringSet)
focal_class.full_signature: private boolean inRingSet(IAtom atom, IRingSet ringSet)
focal_class.identifier: inRingSet
focal_class.modifiers: private
focal_class.parameters: (IAtom atom, IRingSet ringSet)
focal_class.return: boolean
focal_class.signature: boolean inRingSet(IAtom atom, IRingSet ringSet)
focal_class.class_method_signature: DeduceBondSystemTool.loop(long starttime, IAtomContainer atomContainer, int index,
              List<List<List<String>>> MasterList, int[] choices, IAtomContainerSet som)
focal_class.full_signature: private IAtomContainer loop(long starttime, IAtomContainer atomContainer, int index,
              List<List<List<String>>> MasterList, int[] choices, IAtomContainerSet som)
focal_class.identifier: loop
focal_class.modifiers: private
focal_class.parameters: (long starttime, IAtomContainer atomContainer, int index,
              List<List<List<String>>> MasterList, int[] choices, IAtomContainerSet som)
focal_class.return: IAtomContainer
focal_class.signature: IAtomContainer loop(long starttime, IAtomContainer atomContainer, int index,
              List<List<List<String>>> MasterList, int[] choices, IAtomContainerSet som)
focal_class.class_method_signature: DeduceBondSystemTool.isStructureOK(IAtomContainer atomContainer)
focal_class.full_signature: private boolean isStructureOK(IAtomContainer atomContainer)
focal_class.identifier: isStructureOK
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: boolean
focal_class.signature: boolean isStructureOK(IAtomContainer atomContainer)
focal_class.class_method_signature: DeduceBondSystemTool.removeExtraRings(IAtomContainer m)
focal_class.full_signature: private IRingSet removeExtraRings(IAtomContainer m)
focal_class.identifier: removeExtraRings
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m)
focal_class.return: IRingSet
focal_class.signature: IRingSet removeExtraRings(IAtomContainer m)
focal_class.class_method_signature: DeduceBondSystemTool.findRingsToCheck(IRingSet rs)
focal_class.full_signature: private boolean[] findRingsToCheck(IRingSet rs)
focal_class.identifier: findRingsToCheck
focal_class.modifiers: private
focal_class.parameters: (IRingSet rs)
focal_class.return: boolean[]
focal_class.signature: boolean[] findRingsToCheck(IRingSet rs)
focal_class.class_method_signature: DeduceBondSystemTool.storeRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.full_signature: private void storeRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.identifier: storeRingSystem
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer mol, IRingSet ringSet)
focal_class.return: void
focal_class.signature: void storeRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.class_method_signature: DeduceBondSystemTool.recoverRingSystem(IAtomContainer mol)
focal_class.full_signature: private IRingSet recoverRingSystem(IAtomContainer mol)
focal_class.identifier: recoverRingSystem
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer mol)
focal_class.return: IRingSet
focal_class.signature: IRingSet recoverRingSystem(IAtomContainer mol)
focal_class.class_method_signature: DeduceBondSystemTool.setInterrupted(boolean interrupted)
focal_class.full_signature: public void setInterrupted(boolean interrupted)
focal_class.identifier: setInterrupted
focal_class.modifiers: public
focal_class.parameters: (boolean interrupted)
focal_class.return: void
focal_class.signature: void setInterrupted(boolean interrupted)
focal_class.class_method_signature: DeduceBondSystemTool.isInterrupted()
focal_class.full_signature: public boolean isInterrupted()
focal_class.identifier: isInterrupted
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isInterrupted()
focal_method.body: public IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer) throws CDKException {
  
          // preset all bond orders to single
          for (IBond bond : atomContainer.bonds()) {
              if (bond.isAromatic() && bond.getOrder() == IBond.Order.UNSET)
                  bond.setOrder(IBond.Order.SINGLE);
          }
  
          // OK, we take advantage here from the fact that this class does not take
          // into account rings larger than 7 atoms. See fixAromaticBondOrders().
          IRingSet rs = allRingsFinder.findAllRings(atomContainer, 7);
          storeRingSystem(atomContainer, rs);
  
          IRingSet ringSet;
  
          // TODO remove rings with nonsp2 carbons(?) and rings larger than 7 atoms
          ringSet = removeExtraRings(atomContainer);
  
          if (ringSet == null) throw new CDKException("failure in AllRingsFinder.findAllRings");
  
          List<List<List<String>>> MasterList = new ArrayList<List<List<String>>>();
  
          //this.counter=0;// counter which keeps track of all current possibilities for placing double bonds
  
          this.FixPyridineNOxides(atomContainer, ringSet);
  
          for (int i = 0; i <= ringSet.getAtomContainerCount() - 1; i++) {
  
              IRing ring = (IRing) ringSet.getAtomContainer(i);
  
              // only takes into account rings up to 7 atoms... if that changes,
              // make sure to update the findAllRings() calls too!
              if (ring.getAtomCount() == 5) {
                  fiveMemberedRingPossibilities(atomContainer, ring, MasterList);
              } else if (ring.getAtomCount() == 6) {
                  sixMemberedRingPossibilities(atomContainer, ring, MasterList);
              } else if (ring.getAtomCount() == 7) {
                  sevenMemberedRingPossibilities(atomContainer, ring, MasterList);
                  //TODO- add code for all 7 membered aromatic ring possibilities not just 3 bonds
              } else {
                  //TODO: what about other rings systems?
                  logger.debug("Found ring of size: " + ring.getAtomCount());
              }
          }
  
          IAtomContainerSet som = atomContainer.getBuilder().newInstance(IAtomContainerSet.class);
  
          //		int number=1; // total number of possibilities
          //
          //		for (int ii=0;ii<=MasterList.size()-1;ii++) {
          //		ArrayList ringlist=(ArrayList)MasterList.get(ii);
          //		number*=ringlist.size();
          //		}
          //		logger.debug("number= "+number);
  
          int[] choices;
  
          //if (number> 1000000) return null;
  
          choices = new int[MasterList.size()];
  
          if (MasterList.size() > 0) {
              IAtomContainer iAtomContainer = loop(System.currentTimeMillis(), atomContainer, 0, MasterList, choices, som);
              if (iAtomContainer != null) return iAtomContainer;
          }
  
          int mincount = 99999999;
  
          int best = -1; // one with minimum number of bad atoms
  
          // minimize number of potentially bad nitrogens among AtomContainers in the set
  
          for (int i = 0; i <= som.getAtomContainerCount() - 1; i++) {
  
              IAtomContainer mol = som.getAtomContainer(i);
  
              ringSet = removeExtraRings(mol);
  
              if (ringSet == null) continue;
  
              int count = getBadCount(mol, ringSet);
  
              //logger.debug(i + "\t" + count);
  
              if (count < mincount) {
                  mincount = count;
                  best = i;
              }
  
          }
  
          if (som.getAtomContainerCount() > 0) return som.getAtomContainer(best);
          return atomContainer;
      }
focal_method.class_method_signature: DeduceBondSystemTool.fixAromaticBondOrders(IAtomContainer atomContainer)
focal_method.full_signature: public IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer)
focal_method.identifier: fixAromaticBondOrders
focal_method.invocations: bonds isAromatic getOrder setOrder findAllRings storeRingSystem removeExtraRings FixPyridineNOxides getAtomContainerCount getAtomContainer getAtomCount fiveMemberedRingPossibilities getAtomCount sixMemberedRingPossibilities getAtomCount sevenMemberedRingPossibilities debug getAtomCount newInstance getBuilder size size loop currentTimeMillis getAtomContainerCount getAtomContainer removeExtraRings getBadCount getAtomContainerCount getAtomContainer
focal_method.modifiers: public
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: IAtomContainer
focal_method.signature: IAtomContainer fixAromaticBondOrders(IAtomContainer atomContainer)