test_class.file: descriptor/fingerprint/src/test/java/org/openscience/cdk/fingerprint/SubstructureFingerprinterTest.java
test_class.identifier: SubstructureFingerprinterTest
test_class.superclass: extends AbstractFixedLengthFingerprinterTest
test_case.body: @Test
      public void testCountableMACCSCount2() throws Exception {
          SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
          IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS());
          IAtomContainer mol;
          ICountFingerprint cfp;
  
          // Test molecule 1
          mol = parser.parseSmiles("C([S](O)(=O)=O)C1=C(C=CC=C1)CCCC[N+](=O)[O-]");
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
          Aromaticity.cdkLegacy().apply(mol);
          cfp = printer.getCountFingerprint(mol);
  
          Assert.assertEquals(cfp.getCountForHash(46), 2);
          Assert.assertEquals(cfp.getCountForHash(27), 1);
          Assert.assertEquals(cfp.getCountForHash(59), 2);
          Assert.assertEquals(cfp.getCountForHash(49), 1);
          Assert.assertEquals(cfp.getCountForHash(111), 1);
          Assert.assertEquals(cfp.getCountForHash(129), 3);
          Assert.assertEquals(cfp.getCountForHash(115), 2);
          Assert.assertEquals(cfp.getCountForHash(120), 3);
          Assert.assertEquals(cfp.getCountForHash(41), 3);
  
          Assert.assertEquals(cfp.getCountForHash(93), 0);
          Assert.assertEquals(cfp.getCountForHash(91), 0);
          Assert.assertEquals(cfp.getCountForHash(24), 0);
  
          // Test molecule 2: Diatrizoic acid
          mol = parser.parseSmiles("CC(=O)NC1=C(C(=C(C(=C1I)C(=O)O)I)NC(=O)C)I");
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
          Aromaticity.cdkLegacy().apply(mol);
          cfp = printer.getCountFingerprint(mol);
  
          Assert.assertEquals(cfp.getCountForHash(15), 3);
          Assert.assertEquals(cfp.getCountForHash(135), 3);
          Assert.assertEquals(cfp.getCountForHash(139), 4);
          Assert.assertEquals(cfp.getCountForHash(93), 3);
          Assert.assertEquals(cfp.getCountForHash(73), 6);
  
          Assert.assertEquals(cfp.getCountForHash(91), 0);
      }
test_case.class_method_signature: SubstructureFingerprinterTest.testCountableMACCSCount2()
test_case.full_signature: @Test public void testCountableMACCSCount2()
test_case.identifier: testCountableMACCSCount2
test_case.invocations: getInstance getCountableMACCSSMARTS parseSmiles percieveAtomTypesAndConfigureAtoms apply cdkLegacy getCountFingerprint assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash parseSmiles percieveAtomTypesAndConfigureAtoms apply cdkLegacy getCountFingerprint assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash assertEquals getCountForHash
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCountableMACCSCount2()
focal_class.declarator: keys = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<Key> keys = new ArrayList<>();
focal_class.type: List<Key>
focal_class.var_name: keys
focal_class.file: descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/SubstructureFingerprinter.java
focal_class.identifier: SubstructureFingerprinter
focal_class.interfaces: implements IFingerprinter
focal_class.class_method_signature: SubstructureFingerprinter.SubstructureFingerprinter(String[] smarts)
focal_class.full_signature: public  SubstructureFingerprinter(String[] smarts)
focal_class.identifier: SubstructureFingerprinter
focal_class.modifiers: public
focal_class.parameters: (String[] smarts)
focal_class.signature:  SubstructureFingerprinter(String[] smarts)
focal_class.class_method_signature: SubstructureFingerprinter.SubstructureFingerprinter()
focal_class.full_signature: public  SubstructureFingerprinter()
focal_class.identifier: SubstructureFingerprinter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  SubstructureFingerprinter()
focal_class.class_method_signature: SubstructureFingerprinter.setSmarts(String[] smarts)
focal_class.full_signature: private void setSmarts(String[] smarts)
focal_class.identifier: setSmarts
focal_class.modifiers: private
focal_class.parameters: (String[] smarts)
focal_class.return: void
focal_class.signature: void setSmarts(String[] smarts)
focal_class.class_method_signature: SubstructureFingerprinter.getBitFingerprint(IAtomContainer atomContainer)
focal_class.full_signature: @Override public IBitFingerprint getBitFingerprint(IAtomContainer atomContainer)
focal_class.identifier: getBitFingerprint
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: IBitFingerprint
focal_class.signature: IBitFingerprint getBitFingerprint(IAtomContainer atomContainer)
focal_class.class_method_signature: SubstructureFingerprinter.getCountFingerprint(IAtomContainer atomContainer)
focal_class.full_signature: @Override public ICountFingerprint getCountFingerprint(IAtomContainer atomContainer)
focal_class.identifier: getCountFingerprint
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: ICountFingerprint
focal_class.signature: ICountFingerprint getCountFingerprint(IAtomContainer atomContainer)
focal_class.class_method_signature: SubstructureFingerprinter.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: SubstructureFingerprinter.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: SubstructureFingerprinter.getSubstructure(int bitIndex)
focal_class.full_signature: public String getSubstructure(int bitIndex)
focal_class.identifier: getSubstructure
focal_class.modifiers: public
focal_class.parameters: (int bitIndex)
focal_class.return: String
focal_class.signature: String getSubstructure(int bitIndex)
focal_class.superclass: extends AbstractFingerprinter
focal_method.body: @Override
      public ICountFingerprint getCountFingerprint(IAtomContainer atomContainer) throws CDKException {
          if (keys.isEmpty()) {
              throw new CDKException("No substructures were defined");
          }
  
          // init SMARTS invariants (connectivity, degree, etc)
          SmartsPattern.prepare(atomContainer);
  
          final Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
          for (int i = 0; i < keys.size(); i++) {
              Pattern ptrn = keys.get(i).pattern;
              map.put(i,
                      ptrn.matchAll(atomContainer)
                          .countUnique());
          }
  
          final int length = keys.size();
          final int size = map.size();
          final int[] hash = new int[size], count = new int[size];
          int n = 0;
          for (int h : map.keySet()) {
              hash[n] = h;
              count[n++] = map.get(h);
          }
  
          return new ICountFingerprint() {
  
              @Override
              public long size() { return length; }
  
              @Override
              public int numOfPopulatedbins() { return size; }
  
              @Override
              public int getCount(int index) { return count[index]; }
  
              @Override
              public int getHash(int index) { return hash[index]; }
  
              @Override
              public void merge(ICountFingerprint fp) {}
  
              @Override
              public void setBehaveAsBitFingerprint(boolean behaveAsBitFingerprint) {}
  
              @Override
              public boolean hasHash(int hash) { return map.containsKey(hash); }
  
              @Override
              public int getCountForHash(int hash) { return map.get(hash); }
          };
      }
focal_method.class_method_signature: SubstructureFingerprinter.getCountFingerprint(IAtomContainer atomContainer)
focal_method.full_signature: @Override public ICountFingerprint getCountFingerprint(IAtomContainer atomContainer)
focal_method.identifier: getCountFingerprint
focal_method.invocations: isEmpty prepare size get put countUnique matchAll size size keySet get containsKey get
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: ICountFingerprint
focal_method.signature: ICountFingerprint getCountFingerprint(IAtomContainer atomContainer)