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

grepcol.R 1.35 KB
Newer Older
fsoubes's avatar
fsoubes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
### 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


#' adjusted is a reactive function that return a list containing multiple data frames
#' with the adj.P.val, logFC and P.value selected for the corresponding groups
#'
#' @param csvf Data frame corresponding to the Alltoptable
#'
#' @return adjusted a reactive list of data frames
#'
#' @export


adjusted <- reactive({
  
  req(csvf())
  
  myrpl = c("^adj.P.Val_","^logFC_","^P.value_")
  grepdf = c("X|^adj.P.Val","X|^logFC","X|^P.value")
  
  adj = csvf()[[3]][, grep("^X|^adj.P.Val",
                           names(csvf()[[3]]),
                           value = TRUE)]
  
  logfc = csvf()[[3]][, grep("^X|^logFC",
                             names(csvf()[[3]]),
                             value = TRUE)]
  
  pval = csvf()[[3]][, grep("^X|^P.value",
                            names(csvf()[[3]]),
                            value = TRUE)]
  
  mygrep = list(adj,logfc,pval)
fsoubes's avatar
fsoubes committed
39

fsoubes's avatar
fsoubes committed
40 41 42 43 44 45 46
  for(i in 1:length(mygrep))
    names(mygrep[[i]]) = gsub(
      pattern = myrpl[i],
      replacement = "",
      x = names(mygrep[[i]]),
      perl = T
    )
fsoubes's avatar
fsoubes committed
47

fsoubes's avatar
fsoubes committed
48 49 50 51
  
  return(mygrep)
  
})