关于
DeepSpot-M generates transcriptome-wide virtual spatial transcriptomics from H&E histology tiles. It predicts log1p-CPM expression for protein-coding genes queried by symbol and can run inference across a whole slide after tiling. This skill requires installing the `deepspotm` PyPI package and accessing the gated model weights from Hugging Face.
快速安装
Claude Code
推荐npx skills add K-Dense-AI/claude-scientific-skills -a claude-code/plugin add https://github.com/K-Dense-AI/claude-scientific-skillsgit clone https://github.com/K-Dense-AI/claude-scientific-skills.git ~/.claude/skills/deepspot-m在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
DeepSpot-M
Overview
DeepSpot-M is a multimodal foundation model that maps a 224x224 H&E histology tile to spatial gene expression in log1p-CPM. The output is virtual spatial transcriptomics: one value per queried gene per tile, laid out on the grid the tiles came from.
A LoRA-adapted pathology foundation backbone (Midnight) tokenises the tile. A
cross-attention gene decoder lets each gene query attend to the patch tokens, and a gene
router hypernetwork builds gene-specific projections from frozen biological embeddings
(Evo 2, Orthrus, ProtT5, scGPT, Apertus). Genes enter the model as queryable embeddings
rather than fixed output slots, so the released model covers a ~19k protein-coding gene
panel including genes unseen in training. The panel ships with the weights as
tokens.csv and is exposed as model.gene_names; genes outside it cannot be queried in
this release.
Applied to TCGA, the model produced a virtual spatial transcriptomics atlas of 28,664 slides across 32 cancer types.
Licensing
The code is PolyForm Noncommercial 1.0.0 and the weights are CC-BY-NC-SA-4.0. Use it for noncommercial research and check both licences before redistributing outputs.
Installation
uv pip install deepspotm==1.0.0
Version 1.0.0 targets Python 3.10 to 3.13 and pulls in PyTorch. Install the PyTorch build that matches your CUDA version first if you want GPU inference.
Model access
The weights are gated:
- Open https://huggingface.co/ratschlab/DeepSpotM and request access.
- Once access is granted, authenticate the machine that will download them:
huggingface-cli login
from_pretrained reads that cached token, so a login is needed once per machine.
Quick start
from deepspotm import DeepSpotM
model, image_processor = DeepSpotM.from_pretrained("ratschlab/DeepSpotM", source="scgpt")
vals = model.predict_genes(image_processor(pil_tile).unsqueeze(0), ["EPCAM", "CD3D"])
pil_tile is a PIL image of exactly 224x224 pixels. image_processor turns it into a
tensor, unsqueeze(0) adds the batch dimension, and predict_genes takes the batch plus a
list of HGNC gene symbols. Values come back in log1p-CPM, aligned with the gene list you
passed, so keep that list beside the output to keep the columns labelled. Symbols must be
in the released ~19k-gene panel (model.gene_names); an unknown symbol raises KeyError
naming the offending genes.
Tile requirements
Tiles must be 224x224 RGB at roughly 20x magnification (about 0.5 microns per pixel). Check the size at the boundary of your pipeline rather than passing an unchecked crop through:
TILE_PX = 224
def require_tile(tile):
"""Return an RGB 224x224 tile, or raise if the crop is the wrong size."""
if tile.size != (TILE_PX, TILE_PX):
raise ValueError(
f"DeepSpot-M expects a {TILE_PX}x{TILE_PX} tile at about 20x "
f"(~0.5 microns per pixel); got {tile.size[0]}x{tile.size[1]}. "
"Re-tile at the matching level or resample the crop."
)
return tile.convert("RGB")
Extract tiles at the slide level whose resolution is nearest 0.5 microns per pixel, then crop to 224x224 there. Resampling from a coarser level changes the texture the backbone reads.
Keep the dependency optional
deepspotm and its weights are a heavy, gated dependency. Import it inside the function
that needs it so the surrounding project installs, imports and tests without it, and turn
an ImportError into a message that names every step:
DEEPSPOTM_HELP = (
"DeepSpot-M is unavailable. Install it with `uv pip install deepspotm==1.0.0`, request "
"access to the gated weights at https://huggingface.co/ratschlab/DeepSpotM, then "
"authenticate with `huggingface-cli login`."
)
def load_deepspotm(source="scgpt"):
try:
from deepspotm import DeepSpotM
except ImportError as exc:
raise RuntimeError(DEEPSPOTM_HELP) from exc
return DeepSpotM.from_pretrained("ratschlab/DeepSpotM", source=source)
Embedding sources
source selects which frozen gene embedding the router builds projections from. It is one
of five values:
source | Gene embedding |
|---|---|
evo2 | genomic sequence |
orthrus | RNA |
prott5 | protein sequence |
scgpt | single-cell expression |
apertus | language model |
Each gives a different view of gene identity. Pick one per run, and run the same tiles
through more than one source when the choice matters to your analysis. See
references/api.md for the full call surface, batching and device placement, gene symbol
handling and output units.
Whole slide workflow
Prediction is per tile, so a slide-scale run is a tiling step followed by batched inference:
- Extract 224x224 tiles on a grid with the
histolabskill, keeping each tile's coordinates. - Process and stack tiles into batches with
torch.stack. - Call
predict_genesonce per batch with the same gene list. - Concatenate the batches into a tiles-by-genes matrix and attach the coordinates.
That matrix is the virtual spatial transcriptomics map for the slide, and it drops
straight into AnnData for downstream spatial analysis. references/whole_slide.md has a
worked loop, batch sizing and an AnnData assembly step.
Common use cases
- Spatial expression maps for marker genes across a tumour section.
- Transcriptome-wide prediction over a slide cohort with no matching assay run.
- Querying any of the ~19k panel genes by symbol, including genes unseen in training — far beyond the few hundred genes of a typical spatial assay panel.
- Adding an expression channel to a morphology-only histology pipeline.
- Building a slide-level cohort atlas, as done for TCGA.
Detailed references
references/api.md:from_pretrainedandpredict_genesin full, the five embedding sources and how to choose, batching, device placement, gene symbol handling, and converting log1p-CPM output.references/whole_slide.md: tiling with histolab, a slide-scale prediction loop, assembling and storing a tiles-by-genes matrix, and cohort-scale runs.
Primary sources
- Paper: https://doi.org/10.64898/2026.06.19.26356060 (medRxiv, posted 22 June 2026)
- Code: https://github.com/ratschlab/DeepSpotM
- Weights: https://huggingface.co/ratschlab/DeepSpotM
- PyPI: https://pypi.org/project/deepspotm/
GitHub 仓库
常见问题
什么是 deepspot-m Skill?
deepspot-m 是一个 Claude Skill,作者为 K-Dense-AI。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 deepspot-m 相关的任务。
如何安装 deepspot-m?
使用本页的安装命令:将 deepspot-m 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。
deepspot-m 属于哪个分类?
deepspot-m 属于元分类。
deepspot-m 可以免费使用吗?
可以。deepspot-m 已收录在 AIMCP,可免费安装。
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
