A molecular fingerprint encodes a molecule’s two-dimensional structural features as a fixed-length vector of 1s and 0s. Each bit records whether a particular feature, such as a benzene ring or carboxylic acid group, is present. This compact representation lets computational workflows compare compounds without manually inspecting complete structures. section 2.4
Fingerprints support virtual screening and similarity searching: compounds whose fingerprints resemble a query can be prioritized for further investigation. Tanimoto and Dice metrics are commonly used, while the fingerprint algorithm, similarity metric, and search strategy all affect results. section 2.4 section 2.6
Morgan circular fingerprints provide a practical implementation:
- Choose a radius and bit-vector length; radius 2 emphasizes local neighborhoods and functional groups, while larger radii capture broader molecular context. section 2.4.3
- Generate the fingerprint for every valid molecule, retaining the parameters in the feature-column name or workflow record. section 2.4.3
- Compare fingerprints to rank library compounds, commonly keeping the top N candidates for subsequent screening. section 2.6
- Inspect set bits by decomposing them into molecular fragments when interpretation is needed. section 2.4.3
Featurizing a compound library
With RDKit, configure a Morgan generator with radius 2 and 2048 bits, apply it to each molecule, and store the resulting vectors for similarity searching or machine-learning features. The demonstrated workflow also visualizes selected bits and their corresponding substructures. section 2.4.3
Listing 2.8 Featurizing molecules with Morgan fingerprints
from rdkit import DataStructs
from rdkit.Chem import AllChem
from rdkit.Chem.rdFingerprintGenerator import GetMorganGenerator
def generate_morgan_fingerprints( #A
df, mol_col='mol', radius=2, n_bits=2048 #A
): #A
df_copy = df.copy()
fp_col_name = f"morgan_fp_r{radius}_b{n_bits}"
morgan_generator = GetMorganGenerator(radius=radius, fpSize=n_bits)
def compute_fingerprint(mol):
if mol is None: return None
return morgan_generator.GetFingerprint(mol)
df_copy.loc[:,fp_col_name] = \
df_copy[mol_col].apply(compute_fingerprint)
return df_copy, fp_col_name
specs_filtered, fp_col_name = generate_morgan_fingerprints(
specs_filtered
)Use the listing to see a reusable RDKit function that handles missing molecules, names features by radius and bit length, and returns the augmented data frame. section 2.4.3
