From 259e1b6513adce8a28e7645e64c877b3a0b78a52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Thu, 14 Nov 2019 10:16:31 +0100
Subject: [PATCH] Towards multimode set

---
 R/mix.R     | 5 +++++
 R/shinyUI.R | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/R/mix.R b/R/mix.R
index bb914ee..1c1f397 100644
--- a/R/mix.R
+++ b/R/mix.R
@@ -98,6 +98,11 @@ getSMILESFromCmpL<-function(id,cmpL) {
     smiles
 }
 
+getColFromCmpL<-function(id,cname,cmpL) {
+    ind<-match(id,cmpL$ID)
+    cmpL[[cname]][[ind]]
+}
+
 ##' Create directories without drama.
 ##'
 ##' Create directories without drama.
diff --git a/R/shinyUI.R b/R/shinyUI.R
index 8e4114f..f628ae0 100644
--- a/R/shinyUI.R
+++ b/R/shinyUI.R
@@ -439,6 +439,11 @@ shinyScreenApp <- function(projDir=getwd()) {
         q
     }
 
+    getSetMode <- function(set,mzMLtab) {
+        sdf<-mzMLtab[which(mzMLtab$set %in% set),]
+        levels(factor(sdf$mode))
+    }
+
     server <- function(input,output,session) {
 
         ## ***** reactive values *****
@@ -683,10 +688,10 @@ shinyScreenApp <- function(projDir=getwd()) {
             setMode<-mzML$mode[match(sets,mzML$set)]
             names(setMode)<-sets
             nR<-nrow(rvSetId$df)
-            mode<-rvConf$mzMLtab
             dfSet<-rvSetId$df
             dfSet$mz<-rep(NA,nR)
             dfSet$SMILES<-rep(NA,nR)
+            dfSet$Name<-rep(NA,nR)
             cmpL<-getCmpL()
             for (s in sets) {
                 md<-setMode[[s]]
@@ -695,6 +700,7 @@ shinyScreenApp <- function(projDir=getwd()) {
                     id<-dfSet[i,"ID"]
                     dfSet[i,"mz"]<-getMzFromCmpL(id,md,cmpL)
                     dfSet[i,"SMILES"]<-getSMILESFromCmpL(id,cmpL)
+                    dfSet[i,"Name"]<-getColFromCmpL(id,"Name",cmpL)
                 }
             }
             ## rvSetId$df<-dfSet
-- 
GitLab