-
Notifications
You must be signed in to change notification settings - Fork 0
/
widgetReadCountPostprocessing.R
56 lines (40 loc) · 1.49 KB
/
widgetReadCountPostprocessing.R
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#'
#' Defines widget that contains the functions to process read counts.
#'
library(DT)
library(shiny)
source("uiHelper.R")
source("helpers.R")
source("readcounts.R")
source("defaultParameters.R")
readCountPostprocessingUI <- function(id) {
ns <- NS(id)
return(tagList(
checkboxInput(ns("postprocessing.remove.constant"), "Remove genes with constant readcounts", value = default.data.postprocessing.removeconstant)
))
}
readCountPostprocessingData_ <- function(input,
output,
session,
dataset) {
return(reactive({
validate(need(dataset(), "[Read count processing] No read counts to process!"))
validate(need(dataset()$readcounts.normalized, "[Read count processing] No read counts to process!"))
dataset <- dataset()
output <- list(removed.genes = c(), operation.remove.constant = F)
# Remove constant read genes
if(input$postprocessing.remove.constant) {
processed <- removeConstantReads(dataset$readcounts.normalized)
output$removed.genes <- processed$genes.removed
output$operation.remove.constant <- T
dataset$readcounts.processed <- processed$readcounts
}
dataset$readcounts.postprocessing.parameters <- output
return(dataset)
}))
}
readCountPostprocessingData <- function(id, dataset) {
return(callModule(readCountPostprocessingData_,
id,
dataset = dataset))
}