Command Palette

Search for a command to run...

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

bio-data-visualization-dimensionality-reduction-plots

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

Produce and interpret PCA, t-SNE, UMAP, and PHATE plots for high-dimensional omics data with rigor about which method preserves what (variance, local…

gabrielmoreiraот gabrielmoreira★ 23 звезды на GitHub

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

Version Compatibility

Reference examples tested with: scanpy 1.10+, anndata 0.10+, scikit-learn 1.4+, umap-learn 0.5+, openTSNE 1.0+, phate 1.0+, ggplot2 3.5+, PCAtools 2.16+, matplotlib 3.8+.

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • R: packageVersion('<pkg>') then ?function_name to verify parameters

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Dimensionality-Reduction Plots

"Make a PCA / UMAP / t-SNE plot" -> Choose a projection method aligned with what the plot must reveal — variance explained (PCA), local neighborhood structure (t-SNE), manifold approximation with some global structure (UMAP), or continuous transitions (PHATE). Set hyperparameters deliberately. Communicate the projection's limits and refuse to over-interpret 2D distances.

  • Python: sklearn.decomposition.PCA, openTSNE, umap-learn, phate, scanpy.tl.umap / scanpy.tl.tsne / scanpy.tl.pca
  • R: prcomp, PCAtools::pca, Seurat::RunPCA / RunUMAP / RunTSNE, phateR

The Single Most Important Modern Insight -- 2D Embeddings Distort

Chari & Pachter 2023 PLOS Comp Biol 19:e1011288 demonstrated that 2D embeddings of single-cell data lose >95% of the high-dimensional geometry — local neighborhoods are preserved by construction, but distances between distant cells, density estimates, and global topology are NOT preserved. The "specious art" of single-cell genomics is the practice of reading 2D layout as biology.

Practical consequence: a UMAP plot communicates "these cells are similar locally" and nothing more. Distance between clusters is meaningless. Density of points within a cluster is dominated by the embedding's repulsion parameter, not the underlying biology. A trajectory inferred from "the gap" between two clusters in UMAP space is an artifact unless validated against the high-dimensional data (RNA velocity, diffusion pseudotime, PHATE).

A second foundational paper is Kobak & Berens 2019 Nat Commun 10:5416 on t-SNE for single-cell: PCA initialization + early-exaggeration + multi-scale similarity kernels recover more global structure than default t-SNE settings. The same logic applies to UMAP via init='spectral' (default) and min_dist.

Algorithmic Taxonomy

Method Preserves Hyperparameters Strength Fails when
PCA Linear variance (orthogonal, ordered) n_components, scaling Interpretable via loadings; deterministic; variance % per axis Non-linear manifolds; high-dim data with few effective dims
t-SNE (van der Maaten 2008) Local neighborhoods (Student-t similarity) perplexity (typ. 30-50), learning_rate, n_iter, init Crisp cluster separation Global distances meaningless; cluster sizes deceptive; non-deterministic
UMAP (McInnes 2018, Becht 2018) Manifold local + partial global n_neighbors (typ. 15-50), min_dist (typ. 0.1-0.5), spread Faster than t-SNE; better global preservation than default t-SNE; deterministic given seed Still distorts; n_neighbors small -> shattered; large -> homogenized
PHATE (Moon 2019) Continuous transitions, branching trajectories k (knn), t (diffusion power) Best for developmental trajectories; preserves transition geometry Slower; less canonical for clustering display
Diffusion map Diffusion distance epsilon, n_components Theoretically motivated; supports pseudotime Less visually striking; less commonly used
MDS / classical MDS Global Euclidean distances n_components, dissimilarity matrix Honest about distance preservation Computationally expensive >5000 points
Isomap Geodesic distance on knn graph n_neighbors, n_components Captures non-linear manifold Sensitive to k; less popular than UMAP
Force-directed (PAGA, ForceAtlas2) Graph topology Layout-specific Best for connectivity (PAGA cluster graph) Not for dense cells; aesthetic

Decision Tree by Scenario

Scenario Recommended Why
Bulk RNA-seq sample QC PCA on log-vst counts; show PC1 vs PC2 with metadata color Variance explained is meaningful for batch detection
Single-cell broad cluster overview UMAP n_neighbors=30, min_dist=0.3 after PCA(50) Standard; preserves clusters; faster than t-SNE
Single-cell with delicate trajectories PHATE OR diffusion map Preserves continuous transitions
Cluster cardinality / boundary visualization t-SNE with PCA init, perplexity=50 (Kobak-Berens) Crisper cluster separation than UMAP
Multi-omics integration projection MOFA factors + PCA, or UMAP of joint embedding Per-omics projection often misleading
Spatial transcriptomics with histology UMAP for transcriptional axis; SEPARATE spatial scatter
Полный SKILL.md на GitHub

Установить bio-data-visualization-dimensionality-reduction-plots в Claude Code и Claude Desktop

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

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

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

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

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

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

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

examples/embedding_phd.pyusage-guide.md

FAQ

Что делает скилл bio-data-visualization-dimensionality-reduction-plots?

Produce and interpret PCA, t-SNE, UMAP, and PHATE plots for high-dimensional omics data with rigor about which method preserves what (variance, local structure, manifold, transitions), hyperparameter sensitivity, and the well-documented limits of 2D embeddings. Covers PCA biplot/scree/loadings, t-SNE PCA initialization (Kobak-Berens 2019), UMAP n_neighbors/min_dist trade-offs, and the Chari-Pachter 2023 critique. Use when visualizing high-dimensional data — bulk PCA, single-cell embeddings, multi-omics integration projections.

Как установить скилл bio-data-visualization-dimensionality-reduction-plots?

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

Скилл bio-data-visualization-dimensionality-reduction-plots запускает скрипты?

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

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

Сравнить bio-data-visualization-dimensionality-reduction-plots с