agentsclimarketplace

Sparsity metric computation

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v1/skills/sparsity-metric-computation

Use when when you have loaded a dataset of molecular fingerprint vectors (such as biosynfoni fingerprints from a Zenodo deposit) and need to quantify how sparse the bit-representations are—that is, what fraction of bit positions are zero across the fingerprint collection.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill sparsity-metric-computation

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

6.7 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

sparsity-metric-computation

Summary

Compute the proportion of zero bits (sparsity metric) across a collection of molecular fingerprint vectors to characterize their distributional sparseness. This metric is essential for understanding the information density and statistical properties of fingerprint-based molecular representations.

When to use

When you have loaded a dataset of molecular fingerprint vectors (such as biosynfoni fingerprints from a Zenodo deposit) and need to quantify how sparse the bit-representations are—that is, what fraction of bit positions are zero across the fingerprint collection. This is particularly relevant when comparing fingerprint encodings or validating the expected behavior of a fingerprinting algorithm on natural product chemistry datasets.

When NOT to use

  • Fingerprints are already pre-filtered or aggregated by sparsity class; computing aggregate sparsity would lose sample-level granularity.
  • The fingerprint representation is continuous or probabilistic rather than binary/count-based; zero-bit proportion is not a meaningful metric.
  • Dataset is extremely small (< 10 fingerprints) or highly heterogeneous in bit length, making distributional statistics unreliable.

Inputs

  • Molecular fingerprint vectors (biosynfoni fingerprints or similar binary/count fingerprint representation)
  • Fingerprint dataset (loaded from Zenodo deposit or local storage)
  • Bit length of fingerprints (required to normalize zero-bit counts)

Outputs

  • Sparsity metric per fingerprint (proportion of zero bits for each vector)
  • Summary statistics table (mean, median, standard deviation of sparsity across dataset)
  • Distribution plot (histogram or density) of sparsity values across the fingerprint collection

How to apply

Load all fingerprint vectors from the dataset (e.g., from a Zenodo deposit via biosynfoni package). For each fingerprint vector, count the number of zero bits and divide by the total bit length to compute the sparsity for that vector. Aggregate sparsity values across all fingerprints in the dataset by computing mean, median, and standard deviation. Visualize the distribution of sparsity values using a histogram or density plot to inspect for expected distributional shapes (e.g., unimodality, skew). Validate that sparsity metrics fall within reasonable bounds (e.g., between 0 and 1) and that no missing values are present in the computed summary statistics table.

Related tools

  • biosynfoni (Load and compute molecular fingerprints; provides the fingerprint vectors for sparsity analysis) — https://github.com/lucinamay/biosynfoni
  • pip (Install biosynfoni package in development mode to access fingerprint loading functions)

Examples

from biosynfoni import Biosynfoni
import numpy as np
fp_vectors = [Biosynfoni(mol).fingerprint for mol in molecules]
sparsity_values = [np.sum(fp == 0) / len(fp) for fp in fp_vectors]
mean_sparsity = np.mean(sparsity_values)
median_sparsity = np.median(sparsity_values)
std_sparsity = np.std(sparsity_values)

Evaluation signals

  • Summary statistics table contains all three metrics (mean, median, std) with no NaN or missing values.
  • Sparsity values for all fingerprints are bounded between 0.0 and 1.0 (inclusive).
  • Distribution plot displays expected shape (e.g., histogram shows bell-curve or other recognized distributional pattern with no outliers in extreme tails).
  • Mean and median sparsity values are consistent with the known bit-length and expected information density of the fingerprinting scheme (e.g., biosynfoni designed for natural products should show characteristic sparsity).
  • Sample size in summary statistics matches the total number of fingerprints loaded from the dataset.

Limitations

  • Sparsity computation assumes binary or count-based fingerprints; not applicable to continuous or probabilistic fingerprint representations.
  • Summary statistics are sensitive to dataset composition; imbalanced representation of molecular classes may skew aggregate sparsity estimates.
  • No changelog or version history is documented in the biosynfoni repository, making it difficult to track whether sparsity-computation behavior changed across releases.
  • Visualization of sparsity distribution may be misleading if the dataset contains outlier fingerprints with highly unusual bit patterns.

Evidence

  • [other] Calculate sparsity metric (proportion of zero bits) across the dataset.: "Calculate sparsity metric (proportion of zero bits) across the dataset."
  • [other] Compute summary statistics table including mean, median, and standard deviation of bit-frequencies, sparsity, and similarity scores.: "Compute summary statistics table including mean, median, and standard deviation of bit-frequencies, sparsity, and similarity scores."
  • [other] Create distribution plots (histogram/density) for bit-frequencies, sparsity values, and pairwise Tanimoto similarity.: "Create distribution plots (histogram/density) for bit-frequencies, sparsity values, and pairwise Tanimoto similarity."
  • [other] Verification: verify that summary statistics table contains all computed metrics with no missing values and that plots display expected distributional shapes.: "verify that summary statistics table contains all computed metrics with no missing values and that plots display expected distributional shapes."
  • [intro] biosynfoni is a molecular fingerprint resource designed for natural product chemistry and bioinformatic research, providing a dataset suitable for statistical characterization of fingerprint properties.: "biosynfoni is a molecular fingerprint resource designed for natural product chemistry and bioinformatic research, providing a dataset suitable for statistical characterization of fingerprint"

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.