scanpy
できること
このツールは、一細胞RNAシーケンス(scRNA-seq)のデータを解析します。データの品質を把握し、似た細胞をグループ化し、重要な遺伝子を見つけ、結果を可視化するのに役立ちます。
使う場面
- ✓未加工の一細胞シーケンスデータがあるとき。
- ✓一細胞データを整理して可視化したいとき。
- ✓サンプル内の細胞の種類を特定したいとき。
スキルのリンク
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/scanpy/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私の一細胞RNA-seqデータを解析してください。品質管理を行い、データを正規化し、PCAとUMAPで次元削減し、細胞をクラスタリングして、マーカー遺伝子を見つけてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、Scanpyと呼ばれる一連の命令を使ってデータを処理します。クリーニング、正規化、次元削減、クラスタリングなどの工程を行い、データのパターンを明らかにします。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Scanpy: Single-Cell Analysis
Overview
Scanpy is a scalable Python toolkit for analyzing single-cell RNA-seq data, built on AnnData. Apply this skill for complete single-cell workflows including quality control, normalization, dimensionality reduction, clustering, marker gene identification, visualization, and trajectory analysis. Targets Scanpy 1.12.4 (released 2026-08-27), reviewed 2026-10-01. Native synthetic tests establish data/API contracts, not biological validity.
Installation
Requires Python 3.12+ (scanpy 1.12 dropped Python ≤3.11) and anndata ≥0.10.
uv pip install "scanpy[leiden]"
The [leiden] extra installs igraph and leidenalg; the scripts explicitly select flavor="igraph". For reproducible environments, pin a version: uv pip install "scanpy[leiden]==1.12.4".
For large or out-of-core datasets, many functions support Dask arrays (experimental):
uv pip install "scanpy[leiden]" dask
See the Using dask with Scanpy tutorial. For GPU-accelerated scanpy-like operations, use rapids-singlecell as a separate package.
If the input is an R-native single-cell object (.rds, .RData, Seurat, or SingleCellExperiment), first convert it to .h5ad with R tooling, then load it with Scanpy. Read references/r_interop.md for agent-run installation and conversion instructions across macOS, Linux, and Windows.
For AnnData structure and I/O details, use the anndata skill. For probabilistic models and batch correction, use scvi-tools.
Representation and inference contracts
- Input to QC/preprocessing must be identified raw counts. The scripts reject negative,
fractional, nonfinite or zero-total cells. Use
--counts-layer countswhen X is already normalized; never infer provenance from integer-looking values alone. layers["counts"]remains unnormalized;.rawis an independent full-gene log-normalized snapshot. Gene subsetting also subsets every layer, but does not subset.rawgenes. Retain a full-gene object for pseudobulk; the full pipeline does so.seurat/cell_rangerHVGs use log-normalized values;seurat_v3andseurat_v3_paperuse counts and requirescanpy[skmisc]. Scaling/regression are optional, may densify sparse data, and can remove biology along with covariates.- Marker ranking defaults to
.rawwhen present;--no-use-rawselects X and--layerselects an explicit log-normalized layer.--groups/--referencecontrol contrasts. Wilcoxon/t-test adjusted p-values use BH within each comparison; logreg returns ranking scores without p-values. Clusters chosen from the same data yield exploratory markers. - Condition DE requires raw-count sums per sample and cell type, independent biological replicates, aligned condition/donor metadata and a full-rank design. Analyze each cell type separately; repeated donor samples require a suitable paired design. Aggregation cannot fix confounding, missing replication, doublets or incorrect annotations.
- Harmony (
harmonypy) changes PCA coordinates; BBKNN (bbknn) changes the graph; ComBat changes X. Keep original expression/counts for DE, and assess biological conservation and batch mixing together. Requested integration/doublet failures stop. - The toolkit loads files into memory. For backed data, explicitly call
.to_memory()on a chosen subset and close the file; backed mode is not a general out-of-core pipeline. Copy views before mutation. Dask support varies by function/array layout. .rdsneeds an explicit R conversion stage. Cluster IDs do not determine cell types: all mappings/signature assets are illustrative human marker examples, requiring review.
Harmony 2 returns cells x PCs; the toolkit calls its native API because the Scanpy 1.12.4 wrapper still transposes that output and fails with current Harmony.
Optional packages: scikit-image for Scrublet automatic thresholding, loompy for Loom,
scikit-misc for v3 HVGs, harmonypy==2.0.2/bbknn==1.6.0 for their integration branches, and louvain
for the deprecated Louvain option (separate environment: louvain 0.8.2 requires
igraph <0.12, conflicting with the tested igraph 1.0). Install only needed branches. R and optional integration
execution boundaries are recorded in references/upstream-review.md.
…
よくある質問
一細胞RNAシーケンス(scRNA-seq)データとは何ですか?
個々の細胞からRNAを解析する技術です。組織や試料に含まれる細胞の多様性と、それぞれの細胞の機能を明らかにできます。
.h5adファイルとは何ですか?
一細胞データを効率よく保存するために使われる一般的なファイル形式で、Scanpyと互換性があります。
.rdsなど他の形式のデータも使えますか?
はい、ツールは.rds形式(Rでよく使われる形式)のデータを、解析前に.h5ad形式へ変換できます。
詳細
作者による元の説明
Performs Scanpy single-cell RNA-seq QC, normalization, HVG selection, PCA/UMAP/t-SNE, clustering, exploratory marker ranking, pseudobulk preparation, visualization, and Seurat or SingleCellExperiment RDS conversion to h5ad. Applies to established exploratory scRNA-seq workflows with explicit count and expression provenance; complementary skills cover scvi-tools models and AnnData format details.
人気
- GitHubのスター
- 51k
- ランキング
- #3559
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
13c-metabolic-flux
51k炭素13同位体トレーシングのデータを使って代謝フラックスを推定します。細胞の代謝や生化学経路の分析に役立ちます。
adaptyv
51kAdaptyv APIを使ってタンパク質の特性評価実験を設計します。コストの見積もり、配列の提出、ラボの結果の監視を支援します。
aeon
51k時系列データに対して機械学習のタスクを実行します。逐次データの分類、予測、異常検知、パターンの発見に役立ちます。
alphagenome
51k遺伝的変異に対して、事前に計算されたゲノム上の効果を検索します。スコアと説明を提供し、変異がゲノムに与える影響を理解するのに役立ちます。