Communitygithub.com

deepspot-m

H&E 病理画像からトランスクリプトーム全体をカバーする仮想空間トランスクリプトミクスを生成するDeepSpot-M。約20倍の224x224タイルに対してlog1p-CPMの空間的遺伝子発現が必要な場合、固定パネルではなく遺伝子シンボルでタンパク質コード遺伝子をクエリしたい場合、またはhistolabでタイル化した後スライド全体で予測を実行したい場合に使用します。

deepspot-m とは?

DeepSpot-Mは、224x224ピクセルのH&E染色病理画像タイルを入力として、空間的な遺伝子発現(log1p-CPM値)を仮想的に予測するマルチモーダル基盤モデルです。このスキルは、LoRA適応された病理基盤バックボーン(Midnight)によるタイルのトークン化と、遺伝子クエリごとにパッチトークンにアテンションするクロスアテンション遺伝子デコーダ、そして凍結された生物学的埋め込み(Evo 2、Orthrus、ProtT5、scGPT、Apertus)から遺伝子固有の射影を構築する遺伝子ルーターハイパーネットワークにより構成されます。遺伝子は固定出力スロットではなくクエリ可能な埋め込みとしてモデルに入力されるため、学習時に見たことのない遺伝子を含む約19,000個のタンパク質コード遺伝子パネルをクエリできます。出力はタイルごとの遺伝子発現行列として得られ、AnnDataに直接格納できるため、TCGAの28,664スライドにわたる仮想空間トランスクリプトミクスアトラス構築に利用されました。コードはPolyForm Noncommercial 1.0.0、重みはCC-BY-NC-SA-4.0でライセンスされており、非商用研究での使用が推奨されます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/deepspot-m

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

deepspot-m は何をしますか?

概要

DeepSpot-M は、224x224 の H&E 病理画像タイルを空間的遺伝子発現(log1p-CPM)にマッピングするマルチモーダル基盤モデルです。出力は仮想空間トランスクリプトミクスです。すなわち、タイルごとにクエリされた遺伝子ごとに1つの値が、タイルが切り出されたグリッド上に配置されます。

LoRA 適応された病理基盤バックボーン(Midnight)がタイルをトークン化します。クロスアテンション遺伝子デコーダにより、各遺伝子クエリがパッチトークンにアテンションし、遺伝子ルーターハイパーネットワークが凍結された生物学的埋め込み(Evo 2、Orthrus、ProtT5、scGPT、Apertus)から遺伝子固有の射影を構築します。遺伝子は固定出力スロットではなくクエリ可能な埋め込みとしてモデルに入力されるため、リリースされたモデルは学習時に見たことのない遺伝子を含む約19,000個のタンパク質コード遺伝子パネルをカバーします。このパネルはtokens.csvとして重みとともに提供され、model.gene_namesとして公開されています。このリリースでは、このパネルに含まれない遺伝子はクエリできません。

TCGA に適用されたこのモデルは、32のがんタイプにわたる28,664スライドの仮想空間トランスクリプトミクスアトラスを生成しました。

ライセンス

コードは PolyForm Noncommercial 1.0.0、重みは CC-BY-NC-SA-4.0 です。非商用研究に使用し、出力を再配布する前に両方のライセンスを確認してください。

インストール

uv pip install deepspotm==1.0.0

バージョン 1.0.0 は Python 3.10 から 3.13 を対象とし、PyTorch を必要とします。GPU 推論を行う場合は、最初に CUDA バージョンに一致する PyTorch ビルドをインストールしてください。

モデルアクセス

重みはゲート付きです。

  1. https://huggingface.co/ratschlab/DeepSpotM を開き、アクセスをリクエストします。
  2. アクセスが許可されたら、ダウンロードするマシンで認証します。
huggingface-cli login

from_pretrained はキャッシュされたトークンを読み取るため、マシンごとに一度ログインする必要があります。

クイックスタート

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 は正確に 224x224 ピクセルの PIL 画像です。image_processor はそれをテンソルに変換し、unsqueeze(0) でバッチ次元を追加します。predict_genes はバッチと HGNC 遺伝子シンボルのリストを受け取ります。値は log1p-CPM で返され、渡した遺伝子リストと整列しています。したがって、出力の列ラベルを保持するために、そのリストを出力の横に保管してください。シンボルはリリースされた約19,000遺伝子パネル(model.gene_names)に含まれている必要があります。未知のシンボルは、問題の遺伝子を指名する KeyError を発生させます。

