omicverse-single-cell-clustering

omicverse-single-cell-clustering is a skill for Claude Code, Codex from ItamarZand88/awesome-agent-conventions. It costs 0 tokens per session (2,041 once invoked), scanned A, original, MIT.

A guide to grouping and comparing individual cells in biological data with OmicVerse, while correcting differences between batches. Batch correction helps separate technical differences between experiments from real biological patterns.

In plain words
What is it for?
Use it to prepare AnnData datasets, try Leiden, Louvain, scICE, GMM, topic, or cNMF methods, and apply or evaluate Harmony, scVI, BBKNN, or Combat correction.
Why use it?
It helps researchers choose clustering and correction methods and check whether the resulting groups and comparisons are credible.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to prepare AnnData datasets, try Leiden, Louvain, scICE, GMM, topic, or cNMF methods, and apply or evaluate Harmony, scVI, BBKNN, or Combat correction.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ItamarZand88/awesome-agent-conventions --skill omicverse-single-cell-clustering
Clone the repo
git clone --depth 1 https://github.com/ItamarZand88/awesome-agent-conventions

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for omicverse-single-cell-clustering

README.md
[![agentmods](https://agentmods.dev/badge/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering/github.svg)](https://agentmods.dev/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering)
Your own site
<a href="https://agentmods.dev/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering"><img src="https://agentmods.dev/badge/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for omicverse-single-cell-clustering

Your own site · 80×15
<a href="https://agentmods.dev/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering"><img src="https://agentmods.dev/badge/skills/itamarzand88/awesome-agent-conventions/omicverse-single-cell-clustering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02041
Opus 5 $0.00000 $0.01020
Sonnet 5 $0.00000 $0.00408
Haiku 4.5 $0.00000 $0.00204

Measured 12d ago against content hash 944452b971fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

omicverse-single-cell-clustering scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

conventions/skill-md/examples/data-analysis/omicverse-single-cell-clustering/SKILL.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.


name: single-cell-clustering-and-batch-correction-with-omicverse title: Single-cell clustering and batch correction with omicverse description: "Single-cell clustering (Leiden, Louvain, scICE, GMM), batch correction (Harmony, scVI, BBKNN, Combat), topic modeling, and cNMF in OmicVerse."

Single-cell clustering and batch correction with omicverse

Overview

This skill distills the single-cell tutorials t_cluster.ipynb and t_single_batch.ipynb. Use it when a user wants to preprocess an AnnData object, explore clustering alternatives (Leiden, Louvain, scICE, GMM, topic/cNMF models), and evaluate or harmonise batches with omicverse utilities.

Instructions

  1. Import libraries and set plotting defaults
    • Load omicverse as ov, scanpy as sc, and plotting helpers (scvelo as scv when using dentate gyrus demo data).
    • Apply ov.plot_set() or ov.utils.ov_plot_set() so figures adopt omicverse styling before embedding plots.
  2. Load data and annotate batches
    • For demo clustering, fetch scv.datasets.dentategyrus(); for integration, read provided .h5ad files via ov.read() and set adata.obs['batch'] identifiers for each cohort.
    • Confirm inputs are sparse numeric matrices; convert with adata.X = adata.X.astype(np.int64) when required for QC steps.
  3. Run quality control
    • Execute ov.pp.qc(adata, tresh={'mito_perc': 0.2, 'nUMIs': 500, 'detected_genes': 250}, batch_key='batch') to drop low-quality cells and inspect summary statistics per batch.
    • Save intermediate filtered objects (adata.write_h5ad(...)) so users can resume from clean checkpoints.
  4. Preprocess and select features
    • Call ov.pp.preprocess(adata, mode='shiftlog|pearson', n_HVGs=3000, batch_key=None) to normalise, log-transform, and flag highly variable genes; assign adata.raw = adata and subset to adata.var.highly_variable_features for downstream modelling.
    • Scale expression (ov.pp.scale(adata)) and compute PCA scores with ov.pp.pca(adata, layer='scaled', n_pcs=50). Encourage reviewing variance explained via ov.utils.plot_pca_variance_ratio(adata).
  5. Construct neighbourhood graph and baseline clustering
    • Build neighbour graph using sc.pp.neighbors(adata, n_neighbors=15, n_pcs=50, use_rep='scaled|original|X_pca') or ov.pp.neighbors(...).
    • Generate Leiden or Louvain labels through ov.utils.cluster(adata, method='leiden'|'louvain', resolution=1), ov.single.leiden(adata, resolution=1.0), or ov.pp.leiden(adata, resolution=1); remind users that resolution tunes granularity.
    • IMPORTANT - Dependency checks: Always verify prerequisites before clustering or plotting:
      # Before clustering: check neighbors graph exists
      if 'neighbors' not in adata.uns:
          if 'X_pca' in adata.obsm:
              ov.pp.neighbors(adata, n_neighbors=15, use_rep='X_pca')
          else:
              raise ValueError("PCA must be computed before neighbors graph")
      
      # Before plotting by cluster: check clustering was performed
      if 'leiden' not in adata.obs:
          ov.single.leiden(adata, resolution=1.0)
      
    • Visualise embeddings with ov.pl.embedding(adata, basis='X_umap', color=['clusters','leiden'], frameon='small', wspace=0.5) and confirm cluster separation. Always check that columns in color= parameter exist in adata.obs before plotting.
  6. Explore advanced clustering strategies
    • scICE consensus: instantiate model = ov.utils.cluster(adata, method='scICE', use_rep='scaled|original|X_pca', resolution_range=(4,20), n_boot=50, n_steps=11) and inspect stability via model.plot_ic(figsize=(6,4)) before selecting model.best_k groups.
    • Gaussian mixtures: run ov.utils.cluster(..., method='GMM', n_components=21, covariance_type='full', tol=1e-9, max_iter=1000) for model-based assignments.
    • Topic modelling: fit LDA_obj = ov.utils.LDA_topic(...), review LDA_obj.plot_topic_contributions(6), derive cluster calls with LDA_obj.predicted(k) and optionally refine using LDA_obj.get_results_rfc(...).
    • cNMF programs: initialise cnmf_obj = ov.single.cNMF(... components=np.arange(5,11), n_iter=20, num_highvar_genes=2000, output_dir=...), factorise (factorize, combine), select K via k_selection_plot, and propagate usage scores back with cnmf_obj.get_results(...) and cnmf_obj.get_results_rfc(...).
  7. Evaluate clustering quality
    • Compare predicted labels against known references with adjusted_rand_score(adata.obs['clusters'], adata.obs['leiden']) and report metrics for each method (Leiden, Louvain, GMM, LDA variants, cNMF models) to justify chosen parameters.
  8. Embed with multiple layouts
    • Use ov.utils.mde(...) to create MDE projections from different latent spaces (adata.obsm["scaled|original|X_pca"], harmonised embeddings, topic compositions) and plot via ov.pl.embedding(..., color=['batch','cell_type']) or ov.pl.embedding for consistent review of cluster/batch mixing.
  9. Perform batch correction and integration
    • Apply ov.single.batch_correction(adata, batch_key='batch', methods='harmony'|'combat'|'scanorama'|'scVI'|'CellANOVA', n_pcs=50, ...) sequentially to generate harmonised embeddings stored in adata.obsm (X_harmony, X_combat, X_scanorama, X_scVI, X_cellanova). For scVI, mention latent size (n_latent=30) and gene_likelihood="nb"; for CellANOVA define control pools via control_dict.
    • After each correction, project to 2D with ov.utils.mde and visualise batch vs cell_type to check mixing and conservation.
  10. Benchmark integration performance
    • Persist final object (adata.write_h5ad('neurips2021_batch_all.h5ad', compression='gzip')) and reload when necessary.
    • Use scib_metrics.benchmark.Benchmarker with embeddings list (["X_pca", "X_combat", "X_harmony", "X_cellanova", "X_scanorama", "X_mira_topic", "X_mira_feature", "X_scVI"]) to compute batch-vs-biology trade-offs via bm.benchmark() and summarise with bm.plot_results_table(min_max_scale=False).
  11. General troubleshooting
    • Ensure adata.raw captures the unscaled log-normalised matrix before subsetting to HVGs.
    • Confirm use_rep='scaled|original|X_pca' strings exist in adata.obsm prior to clustering; rerun preprocessing if missing.
    • Monitor memory when running cNMF or scVI; adjust n_iter, components, or latent dimensions for smaller datasets.
    • Pipeline dependency errors: When you encounter errors like "Could not find 'leiden' in adata.obs", always check and add prerequisites:
      • Before leiden/louvain clustering → ensure 'neighbors' in adata.uns
      • Before plotting by clustering → ensure the cluster column exists in adata.obs
      • Before UMAP/embedding → ensure PCA or another dimensionality reduction is complete
    • Code generation pattern: When generating multi-step code, use defensive checks rather than assuming prior steps completed successfully. This prevents cascading failures when users run steps out of order or in separate sessions.

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 77 lines · 0 tokens per session scan A 944452b971fe

Subscribe to this mod's changes

omicverse-single-cell-clustering is a skill published in the GitHub repository ItamarZand88/awesome-agent-conventions (31 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,041 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.