Impact of 'useBondOrder' on RDKFingerprint()

This section provides a tutorial example on impact of the 'useBondOrder' option on fingerprint generation with rdkit.Chem.rdmolops.RDKFingerprint() function.

The 'useBondOrder' option in the rdkit.Chem.rdmolops.RDKFingerprint() function call allows you to control whether bond order (bond type) should be considered in unique subgraphs determination. If useBondOrder=True is used, different bond orders are considered as different subgraphs. If useBondOrder=False is used, different bond orders are considered as the same bond.

1. For example, "CC" and "C=C" are considered as 2 different subgraphs when "useBondOrder=True" is used. Their hash values set bit 28 and bit 52 in the fingerprint of molecule "CC=C".

from rdkit import Chem
atomBits = []
bitInfo = {}
mol = Chem.MolFromSmiles('CC=C')
fp = Chem.RDKFingerprint(mol, 
  fpSize=64, nBitsPerHash=1, useBondOrder=True, 
  atomBits=atomBits, bitInfo=bitInfo)
print(fp.ToBitString())
print(fp.GetNumOnBits())
print(atomBits)
print(bitInfo)

# output: 
0000000000000000010000000000100000000000000000000000100000000000
3
[[28, 17], [28, 52, 17], [52, 17]]
{17: [[0, 1]], 28: [[0]], 52: [[1]]}

2. For the same molecule, "CC" and "C=C" are considered as identical subgraphs when "useBondOrder=False" is used. Their shared hash value sets bit 28 in the fingerprint.

atomBits = []
bitInfo = {}
mol = Chem.MolFromSmiles('CC=C')
fp = Chem.RDKFingerprint(mol, 
  fpSize=64, nBitsPerHash=1, useBondOrder=False, 
  atomBits=atomBits, bitInfo=bitInfo)
print(fp.ToBitString())
print(fp.GetNumOnBits())
print(atomBits)
print(bitInfo)

# output:
0000000000000000000001000000100000000000000000000000000000000000
2
[[28, 21], [28, 21], [28, 21]]
{21: [[0, 1]], 28: [[0], [1]]}

Conclusion: We should keep using "useBondOrder=True" option so that differences in bond orders will be reflected the fingerprint.

Table of Contents

 About This Book

 SMILES (Simplified Molecular-Input Line-Entry System)

 Open Babel: The Open Source Chemistry Toolbox

 Using Open Babel Command: "obabel"

 Generating SVG Pictures with Open Babel

 Substructure Search with Open Babel

 Similarity Search with Open Babel

 Fingerprint Index for Fastsearch with Open Babel

 Stereochemistry with Open Babel

 Command Line Tools Provided by Open Babel

 RDKit: Open-Source Cheminformatics Software

 rdkit.Chem.rdchem - The Core Module

 rdkit.Chem.rdmolfiles - Molecular File Module

 rdkit.Chem.rdDepictor - Compute 2D Coordinates

 rdkit.Chem.Draw - Handle Molecule Images

 Molecule Substructure Search with RDKit

 rdkit.Chem.rdmolops - Molecule Operations

Daylight Fingerprint Generator in RDKit

 What Is Daylight Fingerprint Generator in RDKit

 RDKFingerprint() Method in RDKit

Impact of 'useBondOrder' on RDKFingerprint()

 Impact of 'branchedPaths' on RDKFingerprint()

 Impact of 'maxPath' on RDKFingerprint()

 Impact of 'fpSize' on RDKFingerprint()

 Impact of 'tgtDensity' on RDKFingerprint()

 Impact of 'nBitsPerHash' on RDKFingerprint()

 UnfoldedRDKFingerprintCountBased() Method in RDKit

 GetRDKitFPGenerator() Method in RDKit

 Morgan Fingerprint Generator in RDKit

 RDKit Performance on Substructure Search

 Introduction to Molecular Fingerprints

 OCSR (Optical Chemical Structure Recognition)

 AlphaFold - Protein Structure Prediction

 Resources and Tools

 Cheminformatics Related Terminologies

 References

 Full Version in PDF/EPUB