@TestClass(value="org.openscience.cdk.fingerprint.FingerprinterTest") public class Fingerprinter extends Object implements IFingerprinter
A fingerprint is generated for an AtomContainer with this code:
Molecule molecule = new Molecule(); IFingerprinter fingerprinter = new Fingerprinter(); BitSet fingerprint = fingerprinter.getFingerprint(molecule); fingerprint.size(); // returns 1024 by default fingerprint.length(); // returns the highest set bit
The FingerPrinter assumes that hydrogens are explicitly given! Furthermore,
if pseudo atoms or atoms with malformed symbols are present, their atomic
number is taken as one more than the last element currently supported in
PeriodicTable
.
Warning: The aromaticity detection for this
FingerPrinter relies on AllRingsFinder, which is known to take very long
for some molecules with many cycles or special cyclic topologies. Thus,
the AllRingsFinder has a built-in timeout of 5 seconds after which it
aborts and throws an Exception. If you want your SMILES generated at any
expense, you need to create your own AllRingsFinder, set the timeout to a
higher value, and assign it to this FingerPrinter. In the vast majority of
cases, however, the defaults will be fine.
Another Warning : The daylight manual says: "Fingerprints are not so definite: if a fingerprint indicates a pattern is missing then it certainly is, but it can only indicate a pattern's presence with some probability." In the case of very small molecules, the probability that you get the same fingerprint for different molecules is high.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SEARCH_DEPTH
The default search depth used to create the fingerprints.
|
static int |
DEFAULT_SIZE
The default length of created fingerprints.
|
Constructor and Description |
---|
Fingerprinter()
Creates a fingerprint generator of length
DEFAULT_SIZE
and with a search depth of DEFAULT_SEARCH_DEPTH . |
Fingerprinter(int size) |
Fingerprinter(int size,
int searchDepth)
Constructs a fingerprint generator that creates fingerprints of
the given size, using a generation algorithm with the given search
depth.
|
Modifier and Type | Method and Description |
---|---|
BitSet |
getFingerprint(IAtomContainer container)
Generates a fingerprint of the default size for the given AtomContainer.
|
BitSet |
getFingerprint(IAtomContainer container,
AllRingsFinder ringFinder)
Generates a fingerprint of the default size for the given AtomContainer.
|
int |
getSearchDepth() |
int |
getSize()
Returns the size of the fingerprints calculated.
|
public static final int DEFAULT_SIZE
public static final int DEFAULT_SEARCH_DEPTH
public Fingerprinter()
DEFAULT_SIZE
and with a search depth of DEFAULT_SEARCH_DEPTH
.public Fingerprinter(int size)
public Fingerprinter(int size, int searchDepth)
size
- The desired size of the fingerprintsearchDepth
- The desired depth of search@TestMethod(value="testGetFingerprint_IAtomContainer") public BitSet getFingerprint(IAtomContainer container, AllRingsFinder ringFinder) throws CDKException
container
- The AtomContainer for which a Fingerprint is generatedringFinder
- An instance of
AllRingsFinder
BitSet
representing the fingerprintCDKException
- if there is a timeout in ring or aromaticity
perception@TestMethod(value="testGetFingerprint_IAtomContainer") public BitSet getFingerprint(IAtomContainer container) throws CDKException
getFingerprint
in interface IFingerprinter
container
- The AtomContainer for which a Fingerprint is generatedCDKException
- TODO@TestMethod(value="testGetSearchDepth") public int getSearchDepth()
@TestMethod(value="testGetSize") public int getSize()
IFingerprinter
getSize
in interface IFingerprinter