From bf88b867b0ed372d99c7f67ad378c5b85124261b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Thu, 7 May 2020 12:36:51 +0200
Subject: [PATCH] rf: Add ctrl2mzml_df, ctrl2mzml and get_all_sets

* R/shiny-ui-config.R(ctrl2mzml_df, ctrl2mzml): New functions.

(get_all_sets): New function. Finally stopped recalculating sets.
---
 R/shiny-ui-config.R | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/R/shiny-ui-config.R b/R/shiny-ui-config.R
index 570573d..2f834bf 100644
--- a/R/shiny-ui-config.R
+++ b/R/shiny-ui-config.R
@@ -134,7 +134,19 @@ react_conf_f <- function(input,output,session,rv,rf) {
         input$updTagsB
         isol(if (isTruthy(input$tagsInp)) unique(txt2tags(input$tagsInp)) else TAG_DEF)
     })
-    
+
+    rf$ctrl2mzml_df <- react_f({
+        x <- tryCatch(rhandsontable::hot_to_r(input$mzMLtabCtrl),error=function(m) NULL)
+        shiny::req(x)
+        x
+    })
+
+    rf$ctrl2mzml <- react_f({
+        dtable(rf$ctrl2mzml_df())
+    })
+
+    rf$get_all_sets <- react_e(rv$m$input$tab$setid,unique(rv$m$input$tab$setid$set))
+
     rf
 }
 
-- 
GitLab