Package org.openscience.cdk.fingerprint
Class ShortestPathFingerprinter
- java.lang.Object
-
- org.openscience.cdk.fingerprint.AbstractFingerprinter
-
- org.openscience.cdk.fingerprint.ShortestPathFingerprinter
-
- All Implemented Interfaces:
Serializable
,IFingerprinter
public class ShortestPathFingerprinter extends AbstractFingerprinter implements IFingerprinter, Serializable
Generates a fingerprint for a givenIAtomContainer
. Fingerprints are one-dimensional bit arrays, where bits are set according to a the occurrence of a particular structural feature (See for example the Daylight inc. theory manual for more information). Fingerprints are a means for determining the similarity of chemical structures, some fingerprints (not this one) allow database pre-screening for substructure searches.A fingerprint is generated for an AtomContainer with this code: It is recommended to use atomtyped container before generating the fingerprints. For example: AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(atomContainer); AtomContainer molecule = new AtomContainer(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(atomContainer); IFingerprinter fingerprinter = new ShortestPathFingerprinter(); IBitFingerprint fingerprint = fingerprinter.getFingerprint(molecule); fingerprint.fingerprintLength(); // returns 1024 by default fingerprint.length(); // returns the highest set bit
The FingerPrinter calculates fingerprint based on the Shortest Paths between two atoms. It also takes into account ring system, charges etc while generating a fingerprint.
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
.
Important! this fingerprint can not be used for substructure screening.- Author:
- Syed Asad Rahman (2012)
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- fingerprint
- Keywords:
- fingerprint, similarity
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SIZE
The default length of created fingerprints.
-
Constructor Summary
Constructors Constructor Description ShortestPathFingerprinter()
Creates a fingerprint generator of lengthDEFAULT_SIZE
ShortestPathFingerprinter(int fingerprintLength)
Constructs a fingerprint generator that creates fingerprints of the given fingerprintLength, using a generation algorithm with shortest paths.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IBitFingerprint
getBitFingerprint(IAtomContainer ac)
Generates a shortest path based BitSet fingerprint for the given AtomContainer.ICountFingerprint
getCountFingerprint(IAtomContainer iac)
Returns the count fingerprint for the givenIAtomContainer
.Map<String,Integer>
getRawFingerprint(IAtomContainer ac)
Returns the raw representation of the fingerprint for the given IAtomContainer.int
getSize()
Returns the size (or length) of the fingerprint.-
Methods inherited from class org.openscience.cdk.fingerprint.AbstractFingerprinter
getFingerprint, getParameters, getVersionDescription
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openscience.cdk.fingerprint.IFingerprinter
getFingerprint, getVersionDescription
-
-
-
-
Field Detail
-
DEFAULT_SIZE
public static final int DEFAULT_SIZE
The default length of created fingerprints.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ShortestPathFingerprinter
public ShortestPathFingerprinter()
Creates a fingerprint generator of lengthDEFAULT_SIZE
-
ShortestPathFingerprinter
public ShortestPathFingerprinter(int fingerprintLength)
Constructs a fingerprint generator that creates fingerprints of the given fingerprintLength, using a generation algorithm with shortest paths.- Parameters:
fingerprintLength
- The desired fingerprintLength of the fingerprint
-
-
Method Detail
-
getBitFingerprint
public IBitFingerprint getBitFingerprint(IAtomContainer ac) throws CDKException
Generates a shortest path based BitSet fingerprint for the given AtomContainer.- Specified by:
getBitFingerprint
in interfaceIFingerprinter
- Parameters:
ac
- The AtomContainer for which a fingerprint is generated- Returns:
- A
BitSet
representing the fingerprint - Throws:
CDKException
- if there error in aromaticity perception or other CDK functions
-
getRawFingerprint
public Map<String,Integer> getRawFingerprint(IAtomContainer ac) throws CDKException
Returns the raw representation of the fingerprint for the given IAtomContainer. The raw representation contains counts as well as the key strings.- Specified by:
getRawFingerprint
in interfaceIFingerprinter
- Parameters:
ac
- The AtomContainer for which a fingerprint is generated- Returns:
- Map of raw fingerprint paths/features
- Throws:
UnsupportedOperationException
- method is not supportedCDKException
-
getSize
public int getSize()
Description copied from interface:IFingerprinter
Returns the size (or length) of the fingerprint.- Specified by:
getSize
in interfaceIFingerprinter
- Returns:
- the size of the fingerprint
-
getCountFingerprint
public ICountFingerprint getCountFingerprint(IAtomContainer iac) throws CDKException
Description copied from interface:IFingerprinter
Returns the count fingerprint for the givenIAtomContainer
.- Specified by:
getCountFingerprint
in interfaceIFingerprinter
- Parameters:
iac
-IAtomContainer
for which the fingerprint should be calculated.- Returns:
- the count fingerprint
- Throws:
CDKException
- if there is an error during aromaticity detection or (for key based fingerprints) if there is a SMARTS parsing error.
-
-