OpenClaw-Medical-Skills single-trajectory-analysis
Guide to reproducing OmicVerse trajectory workflows spanning PAGA, Palantir, VIA, velocity coupling, and fate scoring notebooks.
install
source · Clone the upstream repo
git clone https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/single-trajectory" ~/.claude/skills/freedomintelligence-openclaw-medical-skills-single-trajectory-analysis && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/single-trajectory" ~/.openclaw/skills/freedomintelligence-openclaw-medical-skills-single-trajectory-analysis && rm -rf "$T"
manifest:
skills/single-trajectory/SKILL.mdsource content
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 (
) on the preprocessed AnnData object.pp.neighbors - Use
to compute cluster connectivity andtl.paga
ortl.draw_graph
withtl.umap
for embedding.init_pos='paga' - Interpret edge weights to prioritize branch resolution and seed paths.
- Build a neighborhood graph (
- Palantir
- Run
on diffusion components, seeding with manually selected start cells (e.g., naïve T cells).Palantir - Extract pseudotime, branch probabilities, and differentiation potential for subsequent overlays.
- Run
- VIA
- Execute
on the kNN graph to identify lineage progression with automatic root selection or user-defined roots.via.VIA - Export terminal states and pseudotime for cross-validation against PAGA and Palantir results.
- Execute
Velocity coupling (VIA + scVelo)
- Use
,scv.pp.filter_and_normalize
, andscv.pp.moments
to generate velocity layers.scv.tl.velocity - Provide VIA with
to refine lineage directionality (adata.layers['velocity']
).via.VIA(..., velocity_weight=...) - Compare VIA pseudotime with scVelo latent time (
) to validate directionality and root selection.scv.tl.latent_time
Downstream fate scoring notebooks
: Map lineage probabilities onto T-cell subsets, quantify fate bias, and visualize heatmaps.t_cellfate*.ipynb
: Aggregate metacell trajectories for robustness checks and meta-state differential expression.t_metacells.ipynb
: Integrate CytoTRACE differentiation potential with velocity-informed lineages for maturation scoring.t_cytotrace.ipynb
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
andn_neighbors
should be harmonized across PAGA, VIA, and Palantir to maintain consistency.n_pcs - In VIA, adjust
,knn
, andtoo_big_factor
for datasets with uneven sampling.root_user - Palantir requires careful start cell selection; use marker genes and velocity arrows to confirm.
- For PAGA, tweak
to control edge sparsity; ensure connected components reflect biological branches.threshold - Velocity estimation: compare
vsmode='stochastic'
in scVelo; recalibrate if terminal states disagree with VIA.mode='dynamical'
Visualization and export
- Overlay PAGA edges on UMAP (
) and annotate branch labels.scv.pl.paga - Plot Palantir pseudotime and branch probabilities on embeddings.
- Visualize VIA trajectories using
andvia.plot_fates
.via.plot_scatter - Export pseudotime tables and fate probabilities to CSV for downstream notebooks.
- Save high-resolution figures (PNG/SVG) and notebook artifacts for reproducibility.
- Update notebooks with consistent color schemes and metadata columns before sharing.
Troubleshooting tips
- Missing velocity layers: re-run
andscv.pp.moments
ensuringscv.tl.velocity
/adata.layers['spliced']
exist; verify loom/H5AD import preserved layers.['unspliced'] - Disconnected PAGA graph: inspect neighbor graph or adjust
; confirm batch correction didn’t fragment the manifold.n_neighbors - Palantir convergence issues: reduce diffusion components or reinitialize start cells; ensure no NaN values in data matrix.
- VIA terminal states unstable: increase iterations (
), or provide manual terminal state hints based on marker expression.cluster_graph_pruning_iter - Notebook kernel memory errors: downsample cells or precompute summaries (metacells) before rerunning.