agentsclimarketplace

Spot level intensity aggregation

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/spot-level-intensity-aggregation

Use when after loading spatial metabolomics data (from CSV, imzML, or merged positive/negative ion modes) into an AnnData object, and before filtering or alignment steps.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill spot-level-intensity-aggregation

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

5.9 KB, 995 tokens by cl100k_base, as published. Nobody here has run it

spot-level-intensity-aggregation

Summary

Compute per-spot quality control metrics on spatial metabolomics AnnData objects, including total intensity and number of detected metabolites per spot. This skill quantifies data completeness and signal strength at each spatial location before downstream analysis.

When to use

Apply this skill after loading spatial metabolomics data (from CSV, imzML, or merged positive/negative ion modes) into an AnnData object, and before filtering or alignment steps. Use it to characterize spot-level data quality—identifying which spots have sufficient metabolite detection and signal intensity to justify downstream processing.

When NOT to use

  • Input is already a quality-filtered or aggregated feature table (e.g., from external pre-processing).
  • You are analyzing untargeted transcriptomics or proteomics data without spatial metabolomics component.
  • Spot-level metrics are not relevant to your downstream analysis (e.g., if doing only global metabolite-level statistics).

Inputs

  • AnnData object with spatial metabolomics data (X matrix: m/z × spot)
  • Metadata: spot coordinates, ion polarity mode

Outputs

  • adata.obs columns: per-spot QC metrics (total intensity, number of detected metabolites)
  • Annotated AnnData object with QC metrics embedded

How to apply

Load your spatial metabolomics AnnData object (prepared by read_sm_csv_as_anndata, read_sm_imzml_as_anndata, or merge_sm_pos_neg). Apply spatialmeta.pp.calculate_qc_metrics_sm, which computes per-spot metrics such as total intensity (sum of all metabolite signals at each spot) and detection frequency (number of detected metabolites per spot). The function stores these metrics in adata.obs columns for downstream filtering (e.g., via filter_cells_sm to remove low-quality spots). Rationale: spot-level aggregation reveals spatial heterogeneity in sample coverage and ionization efficiency, which is critical for identifying and excluding dead pixels, edge artifacts, or instrumental dropouts before joint integration with spatial transcriptomics.

Related tools

Examples

import spatialmeta as smt
adata = smt.pp.read_sm_csv_as_anndata('metabolites.csv', 'coordinates.csv')
smt.pp.calculate_qc_metrics_sm(adata)
print(adata.obs[['total_intensity', 'n_detected_metabolites']].head())

Evaluation signals

  • adata.obs contains new columns for per-spot metrics (e.g., 'total_intensity', 'n_detected_metabolites') with numeric values matching spot count
  • Per-spot total intensity values are non-negative and reflect sum of all m/z intensities at each location
  • Detection frequency (number of metabolites per spot) is between 0 and total number of metabolites (adata.n_vars)
  • Spatial distribution of metrics correlates with expected sample morphology (e.g., higher intensity in tissue core vs. edges)
  • Downstream filter_cells_sm successfully identifies and flags outlier spots using these metrics

Limitations

  • Assumes metabolite intensities are already normalized or raw; does not perform ion suppression correction across spots.
  • Per-spot aggregation loses fine-grained m/z-level variation; complements but does not replace per-metabolite QC (available in adata.var).
  • Quality metric thresholds are data- and instrument-dependent; no universal cutoff for spot inclusion is provided.
  • Works only on AnnData objects; requires prior conversion of raw imzML or CSV formats using read_sm_imzml_as_anndata or read_sm_csv_as_anndata.

Evidence

  • [other] The calculate_qc_metrics_sm function computes QC metrics at per-spot and per-metabolite level: "SpatialMETA includes a calculate_qc_metrics_sm preprocessing function that computes quality control metrics at the per-spot and per-metabolite level on spatial metabolomics AnnData objects"
  • [other] Per-spot metrics include total intensity and number of detected metabolites: "compute QC metrics at the spot level (e.g., total intensity, number of detected metabolites per spot)"
  • [other] Per-spot metrics are stored in adata.obs columns: "Store computed metrics in adata.obs (per-spot) and adata.var (per-metabolite) columns"
  • [other] Input data preparation workflow prior to QC metric computation: "Load a spatial metabolomics AnnData object (prepared by read_sm_csv_as_anndata, read_sm_imzml_as_anndata, or merge_sm_pos_neg)"

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.