single-trajectory-analysis
БесплатноБез исполняемых скриптовНе проверенTrajectory & RNA velocity: PAGA, Palantir, VIA, dynamo, scVelo, latentvelo, graphvelo backends via ov.single.Velo. Pseudotime, stream plots.
Об этом скилле
Single-trajectory analysis skill
Overview
This skill describes how to reproduce and extend the single-trajectory analysis workflow in omicverse, combining graph-based trajectory inference, RNA velocity coupling, and downstream fate scoring notebooks.
Trajectory setup
- PAGA (Partition-based graph abstraction)
- Build a neighborhood graph (
pp.neighbors) on the preprocessed AnnData object. - Use
tl.pagato compute cluster connectivity andtl.draw_graphortl.umapwithinit_pos='paga'for embedding. - Interpret edge weights to prioritize branch resolution and seed paths.
- Build a neighborhood graph (
- Palantir
- Run
Palantiron diffusion components, seeding with manually selected start cells (e.g., naïve T cells). - Extract pseudotime, branch probabilities, and differentiation potential for subsequent overlays.
- Run
- VIA
- Execute
via.VIAon the kNN graph to identify lineage progression with automatic root selection or user-defined roots. - Export terminal states and pseudotime for cross-validation against PAGA and Palantir results.
- Execute
Velocity coupling (VIA + scVelo)
- Use
scv.pp.filter_and_normalize,scv.pp.moments, andscv.tl.velocityto generate velocity layers. - Provide VIA with
adata.layers['velocity']to refine lineage directionality (via.VIA(..., velocity_weight=...)). - Compare VIA pseudotime with scVelo latent time (
scv.tl.latent_time) to validate directionality and root selection.
Advanced RNA Velocity Backends (ov.single.Velo)
OmicVerse provides a unified Velo class wrapping 4 velocity backends. Use this when you need more than basic scVelo:
Backend selection guide
| Backend | Best for | GPU? | Prerequisites |
|---|---|---|---|
| scvelo | Standard velocity analysis | No | spliced/unspliced layers |
| dynamo | Kinetics modeling, vector fields | No | spliced/unspliced layers |
| latentvelo | VAE-based, batch correction, complex dynamics | Yes (torchdiffeq) | celltype_key, batch_key optional |
| graphvelo | Refinement layer on top of any backend | No | base velocity + connectivities |
Unified Velo pipeline
import omicverse as ov
velo = ov.single.Velo(adata)
# 1. Filter (scvelo backend) or preprocess (dynamo backend)
velo.filter_genes(min_shared_counts=20) # For scvelo
# velo.preprocess(recipe='monocle', n_neighbors=30, n_pcs=30) # For dynamo
# 2. Compute moments
velo.moments(backend='scvelo', n_pcs=30, n_neighbors=30)
# backend: 'scvelo' or 'dynamo'
# 3. Fit kinetic parameters
velo.dynamics(backend='scvelo')
# 4. Calculate velocity
velo.cal_velocity(method='scvelo')
# method: 'scvelo', 'dynamo', 'latentvelo', 'graphvelo'
# 5. Build velocity graph and project to embedding
velo.velocity_graph(basis='umap')
velo.velocity_embedding(basis='umap')
latentvelo specifics (deep learning velocity)
latentvelo uses a VAE + neural ODE to learn latent dynamics. It handles batch effects and complex trajectories better than classical scVelo:
velo.cal_velocity(
method='latentvelo',
celltype_key='cell_type', # Optional: AnnotVAE uses cell type info
batch_key='batch', # Optional: batch correction
velocity_key='velocity_S',
n_top_genes=2000,
latentvelo_VAE_kwargs={}, # Pass custom VAE hyperparameters
)
# Requires: pip install torchdiffeq
# Uses GPU if available, falls back to CPU
graphvelo specifics (refinement layer)
GraphVelo refines velocity estimates from any base method by leveraging the cell graph structure. Run it after scvelo or dynamo:
# First: compute base velocity with scvelo or dynamo
velo.cal_velocity(method='scvelo')
# Then: refine with graphvelo
velo.graphvelo(
xkey='Ms', # Spliced moments key
vkey='velocity_S', # Base velocity key to refine
basis_keys=['X_umap', 'X_pca'], # Project to multiple embeddings
gene_subset=None, # Optional: restrict to gene subset
)
Downstream fate scoring notebooks
- CellFateGenie: For pseudotime-associated gene discovery, use
search_skills('CellFateGenie fate genes')to load the dedicated CellFateGenie skill. t_metacells.ipynb: Aggregate metacell trajectories for robustness checks and meta-state differential expression.
Required preprocessing
- Quality control: remove low-quality cells/genes, apply doublet filtering.
- Normalization & log transformation (
sc.pp.normalize_total,sc.pp.log1p). - Highly variable gene selection tailored to immune datasets (
sc.pp.highly_variable_genes). - Batch correction if necessary (e.g.,
scvi-tools,bbknn). - Compute PCA, neighbor graph, and embedding (UMAP/FA) used by all trajectory methods.
- For velocity: compute moments on the same neighbor graph before running VIA coupling.
Parameter tuning
- Neighbor graph
n_neighborsandn_pcsshould be harmonized across PAGA, VIA, and Palantir to maintain consistency. - In VIA, adju
Установить single-trajectory-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл single-trajectory-analysis?
Trajectory & RNA velocity: PAGA, Palantir, VIA, dynamo, scVelo, latentvelo, graphvelo backends via ov.single.Velo. Pseudotime, stream plots.
Как установить скилл single-trajectory-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл single-trajectory-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic