Skip to content

Post-merge tutorial fixes: heatmap print() + ligand-activity ordering + CI dependencies - #4

Merged
Huangy57 merged 11 commits into
mainfrom
huangy57/contextnet-postmerge-fixes
May 24, 2026
Merged

Huangy57 merged 11 commits into
mainfrom
huangy57/contextnet-postmerge-fixes

Conversation

@Huangy57

Copy link
Copy Markdown
Collaborator

What & why

Three small tutorial/CI fixes that were made after PRs #2 and #3 had already
merged, so they were stranded on the old (now-merged) branches. This PR
cherry-picks them cleanly onto current main plus one new fix from Sarah's
figure review.

Fixes

  1. Heatmap print() so ligand-target heatmaps display.
    nichenetr::make_heatmap_ggplot() ends in an assignment and returns the plot
    invisibly, so a bare call as a cell's last expression never auto-displays.
    Wrapped the two bare calls (NB01 + NB02 ligand-target heatmaps) in print().
    (NB02's activity heatmap already displays — it ends in + ggtitle(...).)

  2. Ligand-activity-score heatmap ordering — highest score on top (from
    figure review). The "Ligand Activity Scores" heatmap (NB02) passed rows in
    top_ligands order (highest first); make_heatmap_ggplot uses
    y = factor(levels = rownames(matrix)) and ggplot places the first level at
    the bottom, so the highest ligand rendered at the bottom. Reversed the
    row order (rev(best_ligands)) so the top row is the highest score — matching
    the bar plot in the same notebook. Diagnosed as a row-order issue; the
    color scale was already correct (light = low, dark orange = high).

  3. CI: install only hard deps. R-CMD-check and lint were failing at "Setup R
    dependencies" because pak tried to install the private ccflowR Suggests,
    which CI's default GITHUB_TOKEN cannot clone. Set
    dependencies: '"hard"' on all three setup-r-dependencies steps so only
    Depends/Imports install; the Suggests-dependent examples/tests are
    namespace-guarded and skip. (The Remotes: for ccflowR/presto added in PR Fix CI: add missing Remotes for ccflowR + presto (dependency-resolution failure) #3
    are kept — harmless, and used by anyone with access to the private repo.)

Scope

Diff vs main: .github/workflows/R-CMD-check.yaml, notebooks/01-getting-started.ipynb,
notebooks/02-standard-workflow.ipynb only. Notebooks remain output-free.

Huangy57 and others added 11 commits May 22, 2026 11:34
… display

nichenetr::make_heatmap_ggplot() ends in an assignment, so it returns the plot
invisibly; a bare call as a cell's last expression never auto-displays (any
environment / ggplot version). Wrap the two bare calls — the NB01 and NB02
ligand-target heatmaps — in print() so the figures render. NB02's activity
heatmap already displays because it ends in `+ ggtitle(...)` (a visible value).

Source-only change; notebooks remain output-free.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
R-CMD-check and lint were dying at "Setup R dependencies" because pak tried to
install the Suggests ccflowR — a private repo CI's default GITHUB_TOKEN cannot
read — and the GitHub-only presto. Set setup-r-dependencies `dependencies:
'"hard"'` on all three jobs (R-CMD-check, lint, test-coverage) so only
Depends/Imports/LinkingTo install; the Suggests-dependent examples and tests are
namespace-guarded and skip when those packages are absent. The Remotes entries
are kept (harmless) so a PAT-equipped run or a developer can still install the
optional deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s on top

The "Ligand Activity Scores" heatmap (NB02) passed rows in top_ligands order
(highest first) to make_heatmap_ggplot, which sets y = factor(levels =
rownames(matrix)); ggplot places the first level at the bottom, so the
highest-scoring ligand rendered at the BOTTOM. Reverse the row order
(rev(best_ligands)) so the top row is the highest score — matching the ligand
activity bar plot in the same notebook. Row-order fix only; the color scale was
already correct (light = low, dark orange = high).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…olve deps

The R-CMD-check job installs Suggests (needs: check), so pak tried to clone the
PRIVATE settylab/ccflowR and 404'd under CI's default GITHUB_TOKEN — the sole
remaining check failure (presto, public, already resolves). ccflowR is fully
optional and guarded: no `ccflowR::` calls in R/ (only requireNamespace in
check_ecosystem plus a data-prep helper), every ccflowR example is in
\dontrun{}, and no test uses it — so R CMD check stays meaningful without it.
Remove ccflowR from Suggests + Remotes (keep public presto). The other public
Suggests (Seurat, nichenetr, multinichenetr, presto) still install, so check
coverage is unchanged. ccflowR stays documented/installable via inst/bootstrap.R
and the install docs (and is still detected at runtime by check_ecosystem).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…the real fix

