PubchemFingerprinter extends AbstractFingerprinter implements IFingerprinter { public byte[] getFingerprintAsBytes() { return m_bits; } PubchemFingerprinter(IChemObjectBuilder builder); @Override IBitFingerprint getBitFingerprint(IAtomContainer atomContainer); @Override Map<String, Integer> getRawFingerprint(IAtomContainer iAtomContainer); @Override int getSize(); byte[] getFingerprintAsBytes(); static BitSet decode(String enc); @Override ICountFingerprint getCountFingerprint(IAtomContainer container); static final int FP_SIZE; }
@Test public void testGetFingerprintAsBytes() throws CDKException { IAtomContainer mol = parser.parseSmiles("C=C(C1=CC=C(C=C1)O)NNC2=C(C(=NC(=C2Cl)Cl)C(=O)O)Cl"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(mol.getBuilder()); adder.addImplicitHydrogens(mol); AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol); Aromaticity.cdkLegacy().apply(mol); PubchemFingerprinter printer = new PubchemFingerprinter(mol.getBuilder()); BitSet fp = printer.getBitFingerprint(mol).asBitSet(); byte[] actual = printer.getFingerprintAsBytes(); byte[] expected = Arrays.copyOf(toByteArray(fp), actual.length); Assert.assertArrayEquals(expected, actual); }