Skills Agentes

Deepspot M

Genera transcriptómica espacial virtual de todo el transcriptoma a partir de histología H&E con DeepSpot-M: expresión génica en log1p-CPM por tile de 224x224 a ~20x, consultando genes por símbolo.

Solicitaread write edit bash
Estrellas
34.8k

en todo el repo

Actividad
59

0–100, la ruta de este skill

Actualizado
hace 21 días

último commit aquí

Commits
2

últimos 90 días

Contexto
1.8k tok

82 tok en reposo

Paquete
3 archivos

19 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add K-Dense-AI/scientific-agent-skills --skill deepspot-m --agent claude-code

Se instala solo en este repositorio.

Este skill makes network requests.

Qué hace

  • Predice expresión génica espacial (log1p-CPM) por tile de histología H&E de 224x224 a ~20x con el modelo DeepSpot-M
  • Permite consultar genes por símbolo HGNC en un panel de ~19k genes codificantes, incluidos genes no vistos en entrenamiento
  • Ofrece cinco fuentes de embedding génico (evo2, orthrus, prott5, scgpt, apertus) para construir las proyecciones del gen
  • Encadena tiling con histolab e inferencia por lotes para generar un mapa transcriptómico virtual de un slide completo
  • Descarga los pesos gated de Hugging Face (ratschlab/DeepSpotM) tras solicitar acceso y autenticar con huggingface-cli

Úsalo cuando

  • Se necesita expresión génica espacial para tiles de 224x224 a ~20x (~0.5 micras por pixel)
  • Se quiere consultar genes por símbolo en vez de un panel fijo de un ensayo espacial
  • Se quiere ejecutar predicción sobre un slide completo tras hacer tiling con histolab
  • Se está construyendo un atlas transcriptómico virtual a nivel de cohorte de slides

No lo uses cuando

  • No usarlo para fines comerciales sin revisar antes las licencias (código PolyForm Noncommercial, pesos CC-BY-NC-SA)

Qué lo activa

Di cualquiera de estas frases y el agente debería cargar este skill.

  • Predice la expresión espacial de EPCAM y CD3D en este tile de histología
  • Genera un mapa transcriptómico virtual de este slide completo con DeepSpot-M
  • Consulta genes por símbolo en vez de usar un panel espacial fijo

SKILL.md

En inglés

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:

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:

  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

Reproducido de K-Dense-AI/scientific-agent-skills bajo licencia PolyForm-Noncommercial-1.0.0. Leer esta página en markdown.

Archivos

3 archivos en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

Antes de instalar

Necesita el paquete deepspotm 1.0.0 (PyPI, Python 3.10-3.13) con PyTorch, y acceso a los pesos gated de ratschlab/DeepSpotM en Hugging Face vía huggingface-cli login; se recomienda GPU CUDA.

Detalles

Creador
K-Dense-AI
Categoría
Investigación
Licencia
PolyForm-Noncommercial-1.0.0
Recursos incluidos
referencias
Código fuente
Ver SKILL.md

Etiquetas

Más de K-Dense-AI/scientific-agent-skills

Este repo incluye 163 skills. Si instalas uno, normalmente ya tienes los demás.

Gestión integral de citas académicas: busca en OpenAlex, PubMed y Google Scholar, extrae metadatos precisos, valida citas y genera entradas BibTeX correctamente formateadas.

Costo de contexto al activarse
3.7k tok
Tamaño del paquete
21 archivos
Última actualización
hace 28 días
investigacion

Realiza revisiones bibliográficas sistemáticas y completas usando varias bases académicas (PubMed, arXiv, bioRxiv, Semantic Scholar). Genera markdown y PDF con citas verificadas en varios estilos (APA, Nature, Vancouver).

Costo de contexto al activarse
3.2k tok
Tamaño del paquete
12 archivos
Última actualización
hace 15 días
investigacion

Crea decks de diapositivas y presentaciones para charlas de investigación: PowerPoint, presentaciones de conferencia, seminarios, defensas de tesis. Da estructura, plantillas, guía de tiempos y validación visual.

Costo de contexto al activarse
5.1k tok
Tamaño del paquete
24 archivos
Última actualización
hace 15 días
documentos

Crea infografías profesionales con Nano Banana Pro AI y refinamiento iterativo inteligente. Usa Gemini 3.6 Flash para revisar la calidad e integra investigación con Perplexity Sonar. Soporta 10 tipos, 8 estilos y paletas para daltonismo.

Costo de contexto al activarse
2.7k tok
Tamaño del paquete
8 archivos
Última actualización
hace 15 días
diseno ui

Crea pósteres de investigación profesionales en LaTeX con beamerposter, tikzposter o baposter, para conferencias y comunicación científica: layout, colores, columnas múltiples e integración de figuras.

Costo de contexto al activarse
3.9k tok
Tamaño del paquete
17 archivos
Última actualización
hace 15 días
documentos

Crea diagramas científicos de calidad de publicación con la IA Nano Banana 2 y refinamiento iterativo inteligente. Gemini 3.6 Flash revisa la calidad y solo regenera si está por debajo del umbral de tu tipo de documento.

Costo de contexto al activarse
4.1k tok
Tamaño del paquete
6 archivos
Última actualización
hace 15 días
diseno ui

Skills relacionados

Astropy

34.8k

Librería Python central para astronomía y astrofísica: unidades/cantidades, coordenadas, E/S de FITS, tablas, sistemas de tiempo, WCS y cosmología, para implementar o depurar código con Astropy.

Costo de contexto al activarse
3.6k tok
Tamaño del paquete
8 archivos
Última actualización
el mes pasado
investigacion

Integración con el SDK de Python de Benchling y su API REST para entidades del registro, inventario, entradas del cuaderno electrónico (ELN), workflows, Benchling Apps y consultas al Data Warehouse.

Costo de contexto al activarse
1.9k tok
Tamaño del paquete
6 archivos
Última actualización
el mes pasado
investigacion

Busca papers científicos y obtiene datos experimentales estructurados extraídos de estudios a texto completo vía el servidor MCP de BGPT: más de 25 campos por paper (métodos, resultados, muestras, calidad, conclusiones).

Costo de contexto al activarse
713 tok
Tamaño del paquete
1 archivo
Última actualización
el mes pasado
investigacion