Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tooluniverse-single-cell

БесплатноЗапускает вложенные скриптыНе проверен

Single-cell RNA-seq analysis with scanpy/anndata — h5ad data loading, scRNA-seq quality control and QC gating (n_genes_by_counts, total_counts, mitochondrial…

mims-harvardот mims-harvard★ 1 813 звёзд на GitHub

Об этом скилле

Single-Cell Genomics and Expression Matrix Analysis

Compute the answer from the data

Do the analysis yourself, from the data files, with the recipe below. Do not take the answer from a notebook that has already been run, a result table, or the output of a script that ships with the data: those are not inputs to the analysis, and copying their numbers is not doing it.


Comprehensive single-cell RNA-seq analysis and expression matrix processing using scanpy, anndata, scipy, and ToolUniverse.


LOOK UP, DON'T GUESS

When uncertain about any scientific fact, SEARCH databases first (PubMed, UniProt, ChEMBL, ClinVar, etc.) rather than reasoning from memory. A database-verified answer is always more reliable than a guess.


When to Use This Skill

Apply when users:

  • Have scRNA-seq data (h5ad, 10X, CSV count matrices) and want analysis
  • Need scRNA-seq quality control / QC gating: deciding cell filters by mito % (pct_counts_mt), gene/UMI counts, doublets, ambient RNA, empty droplets
  • Ask about cell type identification, clustering, or annotation
  • Need differential expression analysis by cell type or condition
  • Want gene-expression correlation analysis (e.g., gene length vs expression by cell type)
  • Ask about PCA, UMAP, t-SNE for expression data
  • Need Leiden/Louvain clustering on expression matrices
  • Want statistical comparisons between cell types (t-test, ANOVA, fold change)
  • Ask about marker genes, batch correction, trajectory, or cell-cell communication

NOT for (use other skills instead):

  • Bulk RNA-seq DESeq2 only -> tooluniverse-rnaseq-deseq2
  • Gene enrichment only -> tooluniverse-gene-enrichment
  • VCF/variant analysis -> tooluniverse-variant-analysis
  • Deep-learning integration/batch correction (scVI, scANVI, totalVI, PeakVI, MultiVI, DestVI, veloVI) -> tooluniverse-scvi-tools

Core Principles

  1. Data-first - Load, inspect, validate before analysis
  2. AnnData-centric - All data flows through anndata objects
  3. Cell type awareness - Per-cell-type subsetting when needed
  4. Statistical rigor - Normalization, multiple testing correction, effect sizes
  5. Question-driven - Parse what the user is actually asking

Required Packages

import scanpy as sc, anndata as ad, pandas as pd, numpy as np
from scipy import stats
from scipy.cluster.hierarchy import linkage, fcluster
from sklearn.decomposition import PCA
from statsmodels.stats.multitest import multipletests
import gseapy as gp  # enrichment
import harmonypy     # batch correction (optional)

Install: pip install scanpy anndata leidenalg umap-learn harmonypy gseapy pandas numpy scipy scikit-learn statsmodels


Workflow Decision Tree

START: User question about scRNA-seq data
|
+-- FULL PIPELINE (raw counts -> annotated clusters)
|   Workflow: QC -> Normalize -> HVG -> PCA -> Cluster -> Annotate -> DE
|   See: references/scanpy_workflow.md
|
+-- DIFFERENTIAL EXPRESSION (per-cell-type comparison)
|   Most common pattern: per-cell-type DE
|   See: analysis_patterns.md "Pattern 1"
|
+-- CORRELATION ANALYSIS (gene property vs expression)
|   Pattern: Gene length vs expression correlation
|   See: analysis_patterns.md "Pattern 2"
|
+-- CLUSTERING & PCA (expression matrix analysis)
|   See: references/clustering_guide.md
|
+-- CELL COMMUNICATION (ligand-receptor interactions)
|   See: references/cell_communication.md
|
+-- TRAJECTORY ANALYSIS (pseudotime)
    See: references/trajectory_analysis.md

Data format handling:

  • h5ad -> sc.read_h5ad()
  • 10X -> sc.read_10x_mtx() or sc.read_10x_h5()
  • CSV/TSV -> pd.read_csv() -> Convert to AnnData (check orientation!)

Data Loading

AnnData expects: cells/samples as rows (obs), genes as columns (var)

adata = sc.read_h5ad("data.h5ad")  # h5ad already oriented

# CSV/TSV: check orientation
df = pd.read_csv("counts.csv", index_col=0)
if df.shape[0] > df.shape[1] * 5:  # genes > samples by 5x => transpose
    df = df.T
adata = ad.AnnData(df)

# Load metadata
meta = pd.read_csv("metadata.csv", index_col=0)
common = adata.obs_names.intersection(meta.index)
adata = adata[common].copy()
for col in meta.columns:
    adata.obs[col] = meta.loc[common, col]

Quality Control and QC Gating (do this BEFORE downstream analysis)

QC gating decides which cells and genes are real before normalization, clustering, or DE. Skipping or rushing it propagates silently: doublets become fake "intermediate" states, ambient RNA smears markers across clusters, and empty droplets inflate cell counts. Never report a filtered cell count without the gates applied, and never report cutoffs you did not actually run.

HONEST EXECUTION: QC runs scanpy/AnnData via Bash/Python. If scanpy is not installed, do NOT fabricate metrics — print the install plan and stop: python scripts/scrna_qc.py --install-plan (exits 0, lists what is missing, suggests pip install scanpy anndata scrublet).

Per-cell QC

Полный SKILL.md на GitHub

Установить tooluniverse-single-cell в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.env.templateanalysis_patterns.mdreferences/cell_communication.mdreferences/clustering_guide.mdreferences/marker_identification.mdreferences/scanpy_workflow.mdreferences/scrna_qc.mdreferences/seurat_workflow.mdreferences/trajectory_analysis.mdreferences/troubleshooting.mdscripts/find_markers.pyscripts/normalize_data.pyscripts/qc_metrics.pyscripts/scrna_qc.py

FAQ

Что делает скилл tooluniverse-single-cell?

Single-cell RNA-seq analysis with scanpy/anndata — h5ad data loading, scRNA-seq quality control and QC gating (n_genes_by_counts, total_counts, mitochondrial percent / pct_counts_mt, pct_counts_ribo, doublet detection with Scrublet/scDblFinder, ambient RNA / SoupX awareness, empty-droplet filtering, MAD-based thresholds), normalization, dimensionality reduction (PCA, UMAP, t-SNE), clustering (Leiden, Louvain), marker gene identification, cell-type annotation, pseudotime/trajectory analysis. Use for any scRNA-seq workflow, including deciding which cells to filter, flag, or investigate before downstream analysis.

Как установить скилл tooluniverse-single-cell?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tooluniverse-single-cell запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить tooluniverse-single-cell с