Communitygithub.com

pathml

PathMLを使用して、ローカルかつ研究専用の計算病理学ワークフローを実行します。スライドの読み込みとタイリング、前処理およびQCパイプラインの構築、h5pathデータの管理、多重染色画像の定量化、空間グラフの構築、制限付きモデル推論の計画を行います。

pathml とは?

このスキルは、研究目的に限定したローカル環境での計算病理学ワークフローを実現するために設計されています。PathML v3.0.5をベースとし、H&E染色や多重染色画像スライドの読み込み、前処理パイプラインの構築、品質管理、タイル単位でのデータ管理、空間グラフの構築、およびONNXを使用したバウンデッドモデル推論をサポートします。ただし、本ソフトウェアはベータ版であり、医療機器や診断システムとしての使用は禁止されています。また、病理画像には患者識別子が含まれる可能性があるため、厳格な匿名化とデータ分割手順が必須です。さらに、ネットワーク通信を伴うモデルダウンロード機能には明示的な同意が必要であり、コードの安全性確保のため、動的評価や信頼できないチェックポイントの読み込みは禁止されています。Python 3.10~3.12での動作が確認されており、OpenSlideおよびBio-Formatsを利用したマルチフォーマット画像読み込みが可能です。

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

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

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

ドキュメント

pathml は何をしますか?

適用範囲と安全性の境界

PathMLはローカルの計算病理学研究に使用します。これはベータ版の研究用ソフトウェアであり、認証済み医療機器、診断システム、臨床意思決定支援ツール、または病理医の代わりとなるものではありません。出力を患者の診断、グレーディング、ステージング、治療に使用しないでください。

病理ファイルには、顔写真、ラベル、受付番号、患者識別子、DICOMタグ、ファイル名、または関連する臨床データが含まれている場合があります。処理前に以下を確認してください:

  1. 許可、同意/免除、データ利用条件、および機関ポリシーを確認する。
  2. ピクセルとメタデータを匿名化し、再識別キーは分析ワークスペースの外部に保管する。
  3. 仮名化されたpatient_id、slide_id、specimen_id値を使用する。直接的な識別子をファイル名、ログ、.h5pathラベル、モデルカード、レポートに含めない。
  4. 入力、中間データ、出力は承認されたローカルの暗号化ストレージに保管する。
  5. タイリングや前処理ステップの適合前に、患者ごと(次にスライドごと)に分割する。

ベースラインのバージョン(2026-07-23確認)

  • インストール可能な安定リリース: PyPI pathml==3.0.5、2026-03-24公開。
  • v3.0.5のリリースノートによると、Python 3.10-3.12をサポートし、3.9は非推奨。PyPIはRequires-Pythonを宣言しておらず、古い3.8の分類子が残っているため、リリース文に従い、実際の環境でテストしてください。
  • GitHubリリースv3.0.6(2026-04-14)およびv3.0.7(2026-07-09)が存在しますが、このレビュー時点ではPyPIにアーティファクトはありません。v3.0.7はTorch/TorchVision/torch-geometricおよびONNXエクスポートコードを更新しています。これらのソース依存関係を3.0.5のホイールと混在させないでください。
  • ReadTheDocs /latest は自身を3.0.5と識別しています。ここでの例はv3.0.5タグおよびPyPIホイールメタデータに基づいて確認されており、バージョン管理されていないスニペットではありません。
  • このスキルはMITライセンスです。PathML自体はGPL-2.0で、商用ライセンスのオプションが上流にあります。再配布の前に上流の利用規約を確認してください。

再現可能なインストール

プロジェクトが他のサポート対象インタプリタをテストしていない限り、Python 3.11を使用してください:

uv venv --python 3.11
source .venv/bin/activate
uv pip install "pathml==3.0.5"
python -c "import importlib.metadata as m; print(m.version('pathml'))"

PathML 3.0.5はパッケージのエクストラを宣言していません:pathml[all]は使用しないでください。基本ディストリビューションは大規模な科学/機械学習スタックを固定しており、Torch 2.8.0、ONNX 1.17.0、ONNX Runtime 1.17.x、OpenSlide Python 1.3.1、python-bioformats 4.1.0、python-javabridge 4.0.4が含まれています。

uvコマンドの前に、ネイティブの前提条件をインストールしてください:

