From 62b19ceb39c390fffc19078ec34b2d8b5809f548 Mon Sep 17 00:00:00 2001 From: lishensuo <80585985+lishensuo@users.noreply.github.com> Date: Fri, 26 Jan 2024 22:35:00 +0800 Subject: [PATCH] fig a bug when grouping sample --- .../modules/function/modules-z-group-sample.R | 22 +++++++++++++------ inst/shinyapp/server/modules.R | 2 +- inst/shinyapp/ui/pancan-analysis-quick.R | 2 +- inst/shinyapp/ui/pancan-analysis-tcga.R | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/inst/shinyapp/modules/function/modules-z-group-sample.R b/inst/shinyapp/modules/function/modules-z-group-sample.R index 6e16f977..3a789115 100644 --- a/inst/shinyapp/modules/function/modules-z-group-sample.R +++ b/inst/shinyapp/modules/function/modules-z-group-sample.R @@ -281,17 +281,22 @@ group_samples_Server = function(input, output, session, database = "toil", dplyr::filter(Sample %in% samples()) } } - x_data$level1 = L1_x - x_data$cancer = clinical_phe[,2,drop=T][match(x_data$Sample, clinical_phe$Sample)] - x_data = x_data[,c("id","level1","level2","Sample","value","cancer")] %>% - dplyr::arrange(cancer, Sample) - x_data + # req(nrow(x_data)>0) + if(nrow(x_data)>0){ + x_data$level1 = L1_x + x_data$cancer = clinical_phe[,2,drop=T][match(x_data$Sample, clinical_phe$Sample)] + x_data = x_data[,c("id","level1","level2","Sample","value","cancer")] %>% + dplyr::arrange(cancer, Sample) + x_data + } else { + NULL + } + }) # output$condi_dist = renderPrint({head(condi_data())}) output$condi_dist = renderPrint({ - if(is.null(condi_data())) return("No item is chosen.") - + if(is.null(condi_data())) return("No valid sammple for the identifier.") if(class(condi_data()[,"value",drop=TRUE])=="numeric"){ summary(condi_data()[,"value",drop=TRUE]) } else { @@ -301,6 +306,7 @@ group_samples_Server = function(input, output, session, database = "toil", output$set_quantile.ui = renderUI({ + req(!is.null(condi_data())) choice_chrs = condi_data()$value if(class(choice_chrs)!="character"){ materialSwitch(ns("set_quantile"),"Whether group by percentile?",value = TRUE) @@ -311,6 +317,7 @@ group_samples_Server = function(input, output, session, database = "toil", # 创建两分组 output$set_group1.ui = renderUI({ + req(!is.null(condi_data())) choice_chrs = condi_data()$value fluidRow( if(class(choice_chrs)=="character"){ @@ -339,6 +346,7 @@ group_samples_Server = function(input, output, session, database = "toil", }) output$set_group2.ui = renderUI({ + req(!is.null(condi_data())) choice_chrs = condi_data()$value fluidRow( if(class(choice_chrs)=="character"){ diff --git a/inst/shinyapp/server/modules.R b/inst/shinyapp/server/modules.R index ec5f3b51..66dc254f 100644 --- a/inst/shinyapp/server/modules.R +++ b/inst/shinyapp/server/modules.R @@ -144,7 +144,7 @@ observeEvent(req(input$navbar=="CCLE: Comparison Analysis"),{ # # identifier help -observeEvent(req(input$navbar=="Id reference"),{ +observeEvent(req(input$navbar=="ID Query"),{ callModule(server.modules_id_reference, "modules_id_reference") }, once = TRUE) diff --git a/inst/shinyapp/ui/pancan-analysis-quick.R b/inst/shinyapp/ui/pancan-analysis-quick.R index 2611463f..d87285bf 100644 --- a/inst/shinyapp/ui/pancan-analysis-quick.R +++ b/inst/shinyapp/ui/pancan-analysis-quick.R @@ -1,6 +1,6 @@ ui.page_pancan_quick <- function() { navbarMenu( - title = "Quick TCGA/PCAWG/CCLE Analysis", + title = "Quick T·P·C Analysis", icon = icon("buromobelexperte"), # tabPanel( # "Combo: Single Gene Analysis", diff --git a/inst/shinyapp/ui/pancan-analysis-tcga.R b/inst/shinyapp/ui/pancan-analysis-tcga.R index 6a57bc59..fdd9f6d4 100644 --- a/inst/shinyapp/ui/pancan-analysis-tcga.R +++ b/inst/shinyapp/ui/pancan-analysis-tcga.R @@ -1,6 +1,6 @@ ui.page_pancan_tcga <- function() { navbarMenu( - title = "Personalized TCGA/PCAWG/CCLE Analysis", + title = "Personalized T·P·C Analysis", icon = icon("buromobelexperte"), #### TCGA tabPanel(