LLMs-Universal-Life-Science-and-Clinical-Skills- sc-velocity

install
source · Clone the upstream repo
git clone https://github.com/mdbabumiamssm/LLMs-Universal-Life-Science-and-Clinical-Skills-
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/mdbabumiamssm/LLMs-Universal-Life-Science-and-Clinical-Skills- "$T" && mkdir -p ~/.claude/skills && cp -r "$T/Skills/Transcriptomics/sc-velocity" ~/.claude/skills/mdbabumiamssm-llms-universal-life-science-and-clinical-skills-sc-velocity && rm -rf "$T"
manifest: Skills/Transcriptomics/sc-velocity/SKILL.md
source content

⚡ Single-Cell RNA Velocity

Quantify transcriptional dynamics by coupling spliced and unspliced matrices using scVelo's stochastic and dynamical models. This skill ingests AnnData/loom counts, performs preconditioning (normalization, moments, phase portrait checks), computes velocities, and returns latent time embeddings with driver gene evidence suitable for trajectory-aware downstream workflows.

When to Trigger

  • User mentions "RNA velocity," "latent time," "dynamic gene programs," or "spliced/unspliced layers"
  • Input AnnData includes
    .layers["spliced"]
    and
    .layers["unspliced"]
  • Need to compare lineage directionality following clustering/integration steps

Supported Inputs

FormatNotes
.h5ad
Preferred; expects
layers["spliced"]
/
["unspliced"]
,
obs
annotations, optional
var
kinetic priors
.loom
Auto-converted to AnnData; verifies
layers/{spliced,unspliced}
MatricesProvide
--spliced
/
--unspliced
MTX + metadata to build AnnData wrapper

Typical Workflow

  1. Load + QC
    import scvelo as scv
    adata = scv.read("sample.h5ad")
    scv.pp.filter_and_normalize(adata, min_shared_counts=30, n_top_genes=4000)
    scv.pp.moments(adata, n_pcs=30, n_neighbors=30)
    
  2. Velocity Computation
    scv.tl.velocity(adata, mode="dynamical")
    scv.tl.velocity_graph(adata)
    scv.tl.velocity_confidence(adata)
    
  3. Latent Time & Drivers
    scv.tl.recover_dynamics(adata)
    scv.tl.latent_time(adata)
    scv.tl.rank_velocity_genes(adata, groupby="leiden")
    
  4. Visualization & Export
    scv.pl.velocity_embedding_stream(adata, basis="umap", color="leiden")
    adata.write_h5ad("velocity_annotated.h5ad")
    

CLI Examples

# Run full pipeline with dynamical model, auto-detect PCA/neighbor params
python omicsclaw.py run sc-velocity --input data/sample.h5ad --mode dynamical --out runs/sc_velocity

# Skip recover_dynamics if kinetics already stored
python omicsclaw.py run sc-velocity --input data/sample.h5ad --mode stochastic --skip-latent-time

# Provide loom inputs and metadata
python omicsclaw.py run sc-velocity --loom data/sample.loom --obs-meta obs.csv --var-meta var.csv

Key Parameters

FlagDefaultDescription
--mode
dynamical
stochastic
,
steady_state
, or
dynamical
modeling
--min-shared-counts
30
Genes must appear with this many shared counts during normalization
--n-top-genes
4000
HVG count for kinetics modeling
--n-pcs
30
Principal components for moment calculation
--n-neighbors
30
Neighborhood size for velocity graph construction
--skip-latent-time
False
Disable latent time + driver gene ranking to save runtime

Outputs

  • Annotated
    .h5ad
    with velocity layers, confidence, latent time, and driver gene tables
  • Summary report (
    report.md
    ) capturing runtime, parameter set, model diagnostics, QC thresholds
  • PNG/PDF figures for streamlines, quiver plots, phase portraits, driver gene heatmaps
  • result.json
    for orchestrator bookkeeping

Integration Touchpoints

  • Upstream:
    sc-preprocessing
    ,
    sc-doublet-detection
    ,
    sc-batch-integration
  • Downstream:
    sc-trajectory
    (uses latent time),
    sc-cell-communication
    (velocity-informed ligand prioritization),
    spatial-velocity

Troubleshooting Cheatsheet

SymptomFix
Low velocity confidence (
velocity_confidence
< 0.4)
Increase
min_shared_counts
, rerun normalization/moments, verify layers not log-normalized beforehand
Divergent dynamical fitInitialize with
mode=stochastic
, inspect phase portraits for genes with insufficient kinetics
Memory pressure (>32 GB)Use
--subset-gene-file
to preselect driver genes or run on sparse-backed AnnData

Source Reliability

SourceScoreNotes
Theis Lab scVelo repo0.93Active upstream repository with peer-reviewed implementation
K-Dense Claude Scientific Skills0.90Provides standardized skill scaffolding we mirror for metadata/trigger design