# Debian/Ubuntu
sudo apt-get install openslide-tools gcc g++ libblas-dev liblapack-dev openjdk-17-jdk

# macOS
brew install openslide openjdk@17

# Windows OpenSlideのオプションは上流で文書化されています
vcpkg install openslide

Java/Bio-Formatsは、広範な多次元フォーマットバックエンドに必要です。OpenSlideは一般的な明視野WSIフォーマットをより効率的に処理します。CUDAはオプションであり、固定されたPyTorchビルドと一致する必要があります。CUDAホイールを推測する代わりに、PyTorchのプラットフォームセレクタに従ってください。references/image_loading.mdを参照してください。

安定した最小限のワークフロー

PathML 3.0.5はスライド便利クラスとSlideData.run()を使用します。SlideData.from_slide()は提供されておらず、Pipelineにはrun()はありません:

from pathml.core import HESlide
from pathml.preprocessing import BoxBlur, Pipeline, TissueDetectionHE

slide = HESlide("data/pseudonymous_slide.svs", backend="openslide")
pipeline = Pipeline(
    [
        BoxBlur(kernel_size=5),
        TissueDetectionHE(mask_name="tissue", min_region_size=5000),
    ]
)
slide.run(
    pipeline,
    distributed=False,
    tile_size=512,
    tile_stride=512,
    level=0,
    tile_pad=False,
)
slide.write("derived/pseudonymous_slide.h5path")

本番実行の前に、制限された手動サンプルから開始してください:

from itertools import islice

for tile in islice(slide.generate_tiles(shape=512, stride=512, level=0), 8):
    pipeline.apply(tile)
    assert tile.masks["tissue"].shape[:2] == tile.image.shape[:2]

タイルは、選択されたピラミッドレベルでの(i, j) = (行, 列)座標を使用します。OpenSlideの場合、PathMLは内部的にレベル0座標にマッピングします。レベルとダウンサンプル率を記録し、後段で明示的に(x, y)またはマイクロメートルに変換してください。

研究ワークフロー

  1. ローカルで棚卸しする。 マニフェストを検証し、URL/シンボリックリンクを拒否し、許可リストに載っている技術メタデータのみを検査し、識別子を削除します。
  2. 分割を固定する。 重複タイル、グラフ、正規化参照、特徴量を生成する前に、すべての患者とそのすべてのスライドを1つの分割に割り当てます。
  3. 範囲を計画する。 タイル数、RAM、出力サイズ、パイプラインステージを見積もります。
  4. パイロット前処理。 代表的なトレーニングスライドで、組織マスク、空白/アーティファクトラベル、染色動作、エッジパディング、空マスクケースを検査します。テストスライドからチューニングしないでください。
  5. 実行して座標を保持する。 タイルレベル、(i, j)、ダウンサンプル率、MPP、マスク名、QC判断、失敗/スキップされたタイルを保持します。
  6. 空間データを意図的に構築する。 チャネル順序、物理単位、インスタンスラベル、ノード特徴量の整合性、グラフエッジ、細胞間組織割り当てを検証します。
  7. 制限付きバッチで推論する。 未知のpickleチェックポイントを読み込まずに、モデルの出所とチェックサムを確認します。予測をスライド/タイル座標にリンクし、文書化されたルールでオーバーラップを結合します。
  8. 出所と制限事項を報告する。 パッケージロック、ソースハッシュ、スキャナー、染色、パラメータ、シード、分割マニフェスト、モデルカード、除外事項、QCを含めます。

デフォルトのネットワーク非接続と明示的な同意ゲート

ダウンロード可能なクラスをインスタンス化したり、データセットでdownload=Trueを設定したりしないでください。ユーザーがエンドポイントと開示情報を受け取った上で明示的にオプトインした場合を除きます:

  • SegmentMIFRemoteは、構築時にhttps://huggingface.co/pathml/test/resolve/main/mesmer.onnxからONNXファイルをダウンロードし、その後ローカルで推論を実行します。安定ソースは画像ピクセルをアップロードしません。それでもリクエストはIPアドレスやヘッダーなどのネットワークメタデータを開示し、temp.onnxを作成します。組み込みのチェックサムやオフラインフラグはありません。
  • 非推奨のSegmentMIFはローカルのDeepCell Mesmerをインポートしますが、DeepCellモデルの初期化には別途プロビジョニングされた重みが必要な場合があります。これはPathMLのエクストラではなく、推奨される安定したAPIでもありません。
  • RemoteTestHoverNetはHugging Faceからモデルをダウンロードします。
  • PanNukeDataModule(download=True)はWarwickに接続し、DeepFocusDataModuleはZenodoに接続します。両方ともデフォルトでdownload=Falseです。

