agentsclimarketplace

Molecular fingerprint generation

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/molecular-fingerprint-generation

Use when when you have annotated chemical structures (SMILES or InChI strings) from a curated MS/MS dataset and need to compute pairwise structural similarity scores (Tanimoto or other metrics) as training labels, or when preparing molecular representations for comparison against mass spectral data.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill molecular-fingerprint-generation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.9 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

molecular-fingerprint-generation

Summary

Generate binary molecular fingerprints from chemical structures (SMILES/InChI) using RDKit Daylight algorithm to encode structural features for downstream similarity computation and machine learning tasks.

When to use

When you have annotated chemical structures (SMILES or InChI strings) from a curated MS/MS dataset and need to compute pairwise structural similarity scores (Tanimoto or other metrics) as training labels, or when preparing molecular representations for comparison against mass spectral data.

When NOT to use

  • Input structures are already pre-computed fingerprints or embeddings (skip directly to similarity scoring).
  • Only unannotated spectra are available without chemical structure data (fingerprints cannot be generated de novo from mass spectral peaks alone).
  • Non-standard or stereoisomerically ambiguous InChI strings that do not map to a single canonical structure (handle curation first).

Inputs

  • InChIKey (14-character identifiers, unique per molecular structure)
  • InChI or SMILES strings (chemical structure representations)
  • Annotated MS/MS spectra dataset with metadata mappings

Outputs

  • RDKit Daylight fingerprints (2048-bit binary vectors, one per unique InChIKey)
  • Fingerprint index/lookup table (InChIKey → fingerprint)
  • Fingerprint matrix ready for pairwise similarity computation

How to apply

For each unique 14-character InChIKey in your annotated dataset, extract the most common InChI (if multiple InChI annotations exist for the same InChIKey) and generate a 2048-bit RDKit Daylight fingerprint using matchms and RDKit. Each fingerprint encodes structural features as a binary vector. Store fingerprints indexed by InChIKey for efficient pairwise comparison. The 2048-bit representation balances chemical feature discrimination with computational tractability for subsequent similarity scoring across large molecular libraries (e.g., 15,062 unique molecules).

Related tools

  • RDKit (Generates Daylight fingerprints (2048 bits) from InChI/SMILES structures; core algorithm for binary molecular representation) — https://www.rdkit.org/
  • matchms (Wraps RDKit fingerprint generation and manages InChIKey/SMILES/InChI metadata extraction and standardization from MS/MS spectra annotations) — https://github.com/matchms/matchms
  • pubchempy (Automated PubChem lookup to retrieve missing InChI or SMILES annotations for spectra before fingerprint generation) — https://pubchem.ncbi.nlm.nih.gov/

Examples

from rdkit import Chem
from rdkit.Chem import AllChem
fp = AllChem.GetMorganFingerprintAsBitVect(Chem.MolFromInchi(inchi_string), radius=2, nBits=2048)

Evaluation signals

  • All 15,062 unique InChIKeys yield exactly one canonical fingerprint (no duplicates or missing values).
  • Fingerprints are binary vectors of length 2048 with no NaN or null entries.
  • Pairwise Tanimoto similarity scores computed from fingerprints fall within [0, 1] range and show expected chemical similarity patterns (e.g., structurally identical compounds yield Tanimoto = 1.0).
  • Fingerprint generation completes without RDKit structure parsing errors; any failures are logged and traceable to malformed InChI/SMILES input.
  • Fingerprint matrix dimensions are 15,062 × 2048 (or smaller if subset of unique InChIKeys); matrix is sparse (binary representation).

Limitations

  • Daylight fingerprints encode 2D molecular structure only; stereochemical information is discarded (disregarding stereoisomerism as noted in the article).
  • Fingerprint quality depends on input SMILES/InChI curation; invalid or ambiguous structures fail silently or produce uninformative fingerprints.
  • 2048-bit resolution is a fixed hyperparameter; different fingerprint lengths or algorithms (e.g., Morgan, ECFP) may be more suitable for specific molecular scaffolds but are not explored here.
  • Computational cost scales quadratically with the number of unique molecules during pairwise Tanimoto computation (O(n²) for n InChIKeys).
  • Fingerprints do not preserve intensity or fragmentation patterns from MS/MS spectra; only structural features are encoded.

Evidence

  • [methods] For every unique 14-character InChIKey the most common InChI was selected (if different InChI existed) and used to generate a molecular fingerprint.: "For every unique 14-character InChIKey the most common InChI was selected (if different InChI existed) and used to generate a molecular fingerprint."
  • [other] RDKit Daylight fingerprints (2048 bits) are generated per unique InChIKey, and pairwise Tanimoto scores are computed between all fingerprint pairs to quantify structural similarity as training targets.: "RDKit Daylight fingerprints (2048 bits) are generated per unique InChIKey, and pairwise Tanimoto scores are computed between all fingerprint pairs to quantify structural similarity as training"
  • [methods] Unless noted otherwise, we used Tanimoto scores on RDKit Daylight fingerprints (2048 bits) to compute structural similarities: "Unless noted otherwise, we used Tanimoto scores on RDKit Daylight fingerprints (2048 bits) to compute structural similarities"
  • [other] Generate RDKit Daylight fingerprints (2048 bits) for each unique InChIKey using matchms and RDKit.: "Generate RDKit Daylight fingerprints (2048 bits) for each unique InChIKey using matchms and RDKit."
  • [results] The dataset contains 15,062 different molecules (disregarding stereoisomerism): "The dataset contains 15,062 different molecules (disregarding stereoisomerism)"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.