[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EDD63TKWJEMV7KZ3B77BNP":3,"skill-same:01M7EDD63TKWJEMV7KZ3B77BNP":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7EDD63TKWJEMV7KZ3B77BNP","bio-gene-regulatory-networks-scenic-regulons",null,"Infer transcription factor regulons from single-cell RNA-seq with pySCENIC by combining GRNBoost2 co-expression, cisTarget motif-enrichment pruning, and AUCell per-cell activity scoring. Covers the motif-pruning-as-directionality principle, regulon specificity scoring, run-to-run stability, and database\u002Fspecies matching. Use when identifying TF regulons, scoring TF activity per cell, finding master regulators of cell identity, or comparing regulon activity across conditions. For enhancer-driven multiomic GRNs see multiomics-grn; for bulk inference and VIPER protein-activity see grn-inference.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-gene-regulatory-networks-scenic-regulons\ndescription: Infer transcription factor regulons from single-cell RNA-seq with pySCENIC by combining GRNBoost2 co-expression, cisTarget motif-enrichment pruning, and AUCell per-cell activity scoring. Covers the motif-pruning-as-directionality principle, regulon specificity scoring, run-to-run stability, and database\u002Fspecies matching. Use when identifying TF regulons, scoring TF activity per cell, finding master regulators of cell identity, or comparing regulon activity across conditions. For enhancer-driven multiomic GRNs see multiomics-grn; for bulk inference and VIPER protein-activity see grn-inference.\ntool_type: python\nprimary_tool: pySCENIC\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"gene-regulatory-networks\u002Fscenic-regulons\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: pySCENIC 0.12+, ctxcore 0.2+, arboreto 0.1.6+, scanpy 1.10+, loompy 3.0+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe motif-DB machinery lives in `ctxcore`; a ctxcore\u002Ffeather-format version mismatch is the most common silent failure. pySCENIC is most reliable on a dedicated Python 3.10 environment.\n\n# SCENIC Regulons\n\n**\"Identify transcription factor regulons and score TF activity from my scRNA-seq data\"** -> Run the pySCENIC three-step pipeline: infer TF-target co-expression with GRNBoost2, prune to direct targets by cis-regulatory motif enrichment with cisTarget, then score per-cell regulon activity with AUCell.\n- CLI: `pyscenic grn` -> `pyscenic ctx` -> `pyscenic aucell`\n- Python: `arboreto_with_multiprocessing.py` for the GRN step (avoids the dask breakage)\n\n## The Single Most Important Modern Insight -- Motif Pruning Is What Converts Co-expression into Directed Regulation\n\nStep 1 (GRNBoost2) produces **undirected co-expression only** -- it is no better than WGCNA and inherits all of co-expression's confounding (indirect edges, batch, cell-cycle). The entire conceptual payload of SCENIC is **Step 2 (cisTarget)**: for each module it asks whether the candidate TF's binding motif is significantly enriched (NES >= 3.0) in the cis-regulatory space of the module's targets, and keeps only the targets in the motif's leading edge. This (a) imposes a mechanistic prior -- the TF can physically bind near its retained targets, (b) breaks the symmetry of co-expression into a TF -> target direction, and (c) discards indirect targets. **A \"regulon\" is by definition only the post-cisTarget TF plus its direct targets.** Modules that were never pruned are co-expression modules, and calling them regulons misuses the word.\n\nThe second non-obvious consequence is **AUCell: regulon activity is not TF expression.** AUCell ranks genes within each cell and computes the area under the recovery curve for the regulon's gene set, so activity can be high even when the TF's own mRNA is dropout-zero (TF transcripts are sparse). Showing TF *expression* in place of regulon AUC -- or \"validating\" activity by its correlation with TF expression -- misses the method's point and is circular. SCENIC regulons remain motif-supported co-expression: a strong, directed hypothesis worth a knockdown, not proof of causal regulation.\n\n## Pipeline Taxonomy\n\n| Step | Tool | Produces | Key parameter | Watch out for |\n|------|------|----------|---------------|---------------|\n| 1. GRN | GRNBoost2 (or GENIE3) | TF-target co-expression adjacencies | `--seed`, `--num_workers` | stochastic; not reproducible without a fixed seed |\n| 2. Prune | cisTarget (ctxcore) | regulons (direct targets) | `--nes_threshold 3.0`, `--rank_threshold 5000` | feather DB + motif2TF version must match |\n| 3. Score | AUCell | per-cell regulon activity (AUC) | `--auc_threshold 0.05` | this is the top-fraction, NOT the binarization cut |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| scRNA-seq, want TF regulons + per-cell activity | pySCENIC grn\u002Fctx\u002Faucell | the canonical workflow |\n| GRN step hangs \u002F KilledWorker | `arboreto_with_multiprocessing.py` | arboreto's dask backend breaks on newer dask |\n| Need reproducible regulons | run GRN 10-100x, keep links recurring >80% | GRNBoost2\u002FGENIE3 are stochastic |\n| Which regulons mark a cell type | Regulon Specificity Score (RSS) | JSD-based specificity, not just magnitude |\n| Paired scRNA + scATAC available | -> multiomics-grn (SCENIC+) | accessibility defines enhancers; eRegulons add the region layer |\n| Bulk RNA-seq \u002F want protein activity | -> grn-inference (ARACNe + VIPER) | SCENIC is single-cell; VIPER reads TF activity from bulk |\n| Compare activity across conditions | run SCENIC once on the integrated object | raw AUC is population-relative; batch survives into regulons |\n\n## Required Databases\n\ncisTarget needs three matched resources: ranking database(s), motif-to-TF annotations, and the TF list -- all the same species\u002Fassembly\u002Fsymbol namespace. Download from `resources.aertslab.org\u002Fcistarget\u002F`.\n\n```bash\n# Human hg38 gene-based rankings (~1.5 GB each). Run ctx with BOTH search-space DBs\n# (500bp+100bp around TSS, and TSS +\u002F-10kb) so the leading-edge logic pools them.\nwget https:\u002F\u002Fresources.aertslab.org\u002Fcistarget\u002Fdatabases\u002Fhomo_sapiens\u002Fhg38\u002Frefseq_r80\u002Fmc9nr\u002Fgene_based\u002Fhg38__refseq-r80__10kb_up_and_down_tss.mc9nr.genes_vs_motifs.rankings.feather\nwget https:\u002F\u002Fresources.aertslab.org\u002Fcistarget\u002Fmotif2tf\u002Fmotifs-v9-nr.hgnc-m0.001-o0.0.tbl\n# The ranking-DB version (mc9nr \u002F v10) and the motif2tf annotation version MUST match.\n```\n\n## Step 1: GRN Inference (use the multiprocessing wrapper)\n\n**Goal:** Infer TF-target co-expression adjacencies as candidate regulatory modules.\n\n**Approach:** Run GRNBoost2 via the bundled multiprocessing script (single-node, stable) rather than the dask backend, and fix the seed so the stochastic boosting is reproducible.\n\n```bash\n# arboreto's dask backend breaks on dask>=2.x (silent hangs, KilledWorker).\n# The bundled multiprocessing wrapper is the supported workaround.\npython arboreto_with_multiprocessing.py \\\n    filtered.loom allTFs_hg38.txt \\\n    --method grnboost2 --output adj.tsv \\\n    --num_workers 8 --seed 42\n```\n\n## Step 2: Prune to Regulons by Motif Enrichment\n\n**Goal:** Keep only TF-target links whose target genes are enriched for the TF's binding motif -- the step that confers directness and direction.\n\n**Approach:** Load the ranking databases and motif2TF annotations, build candidate modules from the adjacencies, and run cisTarget pruning; targets surviving motif enrichment (NES >= 3.0) form the regulon.\n\n```python\nimport glob, pickle, pandas as pd\nfrom pyscenic.utils import modules_from_adjacencies\nfrom pyscenic.prune import prune2df, df2regulons\nfrom ctxcore.rnkdb import FeatherRankingDatabase\n\nadjacencies = pd.read_csv('adj.tsv', sep='\\t')\nexpr = pd.read_csv('expr.csv', index_col=0)            # cells x genes\nmodules = list(modules_from_adjacencies(adjacencies, expr))\n\ndbs = [FeatherRankingDatabase(f, name=f) for f in glob.glob('*.genes_vs_motifs.rankings.feather')]\n# rank_threshold=5000 matches the CLI default (the prune2df Python default is 1500).\ndf = prune2df(dbs, modules, 'motifs-v9-nr.hgnc-m0.001-o0.0.tbl', rank_threshold=5000)\nregulons = df2regulons(df)                              # TF + direct targets only\n\nwith open('regulons.pkl', 'wb') as fh:\n    pickle.dump(regulons, fh)\n```\n\nCLI equivalent for steps 1-2 (`pyscenic grn`, then `pyscenic ctx adj.tsv DB.feather --annotations_fname motifs.tbl --expression_mtx_fname filtered.loom -o reg.csv`). ctx verified defaults: `--rank_threshold 5000`, `--auc_threshold 0.05`, `--nes_threshold 3.0`, `--min_genes 20`. `--mask_dropouts` now defaults to False (matching R SCENIC); it changes the TF-target correlation sign that splits activating `(+)` from repressing `(-)` regulons, so report the setting used.\n\n## Step 3: AUCell Per-Cell Activity\n\n**Goal:** Score each regulon's activity in every cell, robustly to dropout.\n\n**Approach:** Rank genes within each cell, integrate the recovery curve over the top fraction (`auc_threshold`, default 0.05 = top 5%), and emit a cell-by-regulon AUC matrix.\n\n```python\nfrom pyscenic.aucell import aucell\n\n# auc_threshold = top 5% of the ranking integrated for the AUC -- NOT a binarization cut.\nauc_mtx = aucell(expr, regulons, auc_threshold=0.05, num_workers=8)\nauc_mtx.to_csv('auc_matrix.csv')\n```\n\n## Interpretation: Specificity and Binarization\n\n**Goal:** Surface the regulons that define each cell type and convert activity to on\u002Foff states for clustering.\n\n**Approach:** Use the Regulon Specificity Score (Jensen-Shannon divergence vs an idealized cell-type-specific distribution) for identity regulators, and binarize the AUC distribution (bimodal -> density threshold) for state heatmaps.\n\n```python\nfrom pyscenic.rss import regulon_specificity_scores\nfrom pyscenic.binarization import binarize\n\ncell_types = pd.read_csv('cell_types.csv', index_col=0)['cell_type']\nrss = regulon_specificity_scores(auc_mtx, cell_types)     # high RSS = identity regulator\nbinary_mtx, thresholds = binarize(auc_mtx)                # per-regulon on\u002Foff\n```\n\nRSS (rewards specificity) and a per-cluster AUC z-score (rewards magnitude) can disagree; prefer RSS for \"which regulon marks this cluster.\"\n\n## Per-Method Failure Modes\n\n### Calling unpruned modules \"regulons\"\n**Trigger:** skipping ctx, or dropping the NES threshold to admit everything. **Mechanism:** without motif enrichment the output is co-expression, not direct regulation. **Symptom:** no motif DB\u002Fversion reported; implausibly large \"regulons.\" **Fix:** always run cisTarget; report DB + motif2TF versions and the search-space windows.\n\n### Dask hang in the GRN step\n**Trigger:** native arboreto on dask>=2.x. **Mechanism:** scheduler incompatibility. **Symptom:** silent hang or KilledWorker. **Fix:** use `arboreto_with_multiprocessing.py` (single-node, stable).\n\n### Species \u002F assembly mismatch\n**Trigger:** mouse genes against an hg38 ranking DB, or HGNC vs MGI symbol mismatch. **Mechanism:** gene IDs do not map into the database. **Symptom:** near-empty regulon set. **Fix:** match expression IDs, ranking DB, and motif2TF to one species\u002Fassembly\u002Fnamespace.\n\n### Cross-condition AUC comparison without batch control\n**Trigger:** comparing raw AUC across separately-run SCENIC analyses or strong batches. **Mechanism:** AUC is relative to the population it was ranked within; batch-driven co-expression can pass motif enrichment by chance. **Symptom:** a \"condition-specific regulator\" that tracks the batch. **Fix:** run SCENIC once on the integrated object; sanity-check condition regulons against batch.\n\n### Over-reading _extended or _- regulons\n**Trigger:** using `_extended` regulons for direct-binding claims, or building a story on `(-)` repressor activity. **Mechanism:** `_extended` adds orthology\u002Fsimilarity-inferred (low-confidence) motif annotations; negative regulons are sparse and weakly enriched. **Symptom:** direct-regulation claims from low-confidence edges. **Fix:** default to high-confidence positive regulons; treat `_extended`\u002F`(-)` as hypotheses.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| NES >= 3.0 (motif enrichment) | Aibar 2017 \u002F iRegulon (Janky 2014) | recovery-curve enrichment cutoff defining a supported motif |\n| auc_threshold = 0.05 (top 5%) | pySCENIC default | fraction of the ranking integrated for the AUC |\n| GRN reruns: keep links recurring >80% of runs | Van de Sande 2020 | GRNBoost2\u002FGENIE3 are stochastic; recurrence = high confidence |\n| min_genes = 20 per regulon | pySCENIC default | smaller target sets give unstable AUC |\n| >= a few hundred cells per cell type | practical | rare clusters and doublets inflate spurious regulons |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| \"not a cisTarget Feather database in v1 or v2 format\" | ctxcore\u002FDB version mismatch | download current DB; align `ctxcore` version |\n| empty regulon set | species\u002Fassembly or symbol mismatch | match gene IDs to the DB namespace |\n| different regulons each run | unset seed in GRN step | fix `--seed`; run multiple seeds and intersect |\n| activity != TF expression confuses the reader | conflating regulon AUC with TF mRNA | report AUCell activity; that independence is the point |\n| ctx returns nothing | missing\u002Fmismatched `--annotations_fname` | supply matching motif2TF; check DB is gene-based (not region-based) |\n\n## References\n\n- Aibar S, et al. 2017. SCENIC: single-cell regulatory network inference and clustering. *Nat Methods* 14(11):1083-1086.\n- Van de Sande B, et al. 2020. A scalable SCENIC workflow for single-cell gene regulatory network analysis. *Nat Protoc* 15(7):2247-2276.\n- Moerman T, et al. 2019. GRNBoost2 and Arboreto. *Bioinformatics* 35(12):2159-2161.\n- Janky R, et al. 2014. iRegulon: cisTarget ranking-and-recovery framework. *PLoS Comput Biol* 10(7):e1003731.\n- Suo S, et al. 2018. Revealing critical regulators of cell identity (Regulon Specificity Score). *Cell Rep* 25(6):1436-1445.e3.\n- Huynh-Thu VA, et al. 2010. GENIE3. *PLoS ONE* 5(9):e12776.\n\n## Related Skills\n\n- multiomics-grn - enhancer-driven eRegulons from paired scRNA+scATAC (SCENIC+)\n- grn-inference - bulk GRN inference and VIPER TF protein-activity (the Califano lineage)\n- coexpression-networks - undirected co-expression modules (what step 1 produces alone)\n- single-cell\u002Fclustering - cluster cells before regulon and RSS analysis\n- single-cell\u002Fpreprocessing - QC, doublet removal, and normalization of scRNA-seq inputs\n- single-cell\u002Fdoublet-detection - remove doublets that inflate spurious regulons\n","## Version Compatibility\n\nReference examples tested with: pySCENIC 0.12+, ctxcore 0.2+, arboreto 0.1.6+, scanpy 1.10+, loompy 3.0+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe motif-DB machinery lives in `ctxcore`; a ctxcore\u002Ffeather-format version mismatch is the most common silent failure. pySCENIC is most reliable on a dedicated Python 3.10 environment.\n\n# SCENIC Regulons\n\n**\"Identify transcription factor regulons and score TF activity from my scRNA-seq data\"** -> Run the pySCENIC three-step pipeline: infer TF-target co-expression with GRNBoost2, prune to direct targets by cis-regulatory motif enrichment with cisTarget, then score per-cell regulon activity with AUCell.\n- CLI: `pyscenic grn` -> `pyscenic ctx` -> `pyscenic aucell`\n- Python: `arboreto_with_multiprocessing.py` for the GRN step (avoids the dask breakage)\n\n## The Single Most Important Modern Insight -- Motif Pruning Is What Converts Co-expression into Directed Regulation\n\nStep 1 (GRNBoost2) produces **undirected co-expression only** -- it is no better than WGCNA and inherits all of co-expression's confounding (indirect edges, batch, cell-cycle). The entire conceptual payload of SCENIC is **Step 2 (cisTarget)**: for each module it asks whether the candidate TF's binding motif is significantly enriched (NES >= 3.0) in the cis-regulatory space of the module's targets, and keeps only the targets in the motif's leading edge. This (a) imposes a mechanistic prior -- the TF can physically bind near its retained targets, (b) breaks the symmetry of co-expression into a TF -> target direction, and (c) discards indirect targets. **A \"regulon\" is by definition only the post-cisTarget TF plus its direct targets.** Modules that were never pruned are co-expression modules, and calling them regulons misuses the word.\n\nThe second non-obvious consequence is **AUCell: regulon activity is not TF expression.** AUCell ranks genes within each cell and computes the area under the recovery curve for the regulon's gene set, so activity can be high even when the TF's own mRNA is dropout-zero (TF transcripts are sparse). Showing TF *expression* in place of regulon AUC -- or \"validating\" activity by its correlation with TF expression -- misses the method's point and is circular. SCENIC regulons remain motif-supported co-expression: a strong, directed hypothesis worth a knockdown, not proof of causal regulation.\n\n## Pipeline Taxonomy\n\n| Step | Tool | Produces | Key parameter | Watch out for |\n|------|------|----------|---------------|---------------|\n| 1. GRN | GRNBoost2 (or GENIE3) | TF-target co-expression adjacencies | `--seed`, `--num_workers` | stochastic; not reproducible without a fixed seed |\n| 2. Prune | cisTarget (ctxcore) | regulons (direct targets) | `--nes_threshold 3.0`, `--rank_threshold 5000` | feather DB + motif2TF version must match |\n| 3. Score | AUCell | per-cell regulon activity (AUC) | `--auc_threshold 0.05` | this is the top-fraction, NOT the binarization cut |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| scRNA-seq, want TF regulons + per-cell activity | pySCENIC grn\u002Fctx\u002Faucell | the canonical workflow |\n| GRN step hangs \u002F KilledWorker | `arboreto_with_multiprocessing.py` | arboreto's dask backend breaks on newer dask |\n| Need reproducible regulons | run GRN 10-100x, keep links recurring >80% | GRNBoost2\u002FGENIE3 are stochastic |\n| Which regulons mark a cell type | Regulon Specificity Score (RSS) | JSD-based specificity, not just magnitude |\n| Paired scRNA + scATAC available | -> multiomics-grn (SCENIC+) | accessibility defines enhancers; eRegulons add the region layer |\n| Bulk RNA-seq \u002F want protein activity | -> grn-inference (ARACNe + VIPER) | SCENIC is single-cell; VIPER reads TF activity from bulk |\n| Compare activity across conditions | run SCENIC once on the integrated object | raw AUC is population-relative; batch survives into regulons |\n\n## Required Databases\n\ncisTarget needs three matched resources: ranking database(s), motif-to-TF annotations, and the TF list -- all the same species\u002Fassembly\u002Fsymbol namespace. Download from `resources.aertslab.org\u002Fcistarget\u002F`.\n\n```bash\n# Human hg38 gene-based rankings (~1.5 GB each). Run ctx with BOTH search-space DBs\n# (500bp+100bp around TSS, and TSS +\u002F-10kb) so the leading-edge logic pools them.\nwget https:\u002F\u002Fresources.aertslab.org\u002Fcistarget\u002Fdatabases\u002Fhomo_sapiens\u002Fhg38\u002Frefseq_r80\u002Fmc9nr\u002Fgene_based\u002Fhg38__refseq-r80__10kb_up_and_down_tss.mc9nr.genes_vs_motifs.rankings.feather\nwget https:\u002F\u002Fresources.aertslab.org\u002Fcistarget\u002Fmotif2tf\u002Fmotifs-v9-nr.hgnc-m0.001-o0.0.tbl\n# The ranking-DB version (mc9nr \u002F v10) and the motif2tf annotation version MUST match.\n```\n\n## Step 1: GRN Inference (use the multiprocessing wrapper)\n\n**Goal:** Infer TF-target co-expression adjacencies as candidate regulatory modules.\n\n**Approach:** Run GRNBoost2 via the bundled multiprocessing script (single-node, stable) rather than the dask backend, and fix the seed so the stochastic boosting is reproducible.\n\n```bash\n# arboreto's dask backend breaks on dask>=2.x (silent hangs, KilledWorker).\n# The bundled multiprocessing wrapper is the supported workaround.\npython arboreto_with_multiprocessing.py \\\n    filtered.loom allTFs_hg38.txt \\\n    --method grnboost2 --output adj.tsv \\\n    --num_workers 8 --seed 42\n```\n\n## Step 2: Prune to Regulons by Motif Enrichment\n\n**Goal:** Keep only TF-target links whose target genes are enriched for the TF's binding motif -- the step that confers directness and direction.\n\n**Approach:** Load the ranking databases and motif2TF annotations, build candidate modules from the adjacencies, and run cisTarget pruning; targets surviving motif enrichment (NES >= 3.0) form the regulon.\n\n```python\nimport glob, pickle, pandas as pd\nfrom pyscenic.utils import modules_from_adjacencies\nfrom pyscenic.prune import prune2df, df2regulons\nfrom ctxcore.rnkdb import FeatherRankingDatabase\n\nadjacencies = pd.read_csv('adj.tsv', sep='\\t')\nexpr = pd.read_csv('expr.csv', index_col=0)            # cells x genes\nmodules = list(modules_from_adjacencies(adjacencies, expr))\n\ndbs = [FeatherRankingDatabase(f, name=f) for f in glob.glob('*.genes_vs_motifs.rankings.feather')]\n# rank_threshold=5000 matches the CLI default (the prune2df Python default is 1500).\ndf = prune2df(dbs, modules, 'motifs-v9-nr.hgnc-m0.001-o0.0.tbl', rank_threshold=5000)\nregulons = df2regulons(df)                              # TF + direct targets only\n\nwith open('regulons.pkl', 'wb') as fh:\n    pickle.dump(regulons, fh)\n```\n\nCLI equivalent for steps 1-2 (`pyscenic grn`, then `pyscenic ctx adj.tsv DB.feather --annotations_fname motifs.tbl --expression_mtx_fname filtered.loom -o reg.csv`). ctx verified defaults: `--rank_threshold 5000`, `--auc_threshold 0.05`, `--nes_threshold 3.0`, `--min_genes 20`. `--mask_dropouts` now defaults to False (matching R SCENIC); it changes the TF-target correlation sign that splits activating `(+)` from repressing `(-)` regulons, so report the setting used.\n\n## Step 3: AUCell Per-Cell Activity\n\n**Goal:** Score each regulon's activity in every cell, robustly to dropout.\n\n**Approach:** Rank genes within each cell, integrate the recovery curve over the top fraction (`auc_threshold`, default 0.05 = top 5%), and emit a cell-by-regulon AUC matrix.\n\n```python\nfrom pyscenic.aucell import aucell\n\n# auc_threshold = top 5% of the ranking integrated for the AUC -- NOT a binarization cut.\nauc_mtx = aucell(expr, regulons, auc_threshold=0.05, num_workers=8)\nauc_mtx.to_csv('auc_matrix.csv')\n```\n\n## Interpretation: Specificity and Binarization\n\n**Goal:** Surface the regulons that define each cell type and convert activity to on\u002Foff states for clustering.\n\n**Approach:** Use the Regulon Specificity Score (Jensen-Shannon divergence vs an idealized cell-type-specific distribution) for identity regulators, and binarize the AUC distribution (bimodal -> density threshold) for state heatmaps.\n\n```python\nfrom pyscenic.rss import regulon_specificity_scores\nfrom pyscenic.binarization import binarize\n\ncell_types = pd.read_csv('cell_types.csv', index_col=0)['cell_type']\nrss = regulon_specificity_scores(auc_mtx, cell_types)     # high RSS = identity regulator\nbinary_mtx, thresholds = binarize(auc_mtx)                # per-regulon on\u002Foff\n```\n\nRSS (rewards specificity) and a per-cluster AUC z-score (rewards magnitude) can disagree; prefer RSS for \"which regulon marks this cluster.\"\n\n## Per-Method Failure Modes\n\n### Calling unpruned modules \"regulons\"\n**Trigger:** skipping ctx, or dropping the NES threshold to admit everything. **Mechanism:** without motif enrichment the output is co-expression, not direct regulation. **Symptom:** no motif DB\u002Fversion reported; implausibly large \"regulons.\" **Fix:** always run cisTarget; report DB + motif2TF versions and the search-space windows.\n\n### Dask hang in the GRN step\n**Trigger:** native arboreto on dask>=2.x. **Mechanism:** scheduler incompatibility. **Symptom:** silent hang or KilledWorker. **Fix:** use `arboreto_with_multiprocessing.py` (single-node, stable).\n\n### Species \u002F assembly mismatch\n**Trigger:** mouse genes against an hg38 ranking DB, or HGNC vs MGI symbol mismatch. **Mechanism:** gene IDs do not map into the database. **Symptom:** near-empty regulon set. **Fix:** match expression IDs, ranking DB, and motif2TF to one species\u002Fassembly\u002Fnamespace.\n\n### Cross-condition AUC comparison without batch control\n**Trigger:** comparing raw AUC across separately-run SCENIC analyses or strong batches. **Mechanism:** AUC is relative to the population it was ranked within; batch-driven co-expression can pass motif enrichment by chance. **Symptom:** a \"condition-specific regulator\" that tracks the batch. **Fix:** run SCENIC once on the integrated object; sanity-check condition regulons against batch.\n\n### Over-reading _extended or _- regulons\n**Trigger:** using `_extended` regulons for direct-binding claims, or building a story on `(-)` repressor activity. **Mechanism:** `_extended` adds orthology\u002Fsimilarity-inferred (low-confidence) motif annotations; negative regulons are sparse and weakly enriched. **Symptom:** direct-regulation claims from low-confidence edges. **Fix:** default to high-confidence positive regulons; treat `_extended`\u002F`(-)` as hypotheses.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| NES >= 3.0 (motif enrichment) | Aibar 2017 \u002F iRegulon (Janky 2014) | recovery-curve enrichment cutoff defining a supported motif |\n| auc_threshold = 0.05 (top 5%) | pySCENIC default | fraction of the ranking integrated for the AUC |\n| GRN reruns: keep links recurring >80% of runs | Van de Sande 2020 | GRNBoost2\u002FGENIE3 are stochastic; recurrence = high confidence |\n| min_genes = 20 per regulon | pySCENIC default | smaller target sets give unstable AUC |\n| >= a few hundred cells per cell type | practical | rare clusters and doublets inflate spurious regulons |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| \"not a cisTarget Feather database in v1 or v2 format\" | ctxcore\u002FDB version mismatch | download current DB; align `ctxcore` version |\n| empty regulon set | species\u002Fassembly or symbol mismatch | match gene IDs to the DB namespace |\n| different regulons each run | unset seed in GRN step | fix `--seed`; run multiple seeds and intersect |\n| activity != TF expression confuses the reader | conflating regulon AUC with TF mRNA | report AUCell activity; that independence is the point |\n| ctx returns nothing | missing\u002Fmismatched `--annotations_fname` | supply matching motif2TF; check DB is gene-based (not region-based) |\n\n## References\n\n- Aibar S, et al. 2017. SCENIC: single-cell regulatory network inference and clustering. *Nat Methods* 14(11):1083-1086.\n- Van de Sande B, et al. 2020. A scalable SCENIC workflow for single-cell gene regulatory network analysis. *Nat Protoc* 15(7):2247-2276.\n- Moerman T, et al. 2019. GRNBoost2 and Arboreto. *Bioinformatics* 35(12):2159-2161.\n- Janky R, et al. 2014. iRegulon: cisTarget ranking-and-recovery framework. *PLoS Comput Biol* 10(7):e1003731.\n- Suo S, et al. 2018. Revealing critical regulators of cell identity (Regulon Specificity Score). *Cell Rep* 25(6):1436-1445.e3.\n- Huynh-Thu VA, et al. 2010. GENIE3. *PLoS ONE* 5(9):e12776.\n\n## Related Skills\n\n- multiomics-grn - enhancer-driven eRegulons from paired scRNA+scATAC (SCENIC+)\n- grn-inference - bulk GRN inference and VIPER TF protein-activity (the Califano lineage)\n- coexpression-networks - undirected co-expression modules (what step 1 produces alone)\n- single-cell\u002Fclustering - cluster cells before regulon and RSS analysis\n- single-cell\u002Fpreprocessing - QC, doublet removal, and normalization of scRNA-seq inputs\n- single-cell\u002Fdoublet-detection - remove doublets that inflate spurious regulons\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","python","2026-09-20","gene-regulatory-networks\u002Fscenic-regulons\u002FSKILL.md","pySCENIC","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-gene-regulatory-networks-scenic-regulons",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-gene-regulatory-networks-scenic-regulons",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-gene-regulatory-networks-scenic-regulons","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons\u002FSKILL.md",true,[50,56,60],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fpyscenic_workflow.py","SCRIPT","脚本",4563,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons\u002Fexamples\u002Fpyscenic_workflow.py",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fscenic_visualization.py",4313,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons\u002Fexamples\u002Fscenic_visualization.py",{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"usage-guide.md","REFERENCE","参考文档",4522,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-gene-regulatory-networks-scenic-regulons\u002Fusage-guide.md",[67,75,82,89,96,103],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":74},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":74},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":74},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":74},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":74},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":74},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]