The dependencies: '"hard"' workaround was both ineffective and harmful: pak still
SOLVES the ccflowR Remote (which 404'd under CI's token), and excluding Suggests
made R CMD check run the test suite without testthat ("no package called
testthat"). Removing the private ccflowR from DESCRIPTION (prior commit) lets pak
resolve an all-public dependency set, so the default workflow installs Suggests
normally; the data-dependent tests skip in CI (no local data/ present) and the
simulated-data tests run. Restore the workflow to its original form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ps for check

ccflowR is a real, fully-guarded OPTIONAL dependency (requireNamespace in
check_ecosystem, \dontrun examples, skip-guarded tests), so it must stay
declared in Suggests. The no-PAT fix is to stop CI from cloning the private repo:

- DESCRIPTION: ccflowR stays in Suggests; removed from Remotes only (public
  presto/nichenetr/multinichenetr remain in Remotes).
- Workflow: each setup-r-dependencies uses dependencies: '"hard"' plus the public
  packages the check actually exercises (rcmdcheck/covr/lintr, testthat, Seurat),
  so pak never tries to resolve the unresolvable private ccflowR Suggests.
  R-CMD-check sets _R_CHECK_FORCE_SUGGESTS_: false so absent optional Suggests
  are NOTEs, not errors. nichenetr/multinichenetr tests skip in CI anyway (they
  need local data), so omitting them costs no coverage.

Supersedes the earlier dependencies-only and Suggests-removal attempts on this
branch. ccflowR remains documented/installable (with a PAT) via inst/bootstrap.R.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
….2 resolve)

The prior commit added any::Seurat to the check/coverage extra-packages, but
Seurat's dependency tree (SeuratObject -> Matrix >= 1.6.4, matrixStats, ...)
fails to resolve on R 4.2, macOS, and Windows (it solved only on ubuntu
4.3/4.4). Seurat is not needed for CI: tests/ is gitignored and only six test
files are tracked (class-grn, class-network, config, import-grn,
network-integrate, validate) — all use simulated data, none load Seurat or
nichenetr. The Seurat/nichenetr/multinichenetr-dependent test files are not in
the repo. Install just hard deps + testthat (+ rcmdcheck/covr/lintr);
_R_CHECK_FORCE_SUGGESTS_=false keeps the absent optional Suggests (ccflowR,
Seurat, nichenetr, ...) as NOTEs rather than errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lowR Suggests

Evidence: the lint job (needs: lint + dependencies: '"hard"') already skips
Suggests and passes, while the check job (needs: check) kept failing with
"local::.: Can't install dependency ccflowR" — `needs: check` forces Suggests
(for example/vignette checking) into the dependency solve, where the private,
Remote-less ccflowR is unresolvable. Removing `needs: check`/`needs: coverage`
lets dependencies: '"hard"' govern: install hard deps + the explicit
rcmdcheck/covr/testthat only. ccflowR (and other optional Suggests) stay absent;
_R_CHECK_FORCE_SUGGESTS_=false keeps them as NOTEs. ccflowR remains declared in
Suggests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…fixes

The no-PAT CI path is exhausted (pak resolves the package's Suggests for the
check job, where the private, Remote-less ccflowR is unresolvable). Restore
DESCRIPTION (ccflowR stays in Suggests AND Remotes, so the PAT route can clone
it) and .github/workflows/R-CMD-check.yaml to exactly match main. PR #4 now
contains only the two tutorial fixes:
- NB01/NB02: print() the bare make_heatmap_ggplot calls so the ligand-target
  heatmaps display (the function returns invisibly).
- NB02: order the ligand-activity-score heatmap so the highest score is on top
  (rev(best_ligands)).

Greening R-CMD-check is a separate PAT decision (add github-token to the
setup-r-dependencies steps once the ccflowR-read secret exists).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ency

The default GITHUB_TOKEN cannot clone the private settylab/ccflowR Remote,
so pak dependency resolution failed in every R-CMD-check matrix job, plus
test-coverage and lint. Point GITHUB_PAT (read by
r-lib/actions/setup-r-dependencies) at the new SETTYLAB_CI_PAT repo secret,
which has read access to ccflowR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ct 5 / Matrix

R 4.2 ran only on ubuntu and could never solve the dependency graph: the
package needs SeuratObject (>= 5.0.0), which requires Matrix (>= 1.6.4), and
the available Matrix needs R >= 4.4. R 4.3 and 4.4 cells (all platforms) pass.
Remove '4.2' from r-version and the now-dead macOS/Windows excludes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Huangy57
Huangy57 merged commit 73a3ed3 into main May 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant