Skip to content

Add themeable plots, self-describing outputs, failure reporting; markers opt-in - #8

Merged
MilesGithub merged 1 commit into
mainfrom
feature/v0.3.0-usability
Jul 9, 2026
Merged

Add themeable plots, self-describing outputs, failure reporting; markers opt-in#8
MilesGithub merged 1 commit into
mainfrom
feature/v0.3.0-usability

Conversation

@MilesGithub

Copy link
Copy Markdown
Owner

Usability improvements to NMFprofileR(). Everything is additive except one intentional default change (emit_marker_genes).

Changes

  • Themeable plots — new custom_theme (a ggplot2 theme) and factor_palette (a colour vector) arguments, threaded into generate_rank_plots()/generate_global_plots(), so figures can match a project's house style without editing the package. custom_theme also matches the argument the NMFprofileR_TCGA scripts already pass.
  • umap_n_neighbors — parametrizes the sample-coefficient UMAP. The embedding now renders whenever the cohort has more samples than this value (previously hardcoded > 15), with the neighbour count capped at n_samples - 1 so smaller cohorts also embed.
  • Self-describing outputs — an optional run_id is stamped as a leading Run_ID column in the consolidated summary and recorded in the manifest; the whole nmf_profile result is saved as a single <prefix>_nmf_profile.rds bundle; and Summaries/manifest.tsv lists every file a run produced with its type.
  • Failure reporting — ranks whose NMF fit fails are recorded in a new $failures data frame (Rank + Reason) and listed by print(), instead of silently disappearing.
  • emit_marker_genes now defaults to FALSE (breaking) — specificity markers and their second enrichment pass are opt-in, halving g:Profiler calls per default run. The marker_genes / enrichment$markers elements are still always present (empty when off).

Testing

  • New test-manifest (manifest helpers) and test-failures (failure path via a mocked fit) run without a network.
  • Smoke test extended to cover run_id, the .rds bundle, the manifest, and empty $failures.
  • Full suite run locally on R 4.6.0 (network tests included) — green. Docs regenerated; version bumped to 0.3.0.

…ers opt-in

- Themeable plots: NMFprofileR() gains `custom_theme` (a ggplot2 theme) and
  `factor_palette` (a colour vector), threaded into generate_rank_plots() and
  generate_global_plots() in place of the hardcoded theme/palette.
- `umap_n_neighbors` parametrizes the sample-coefficient UMAP; the embedding now
  renders whenever n_samples exceeds it (was hardcoded > 15) and the neighbour
  count is capped at n_samples - 1 so smaller cohorts also embed.
- Self-describing outputs: an optional `run_id` is stamped as a leading Run_ID
  column in the consolidated summary and recorded in the manifest; the whole
  nmf_profile is saved as one <prefix>_nmf_profile.rds bundle; and a
  Summaries/manifest.tsv lists every file a run produced with its type
  (write_output_manifest / classify_output_file).
- Failed ranks are recorded in $failures (Rank + Reason) and surfaced by
  print(), instead of silently vanishing from the output.
- emit_marker_genes now defaults to FALSE (breaking): specificity markers and
  their enrichment are opt-in, halving g:Profiler calls per default run. The
  marker_genes and enrichment$markers elements remain present (empty when off).

Tests: add test-manifest (manifest helpers, no network) and test-failures
(failure path via mocked fit, no network); extend the smoke test to cover
run_id, the .rds bundle, the manifest, and empty $failures. Docs regenerated
(S3 methods now registered via S3method()); version bumped to 0.3.0.
@MilesGithub
MilesGithub merged commit 40b757d into main Jul 9, 2026
4 checks passed
@MilesGithub
MilesGithub deleted the feature/v0.3.0-usability branch July 9, 2026 03:47
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