-
Notifications
You must be signed in to change notification settings - Fork 2
/
variantEDA_module.R
executable file
·86 lines (68 loc) · 3.15 KB
/
variantEDA_module.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# UI function for the differentially expressed gene table module
wgsTriosUI <- function(id, label = "Differentially expressed gene table") {
library(DT)
library(shinyWidgets)
ns <- NS(id) # Setting a unique namespace for this module
fluidPage(theme = shinytheme("lumen"),
tags$head(tags$style(HTML('.shiny-output-error-validation { color: #93C54B; }'))), # Custom CSS to modify the app error messages
sidebarLayout(
position = "left",
sidebarPanel(
helpText("placeholder"),
),
mainPanel(position = "right",
fluidRow(
box(width = 12, div(style = 'overflow-x: scroll'))
)
)
)
)
)
}
# Server function for the differentially expressed gene table module
wgsTriosTable <- function(input, output, session, gene, table, parent) {
library(tidyverse)
library(DT)
library(shinyWidgets)
`%then%` <- shiny:::`%OR%` # See https://shiny.rstudio.com/articles/validation.html for details on the %then% operator
# Making a function to generate a summary table with outcome data
tableFun <- reactive({
validate(
need(gene(), "Please enter a gene symbol or miRNA in the text box to the left.")
)
table %>%
mutate(across(where(is.numeric), ~round(., 2))) %>%
filter(Gene_Symbol == gene()) %>%
arrange(desc(logFC))
})
# https://glin.github.io/reactable/articles/examples.html#conditional-styling
output$filteredTable <- DT::renderDataTable({
DT::datatable(tableFun(),
class = "compact nowrap hover row-border order-column", # Defines the CSS formatting of the final table, can string multiple options together
extensions = 'Buttons', # See https://rstudio.github.io/DT/extensions.html for more extensions & features
options = list(scrollY = "70vh",
dom = 'Bfrtip',
buttons = c('excel'),
scrollX = TRUE,
fixedColumns = list(leftColumns = 1),
searchHighlight = TRUE,
pageLength = 25),
escape = F) %>%
DT::formatStyle(columns = c(1,2,4), fontSize = "100%")
})
observeEvent(input$col_key, {
showModal( # Tells Shiny to create a modal popup when the corresponding button is activated
modalDialog(
title = "Differential Expression Analysis Results Key",
DT::renderDataTable(# Interactively renders the datatable
DT::datatable(deColKey, # Actually produces the datatable table object
class = "stripe row-border",
options = list(dom = "t", pageLength = nrow(deColKey)),
width = "500",
rownames = F) %>%
DT::formatStyle(columns = c(1,2), fontSize = "90%"),
),
easyClose = TRUE)
)
})
}