smithery/Starlitnightly

bulktrajblend-trajectory-interpolation

Extend scRNA-seq developmental trajectories with BulkTrajBlend by generating intermediate cells from bulk RNA-seq, training beta-VAE and GNN models, and interpolating missing states.

Installation

$ npx skills add smithery/Starlitnightly --skill bulktrajblend-trajectory-interpolation

Also in this package

Other skills from smithery/Starlitnightly · top by installs.

npx skills add smithery/Starlitnightly

Browse all from smithery/Starlitnightly

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,116 B
  • docs SUMMARY.md 228 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

BulkTrajBlend trajectory interpolation

Overview

Invoke this skill when users need to bridge gaps in single-cell developmental trajectories using matched bulk RNA-seq. It follows [tbulktrajblend.ipynb](../../omicverseguide/docs/Tutorials-bulk2single/t_bulktrajblend.ipynb), showcasing how BulkTrajBlend deconvolves PDAC bulk samples, identifies overlapping communities with a GNN, and interpolates "interrupted" cell states.

Instructions

  1. Prepare libraries and inputs

- Import omicverse as ov, scanpy as sc, scvelo as scv, and helper functions like from omicverse.utils import mde; run ov.plotset(). - Load the reference scRNA-seq AnnData (scv.datasets.dentategyrus()) and raw bulk counts with ov.utils.read(...) followed by ov.bulk.MatrixID_mapping(...) for gene ID harmonisation.

  1. Configure BulkTrajBlend

- Instantiate ov.bulk2single.BulkTrajBlend(bulkseq=bulkdf, singleseq=adata, bulkgroup=['dgd1','dgd2','dgd3'], celltypekey='clusters'). - Explain that bulkgroup names correspond to raw bulk columns and the method expects unscaled counts.

  1. Set beta-VAE expectations

- Call bulktb.vaeconfigure(celltarget_num=100) (or pass a dictionary) to define expected cell counts per cluster. Mention that omitting the argument triggers TAPE-based estimation.

  1. Train or load the beta-VAE

- Use bulktb.vaetrain(batchsize=512, learningrate=1e-4, hiddensize=256, epochnum=3500, vaesavedir='...', vaesavename='dgbtbvae', generatesavedir='...', generatesavename='dgbtb'). - Highlight resuming with bulktb.vaeload('.../dgbtb_vae.pth') and the need to regenerate cells with consistent random seeds for reproducibility.

  1. Generate synthetic cells

- Produce filtered AnnData via bulktb.vaegenerate(leidensize=25) and inspect compositions with ov.bulk2single.bulk2singleplotcellprop(...). - Save outputs to disk for reuse (adata.write_h5ad).

  1. Configure and train the GNN

- Call bulktb.gnnconfigure(maxepochs=2000, userep='X', neighborrep='Xpca', gpu=0, ...) to set hyperparameters. - Train using bulktb.gnntrain(); reload checkpoints with bulktb.gnnload('savemodel/gnn.pth'). - Generate overlapping community assignments through bulktb.gnn_generate().

  1. Visualise community structure

- Create MDE embeddings: bulktb.nocdobj.adata.obsm['Xmde'] = mde(bulktb.nocdobj.adata.obsm['Xpca']). - Plot clusters vs. discovered communities using sc.pl.embedding(..., color=['clusters','nocdn'], palette=ov.utils.pyomicpalette()) and filtered subsets excluding synthetic labels with hyphens.

  1. Interpolate missing states

- Run bulktb.interpolation('OPC') (replace with target lineage) to synthesise continuity, then preprocess the interpolated AnnData (HVG selection, scaling, PCA). - Compute embeddings with mde, visualise with ov.pl.embedding, and compare to the original atlas.

  1. Analyse trajectories

- Initialise ov.single.pyVIA on both original and interpolated data to derive pseudotime, followed by getpseudotime, ov.pp.neighbors, ov.utils.calpaga, and ov.utils.plot_paga for topology validation.

  1. Defensive validation

``python # Before BulkTrajBlend: verify bulkgroup columns exist for g in bulkgroup: assert g in bulkdf.columns, f"Bulk group '{g}' not in bulk data columns" # Verify celltypekey exists in reference assert celltypekey in adata.obs.columns, f"Cell type column '{celltypekey}' not in reference AnnData" # Verify gene name overlap shared = set(bulkdf.index) & set(adata.varnames) assert len(shared) > 100, f"Only {len(shared)} shared genes — harmonize gene IDs first" ``

  1. Troubleshooting tips

- If the VAE collapses (high reconstruction loss), lower learningrate or reduce hiddensize. - Ensure the same generated dataset is used before calling gnntrain; regenerating cells changes the graph and can break checkpoint loading. - Sparse clusters may need adjusted celltargetnum thresholds or a smaller leidensize filter to retain rare populations.

Examples

  • "Train BulkTrajBlend on PDAC cohorts, then interpolate missing OPC states in the trajectory."
  • "Load saved beta-VAE and GNN weights to regenerate overlapping communities and plot cluster vs. nocd labels."
  • "Run VIA on interpolated cells and compare PAGA graphs with the original scRNA-seq trajectory."

References

  • Tutorial notebook: [tbulktrajblend.ipynb](../../omicverseguide/docs/Tutorials-bulk2single/t_bulktrajblend.ipynb)
  • Example datasets and checkpoints: [omicverseguide/docs/Tutorials-bulk2single/data/](../../omicverseguide/docs/Tutorials-bulk2single/data/)
  • Quick copy/paste commands: [reference.md](reference.md)