タイル要件

タイルは、約20倍(約0.5ミクロン/ピクセル)の224x224 RGB でなければなりません。未確認の切り抜きをそのまま渡すのではなく、パイプラインの境界でサイズを確認してください。

TILE_PX = 224

def require_tile(tile):
    """RGB 224x224 タイルを返すか、切り抜きのサイズが間違っている場合はエラーを発生させる"""
    if tile.size != (TILE_PX, TILE_PX):
        raise ValueError(
            f"DeepSpot-M は約20倍(~0.5ミクロン/ピクセル)の {TILE_PX}x{TILE_PX} タイルを想定しています。"
            f"取得されたサイズは {tile.size[0]}x{tile.size[1]} です。"
            "一致するレベルのスライドで再タイル化するか、切り抜きをリサンプリングしてください。"
        )
    return tile.convert("RGB")

解像度が0.5ミクロン/ピクセルに最も近いスライドレベルでタイルを抽出し、そこで224x224に切り抜いてください。粗いレベルからのリサンプリングは、バックボーンが読み取るテクスチャを変化させます。

依存関係をオプショナルに保つ

deepspotm とその重みは、重くゲート付きの依存関係です。それを必要とする関数の内部でのみインポートすることで、プロジェクト全体が deepspotm なしでもインストール、インポート、テストできるようにし、ImportError を各ステップを明示するメッセージに変換します。

DEEPSPOTM_HELP = (
    "DeepSpot-M は利用できません。`uv pip install deepspotm==1.0.0` でインストールし、"
    "https://huggingface.co/ratschlab/DeepSpotM でゲート付き重みへのアクセスをリクエストし、"
    "`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)

埋め込みソース

source は、ルータープロジェクションが構築する凍結遺伝子埋め込みを選択します。以下の5つの値のいずれかです。

source遺伝子埋め込み
evo2ゲノム配列
orthrusRNA
prott5タンパク質配列
scgpt単一細胞発現
apertus言語モデル

それぞれが遺伝子同一性の異なる視点を提供します。実行ごとに1つを選択し、その選択が分析にとって重要な場合には、同じタイルを複数のソースで実行してください。完全な呼び出しインターフェース、バッチ処理、デバイス配置、遺伝子シンボル処理、出力単位については、references/api.md を参照してください。

全スライドワークフロー

予測はタイルごとであるため、スライド全体の実行はタイル化ステップとそれに続くバッチ推論で構成されます。

  1. histolab スキルを使用して、224x224 のタイルをグリッド上に抽出し、各タイルの座標を保持します。
  2. torch.stack を使用してタイルをバッチに処理し、スタックします。
  3. 同じ遺伝子リストを使用して、バッチごとに predict_genes を呼び出します。
  4. バッチを連結してタイル×遺伝子の行列を作成し、座標を結合します。

この行列はスライドの仮想空間トランスクリプトミクスマップであり、下流の空間解析のために AnnData に直接取り込むことができます。references/whole_slide.md には、動作ループ、バッチサイズ、AnnData アセンブリ手順が記載されています。

一般的なユースケース

  • 腫瘍切片全体にわたるマーカー遺伝子の空間発現マップ。
  • 対応するアッセイランがないスライドコホート全体でのトランスクリプトーム全体予測。
  • 学習時に見たことのない遺伝子を含む、約19,000のパネル遺伝子をシンボルでクエリ可能。これは典型的な空間アッセイパネルの数百遺伝子をはるかに超えます。
  • 形態のみの病理パイプラインへの発現チャネルの追加。
  • TCGA で行われたようなスライドレベルのコホートアトラスの構築。

詳細リファレンス

  • references/api.md: from_pretrained と predict_genes の完全な説明、5つの埋め込みソースとその選択方法、バッチ処理、デバイス配置、遺伝子シンボル処理、log1p-CPM 出力の変換。
  • references/whole_slide.md: histolab によるタイル化、スライドスケールの予測ループ、タイル×遺伝子行列のアセンブリと保存、コホートスケールの実行。

一次ソース

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arbor

Autonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

関連スキル