consensus-nmf-multirun

Runs multi-variant consensus cNMF to discover robust gene programs in single-cell RNA-seq data.

1|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/tony-zhelonkin/scio --skill consensus-nmf-multirun-tony-zhelonkin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: consensus-nmf-multirun
Source: https://github.com/tony-zhelonkin/scio/tree/main/skills/consensus-nmf-multirun
Command: npx skills add https://github.com/tony-zhelonkin/scio --skill consensus-nmf-multirun-tony-zhelonkin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires cnmf, scanpy, anndata, numpy, pandas, scipy, statsmodels, gprofiler-official, and includes scripts (resource) and references (resource) components.

What problem does it solve? Single-run cNMF on scRNA-seq data is sensitive to K choice, QC filtering, and cell subsetting, producing gene programs that may not be reproducible. This Skill runs cNMF across multiple variants (full dataset and subsets, raw and QC-filtered), merges correlated programs, and classifies them so only robust, cross-run programs survive. ## Core Features & Use Cases - Multi-run consensus cNMF: Executes cNMF per (subset × QC) variant, scores all programs onto the full barcode space, and merges them via hierarchical clustering on cross-run correlation. - Program classification and annotation: Assigns confidence tiers (High/Medium/Low), classifies programs as Biological/Technical/CellCycle/Ribosomal/Mitochondrial/ImmediateEarly, and annotates top genes via g:Profiler GO/KEGG/Reactome enrichment. - Per-celltype factor ANOVA: Tests program scores against a user-named obs factor with eta-squared effect sizes and BH-FDR correction, with optional batch covariate via statsmodels. - Use Case: Given an annotated AnnData with raw counts and a Young/Old treatment factor, run the seven-stage pipeline to obtain merged, annotated gene programs and a table of which programs respond to the factor per celltype. ## Quick Start Run consensus cNMF on my annotated scRNA-seq dataset, merging programs across raw and QC-filtered variants and testing them against my condition factor.

Frequently Asked Questions about consensus-nmf-multirun

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run consensus cNMF on single-cell RNA-seq data?▼

Run cNMF once per variant (subset × QC combination) using run_cnmf_subset.py, manually pick K from each k_selection plot, then transfer usage scores onto the full dataset, merge correlated programs, annotate via g:Profiler, and test against a factor with ANOVA.

How do I choose K for cNMF factorization?▼

Inspect the k_selection.png plot showing reproducibility and stability across K, and pick the largest K on the high plateau before the curves fall. State your expected K before viewing the plot, then confirm against the inflection point.

When should I use consensus cNMF versus per-sample NMF metaprogram discovery?▼

Use consensus cNMF when you have one dataset with factorial conditions and want programs robust to QC and subsetting. Use per-sample NMF with cross-donor consensus (genenmf-metaprogram-discovery) when you have multiple donors and want recurrent programs across them.

Why does cNMF fail with KeyError counts or produce all-zero programs?▼

cNMF requires raw integer counts, but most scanpy pipelines normalize .X and discard the raw values. Store raw counts with adata.layers['counts'] = adata.X.copy() before any normalization so the cNMF input file contains integer counts.

What correlation threshold should I use to merge cNMF programs?▼

The default r > 0.7 works for most projects, cutting the hierarchical clustering dendrogram at distance 0.3. Use r > 0.9 to preserve subtle distinctions or r > 0.5 only when you want a heavily aggregated overview, since loose thresholds collapse distinct biology.

How do I handle a condition factor confounded with sequencing batch?▼

Plain f_oneway cannot include covariates, so pass --covariate to condition_anova.py to fit program ~ C(factor) + C(batch) via statsmodels OLS. Alternatively restrict comparisons to within-batch subsets and document the confound explicitly.