Skip to content

Enhance plotting functions and documentation#8

Open
AbhirupaGhosh wants to merge 28 commits into
mainfrom
plotting_ml_results
Open

Enhance plotting functions and documentation#8
AbhirupaGhosh wants to merge 28 commits into
mainfrom
plotting_ml_results

Conversation

@AbhirupaGhosh

Copy link
Copy Markdown
Contributor

Updated documentation for plotPRC, plotROC, plotCM, plotDensity, and plotTopFeatsVI functions. Added new functions for plotting ROC curves, confusion matrices, and density of predicted class probabilities.

Description

What kind of change(s) are included?

  • Feature (adds or updates new capabilities)
  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (these changes would cause existing functionality to not work as expected).

Checklist

Please ensure that all boxes are checked before indicating that this pull request is ready for review.

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have searched for existing content to ensure this is not a duplicate.
  • I have performed a self-review of these additions (including spelling, grammar, and related).
  • I have added comments to my code to help provide understanding.
  • I have added a test which covers the code changes found within this PR.
  • I have deleted all non-relevant text in this pull request template.
  • Reviewer assignment: Tag a relevant team member to review and approve the changes.

Updated documentation for plotPRC, plotROC, plotCM, plotDensity, and plotTopFeatsVI functions. Added new functions for plotting ROC curves, confusion matrices, and density of predicted class probabilities.
epbrenner
epbrenner previously approved these changes Jan 20, 2026

@epbrenner epbrenner 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.

These work, but I'd strongly suggest that the import functions for the plots to natively include the tsv reading rather than requiring it.

@AbhirupaGhosh
AbhirupaGhosh marked this pull request as draft May 29, 2026 22:25
@AbhirupaGhosh
AbhirupaGhosh requested review from amcim and eboyer221 June 2, 2026 14:00
@AbhirupaGhosh

Copy link
Copy Markdown
Contributor Author

These work, but I'd strongly suggest that the import functions for the plots to natively include the tsv reading rather than requiring it.

I have modified the function to input tsv.
I have added additional plotting functions based on my Staph poster and a few others. @eboyer221, please look through the plots to decide if anything can be adapted for the dashboard or generate an Rmd as the end product of amRml.

@AbhirupaGhosh
AbhirupaGhosh marked this pull request as ready for review June 2, 2026 14:03
@eboyer221

Copy link
Copy Markdown
Contributor

@AbhirupaGhosh @jananiravi @amcim
I am currently reviewing these plots and working on adding them into the amRviz dashboard, along with an option to export them. Since plotCrossDrug() uses ComplexHeatmap, bringing that into amRviz will give us a Bioconductor dependency we need, which should help resolve the BiocCheck warning we have been hitting in that package.

Comment thread R/plot_ml.R Outdated
#' @return A heatmap (`ggplot2` object) showing the confusion matrix.
#'
#' @export
plotCM <- function(test_data_plus_predictions_file) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

plotConfusion will seem odd?

Comment thread R/plot_ml.R Outdated
Comment thread R/plot_ml.R Outdated
Comment thread R/plot_ml.R Outdated
"#0F2A5A" # very dark for ~1
),
values = scales::rescale(c(-1, 0, 0.85, 1)),
name = "Best MCC"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@AbhirupaGhosh including ties?

