scvelo
它能做什么
这个工具利用 RNA 数据,分析细胞中的基因如何随时间变化。它有助于理解细胞发育的方向,并检验细胞过程运作方式的模型。
适用场景
- ✓当你想在实验中观察细胞的走向时。
- ✓用于检验关于基因如何控制细胞发育的假设。
- ✓用于检查细胞功能模型是否与数据相符。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/scvelo/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“分析 RNA velocity,帮助我理解数据集中的细胞轨迹。”
每周 5 个新技能,1 分钟读完。
工作原理
该工具比较每个细胞中“剪接后”(已加工)和“未剪接”(未加工)RNA 的数量。借助数学模型,这种比较可以估算基因变化的方向和速度。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
scVelo RNA Velocity
When to use
Use for kinetic analysis of aligned spliced/unspliced RNA counts, directional trajectory hypotheses, gene-level phase portraits, and dynamical latent time. Use the model reference for assumptions, transition probabilities, and an optional CellRank handoff.
RNA velocity estimates an expression derivative under a model. Smooth arrows are not observed cell movement, lineage tracing, causal drivers, or proof of future fate. The dynamical estimator is not automatically more accurate than a steady-state estimator on every dataset.
Tested environment and compatibility
The maintained workflow targets scVelo 0.3.4, Scanpy 1.12.4, AnnData 0.13.4, NumPy 2.5.3, pandas 2.3.3, SciPy 1.18.1, Matplotlib 3.11.2, and loompy 3.0.8 on Python 3.13. Use an isolated environment:
uv venv --python 3.13 .venv-velocity
uv pip install --python .venv-velocity/bin/python \
scvelo==0.3.4 scanpy==1.12.4 anndata==0.13.4 numpy==2.5.3 \
pandas==2.3.3 scipy==1.18.1 matplotlib==3.11.2 loompy==3.0.8
The packages above were resolved from cache and tested in an isolated uv
environment; shell paths above use POSIX syntax. Installation requires network
access unless packages are cached. No API key is required.
- Deterministic and dynamical models: native synthetic fitting, graphs, relative times, plots and H5AD round trips are tested on this stack.
- Stochastic model: scVelo 0.3.4's default GLS scalar assignment fails with
NumPy 2. Scanpy 1.12 requires NumPy 2, so installing
numpy<2beside current Scanpy is not a solution. A separately validated legacy Scanpy/NumPy environment is required; that legacy stack was not executed in this review. The helper rejects this combination before modifying data, without changing the model. - pandas 3: scVelo 0.3.4 dynamical fitting and some plots use operations no longer supported by pandas 3. Keep the explicit pandas pin.
- The upstream stable tutorial still contains removed
scv.readand older preprocessing calls. Check the 0.3.4 source when a tutorial disagrees with the installed API.
Input contract
- Obtain spliced and unspliced counts from a velocity-aware quantifier. Keep quantifier/version, reference annotation, counting mode, sample IDs and cell barcode mapping. Upstream quantification is outside the bundled script.
- Supply cells by genes matrices in
adata.layers['spliced']andadata.layers['unspliced'], with identical cell/gene ordering and unique IDs. Counts must be finite and nonnegative; fractional count estimates are allowed. Never use logged, scaled, residualized, or batch-corrected values as counts. Numerical inspection alone cannot establish that data are raw. - Inspect per-library/cluster coverage, doublets, ambient RNA, zero-count cells, and annotation compatibility before fitting. Preserve the original full-gene count file. Retained-gene backups do not preserve filtered-out genes.
- Resolve barcode prefixes and gene identifiers explicitly when combining files. Do not silently strip library IDs, intersect away most cells, or make duplicated biological IDs unique without understanding why they repeat.
Read H5AD through AnnData. scVelo 0.3.4 has no scv.read or scv.DataFrame:
import anndata as ad
adata = ad.read_h5ad("velocity_counts.h5ad")
For legacy loom input use ad.io.read_loom('counts.loom', X_name='spliced', sparse=True). AnnData 0.13 deprecates loom; convert to H5AD for further work.
Its layers[None] aliases X: do not delete it or iterate all layers as if every
key were a string. The helper accesses only named velocity layers. Native loom
reading and exact, reordered metadata alignment are covered by the tests;
AnnData 0.13 write_loom is not used.
Run the maintained workflow
The bundled script accepts local files and never downloads a demonstration dataset on startup:
MPLBACKEND=Agg .venv-velocity/bin/python scripts/rna_velocity_workflow.py \
velocity_counts.h5ad --mode dynamical --groupby clusters \
--n-top-genes 2000 --n-neighbors 30 --n-jobs 1 --output-dir velocity_results
# Import a loom and align its raw counts to an existing annotation file:
MPLBACKEND=Agg .venv-velocity/bin/python scripts/rna_velocity_workflow.py \
…
常见问题
什么是“剪接后”和“未剪接”RNA?
“未剪接”RNA 是最初的草稿,“剪接后”RNA 是最终加工完成的版本。两者之间的差异能反映近期的基因活动情况。
这个工具能预测细胞的未来吗?
不能。它只是根据当前数据估算变化的可能方向,并不能保证细胞最终的命运。
使用这个工具需要特定的软件吗?
需要。该工具要求特定版本的 Python 库,例如 scVelo、Scanpy 和 AnnData。建议使用独立的环境,以确保兼容性。
详情
作者的原始描述
Performs RNA velocity analysis with scVelo from spliced and unspliced single-cell RNA counts. Fits deterministic or dynamical models, examines gene phase portraits, builds velocity graphs, estimates relative latent time, and ranks velocity-associated genes. Use for directional trajectory hypotheses and kinetic-model diagnostics alongside Scanpy; velocity alone does not establish cell fate or causa
热度
- GitHub 星标
- 51k
- 排名
- #3570
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …