deepspot-m

Generate virtual spatial transcriptomics from H&E histology tiles with DeepSpot-M.

41.1k|3.8k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill deepspot-m
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: deepspot-m
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/deepspot-m
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill deepspot-m

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires deepspotm, torch, histolab, openslide, anndata, and includes references (resource) components.

What problem does it solve?

Spatial transcriptomics assays are expensive and limited to small fixed gene panels, leaving most H&E histology slides without any matched gene expression data. DeepSpot-M predicts transcriptome-wide spatial gene expression directly from 224x224 H&E tiles, producing virtual spatial transcriptomics maps without running a physical assay.

Core Features & Use Cases

  • Virtual spatial transcriptomics: Predict log1p-CPM expression per tile for any of ~19,000 protein-coding genes queried by HGNC symbol, including genes unseen during training.
  • Five gene embedding sources: Choose between evo2, orthrus, prott5, scgpt, and apertus embeddings to represent gene identity from different biological modalities.
  • Whole-slide and cohort workflows: Tile slides with histolab, run batched GPU inference, and assemble tiles-by-genes matrices into AnnData objects for spatial analysis.
  • Use Case: A researcher with a cohort of TCGA tumor slides wants spatial expression maps for EPCAM and CD3D. They tile each slide at 20x, run batched predict_genes calls, and build one .h5ad file per slide for downstream clustering and spatial statistics.

Quick Start

Ask the agent to install deepspotm, load the ratschlab/DeepSpotM weights after Hugging Face login, and predict EPCAM and CD3D expression from a 224x224 H&E tile.

Frequently Asked Questions about deepspot-m

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I predict spatial gene expression from H&E histology images?

Load DeepSpot-M with DeepSpotM.from_pretrained("ratschlab/DeepSpotM", source="scgpt"), process a 224x224 PIL tile with the returned image_processor, and call model.predict_genes with a list of HGNC gene symbols. Values come back in log1p-CPM aligned with your gene list.

How do I run DeepSpot-M on a whole slide image?

Tile the slide into 224x224 patches at the level nearest 0.5 microns per pixel using histolab's GridTiler, then run batched predict_genes calls and assemble the tiles-by-genes matrix into an AnnData object with spatial coordinates. Batch size 32 on GPU is a reasonable starting point.

Which genes can DeepSpot-M predict expression for?

The model covers a panel of roughly 19,000 protein-coding genes queried by HGNC symbol, exposed as model.gene_names. Symbols outside the panel raise a KeyError, so check membership before querying and map aliases like CD45 to current symbols such as PTPRC.

Does DeepSpot-M require a GPU and Hugging Face access?

The weights at ratschlab/DeepSpotM are gated, so you must request access on the model page and run huggingface-cli login before downloading. A CUDA GPU speeds up batched inference, but CPU inference works with smaller batches of around 8 tiles.

What is the difference between the five embedding sources in DeepSpot-M?

The source argument selects which frozen gene embedding the router uses: evo2 (genomic sequence), orthrus (RNA), prott5 (protein sequence), scgpt (single-cell expression), or apertus (language model). Pick one per run and keep it fixed across a slide or cohort so values stay comparable.

Why does DeepSpot-M reject my histology tile?

Tiles must be exactly 224x224 RGB pixels at roughly 20x magnification, about 0.5 microns per pixel. Crops of other sizes or resolutions change the texture the backbone reads, so re-tile at the correct slide level rather than resampling from a coarser level.