test_class.file: legacy/src/test/java/org/openscience/cdk/smsd/tools/MoleculeSanityCheckTest.java
test_class.identifier: MoleculeSanityCheckTest
test_case.body: @Test
      public void testFixAromaticity() throws InvalidSmilesException {
          String rawMolSmiles = "C1=CC2=C(C=C1)C=CC=C2";
          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
          IAtomContainer mol = sp.parseSmiles(rawMolSmiles);
          MoleculeSanityCheck.checkAndCleanMolecule(mol);
          int count = 0;
          for (IBond b : mol.bonds()) {
              if (b.getFlag(CDKConstants.ISAROMATIC) && b.getOrder().equals(IBond.Order.DOUBLE)) {
                  count++;
              }
          }
          assertEquals(5, count);
      }
test_case.class_method_signature: MoleculeSanityCheckTest.testFixAromaticity()
test_case.full_signature: @Test public void testFixAromaticity()
test_case.identifier: testFixAromaticity
test_case.invocations: getInstance parseSmiles checkAndCleanMolecule bonds getFlag equals getOrder assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFixAromaticity()
focal_class.file: legacy/src/main/java/org/openscience/cdk/smsd/tools/MoleculeSanityCheck.java
focal_class.identifier: MoleculeSanityCheck
focal_class.class_method_signature: MoleculeSanityCheck.checkAndCleanMolecule(IAtomContainer molecule)
focal_class.full_signature: public static IAtomContainer checkAndCleanMolecule(IAtomContainer molecule)
focal_class.identifier: checkAndCleanMolecule
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer molecule)
focal_class.return: IAtomContainer
focal_class.signature: IAtomContainer checkAndCleanMolecule(IAtomContainer molecule)
focal_class.class_method_signature: MoleculeSanityCheck.configure(IAtomContainer mol)
focal_class.full_signature: public static void configure(IAtomContainer mol)
focal_class.identifier: configure
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer mol)
focal_class.return: void
focal_class.signature: void configure(IAtomContainer mol)
focal_method.body: public static IAtomContainer checkAndCleanMolecule(IAtomContainer molecule) {
          boolean isMarkush = false;
          for (IAtom atom : molecule.atoms()) {
              if (atom.getSymbol().equals("R")) {
                  isMarkush = true;
                  break;
              }
          }
  
          if (isMarkush) {
              System.err.println("Skipping Markush structure for sanity check");
          }
  
          // Check for salts and such
          if (!ConnectivityChecker.isConnected(molecule)) {
              // lets see if we have just two parts if so, we assume its a salt and just work
              // on the larger part. Ideally we should have a check to ensure that the smaller
              //  part is a metal/halogen etc.
              IAtomContainerSet fragments = ConnectivityChecker.partitionIntoMolecules(molecule);
              if (fragments.getAtomContainerCount() > 2) {
                  System.err.println("More than 2 components. Skipped");
              } else {
                  IAtomContainer frag1 = fragments.getAtomContainer(0);
                  IAtomContainer frag2 = fragments.getAtomContainer(1);
                  if (frag1.getAtomCount() > frag2.getAtomCount()) {
                      molecule = frag1;
                  } else {
                      molecule = frag2;
                  }
              }
          }
          configure(molecule);
          return molecule;
      }
focal_method.class_method_signature: MoleculeSanityCheck.checkAndCleanMolecule(IAtomContainer molecule)
focal_method.full_signature: public static IAtomContainer checkAndCleanMolecule(IAtomContainer molecule)
focal_method.identifier: checkAndCleanMolecule
focal_method.invocations: atoms equals getSymbol println isConnected partitionIntoMolecules getAtomContainerCount println getAtomContainer getAtomContainer getAtomCount getAtomCount configure
focal_method.modifiers: public static
focal_method.parameters: (IAtomContainer molecule)
focal_method.return: IAtomContainer
focal_method.signature: IAtomContainer checkAndCleanMolecule(IAtomContainer molecule)