Maintenance - Mise à jour mensuelle Lundi 6 Avril 2020 entre 7h00 et 9h00

checkboxcontrast.R 1.9 KB
Newer Older
fsoubes's avatar
fsoubes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
### Author: Franck Soubès
### Bioinformatics Master Degree - University of Bordeaux, France
### Link: https://github.com/fsoubes/MA_Trix_App
### Where: GET-TRiX's facility
### Application: MATRiX is a shiny application for Microarray Analysis on Transcriptomic impact of Xenobiotics
### Licence: GPL-3.0


#################################
######## Select the comparisons #
#################################

# Render in the UI.R the levels for the pData Group 

observe({
  
fsoubes's avatar
fsoubes committed
17
groupinline = ifelse(length(levels(csvf()[[2]]$Grp)) > 6, T, F)  
fsoubes's avatar
fsoubes committed
18 19 20 21 22

output$testout <- renderUI(
  checkboxGroupInput(
    inputId = "test" ,
    label =  "Choose your comparison",
fsoubes's avatar
fsoubes committed
23
    choices =  colnames(adjusted()[[1]][,-1,drop = FALSE]),
fsoubes's avatar
fsoubes committed
24 25 26 27 28 29
    #,selected = colnames(adjusted()[, -1])
    inline = groupinline
  )
)
})

fsoubes's avatar
fsoubes committed
30 31


fsoubes's avatar
fsoubes committed
32 33 34 35 36 37 38 39
#Select all the contrasts

observeEvent(input$allTests, {
  groupinline = ifelse(length(levels(csvf()[[2]]$Grp)) > 6, T, F)
  updateCheckboxGroupInput(
    session,
    "test",
    label = "Choose your comparison",
fsoubes's avatar
fsoubes committed
40 41
    choices = colnames(adjusted()[[1]][,-1,drop = FALSE]),
    selected = colnames(adjusted()[[1]][,-1,drop = FALSE]),
fsoubes's avatar
fsoubes committed
42 43 44 45 46 47 48 49 50 51
    inline = groupinline
  )
})

#Unselect all the contrasts
observeEvent(input$noTests, {
  groupinline = ifelse(length(levels(csvf()[[2]]$Grp)) > 6, T, F)
  updateCheckboxGroupInput(session,
                           "test",
                           label = "Choose your comparison",
fsoubes's avatar
fsoubes committed
52
                           choices = colnames(adjusted()[[1]][, -1,drop = FALSE]),
fsoubes's avatar
fsoubes committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
                           inline= groupinline
                           )
})


#' choix_test is an eventreactive function in the aim of selecting different comparison after a clickable event
#'
#' @param test input id corresponding to the checkboxgroup for the different comparisons
#'
#' @return  a reactive value of type character for the different comparisons selected
#'
#' @export

choix_test <- reactive({
  return(input$test)
})