Skip to content
Snippets Groups Projects
Commit d69fae24 authored by Todor Kondic's avatar Todor Kondic
Browse files

api,plotting: Fix save all glitch

* R/api.R (create_plots): Fixed argument to single plot saving function.

* R/plotting.R <saving plots>: Clean up.
parent 9e5a16fc
No related branches found
No related tags found
No related merge requests found
Package: shinyscreen
Title: Pre-screening of Mass Spectrometry Data
Version: 1.0.0
Version: 1.0.1
Author: Todor Kondić
Maintainer: Todor Kondić <todor.kondic@uni.lu>
Authors@R:
......
......@@ -573,6 +573,11 @@ create_plots <- function(m) {
pdata_ms2 <- data4plot_ms2_cgram(ms2,select)
pdata_spec <- data4plot_ms2_spec(ms2,flt_summ,select)
tabl_ms1 <- table_eic(pdata_ms1)
## tabl_ms2 <- table_eic(pdata_ms2) # For the moment, no real
# info to be had here.
tabl_spec <- table_spec(pdata_spec)
palette = plot_palette(pdata_ms1)
p_eic <- plot_eic_w_facet(pdata_ms1 = pdata_ms1,
......@@ -584,18 +589,19 @@ create_plots <- function(m) {
mz_range = c(NA_real_,NA_real_),
palette = palette)
message("CCC")
## TODO
plot_save_single(p_eic,
decotab = select,
figtag = "eic",
proj = m$conf$project,
tabl = tabl_ms1,
extension = m$conf$figures$ext)
message("DDD")
plot_save_single(p_spec,
decotab = select,
figtag = "spec",
proj = m$conf$project,
tabl = tabl_spec,
extension = m$conf$figures$ext)
message("Plotting of figure ",n," out of ",NROW(keytab)," has been completed.")
......
......@@ -282,9 +282,8 @@ table_spec <- function(pdata) {
tbl
}
plot_save_single <- function(plot,decotab,extension,proj,tabl,figtag="") {
if (is.null(plot)) return()
print(decotab)
plot_fname_prefix <- function(decotab,proj) {
if (NROW(decotab)==0) return()
adducts <- decotab[,adduct]
ids <- decotab[,ID]
rpls <- list("\\["="","\\]"="","\\+"="p","\\-"="m")
......@@ -302,6 +301,14 @@ plot_save_single <- function(plot,decotab,extension,proj,tabl,figtag="") {
fname <- paste0(fname,paste(ids,collapse = "_"))
fname <- file.path(ddir,fname)
fname
}
plot_save_single <- function(plot,decotab,extension,proj,tabl=NULL,figtag="") {
if (is.null(plot)) return()
fname <- plot_fname_prefix(decotab,proj)
fnplot <- paste0(fname,"__",figtag,".",extension)
......@@ -311,7 +318,7 @@ plot_save_single <- function(plot,decotab,extension,proj,tabl,figtag="") {
plot = plot)
fntab <- paste0(fname,"__",figtag,".csv")
data.table::fwrite(tabl,file=fntab,sep = ",")
if (! is.null(tabl)) data.table::fwrite(tabl,file=fntab,sep = ",")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment