Repository navigation
Rewrite ContextNet tutorials: runnable, reproducible, biologically framed - #2
Merged
Merged
Conversation
… paths, optional ccflowR - Switch all three notebooks from the private `MultiNicheNet_v2` kernel to the portable `ir` IRkernel; normalize to nbformat 4.5 with cell ids. - Clear all executed outputs (removes stale private absolute paths). - Replace the cross-notebook /tmp/contextnet_network.rds dependency with a repo-local data/cache/ convention; tutorial 03 is now self-contained. - 01: replace "download-if-missing" with verify-local-priors; move the Zenodo download to an optional, non-executed cell. Fix defunct GetAssayData(slot=) -> layer= for Seurat 5. - 03: default N_CORES <- 1 to avoid FORK/socket failures. - Keep ccflowR optional everywhere; simplify dead-code ccflowR fallbacks. - Docs: notebooks/README data requirements + example-data strategy + troubleshooting; installation guide bootstrap + IRkernel registration; README notes full-local-data tutorials and optional ccflowR. All three notebooks execute end-to-end via nbconvert (ir kernel) against local data; targeted unit tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses the 5 nice-to-haves from the independent review (review-27); no must-fix items, no behavior change (notebooks not re-executed). - NB02/NB03: replace literal newlines embedded in cat() strings with "\n" (7 in NB02, 4 in NB03) to match NB01's style; output is byte-identical. - NB02: harmonize the metric name to corrected AUPR / AUPR_c (bar-plot axis, interpretation prose, and heatmap column/legend) — the plotted column is aupr_corrected. - notebooks/README: state the full ~1.8 GB data/ footprint (Seurat ~1.2 GB; LT matrix >250 MB), not just the LT-matrix size. - NB03: drop the dead `contrast_col` variable in the ligand-summary cell. - All notebooks: realign the USER CONFIGURATION ASCII box right border, and note that the abundance-based auto-sender set can include the receiver cell type itself (autocrine). Verified: nbformat 4.5 valid, all code cells R-parse, 0 residual cat bugs, cat() output confirmed identical. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Makes the three ContextNet tutorial notebooks runnable and reproducible for a
public audience, building on the earlier "reframe around biological questions"
work (already on
main). Each tutorial opens with a biological question and readsContextNet outputs as communication hypotheses, not proof of secretion,
receptor binding, spatial contact, or causality.
epithelial identity program (cell-type comparison).
(within-receiver condition comparison) + ligand-target heatmaps + Sankey.
samples (replicate-aware MultiNicheNet pseudobulk).
Reproducibility / runnability fixes
MultiNicheNet_v2kernel to the standardirIRkernel; normalized to nbformat4.5. Execution also supports
--ExecutePreprocessor.kernel_name=ir.output-free (this is the bulk of the NB02 deletions).
verifies the NicheNet priors are present locally and the optional Zenodo
download lives in a clearly-labeled, non-executed cell.
/tmpdependency — the reusable network is cached under arepo-local
data/cache/; NB03 reuses it if present but is otherwiseself-contained.
rendering is guarded by
requireNamespace("ccflowR")and degrades gracefullywith an install hint when absent.
N_CORES <- 1in NB03 by default to avoid FORK/socket failures.notebooks/README.mdgains data-requirements + example-data strategy +troubleshooting; the micromamba install guide adds the bootstrap one-shot and
an IRkernel registration step;
README.mdnotes the full-local-data tutorialsand optional ccflowR.
Testing
check_ecosystem()clean.nbconvert(theirkernel)against the full local dataset, including MultiNicheNet at
n_cores = 1.export). The full
devtools::test()is expected to fail locally onparallel-backend and Zenodo-reaching tests; the tutorials deliberately avoid
those modes (
n_cores = 1,nichenet_database = "data").Review
Independently reviewed before this PR — verdict ready-with-minor-fixes, zero
must-fix, all 8 tracking-issue requirements pass. The 5 nice-to-have polish
items (cat-newline style, AUPR_c naming consistency, data-footprint note, a dead
variable, ASCII-box alignment) were applied in the final commit.
Scope
This PR carries the two remaining tutorial commits (
e6e8daf,cfffd01); theearlier reframe commit is already on
mainvia the install-audit merge, so thediff is tutorial/doc-only (6 files) with no package-source, license, or env
changes.
Tracking issue: settylab/sarah-nexus#27