From e5eeb8147df4e88646ae15d9ed19d5d5ef534c2b Mon Sep 17 00:00:00 2001 From: bielow Date: Wed, 27 Oct 2021 16:31:26 +0200 Subject: [PATCH 1/4] only show legend items which are actually in the data --- R/fcn_plots.R | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/R/fcn_plots.R b/R/fcn_plots.R index 67159b8..22021a0 100644 --- a/R/fcn_plots.R +++ b/R/fcn_plots.R @@ -875,9 +875,12 @@ plot_UncalibratedMSErr = function(data, MQBug_raw_files, stats, y_lim, extra_lim ## use augmented name data$fc.raw.file_ext = stats$fcr_new_lvl[ match(data$fc.raw.file, stats$fc.raw.file) ] + cols_sub = c("default"="black", "MQ bug"="red", "out-of-search-tol"="orange") + cols_sub = cols_sub[names(cols_sub) %in% data$col] + p = ggplot(data, col=data$col) + geom_boxplot(aes_string(x = "fc.raw.file_ext", y = "uncalibrated.mass.error..ppm.", col="col"), varwidth = TRUE, outlier.shape = NA) + - scale_colour_manual("", values = c("default"="black", "MQ bug"="red", "out-of-search-tol"="orange"), guide = showColLegend) + + scale_colour_manual("", values = cols_sub, guide = showColLegend) + ylab(expression(Delta~"mass [ppm]")) + xlab("") + ylim(y_lim) + @@ -935,10 +938,13 @@ plot_CalibratedMSErr = function(data, MQBug_raw_files, stats, y_lim, extra_limit ## only show legend if special things happen showColLegend = ifelse(length(setdiff(data$col, "default")) > 0, "legend", "none") + cols_sub = c("default"="black", "MQ bug"="red", "out-of-search-tol"="orange") + cols_sub = cols_sub[names(cols_sub) %in% data$col] + ## plot p = ggplot(data, col = data$col) + geom_boxplot(aes_string(x = "fc.raw.file", y = "mass.error..ppm.", col="col"), varwidth = TRUE, outlier.shape = NA) + - scale_colour_manual("", values = c("default"="black", "MQ bug"="red", "out-of-search-tol"="orange"), guide = showColLegend) + + scale_colour_manual("", values = cols_sub, guide = showColLegend) + ylab(expression(Delta~"mass [ppm]")) + xlab("") + ylim(y_lim) + From 0f73fe688e955b0b02b7ce6fdbc73e2222fe5218 Mon Sep 17 00:00:00 2001 From: bielow Date: Wed, 27 Oct 2021 16:37:59 +0200 Subject: [PATCH 2/4] links in Html report refined (relative to absolute, so moving the report retains the link correctness) --- R/createReport.R | 3 ++- inst/reportTemplate/PTXQC_report_template.Rmd | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/R/createReport.R b/R/createReport.R index 59a5c97..bcde202 100644 --- a/R/createReport.R +++ b/R/createReport.R @@ -684,7 +684,7 @@ createReport = function(txt_folder = NULL, mztab_file = NULL, yaml_obj = list(), } cat(paste0("HTML TEMPLATE: ", html_template, "\n")) out_dir = dirname(rprt_fns$report_file_HTML) - file.copy(html_template, out_dir, overwrite = TRUE) + file.copy(html_template, out_dir, overwrite = FALSE) out_template = file.path(out_dir, basename(html_template)) ## Rmarkdown: convert to Markdown, and then to HTML (or PDF) ... ## Intermediates_dir is required if inputdir!=outputdir, since Shiny server might not allow write-access to input file directory @@ -721,6 +721,7 @@ createReport = function(txt_folder = NULL, mztab_file = NULL, yaml_obj = list(), print(gg_obj) } } + cat("\nCreating PDF ...\n") grDevices::pdf(report_file_PDF) printWithPage(hm[["plot"]], "p. 1") # summary heatmap printWithPage(pl_nameMapping$plots, "p. 2") # short file mapping diff --git a/inst/reportTemplate/PTXQC_report_template.Rmd b/inst/reportTemplate/PTXQC_report_template.Rmd index 96b188c..e8d3e2a 100644 --- a/inst/reportTemplate/PTXQC_report_template.Rmd +++ b/inst/reportTemplate/PTXQC_report_template.Rmd @@ -155,19 +155,20 @@ document.getElementById("locale_shorttext").innerHTML = shorttext; - navigate using the 'Table of Content' above or just scroll down - collapse sections by just clicking their name - click on the "↓ Show Help" symbol to see a description for each metric and its scoring - - edit the config `r paste0("file:///", gsub("\\\\", "/", rprt_fns$yaml_file))` to + - edit the YAML config `r paste0("file:./", basename(rprt_fns$yaml_file))` to - set the report format (HTML, plainPDF, or both) - disable metrics - customize the order of metrics - set individual target thresholds - - edit `r paste0("file:///", gsub("\\\\", "/", rprt_fns$filename_sorting))` to customize + - edit `r paste0("file:./", basename(rprt_fns$filename_sorting))` to customize - the order of Raw files in plots and heatmap - abbreviations of Raw file names - - edit the Html template `r paste0("file:///", gsub("\\\\", "/", html_template))` to + - edit the Html template `r paste0("file:./", basename(html_template))` to - alter the look and feel of this report (e.g. colors, font and image sizes, help texts, etc.) - report bugs and file requests via the [GitHub issue tracker](https://github.com/cbielow/PTXQC/issues) - full PTXQC manual available [here](https://github.com/cbielow/PTXQC) + ## HeatMap ```{r MQparams, echo=FALSE, results="asis"} hm[["plot"]] From e2a4e4b7a369c6e5b026b395d1d564a2de2e8d66 Mon Sep 17 00:00:00 2001 From: bielow Date: Wed, 27 Oct 2021 16:38:25 +0200 Subject: [PATCH 3/4] [doc] better help text for MBR align metric --- R/qcMetric_EVD.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/qcMetric_EVD.R b/R/qcMetric_EVD.R index 9a82ba0..f29e0d6 100644 --- a/R/qcMetric_EVD.R +++ b/R/qcMetric_EVD.R @@ -598,11 +598,13 @@ during MaxQuant configuration. The resulting residual RT delta after RT alignment (compared to a reference Raw file), is shown as green/red dots. One dot represents one peptide (incl. charge). Every dot (peptide) outside an allowed residual delta RT (1min by default) is colored red. All others are green. +The ratio of 'green' vs. 'green+red' peptides is annotated using 'sc: ' (for 'score') in the plot subtitles. High values are better (green peptides dominate). If moving 'red' dots to the horizontal zero-line (to make them green) requires large RT shifts, then increasing the alignment search window might help MaxQuant to find a better alignment. -Heatmap score [EVD: MBR Align]: fraction of 'green' vs. 'green+red' peptides. + +Heatmap score [EVD: MBR Align]: ratio of 'green' vs. 'green+red' peptides ", workerFcn = function(.self, df_evd, tolerance_matching, raw_file_mapping) { From 47ec8b6e88f309025540521058c6af28687ebdca Mon Sep 17 00:00:00 2001 From: bielow Date: Sat, 30 Oct 2021 11:07:56 +0200 Subject: [PATCH 4/4] update changelog --- NEWS | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 305bf8f..d89185b 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Versions uploaded to CRAN are marked with [CRAN]. [?] v1.00.12 -- develop - [FIX] Documentation and cosmetic fixes (pr #109) - + - [FIX/DOC] improved legends and better links in Html reports (pr #111) [CRAN] v1.00.11 -- 2021/09/28 - [FEATURE] initial support for mzQC Quality Control output (pr #105) diff --git a/README.md b/README.md index afb8d49..86b392a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ PTXQC ### Latest changes / ChangeLog + - v??? - Nov 2021: Documentation and cosmetic fixes (https://github.com/cbielow/PTXQC/pull/109); improved legends, better links in Html reports (https://github.com/cbielow/PTXQC/pull/111) - v1.00.11 - Sep 2021: initial support for mzQC Quality Control output (https://github.com/cbielow/PTXQC/pull/105); Missed cleavages can be computed from evidence.txt (https://github.com/cbielow/PTXQC/pull/104); minor fixes - v1.00.10 - May 2021: detect non UK/US locale (https://github.com/cbielow/PTXQC/pull/99); Revive missing MBR metrics (https://github.com/cbielow/PTXQC/issues/97); restore full Parameter list (showing MaxQuant parameters (https://github.com/cbielow/PTXQC/issues/101); decoy distribution in MS/MS mass error plot restored (https://github.com/cbielow/PTXQC/issues/102) - v1.00.09 - Jan 2021: output logging to external file (https://github.com/cbielow/PTXQC/issues/94); mzQC support (partial); less warnings;