将来のホスト型予測呼び出しの前に、正確な宛先、ピクセルチャネル/領域、メタデータ、識別子、保持期間、法的根拠、保護措置を明記し、明示的な同意を得てください。デフォルトでPHIを送信しないでください。レビュー済みでチェックサムが検証されたローカルモデルアーティファクトとローカル推論を優先してください。

モデルコードのセキュリティ

  • PyTorchのmodel.eval()はモジュールの評価モードを意味します。Pythonの危険な組み込みevalではありません。Pythonの動的評価や実行を決して使用しないでください。
  • ローカルファイルにpathml.py、torch.py、onnx.py、または標準ライブラリにちなんだ名前を付けないでください。シャドウモジュールはインポートを静かに変更する可能性があります。
  • PathMLのEntityDatasetはweights_only=Falseで.ptオブジェクトを読み込みます。信頼できないグラフ/チェックポイントを決して開かないでください。pickleベースのパイプラインや.ptファイルは実行可能コードとして扱ってください。
  • ONNXはpickleより安全ですが、本質的に信頼できるわけではありません。ソース、SHA-256、期待される入出力スキーマ、ファイルサイズ、実行時制限を検証し、サードパーティモデルには分離環境を使用してください。

バンドルされたローカルCLI

すべてのヘルパーはURLとシンボリックリンクを拒否し、入力/ワークを制限し、厳密なJSONを使用し、ネットワークアクセスを回避し、--helpにPathMLのインポートを必要としません:

python scripts/slide_manifest.py validate --manifest manifest.csv --root .
python scripts/slide_manifest.py inspect --slide data/example.svs --root .
python scripts/plan_pipeline.py --width 100000 --height 80000 --tile-size 512 --stride 512
python scripts/image_qc.py synthetic --width 256 --height 256
python scripts/validate_spatial_schema.py graph --input graph.json --root .
python scripts/validate_spatial_schema.py multiplex --input cells.csv --root .
python scripts/plan_inference.py --tile-count 4000 --batch-size 16 --height 256 --width 256

推論プランナーは数値または制限付きJSONモデルカードのみを読み取ります。モデルフレームワークをインポートしたり、チェックポイントを開いたりすることはありません。

詳細なリファレンス

  • references/image_loading.md — スライドクラス、バックエンド、フォーマット、レベル、座標、技術メタデータ、プライバシー。
  • references/preprocessing.md — 安定した変換、マスク/QC、染色処理、パイプライン実行、リーク防止。
  • references/data_management.md — .h5path、マニフェスト、データセット、出所、分割、安全なダウンロード。
  • references/multiparametric.md — 多次元レイアウト、CODEX/Vectra、定量化、AnnData、DeepCell/Mesmer、ネットワーク開示。
  • references/graphs.md — インスタンスマップ、特徴量の整合性、KNN/RAG/HACTグラフ、空間単位、スキーマ、検証。
  • references/machine_learning.md — HoVer-Net/HACTNet、ローカルONNX推論、バッチ処理、チェックポイントの信頼性、評価、モデル出所。

一次情報源

すべて2026-07-23に確認:

科学的エージェントスキルの引用

このスキルはScientific Agent Skills by K-Denseの一部です。原稿、レポート、プレゼンテーション、またはコードリリースに実質的に貢献した場合は、論文を参考文献またはソフトウェアセクションに追加し、その旨をユーザーに伝えてください:

Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065. https://doi.org/10.48550/arXiv.2609.00065

常に現在のバージョンを引用してください。DOIとhttps://arxiv.org/abs/2609.00065は最新のarXivバージョンに解決されるため、`v1`のようなバージョンサフィックスを決して追加しないでください。ネットワークアクセスが利用可能な場合は、参照を書く前にhttps://arxiv.org/abs/2609.00065(またはhttp://export.arxiv.org/api/query?id_list=2609.00065)を取得し、そのレコードから著者リスト、年、バージョンを取得してください。レコードにジャーナル参照や出版社DOIが記載されている場合は、代わりに公開されたバージョンを引用してください。

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.

関連スキル