public class Fingerprinter extends AbstractFingerprinter implements IFingerprinter
A fingerprint is generated for an AtomContainer with this code:
Molecule molecule = new Molecule(); IFingerprinter fingerprinter = new Fingerprinter(); IBitFingerprint fingerprint = fingerprinter.getBitFingerprint(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 |
---|---|
protected void |
encodePaths(IAtomContainer mol,
int depth,
BitSet fp,
int size) |
protected int[] |
findPathes(IAtomContainer container,
int searchDepth)
Deprecated.
|
IBitFingerprint |
getBitFingerprint(IAtomContainer container)
Generates a fingerprint of the default size for the given AtomContainer.
|
IBitFingerprint |
getBitFingerprint(IAtomContainer container,
AllRingsFinder ringFinder)
Generates a fingerprint of the default size for the given AtomContainer.
|
protected String |
getBondSymbol(IBond bond)
Gets the bondSymbol attribute of the Fingerprinter class
|
ICountFingerprint |
getCountFingerprint(IAtomContainer container)
Returns the count fingerprint for the given
IAtomContainer . |
protected List<Map.Entry<String,String>> |
getParameters()
Base classes should override this method to report the parameters they
are configured with.
|
Map<String,Integer> |
getRawFingerprint(IAtomContainer iAtomContainer)
Returns the raw representation of the fingerprint for the given IAtomContainer.
|
int |
getSearchDepth() |
int |
getSize()
Returns the size (or length) of the fingerprint.
|
void |
setHashPseudoAtoms(boolean value) |
void |
setPathLimit(int limit) |
getFingerprint, getVersionDescription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFingerprint, getVersionDescription
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 (number of bonds)protected List<Map.Entry<String,String>> getParameters()
AbstractFingerprinter
getParameters
in class AbstractFingerprinter
public IBitFingerprint getBitFingerprint(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
perceptionpublic IBitFingerprint getBitFingerprint(IAtomContainer container) throws CDKException
getBitFingerprint
in interface IFingerprinter
container
- The AtomContainer for which a Fingerprint is generatedCDKException
- may be thrown if there is an error during aromaticity detection
or (for key based fingerprints) if there is a SMARTS parsing errorpublic Map<String,Integer> getRawFingerprint(IAtomContainer iAtomContainer) throws CDKException
getRawFingerprint
in interface IFingerprinter
iAtomContainer
- IAtomContainer for which the fingerprint should be calculated.CDKException
@Deprecated protected int[] findPathes(IAtomContainer container, int searchDepth) throws CDKException
encodePaths(IAtomContainer, int, BitSet, int)
container
- The molecule to searchsearchDepth
- The maximum path length desiredCDKException
protected void encodePaths(IAtomContainer mol, int depth, BitSet fp, int size) throws CDKException
CDKException
protected String getBondSymbol(IBond bond)
bond
- Description of the Parameterpublic void setPathLimit(int limit)
public void setHashPseudoAtoms(boolean value)
public int getSearchDepth()
public int getSize()
IFingerprinter
getSize
in interface IFingerprinter
public ICountFingerprint getCountFingerprint(IAtomContainer container) throws CDKException
IFingerprinter
IAtomContainer
.getCountFingerprint
in interface IFingerprinter
container
- IAtomContainer
for which the fingerprint should be calculated.CDKException
- if there is an error during aromaticity detection
or (for key based fingerprints) if there is a SMARTS parsing error.Copyright © 2017. All Rights Reserved.