Comment thread R/plot_ml.R
Comment on lines +478 to +485
feat_pal <- c(
"args" = "#56B4E9", # sky blue
"cogs" = "#E69F00", # orange
"genes" = "#009E73", # bluish green
"domains" = "#F0E442", # yellow
"proteins" = "#CC79A7", # reddish purple
"struct" = "#D55E00" # vermillion
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not defined separately in a function -- so it's the same colors across plots/panels?

Comment thread R/plot_ml.R Outdated
Comment thread R/plot_ml.R Outdated
Comment thread R/plot_ml.R
Comment thread R/plot_ml.R Outdated
Comment thread R/plot_ml.R Outdated
@amcim

amcim commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I am not approving yet, but basically some of the additions I made in PR #23 were reverted. So I am taking the time now to resolve this. I re-added much of this necessary code, including adding more runnable examples, fixed some R CMD CHECK bugs, and more. Ill write some details on approval. I will be pushing changes that hopefully will resolve CI, and then will review the plotting functions functionality.

AbhirupaGhosh and others added 7 commits July 6, 2026 18:27
…eanup

- Re-apply genome_drug.genome_id fix in plotDrugDist/plotDrugPerf that was
  reverted by the previous commit (98f416c); the column in metadata.parquet is
  genome_drug.genome_id, not genome.genome_id
- Move ComplexHeatmap from Suggests to Imports (used unconditionally in
  plotCrossDrug with a runnable example)
- Add .readMetadata()/.readPerfInput() helpers with clear missing-file errors;
  route all parquet reads in the new plot functions through them
- Restore plotBaselineComparison to a tibble-direct API (consistent with sibling
  plot functions and the vignette) and restore antibiotic x-axis labels
- Fix plotMDR to return a named list(performance, prediction) matching @return,
  and remove the large commented-out feature-cluster block
- Add column validation to plotTopFeatsVI for its new topfeat input
- Remove dead commented code and fix indentation flagged by styler
@eboyer221
eboyer221 force-pushed the plotting_ml_results branch from 56db689 to 98f416c Compare July 21, 2026 21:38
@AbhirupaGhosh

Copy link
Copy Markdown
Contributor Author

@eboyer221 @amcim I have replaced the example files. The confusion with the metadata parsing should be solved. The easiest way to check is

devtools::install(".")
library(amRml)
plotDrugDist(metadata_path = system.file("extdata", package = "amRml"))

because the problem was at lines 432 and 511.

@eboyer221

Copy link
Copy Markdown
Contributor

Hi @AbhirupaGhosh thanks for the new data files! Two quick things:

I ran a quick test and confirmed that the genome.genome_id fix was spot on and now the plots all work with the new data.

The one issue I see: the example-data folder is now about 113 MB, and the package's automated checks need it under ~5 MB, so that's currently causing failures. The good news is most of those big files look like duplicates - all the data is already packed inside the small Sfl_parquet.duckdb file, and the plot examples only actually use metadata.parquet. The large individual files (the gene/protein/struct ones, ~26 MB each) don't seem to be used anywhere in the package.

Would it be okay if I remove those big redundant files? I'll double-check everything still runs before and after, so nothing breaks. The only thing I want to confirm with you: do you need those raw files kept for anything else - like re-generating the data later, or sharing them with other people? If not, I'll clean them up and that should bring the size back down.

AbhirupaGhosh and others added 3 commits July 22, 2026 10:39
vip was archived from CRAN on 2026-07-08, so setup-r-dependencies could no
longer install it and every CI job failed at the dependency step. vip::vi() is
still used by extractTopFeats(). Add a Remotes entry pinning vip to its last
CRAN release so pak can install it from the archive. Stopgap until vip returns
to CRAN or its variable-importance use is reimplemented.
Not read by any test, vignette, or executed example; plotTopClusters (its only
reader) uses a \dontrun example pointing elsewhere. Brings inst/extdata from
~11MB to ~1.3MB. Removed with the author's sign-off.
@amcim

amcim commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

One problem right now is that the vignette uses the files that were in inst/extdata. Ultimately though, the vignette should be loading from the eventual EH.

The challenge here is that @eboyer221 is correct that the files need to be under a certain size, as there is a strict error check on this. But if we include files likes struct.parquet, which currently is needed for generating the matrices. These files can't just be removed, they need to be subsetted for the goal of testing functionality.

In the submission to Bioconductor, the order is that we will need to push all 3 packages (EH, ML, Viz), they need to have no errors or warnings, then Lori will allow us to create the EH. From there we can update ML to just utilize EH in the vignette (Currently we have Viz set up to use extdata that is a reasonable size so not an issue there).

I am considering having the vignette not evaluate the chunks that need data for now. This will allow R CMD CHECK to pass again, and once the EH is set up, we can have eval=TRUE again for when the reviewer looks at it

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.

5 participants