Skip to content

Add plot exports, ported amRml visualizations, and network styling#32

Open
eboyer221 wants to merge 1 commit into
mainfrom
dev-add-export-plots-feature
Open

Add plot exports, ported amRml visualizations, and network styling#32
eboyer221 wants to merge 1 commit into
mainfrom
dev-add-export-plots-feature

Conversation

@eboyer221

Copy link
Copy Markdown
Contributor

Summary

This PR adds the cross-drug generalization heatmap, adds several plots from amRml, gives every dashboard panel a dedicated export button, and restyles the interaction networks to have shapes rather than only colors for the legend.
It also resolves the outstanding BiocCheck warning "No Bioconductor dependencies detected" since amRviz now depends on ComplexHeatmap (used for the static heatmap exports).

Exports

  • Heatmap panels export to publication-quality ComplexHeatmap PDFs.
  • All other panels (plots, networks, Sankey) export to static PDF via a headless snapshot.
  • 18 "Export (PDF)" buttons added across all tabs.

Ported from amRml (PR #8)

  • Signed feature-importance bar on the Feature Importance tab.
  • MDR model performance in a new "MDR models" tab.

Networks

  • Node shapes per element type (drug, feature, cluster, COG), mirrored in the legend.
  • Fonts now match the rest of the dashboard.
  • Added a hint prompting users to select a table row to generate the ego network.

Styling

  • Unified small blue export/download buttons matching the navbar accent.

Dependencies

  • Imports: ComplexHeatmap, circlize, RColorBrewer, grid, grDevices, htmlwidgets.
  • Suggests: webshot2 (chromote already present).
  • biocViews updated to valid software terms; READMEs synced.

Testing

  • New tests for the heatmap, ported, and widget exports.
  • Testing

Added 5 test files covering the new functionality:

  • test-crossDrugHeatmap.R - cross-drug matrix prep, ComplexHeatmap object, plotly panel, PDF render
  • test-portedPlots.R -makeTopFeatsVIPlot, makeMDRPerformancePlot, loadMDRResults
  • test-heatmapExport.R -makeHeatmapExport / .plotlyHeatmapMatrix / .writeHeatmapPdf
  • test-widgetExport.R - .writeWidgetStatic (incl. a real headless-Chrome snapshot) + .exportBtn
  • test-network.R - added assertions for the node-shape/legend hook and shared font
  • Full unit suite: 208 pass, 0 fail.

@amcim amcim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is big and utils in particualr has become quite challenging to read. We have decided to first reorganize the code in a separate PR and rebase. In addition after this reorganization, thevarious features here may be split into smaller PRs.

Leaving this PR open for now

@eboyer221 eboyer221 mentioned this pull request Jun 10, 2026
@eboyer221 eboyer221 force-pushed the dev-add-export-plots-feature branch from b9600f3 to 0f9a3a1 Compare June 12, 2026 18:21
@eboyer221

Copy link
Copy Markdown
Contributor Author

Rebased onto main now that the utils reorg (#33) is merged.

The only real conflict was R/utils.R — since the reorg deleted it and split it
into themed files, I redistributed this PR's additions into their new homes:

  • Network styling (.styleNetwork, .NETWORK_FONT, shape JS) + the
    forceNetwork edits → R/plots_network.R
  • Cross-drug heatmap (makeCrossDrugHeatmap, …Plotly, .buildCrossDrugMatrix,
    .crossDrugColorScale) → R/plots_crossmodel.R
  • VI plot (makeTopFeatsVIPlot) → R/plots_featureimportance.R
  • MDR plot (makeMDRPerformancePlot) → R/plots_modelperf.R
  • MDR / drug-class loaders (loadMDRResults, load_drug_class_map,
    .load_one_species_mdr) → R/utils_data.R
  • Export helpers (makeHeatmapExport, .writeHeatmapPdf, .writeWidgetStatic,
    .plotlyHeatmapMatrix, .exportBtn) → new R/utils_export.R, matching the
    reorg's theming

app.R, the *UI.R files, and tests came over unchanged (the reorg didn't touch
them). DESCRIPTION picked up the new deps; NAMESPACE/imports.R needed no changes
since the new code uses pkg::fn() namespacing and the functions stay internal.

After a fresh R CMD INSTALL .: 228 unit + 20 app tests pass, 0 failures.

Still on the to-do list for this PR (per our chat): the export-observer race
conditions and the simplification pass. There's also a pre-existing tidyselect
.data$ deprecation warning in makeFeatureImportancePlot we can fold into the cleanup.

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.

2 participants