Skip to content

Commit

Permalink
feat: resection_site and primary_diagnosis added
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliversinn committed Dec 16, 2023
1 parent fc670b9 commit ce46770
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dashboard/explorer.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ project_id_dt <- function(data) {
return(data)
}

primary_site_barplot <- function(data, variable_name) {
aggregation_substr_barplot <- function(data, variable_name) {
data <- as.data.frame(data)

xticks_labels <- as.list(substr(data$key, 1, 30))
Expand Down
9 changes: 0 additions & 9 deletions Dashboard/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ library(DT)
library(BiocManager)
options(repos = BiocManager::repositories())

projects <- GenomicDataCommons::projects() %>%
GenomicDataCommons::filter(program.name == "TCGA") %>%
GenomicDataCommons::facet(c("name", "project_id")) %>%
results_all()

tcga_project_ids_list <- projects$project_id
tcga_project_ids_list <- c("TODOS", tcga_project_ids_list)


Sys.setenv(OPENSSL_CONF = "/dev/null")
options(shiny.fullstacktrace = TRUE)

Expand Down
48 changes: 46 additions & 2 deletions Dashboard/server.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
function(input, output, session) {
# Static data ----
projects <- GenomicDataCommons::projects() %>%
GenomicDataCommons::filter(program.name == "TCGA") %>%
GenomicDataCommons::facet(c("name", "project_id")) %>%
results_all()

tcga_project_ids_list <- projects$project_id
tcga_project_ids_list <- c("TODOS", tcga_project_ids_list)
# Filters ---
## projects_reactive ----
projects_reactive <- reactive({
Expand Down Expand Up @@ -123,7 +131,7 @@ function(input, output, session) {
## primary_site ----
### barplot ----
output$primary_site_barplot <- renderPlotly({
primary_site_barplot(
aggregation_substr_barplot(
head(explorer_data_reactive()$primary_site, 30),
"Sitio primario"
)
Expand All @@ -138,6 +146,42 @@ function(input, output, session) {
)
})

## primary_diagnosis ----
### barplot ----
output$primary_diagnosis_barplot <- renderPlotly({
aggregation_substr_barplot(
head(explorer_data_reactive()$diagnoses.primary_diagnosis, 30),
"Diagnóstico primario"
)
})

### datatable ----
output$primary_diagnosis_dt <- renderDataTable({
aggregation_dt(
explorer_data_reactive()$diagnoses.primary_diagnosis,
"Diagnóstico primario",
"casos_por_diagnostico_primario"
)
})

## site_of_resection_or_biopsy ----
### barplot ----
output$resection_site_barplot <- renderPlotly({
aggregation_substr_barplot(
head(explorer_data_reactive()$diagnoses.site_of_resection_or_biopsy, 30),
"Sitio de Resección o Biopsia"
)
})

### datatable ----
output$resection_site_dt <- renderDataTable({
aggregation_dt(
explorer_data_reactive()$diagnoses.site_of_resection_or_biopsy,
"Sitio de Resección o Biopsia",
"casos_por_sitio_de_reseccion_o_biopsia"
)
})

## race ----
### barplot ----
output$race_barplot <- renderPlotly({
Expand Down Expand Up @@ -186,7 +230,7 @@ function(input, output, session) {
output$gender_dt <- renderDataTable({
aggregation_dt(
explorer_data_reactive()$demographic.gender,
"Genero",
"Género",
"casos_por_genero"
)
})
Expand Down
78 changes: 77 additions & 1 deletion Dashboard/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ fluidPage(
## Tab EXPLORADOR ----
tabItem(
tabName = "EXPLORADOR",
h2("Explorador de datos"),
h1("Explorador de datos"),
br(),
h2("Proyectos"),
br(),
fluidRow(
width = 12,
Expand Down Expand Up @@ -163,6 +165,80 @@ fluidPage(
)
)
),
fluidRow(
width = 12,
### primary_diagnosis ----
box(
width = 6,
solidHeader = TRUE,
collapsible = TRUE,
title = "Número de casos por diagnóstico primario",
tabBox(
width = 12,
height = NULL,
#### barplot ----
tabPanel(
title = "Gráfico de barras",
icon = icon("chart-bar"),
h4(
class = "text-center",
"Número de Casos por Diagnóstico Primario (top 30)"
),
shinycssloaders::withSpinner(
plotlyOutput("primary_diagnosis_barplot", height = 500),
color = "#1c9ad6", type = "8", size = 0.5
)
),
#### datatable ----
tabPanel(
title = "Cuadro de datos",
icon = icon("table"),
shinycssloaders::withSpinner(
dataTableOutput("primary_diagnosis_dt"),
color = "#1c9ad6", type = "8", size = 0.5
)
)
)
),
### site_of_resection_or_biopsy ----
box(
width = 6,
solidHeader = TRUE,
collapsible = TRUE,
title = "Número de casos por sitio de resección o biopsia",
tabBox(
width = 12,
height = NULL,
#### barplot ----
tabPanel(
title = "Gráfico de barras",
icon = icon("chart-bar"),
h4(
class = "text-center",
paste0(
"Número de Casos por ",
"Sitio de Resección o Biopsia (top 30)"
)
),
shinycssloaders::withSpinner(
plotlyOutput("resection_site_barplot", height = 500),
color = "#1c9ad6", type = "8", size = 0.5
)
),
#### datatable ----
tabPanel(
title = "Cuadro de datos",
icon = icon("table"),
shinycssloaders::withSpinner(
dataTableOutput("resection_site_dt"),
color = "#1c9ad6", type = "8", size = 0.5
)
)
)
)
),
h2("Demografía"),
br(),
fluidRow(
### race ----
box(
Expand Down

0 comments on commit ce46770

Please sign in to comment.