skillfed

mhfp

Molecular MHFP fingerprints for cheminformatics applications

mhfp v1.9.6 86.7K downloads/30d#13,842 on PyPI98
License unclear Abandoned released

What it is and what it does

MHFP is a molecular fingerprinting algorithm that converts chemical structures (provided as SMILES strings or RDKit molecule objects) into compact hash-based representations suitable for fast similarity searching. It applies the MinHash method to circular substructures extracted from molecules, encoding structural detail up to six bonds (MHFP6). The fingerprints are designed to work with locality-sensitive hashing (LSH) for approximate nearest-neighbor search, enabling rapid retrieval of similar molecules from large chemical databases.

The package provides two main interfaces: MHFPEncoder for generating fingerprints and computing pairwise distances, and LSHForestHelper for building indexed structures that support fast approximate queries. It also includes SECFP (SMILES Extended Connectivity Fingerprint), a folded variant. The package is a thin Python wrapper around the fingerprinting logic and depends on RDKit for molecular parsing and NumPy for numerical operations.

Use it for:

  • Virtual screening: find structurally similar drug candidates from a chemical library given a query molecule.
  • Analog recovery: identify known compounds similar to a novel structure in benchmarking or hit-to-lead workflows.
  • Approximate nearest-neighbor search: retrieve the k most similar molecules from a large dataset without exhaustive comparison.
  • Molecular clustering: group compounds by structural similarity using fingerprint distances.
  • Ligand-based design: compare test molecules against a reference set to assess novelty or redundancy.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Encodes molecular structures as MinHash fingerprints (MHFP6) for fast similarity search and nearest-neighbor queries using locality-sensitive hashing.

Yes, if you need fast molecular similarity search and can accept an unmaintained package. The algorithm is well-published and the code is stable, but verify RDKit compatibility with your environment and confirm the license terms before use. Not recommended for new projects requiring ongoing support or frequent updates.

Install

mhfp on PyPI

pip

pip install mhfp

uv

uv add mhfp

poetry

poetry add mhfp

Installing mhfp

Before you install

Low install friction with no runtime dependencies beyond RDKit and NumPy. Package is abandoned (last commit 2023-02-16, 1275 days ago) with no active maintenance, so expect no bug fixes or updates.

License in practice

License status is unclear—no SPDX identifier or raw license text provided. Verify the actual license terms at the repository before use in proprietary or copyleft-sensitive contexts.

Quickstart

pip install mhfp

from mhfp.encoder import MHFPEncoder

mhfp_encoder = MHFPEncoder()
fp = mhfp_encoder.encode('CCOC1=C(C=C(C=C1)S(=O)(=O)N(C)C)C2=NC(=O)C3=C(N2)C(=NN3C)C(C)(C)C')
dist = MHFPEncoder.distance(fp, fp)

Requires RDKit (cheminformatics library) and NumPy; RDKit must be installed separately and may have system-level dependencies.

Verify before relying

  • Whether the package's license is compatible with your use case (license status is unclear in the metadata).
  • Current stability and compatibility with recent RDKit and NumPy versions, given the package has not been updated since 2023.

Package facts

License not declared (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,275 days since the last release
Last repo commit
First released
Downloads 86,738/month — #13,842 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mhfp-1.9.6-py3-none-any.whl

Tags

molecular fingerprint minhashcheminformatics similarity searchSMILES to fingerprint encodingapproximate nearest neighbor moleculesLSH forest molecular searchECFP alternative fingerprintmolecule structure comparison
cheminformaticsmolecular-fingerprintssimilarity-search

More Scientific/Engineering packages