Skip to content
Snippets Groups Projects
app.Rmd 33.9 KiB
Newer Older
Todor Kondic's avatar
Todor Kondic committed
    l <- c(if (checked[["MS2 EIC"]]) "ms2_eic_int" else NULL,l)
    l <- c(if (checked[["MS2 Spectrum"]]) "ms2_spec_int" else NULL,l)
    rv_state$conf$figures[["logaxes"]] <- l[!sapply(l,is.null)]
	
	rv_state$conf$figures$rt_min <- uni_ass("plot_rt_min","plot_rt_min_unit")
	rv_state$conf$figures$rt_max <- uni_ass("plot_rt_max","plot_rt_max_unit")
})
```
<!-- Report -->
```{r, include='false', context = 'server'}
observe({
	rv_state$conf$report$author <- input$rep_aut
	rv_state$conf$report$title <- input$rep_tit
})
```

<!-- Render -->
```{r, include="false", context="server"}
output$project <- renderText(rv_state$conf$project)

output$comp_lists <- renderText({
    lsts <- rev2list(rv_state$conf$compounds$lists)
    if (length(lsts) > 0 &&
        isTruthy(lsts) &&
        lsts != "Nothing selected.") {
        paste(c("<ul>",
                sapply(lsts,
                       function (x) paste("<li>",x,"</li>")),
                "</ul>"))
    } else "No compound list selected yet."
})

output$setids <- renderText({
    sets <- rv_state$conf$compounds$sets
    if (isTruthy(sets) && sets != "Nothing selected.")
        paste("selected <em>setid</em> table:",
              sets) else "No <em>setid</em> table selected."
})

Todor Kondic's avatar
Todor Kondic committed
output$order_summ <- rhandsontable::renderRHandsontable(rhandsontable::rhandsontable(def_ord_summ,
                                                                                     manualRowMove = T))

output$datafiles <- rhandsontable::renderRHandsontable(
{
Todor Kondic's avatar
Todor Kondic committed
    res <- rv_dfiles()
    rhandsontable::rhandsontable(as.data.frame(res),
                                 width = "50%",
                                 height = "25%",
                                 allowInvalid=F)
})

output$datatab <- rhandsontable::renderRHandsontable(
{
    setid <- rv_state$input$tab$setid
Todor Kondic's avatar
Todor Kondic committed
    res <- rv_datatab()
Todor Kondic's avatar
Todor Kondic committed
    if (NROW(res)>0) {
        res$tag <- factor(res$tag,
                          levels = c(unique(res$tag),
                                              "invalid"))
        res$set <- factor(res$set,
                          levels = c(unique(setid$set),
                                             "invalid"))
        res$adduct <- factor(res$adduct,
                             levels = shinyscreen:::DISP_ADDUCTS)
    }


    rhandsontable::rhandsontable(res,stretchH="all",
                                 allowInvalid=F)
})

output$comp_table <- DT::renderDataTable({
    state <- rf_compound_input_state()


    DT::datatable(state$input$tab$cmpds,
                  style = 'bootstrap',
                  class = 'table-condensed',
                  extensions = 'Scroller',
                  options = list(scrollX = T,
                                 scrollY = 200,
                                 deferRender = T,
                                 scroller = T))
})

output$setid_table <- DT::renderDataTable({
    state <- rf_compound_input_state()

    DT::datatable(state$input$tab$setid,
                  style = 'bootstrap',
                  class = 'table-condensed',
                  extensions = 'Scroller',
                  options = list(scrollX = T,
                                 scrollY = 200,
                                 deferRender = T,
                                 scroller = T))

output$summ_subset <- rhandsontable::renderRHandsontable({
    

    rhandsontable::rhandsontable(def_summ_subset)
})

output$summ_table <- DT::renderDataTable({

    
    tab <- rv_state$out$tab$flt_summ
    nms <- colnames(tab)
    dpl_nms <- nms[nms!="Files"]
    validate(need(NROW(tab)>0, message = "Please prescreen the data first."))
    DT::datatable(tab[,..dpl_nms],
                  style = 'bootstrap',
                  class = 'table-condensed',
                  extensions = 'Scroller',
                  options = list(scrollX = T,
                                 scrollY = 200,
                                 deferRender = T,
                                 scroller = T))
})
output$plot_set_b_ctrl <- renderUI({
    tab <- rv_state$out$tab$flt_summ
    req(NROW(tab)>0)
    selectInput(inputId = "plot_set_b",
                label = "Select set",
                choices = c("uninitialised"=0))
})

output$plot_b_ctrl <- renderUI({
    tab <- rv_state$out$tab$flt_summ
    req(NROW(tab)>0)
    actionButton(inputId = "plot_b",
             label= "Generate plots")
    
})
```
```{r, echo=F, context = 'server'}
session$onSessionEnded(function () stopApp())
Todor Kondic's avatar
Todor Kondic committed
```