/** * Get all paths of lengths 0 to the specified length. * * This method will find all paths up to length N starting from each * atom in the molecule and return the unique set of such paths. * * @param container The molecule to search * @param searchDepth The maximum path length desired * @return A Map of path strings, keyed on themselves * @deprecated Use {@link #encodePaths(IAtomContainer, int, BitSet, int)} */ @Deprecated protected int[] findPathes(IAtomContainer container, int searchDepth) throws CDKException { Set<Integer> hashes = new HashSet<>(); Map<IAtom, List<IBond>> cache = new HashMap<>(); StringBuilder buffer = new StringBuilder(); for (IAtom startAtom : container.atoms()) { List<List<IAtom>> p = PathTools.getLimitedPathsOfLengthUpto(container, startAtom, searchDepth, pathLimit); for (List<IAtom> path : p) { if (hashPseudoAtoms || !hasPseudoAtom(path)) hashes.add(encodeUniquePath(container, cache, path, buffer)); } } int pos = 0; int[] result = new int[hashes.size()]; for (Integer hash : hashes) result[pos++] = hash; return result; }
/** * Generates a fingerprint of the default size for the given AtomContainer. * * @param container The AtomContainer for which a Fingerprint is generated * @param ringFinder An instance of * {@link org.openscience.cdk.ringsearch.AllRingsFinder} * @exception CDKException if there is a timeout in ring or aromaticity * perception * @return A {@link BitSet} representing the fingerprint */ public IBitFingerprint getBitFingerprint(IAtomContainer container, AllRingsFinder ringFinder) throws CDKException { logger.debug("Entering Fingerprinter"); logger.debug("Starting Aromaticity Detection"); long before = System.currentTimeMillis(); if (!hasPseudoAtom(container.atoms())) { AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container); Aromaticity.cdkLegacy().apply(container); } long after = System.currentTimeMillis(); logger.debug("time for aromaticity calculation: " + (after - before) + " milliseconds"); logger.debug("Finished Aromaticity Detection"); BitSet bitSet = new BitSet(size); encodePaths(container, searchDepth, bitSet, size); return new BitSetFingerprint(bitSet); }