From bc8e1718e2731b527938d8c4e7f4af015e82bce8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Sat, 2 May 2020 19:33:34 +0200
Subject: [PATCH] Modify loading inputs in gen_base_ftab

* R/api.R (load_data_input,load_compound_input): New functions.
  Split the compounds lists loading from data input loading, to better
  adapt to the way this is used in shiny UI.

* R/api.R (load_inputs): Adapted to above
---
 R/api.R | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/R/api.R b/R/api.R
index 7735b59..9e6dd16 100644
--- a/R/api.R
+++ b/R/api.R
@@ -46,8 +46,7 @@ gen_base_ftab <- function(m) {
 }
 
 ##' @export
-load_inputs <- function(m) {
-    m$input$tab$mzml <- file2tab(m$conf$data)
+load_compound_input <- function(m) {
     m$input$tab$known <- if (shiny::isTruthy(m$conf$compounds$known))
                              file2tab(m$conf$compounds$known) else EMPTY_KNOWN
     m$input$tab$unknown <- if (shiny::isTruthy(m$conf$compounds$unknown))
@@ -58,6 +57,18 @@ load_inputs <- function(m) {
     m
 }
 
+load_data_input <- function(m) {
+    m$input$tab$mzml <- file2tab(m$conf$data)
+    m
+}
+
+##' @export
+load_inputs <- function(m) {
+    m <- load_compound_inputs(m)
+    m <- load_data_input(m)
+    m
+}
+
 ##' @export
 mk_comp_tab <- function(m) {
     message("Started assembling the lists of knowns and unknowns into the `comprehensive' table.")
-- 
GitLab