library(igfuns)
library(dplyr)
library(kableExtra)
server <- function(input, output, session) {
# Tables
output$table_bregs <- renderDataTable({
bregs
})
output$chisq_table_1 <- function(){
react_chisq_test()$observed %>%
kable() %>%
kable_styling("striped")
}
output$chisq_table_2 <- function(){
react_chisq_test()$expected %>%
kable() %>%
kable_styling("striped")
}
output$fisher_table_1 <- function(){
react_fisher_test()$observed %>%
kable() %>%
kable_styling("striped")
}
output$fisher_table_2 <- function(){
react_fisher_test()$expected %>%
kable() %>%
kable_styling("striped")
}
## Gene frequencies
output$v_gene_table <- renderDataTable({
get_freq(v)
})
output$j_gene_table <- renderDataTable({
get_freq(j)
})
# Render prints
output$chisq_result <- renderPrint({
react_chisq_test()
})
output$fisher_result <- renderPrint({
react_fisher_test()
})
output$text_bregs <- renderPrint({
summary(react_df_charges_gravy())
})
output$print_select_input_1 <- renderPrint({
input$select_input_1
})
# Render UI
output$ui_select_input_1 <- renderUI({
choices <-
react_df_charges_gravy() %>%
select(-c(v, j, b_cell_subset, sample))
list_choices <-
as.list(setNames(choices, choices))
selectInput("select_input_1",
label = "Select a qualitative variable",
choices = list_choices,
multiple = FALSE)
})
# Reactives
react_df_1 <- reactive({
df_1 <-
bregs %>%
select(v, j) %>%
table()
df_1
})
react_chisq_test <- reactive({
chisq.test(react_df_1())
})
react_fisher_test <- reactive({
fisher.test(react_df_1())
})
#
react_df_charges_gravy <- reactive({
bregs %>%
select(sample, b_cell_subset,
pos_ch_cdr3, neg_ch_cdr3,
pos_ch_vreg, neg_ch_vreg,
gravy_cdr3, gravy_vreg,
length, length_v,
v, j)
})
# Plots
output$donut_v_plot <- renderPlot({
df_1 <- get_freq(v)
get_donut_plot(df_1, freq, v)
})
output$donut_j_plot <- renderPlot({
df_1 <- get_freq(j)
get_donut_plot(df_1, freq, j)
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.