test_class.declarator: logger = LoggingToolFactory.createLoggingTool(MACCSFingerprinterTest.class)
test_class.modifier: private static
test_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(MACCSFingerprinterTest.class);
test_class.type: ILoggingTool
test_class.var_name: logger
test_class.file: descriptor/fingerprint/src/test/java/org/openscience/cdk/fingerprint/MACCSFingerprinterTest.java
test_class.identifier: MACCSFingerprinterTest
test_class.superclass: extends AbstractFixedLengthFingerprinterTest
test_case.body: @Test
      @Override
      public void testBug706786() throws Exception {
  
          IAtomContainer superStructure = bug706786_1();
          IAtomContainer subStructure = bug706786_2();
  
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(superStructure);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(subStructure);
          addImplicitHydrogens(superStructure);
          addImplicitHydrogens(subStructure);
  
          IFingerprinter fpr = new MACCSFingerprinter();
          IBitFingerprint superBits = fpr.getBitFingerprint(superStructure);
          IBitFingerprint subBits = fpr.getBitFingerprint(subStructure);
  
          assertThat(
                  superBits.asBitSet(),
                  is(asBitSet(53, 56, 65, 71, 73, 88, 97, 104, 111, 112, 126, 130, 136, 138, 139, 140, 142, 143,
                          144, 145, 148, 149, 151, 153, 156, 158, 159, 161, 162, 163, 164)));
          assertThat(
                  subBits.asBitSet(),
                  is(asBitSet(56, 97, 104, 108, 112, 117, 131, 136, 143, 144, 146, 151, 152, 156, 161, 162, 163, 164)));
      }
