MCP HubMCP Hub
SKILL·04BBFC

deepspot-m

K-Dense-AI
Mis à jour 21 days ago
5 vues
38,996
3,647
38,996
Voir sur GitHub
Métageneral

À propos

DeepSpot-M génère des transcriptomiques spatiales virtuelles à l'échelle du transcriptome à partir de tuiles d'histologie H&E. Il prédit l'expression en log1p-CPM pour les gènes codant pour des protéines interrogés par leur symbole et peut exécuter l'inférence sur une lame entière après découpage en tuiles. Cette compétence nécessite l'installation du package PyPI `deepspotm` et l'accès aux poids du modèle conditionnel sur Hugging Face.

Installation rapide

Claude Code

Recommandé
Principal
npx skills add K-Dense-AI/claude-scientific-skills -a claude-code
Commande PluginAlternatif
/plugin add https://github.com/K-Dense-AI/claude-scientific-skills
Git CloneAlternatif
git clone https://github.com/K-Dense-AI/claude-scientific-skills.git ~/.claude/skills/deepspot-m

Copiez et collez cette commande dans Claude Code pour installer cette compétence

Documentation

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:

  1. Open https://huggingface.co/ratschlab/DeepSpotM and request access.
  2. 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:

sourceGene embedding
evo2genomic sequence
orthrusRNA
prott5protein sequence
scgptsingle-cell expression
apertuslanguage 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:

  1. Extract 224x224 tiles on a grid with the histolab skill, keeping each tile's coordinates.
  2. Process and stack tiles into batches with torch.stack.
  3. Call predict_genes once per batch with the same gene list.
  4. 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_pretrained and predict_genes in 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

Dépôt GitHub

K-Dense-AI/claude-scientific-skills
Chemin: skills/deepspot-m
0
agent-skillsai-scientistbioinformaticschemoinformaticsclaudeclaude-skills
FAQ

Questions fréquentes

Qu’est-ce que le Skill deepspot-m ?

deepspot-m est un Skill Claude créé par K-Dense-AI. Un Skill regroupe des instructions et des ressources que Claude charge à la demande pour effectuer des tâches liées à deepspot-m sans consigne supplémentaire.

Comment installer deepspot-m ?

Utilisez les commandes d’installation de cette page : ajoutez deepspot-m à Claude Code comme plugin ou clonez son dépôt dans votre dossier skills, puis redémarrez Claude pour charger le Skill.

À quelle catégorie appartient deepspot-m ?

deepspot-m appartient à la catégorie Méta.

deepspot-m est-il gratuit ?

Oui. deepspot-m est référencé sur AIMCP et son installation est gratuite.

Compétences associées

content-collections
Méta

Cette compétence propose une configuration éprouvée en production pour Content Collections, un outil axé sur TypeScript qui transforme des fichiers Markdown/MDX en collections de données typées de manière sûre avec une validation Zod. Utilisez-la lors de la création de blogs, de sites de documentation ou d'applications Vite + React riches en contenu pour garantir la sécurité de typage et la validation automatique du contenu. Elle couvre tout, de la configuration du plugin Vite et de la compilation MDX à l'optimisation des déploiements et la validation des schémas.

Voir la compétence
polymarket
Méta

Cette compétence permet aux développeurs de créer des applications avec la plateforme de marchés prédictifs Polymarket, incluant l'intégration d'API pour le trading et les données de marché. Elle fournit également une diffusion de données en temps réel via WebSocket pour surveiller les transactions en direct et l'activité du marché. Utilisez-la pour mettre en œuvre des stratégies de trading ou pour créer des outils traitant les mises à jour de marché en direct.

Voir la compétence
creating-opencode-plugins
Méta

Cette compétence aide les développeurs à créer des plugins OpenCode qui s'interconnectent avec plus de 25 types d'événements tels que les commandes, les fichiers et les opérations LSP. Elle fournit la structure du plugin, les spécifications de l'API événementielle et les modèles d'implémentation pour les modules JavaScript/TypeScript. Utilisez-la lorsque vous avez besoin d'intercepter, de surveiller ou d'étendre le cycle de vie de l'assistant IA OpenCode avec une logique personnalisée pilotée par les événements.

Voir la compétence
sglang
Méta

SGLang est un framework de service LLM haute performance spécialisé dans la génération rapide et structurée pour les workflows JSON, regex et agentiques grâce à son cache de préfixe RadixAttention. Il offre une inférence nettement plus rapide, particulièrement pour les tâches avec des préfixes répétés, ce qui le rend idéal pour les sorties complexes et structurées ainsi que les conversations multi-tours. Choisissez SGLang plutôt que des alternatives comme vLLM lorsque vous avez besoin d'un décodage contraint ou que vous construisez des applications avec un partage étendu de préfixes.

Voir la compétence