lazyslide_models.tile_prediction.DeepSpotM#
- class DeepSpotM(source='scgpt', genes=None, token=None)#
Bases:
TilePredictionModeldeepspotm 🤗Hugging Face GitHub Paper PolyForm-Noncommercial-1.0.0; CC-BY-NC-SA-4.0 [Nonchev et al., 2026] Transcriptome-wide virtual spatial transcriptomics from H&E images. DeepSpot-M virtual spatial transcriptomics predictor.
Maps a 224x224 H&E tile to spatial gene expression with a LoRA-adapted Midnight backbone and a cross-attention gene decoder. One model predicts a transcriptome-wide (~19k gene) panel and, because genes are represented as queryable embeddings, genes it never saw during training.
The weights live in the gated
ratschlab/DeepSpotMHugging Face repo: accept the terms on the model page and authenticate (huggingface-cli login, theHF_TOKENenvironment variable, or thetokenargument) before first use.predictreturns one array per gene, keyed by gene symbol. By default the full panel is predicted; each gene becomes a column on the tile table, which is transcriptome-wide but wide to store. Passgenesto score only a marker panel, which is faster (only those gene queries are computed) and lean to store:from lazyslide_models.tile_prediction import DeepSpotM markers = DeepSpotM(genes=["BRAF", "CD37", "COL1A1"]) zs.tl.tile_prediction(wsi, markers)
- Parameters:
- sourcestr, default: “scgpt”
Gene-embedding source used by the gene router; one of
evo2,orthrus,prott5,scgpt,apertus.- genesstr or sequence of str, optional
Restrict prediction to these gene symbols. When omitted, the full panel (
model.gene_names) is predicted.- tokenstr, optional
Hugging Face access token, used to log in before download.
- predict(image)#
Predict expression for a batch of tiles.
imageis a preprocessed[B, 3, 224, 224]tensor. Returns a dict mapping gene symbol to a length-BNumPy array (one column per gene).