test_case.class_method_signature: MACCSFingerprinterTest.testBug706786()
test_case.full_signature: @Test @Override public void testBug706786()
test_case.identifier: testBug706786
test_case.invocations: bug706786_1 bug706786_2 percieveAtomTypesAndConfigureAtoms percieveAtomTypesAndConfigureAtoms addImplicitHydrogens addImplicitHydrogens getBitFingerprint getBitFingerprint assertThat asBitSet is asBitSet assertThat asBitSet is asBitSet
test_case.modifiers: @Test @Override public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBug706786()
focal_class.declarator: logger          = LoggingToolFactory.createLoggingTool(MACCSFingerprinter.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger          = LoggingToolFactory.createLoggingTool(MACCSFingerprinter.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.declarator: KEY_DEFINITIONS = "data/maccs.txt"
focal_class.modifier: private static final
focal_class.original_string: private static final String KEY_DEFINITIONS = "data/maccs.txt";
focal_class.type: String
focal_class.var_name: KEY_DEFINITIONS
focal_class.declarator: keys            = null
focal_class.modifier: private volatile
focal_class.original_string: private volatile MaccsKey[] keys            = null;
focal_class.type: MaccsKey[]
focal_class.var_name: keys
focal_class.declarator: lock = new Object()
focal_class.modifier: private final
focal_class.original_string: private final Object lock = new Object();
focal_class.type: Object
focal_class.var_name: lock
focal_class.file: descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/MACCSFingerprinter.java
focal_class.identifier: MACCSFingerprinter
focal_class.interfaces: implements IFingerprinter
focal_class.class_method_signature: MACCSFingerprinter.MACCSFingerprinter()
focal_class.full_signature: public  MACCSFingerprinter()
focal_class.identifier: MACCSFingerprinter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  MACCSFingerprinter()
focal_class.class_method_signature: MACCSFingerprinter.MACCSFingerprinter(IChemObjectBuilder builder)
focal_class.full_signature: public  MACCSFingerprinter(IChemObjectBuilder builder)
focal_class.identifier: MACCSFingerprinter
focal_class.modifiers: public
focal_class.parameters: (IChemObjectBuilder builder)
focal_class.signature:  MACCSFingerprinter(IChemObjectBuilder builder)
focal_class.class_method_signature: MACCSFingerprinter.getBitFingerprint(IAtomContainer container)
focal_class.full_signature: @Override public IBitFingerprint getBitFingerprint(IAtomContainer container)
focal_class.identifier: getBitFingerprint
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer container)
focal_class.return: IBitFingerprint
focal_class.signature: IBitFingerprint getBitFingerprint(IAtomContainer container)
focal_class.class_method_signature: MACCSFingerprinter.visitPart(boolean[] visit, int[][] g, int beg, int prev)
focal_class.full_signature: private static int visitPart(boolean[] visit, int[][] g, int beg, int prev)
focal_class.identifier: visitPart
focal_class.modifiers: private static
focal_class.parameters: (boolean[] visit, int[][] g, int beg, int prev)
focal_class.return: int
focal_class.signature: int visitPart(boolean[] visit, int[][] g, int beg, int prev)
focal_class.class_method_signature: MACCSFingerprinter.isAromPath(int[] path, GraphUtil.EdgeToBondMap bmap)
focal_class.full_signature: private static boolean isAromPath(int[] path, GraphUtil.EdgeToBondMap bmap)
focal_class.identifier: isAromPath
focal_class.modifiers: private static
focal_class.parameters: (int[] path, GraphUtil.EdgeToBondMap bmap)
focal_class.return: boolean
focal_class.signature: boolean isAromPath(int[] path, GraphUtil.EdgeToBondMap bmap)
focal_class.class_method_signature: MACCSFingerprinter.getRawFingerprint(IAtomContainer iAtomContainer)
focal_class.full_signature: @Override public Map<String, Integer> getRawFingerprint(IAtomContainer iAtomContainer)
focal_class.identifier: getRawFingerprint
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer iAtomContainer)
focal_class.return: Map<String, Integer>
focal_class.signature: Map<String, Integer> getRawFingerprint(IAtomContainer iAtomContainer)
focal_class.class_method_signature: MACCSFingerprinter.getSize()
focal_class.full_signature: @Override public int getSize()
focal_class.identifier: getSize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getSize()
focal_class.class_method_signature: MACCSFingerprinter.readKeyDef(final IChemObjectBuilder builder)
focal_class.full_signature: private MaccsKey[] readKeyDef(final IChemObjectBuilder builder)
focal_class.identifier: readKeyDef
focal_class.modifiers: private
focal_class.parameters: (final IChemObjectBuilder builder)
focal_class.return: MaccsKey[]
focal_class.signature: MaccsKey[] readKeyDef(final IChemObjectBuilder builder)
focal_class.class_method_signature: MACCSFingerprinter.getCountFingerprint(IAtomContainer container)
focal_class.full_signature: @Override public ICountFingerprint getCountFingerprint(IAtomContainer container)
focal_class.identifier: getCountFingerprint
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer container)
focal_class.return: ICountFingerprint
focal_class.signature: ICountFingerprint getCountFingerprint(IAtomContainer container)
focal_class.class_method_signature: MACCSFingerprinter.keys(final IChemObjectBuilder builder)
focal_class.full_signature: private MaccsKey[] keys(final IChemObjectBuilder builder)
focal_class.identifier: keys
focal_class.modifiers: private
focal_class.parameters: (final IChemObjectBuilder builder)
focal_class.return: MaccsKey[]
focal_class.signature: MaccsKey[] keys(final IChemObjectBuilder builder)
focal_class.class_method_signature: MACCSFingerprinter.createPattern(String smarts, IChemObjectBuilder builder)
focal_class.full_signature: private Pattern createPattern(String smarts, IChemObjectBuilder builder)
focal_class.identifier: createPattern
focal_class.modifiers: private
focal_class.parameters: (String smarts, IChemObjectBuilder builder)
focal_class.return: Pattern
focal_class.signature: Pattern createPattern(String smarts, IChemObjectBuilder builder)
focal_class.superclass: extends AbstractFingerprinter
focal_method.body: @Override
      public IBitFingerprint getBitFingerprint(IAtomContainer container) throws CDKException {
  
          MaccsKey[] keys = keys(container.getBuilder());
          BitSet fp = new BitSet(keys.length);
  
          // init SMARTS invariants (connectivity, degree, etc)
          SmartsPattern.prepare(container);
  
          final int numAtoms = container.getAtomCount();
  
  
          final GraphUtil.EdgeToBondMap bmap    = GraphUtil.EdgeToBondMap.withSpaceFor(container);
          final int[][]                 adjlist = GraphUtil.toAdjList(container, bmap);
  
          for (int i = 0; i < keys.length; i++) {
              final MaccsKey key     = keys[i];
              final Pattern  pattern = key.pattern;
  
              switch (key.smarts) {
                  case "[!*]":
                      break;
                  case "[!0]":
                      for (IAtom atom : container.atoms()) {
                          if (atom.getMassNumber() != null) {
                              fp.set(i);
                              break;
                          }
                      }
                      break;
  
                  // ring bits
                  case "[R]1@*@*@1": // 3M RING bit22
                  case "[R]1@*@*@*@1": // 4M RING bit11
                  case "[R]1@*@*@*@*@1": // 5M RING bit96
                  case "[R]1@*@*@*@*@*@1": // 6M RING bit163, x2=bit145
                  case "[R]1@*@*@*@*@*@*@1": // 7M RING, bit19
                  case "[R]1@*@*@*@*@*@*@*@1": // 8M RING, bit101
                      // handled separately
                      break;
  
                  case "(*).(*)":
                      // bit 166 (*).(*) we can match this in SMARTS but it's faster to just
                      // count the number of components or in this case try to traverse the
                      // component, iff there are some atoms not visited we have more than
                      // one component
                      boolean[] visit = new boolean[numAtoms];
                      if (numAtoms > 1 && visitPart(visit, adjlist, 0, -1) < numAtoms)
                          fp.set(165);
                      break;
  
                  default:
                      if (key.count == 0) {
                          if (pattern.matches(container))
                              fp.set(i);
                      } else {
                          // check if there are at least 'count' unique hits, key.count = 0
                          // means find at least one match hence we add 1 to out limit
                          if (pattern.matchAll(container).uniqueAtoms().atLeast(key.count + 1))
                              fp.set(i);
                      }
                      break;
              }
          }
  
          // Ring Bits
  
          // threshold=126, see AllRingsFinder.Threshold.PubChem_97
          if (numAtoms > 2) {
              AllCycles allcycles = new AllCycles(adjlist,
                                                  Math.min(8, numAtoms),
                                                  126);
              int numArom = 0;
              for (int[] path : allcycles.paths()) {
                  // length is +1 as we repeat the closure vertex
                  switch (path.length) {
                      case 4: // 3M bit22
                          fp.set(21);
                          break;
                      case 5: // 4M bit11
                          fp.set(10);
                          break;
                      case 6: // 5M bit96
                          fp.set(95);
                          break;
                      case 7: // 6M bit163->bit145, bit124 numArom > 1
  
                          if (numArom < 2) {
                              if (isAromPath(path, bmap)) {
                                  numArom++;
                                  if (numArom == 2)
                                      fp.set(124);
                              }
                          }
  
                          if (fp.get(162)) {
                              fp.set(144); // >0
                          } else {
                              fp.set(162); // >1
                          }
                          break;
                      case 8: // 7M bit19
                          fp.set(18);
                          break;
                      case 9: // 8M bit101
                          fp.set(100);
                          break;
                  }
              }
          }
  
          return new BitSetFingerprint(fp);
      }
focal_method.class_method_signature: MACCSFingerprinter.getBitFingerprint(IAtomContainer container)
focal_method.full_signature: @Override public IBitFingerprint getBitFingerprint(IAtomContainer container)
focal_method.identifier: getBitFingerprint
focal_method.invocations: keys getBuilder prepare getAtomCount withSpaceFor toAdjList atoms getMassNumber set visitPart set matches set atLeast uniqueAtoms matchAll set min paths set set set isAromPath set get set set set set
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer container)
focal_method.return: IBitFingerprint
focal_method.signature: IBitFingerprint getBitFingerprint(IAtomContainer container)