Skip to content

Commit

Permalink
GUI added logic for HyStar
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanse committed Apr 1, 2021
1 parent d7991fa commit 0ba430b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 29 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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<[email protected]>
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
Expand Down
29 changes: 17 additions & 12 deletions inst/shiny/queue_generator10/queuetools.R
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
52 changes: 36 additions & 16 deletions inst/shiny/queue_generator10/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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, "\\",
Expand All @@ -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, "\\",
Expand Down

0 comments on commit 0ba430b

Please sign in to comment.