diff --git a/DESCRIPTION b/DESCRIPTION index eaefe2d..9d4b3fd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: A Shiny Module for Bridging B-Fabric and R using REST Author: Christian Trachsel [cre, aut], Christian Panse [cre, aut] Maintainer: Christian Panse -Version: 0.10.22 +Version: 0.10.23 Description: provides access modules and functions to interact with the FGCZ's bfabric system. The package contains shiny applications, e.g., to allow the FGCZ user to automatically generate a certain set of queues for diff --git a/inst/shiny/queue_generator10/queuetools.R b/inst/shiny/queue_generator10/queuetools.R index 4f9881c..8afd515 100644 --- a/inst/shiny/queue_generator10/queuetools.R +++ b/inst/shiny/queue_generator10/queuetools.R @@ -82,18 +82,24 @@ S } -.insertStandardsLoop <- function(input, howoften=1, howmany=1, begin = FALSE, end = FALSE) +.insertStandardsLoop <- function(input, howoften = 1, howmany = 1, begin = FALSE, end = FALSE, between=TRUE) { output <- data.frame() - # yes - for readability of the code we have a foor loop! - for (i in 1:nrow(input)){ + + if (isTRUE(between)){ + # yes - for readability of the code we have a foor loop! + for (i in 1:nrow(input)){ output <- rbind(output, input[i, ]) if (howoften > 0 && i %% howoften == 0 && howmany > 0){ - for (j in seq(1, howmany)){ - tmp <- rep(NA, ncol(input)) - output <- rbind(output, tmp) - } + for (j in seq(1, howmany)){ + tmp <- rep(NA, ncol(input)) + output <- rbind(output, tmp) + } } + } + }else{ + # no inserts inbeween runs + output <- input } if (begin){ @@ -109,7 +115,7 @@ output } -.insertStandardsEVOSEP <- function(S, howoften = 1, howmany = 1, begin=FALSE, end=FALSE, stdName = "autoQC01", volume = 1){ +.insertStandardsEVOSEP <- function(S, stdName = "autoQC01", volume = 1, ...){ input <- S if (! 'type' %in% names(input)) input$type <- "sample" @@ -118,7 +124,7 @@ if (! 'volume' %in% names(input)) input$volume <- NA - output <- .insertStandardsLoop(input, howoften=howoften, howmany = howmany, begin=begin, end=end) + output <- .insertStandardsLoop(input, ...) output$type[is.na(output$type )] <- stdName output$volume[output$type == stdName] <- volume @@ -127,15 +133,14 @@ # we iterate row by row through the data.frame and insert the autoQC vials -.insertStandardsNanoElute <- function(S, howoften = 4, howmany = 1, begin=FALSE, - end=FALSE, stdName = "autoQC01", stdPosX='8', stdPosY='F', plate=1, volume=1){ +.insertStandardsNanoElute <- function(S, stdName = "autoQC01", stdPosX='8', stdPosY='F', plate=1, volume=1, ...){ input <- S if (! 'type' %in% names(input)) input$type <- "sample" - output <- .insertStandardsLoop(input, howoften=howoften, howmany = howmany, begin=begin, end=end) + output <- .insertStandardsLoop(input, ...) output$type[is.na(output$type )] <- stdName output$x[is.na(output$x )] <- stdPosX diff --git a/inst/shiny/queue_generator10/server.R b/inst/shiny/queue_generator10/server.R index 1c1518e..5992534 100644 --- a/inst/shiny/queue_generator10/server.R +++ b/inst/shiny/queue_generator10/server.R @@ -386,6 +386,11 @@ shinyServer(function(input, output, session) { }else if (input$instrumentControlSoftware == "HyStar"){ message("DEBUG") message(paste(names(input), collapse = ", ")) + #print(as_tibble(as.data.frame(input))) + #save(input, file='/tmp/input.RData') + # list_of_inputs <- reactiveValuesToList(input) + # print(list_of_inputs) + note <- gsub('([[:punct:]])|\\s+', '_', input$folder) inputSampleTable <- data.frame(container_id = res$containerid, sample_id = res$extract.id, @@ -396,22 +401,30 @@ shinyServer(function(input, output, session) { set.seed(1) inputSampleTable <- inputSampleTable %>% .blockRandom(x = "sample_condition", check=FALSE) } - + print("DEBUG") + print(input$autoQC4L) ## TODO method files only for clean|autoQC4L|autoQC01 if (input$lcSystem == "EVOSEP1x12x8"){ rv <- inputSampleTable %>% .insertStandardsEVOSEP(stdName = "washing", + between=input$clean, howoften = input$cleano, howmany = input$cleanm, - volume = 4) %>% - .insertStandardsEVOSEP(stdName = "autoQC01", + volume = 4, + begin = "4" %in% c(input$start1,input$start2, input$start3), + end = "4" %in% c(input$end1,input$end2, input$end3)) %>% + .insertStandardsEVOSEP(stdName = "autoQC01", + between=input$autoQC01, howoften = input$QC01o, - howmany = input$QC01m) %>% - .insertStandardsEVOSEP(stdName = "autoQC4L", + howmany = input$QC01m, + begin = "1" %in% c(input$start1,input$start2, input$start3), + end = "1" %in% c(input$end1,input$end2, input$end3)) %>% + .insertStandardsEVOSEP(stdName = "autoQC4L", + between=input$autoQC4L, howoften = input$QC4Lo, howmany = input$QC4Lm, - begin=("3" %in% input$start3), - end=("3" %in% input$end3), volume = 2) %>% + begin = "3" %in% c(input$start1,input$start2, input$start3), + end = "3" %in% c(input$end1,input$end2, input$end3), volume = 2) %>% .mapPlatePositionEVOSEP(volume = 1) %>% .formatHyStar(dataPath = paste0("D:\\Data2San\\p", input$project, "\\", input$area, "\\", @@ -426,17 +439,24 @@ shinyServer(function(input, output, session) { rv <- inputSampleTable %>% .mapPlatePositionNanoElute %>% .insertStandardsNanoElute(stdName = "washing", stdPosX='52', stdPosY='1', plate = 2, - howoften = input$cleano, - howmany = input$cleanm, - volume = 4) %>% + between=input$clean, + howoften = input$cleano, + howmany = input$cleanm, + volume = 4, + begin = "4" %in% c(input$start1,input$start2, input$start3), + end = "4" %in% c(input$end1,input$end2, input$end3)) %>% .insertStandardsNanoElute(stdName = "autoQC01", stdPosX='53', stdPosY='1', plate = 2, - howoften = input$QC01o, - howmany = input$QC01m) %>% + between=input$autoQC01, + howoften = input$QC01o, + howmany = input$QC01m, + begin = "1" %in% c(input$start1,input$start2, input$start3), + end = "1" %in% c(input$end1,input$end2, input$end3)) %>% .insertStandardsNanoElute(stdName = "autoQC4L", stdPosX='54', stdPosY='1', plate = 2, - howoften = input$QC4Lo, - howmany = input$QC4Lm, - begin=("3" %in% input$start3), - end=("3" %in% input$end3)) %>% + between=input$autoQC4L, + howoften = input$QC4Lo, + howmany = input$QC4Lm, + begin = "3" %in% c(input$start1,input$start2, input$start3), + end = "3" %in% c(input$end1,input$end2, input$end3), volume = 2) %>% .formatHyStar(dataPath = paste0("D:\\Data2San\\p", input$project, "\\", input$area, "\\", input$instrument, "\\",