The fingerprint types implemented in OEGraphSim encode the 2D graph features of molecules. Fingerprints can be used in applications such as similarity searches, molecular characterization, molecular diversity and chemical database clustering.
The following three types of fingerprints are implemented:
MACCS keys are 166 bit structural key descriptors in which each bit is associated with a SMARTS pattern.
The following code snippets demonstrate two separate ways to create a MACCS keys fingerprint:
fp = OEFingerPrint()
OEMakeMACCS166FP(fp, mol)
OEMakeFP(fp, mol, OEFPType_MACCS166)
The OEGraphSim provides fingerprint API for the LINGO similarity search method implemented in OEChem.
The following code snippets demonstrate two separate ways to create a LINGO fingerprint:
fp = OEFingerPrint()
OEMakeLingoFP(fp, mol)
OEMakeFP(fp, mol, OEFPType_Lingo)
A path-based fingerprint is generated by exhaustively enumerating the unique linear paths of a molecular graph and projecting them into a fixed-length bitvector.
The following code snippets demonstrate two separate ways to create a path-based fingerprint with default parameters:
fp = OEFingerPrint()
OEMakePathFP(fp, mol)
OEMakeFP(fp, mol, OEFPType_Path)
See also
OEGraphSim also provides the ability to parameterize the path-based fingerprint generation with arbitrary sets of properties. For more details see the Path-based Fingerprint chapter.
A fingerprint is a bitvector. To reflect this the OEFingerPrint class derives from the OEBitVector class. The difference is that OEFingerPrint has a type that represents how the fingerprint is generated. Fingerprints may only be compared if they are generated in the same way. Therefore, the following restriction is introduced:
Warning
When two fingerprints are subjected to similarity calculation their type has to be identical.
Listing 1 shows how to create different fingerprint objects (OEFingerPrint) and identify or compare their types.
Listing 1: Fingerprint type
#!/usr/bin/env python
import sys
from openeye.oechem import *
from openeye.oegraphsim import *
fpA = OEFingerPrint()
fpB = OEFingerPrint()
if not fpA.IsValid():
print "uninitialized fingerprint"
mol = OEGraphMol()
OEParseSmiles(mol, "c1ccccc1")
OEMakeFP(fpA, mol, OEFPType_Path)
OEMakeFP(fpB, mol, OEFPType_Lingo)
if OEIsFPType(fpA, OEFPType_Lingo):
print "Lingo"
if OEIsFPType(fpA, OEFPType_Path):
print "Path"
if OEIsSameFPType(fpA, fpB):
print "same fingerprint types"
else:
print "different fingerprint types"
The output of Listing 1 is the following:
uninitialized fingerprint
Path
different fingerprint types
The following code snippet shows how to initialize a OEFingerPrint object by using the type of an other fingerprint. The type of a fingerprint is accessed by the OEFingerPrint.GetFPTypeBase method.
fpA = OEFingerPrint()
OEMakePathFP(fpA, mol)
fpB = OEFingerPrint()
OEMakeFP(fpB, mol, fpA.GetFPTypeBase())