Skip to content

Commit

Permalink
Crash fix sig ana (#420)
Browse files Browse the repository at this point in the history
* check for number of genes and trow explicit error

* add hiding of tabs to avoid usage of results; ; fixes #417

* changed to show debug text again; to let user know what is going on addresses #421 (#423)
  • Loading branch information
LeaSeep authored Dec 17, 2024
1 parent 9038884 commit 7ad0b54
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions program/shinyApp/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -1434,11 +1434,15 @@ server <- function(input,output,session){
# new object Created for res_tmp[[session$token]]
res_tmp[[session$token]]$data <<- res_tmp[[session$token]]$data[rownames(res_tmp[[session$token]]$data),]
par_tmp[[session$token]]['BatchColumn'] <<- input$BatchEffect_Column

# preprocessing
print(paste0("Do chosen Preprocessing:",input$PreProcessing_Procedure))

# Check for DESeq option if more than 100 genes avail as it is for omics!

tryCatch({
if(input$PreProcessing_Procedure == "vst_DESeq"){
if(input$PreProcessing_Procedure == "vst_DESeq" & nrow(res_tmp[[session$token]]$data) < 100){
stop("DESeq Preprocessing is only recommended for omics (here for data with more than 100 genes). Change Pre-processing or your data input!")
}else if(input$PreProcessing_Procedure == "vst_DESeq"& nrow(res_tmp[[session$token]]$data) >= 100){
res_tmp[[session$token]]$data <<- deseq_processing(
data = res_tmp[[session$token]]$data,
omic_type = par_tmp[[session$token]]$omic_type,
Expand All @@ -1455,6 +1459,16 @@ server <- function(input,output,session){
}
}, error = function(e){
error_modal(e)
output$Statisitcs_Data <- renderText({
HTML("<span style='color: red;'>There has been an error</span><br>The current data might not be what you expect.<br>Ensure you change something within the data or the Pre-Processing,<br>and click 'Get Pre-Processing' again.<br><span style='color: red;'>You should not see this message before moving to analysis!</span><br>")
})
hideTab(inputId = "tabsetPanel1", target = "Sample Correlation")
hideTab(inputId = "tabsetPanel1", target = "Significance Analysis")
hideTab(inputId = "tabsetPanel1", target = "PCA")
hideTab(inputId = "tabsetPanel1", target = "Heatmap")
hideTab(inputId = "tabsetPanel1", target = "Single Gene Visualisations")
hideTab(inputId = "tabsetPanel1", target = "Enrichment Analysis")

waiter$hide()
req(FALSE)
})
Expand All @@ -1469,9 +1483,18 @@ server <- function(input,output,session){
)
}, error = function(e){
error_modal(
e, additional_text = "Batch correction failed. Make sure the batch effect column is correct!"
e, additional_text = "Batch correction failed. Make sure the batch effect column is correct or NULL!"
)
waiter$hide()
output$Statisitcs_Data <- renderText({
HTML("<span style='color: red;'>There has been an error</span><br>The current data might not be what you expect.<br>Ensure you change something within the data or the Pre-Processing,<br>and click 'Get Pre-Processing' again.<br><span style='color: red;'>You should not see this message before moving to analysis!</span><br>")
})
hideTab(inputId = "tabsetPanel1", target = "Sample Correlation")
hideTab(inputId = "tabsetPanel1", target = "Significance Analysis")
hideTab(inputId = "tabsetPanel1", target = "PCA")
hideTab(inputId = "tabsetPanel1", target = "Heatmap")
hideTab(inputId = "tabsetPanel1", target = "Single Gene Visualisations")
hideTab(inputId = "tabsetPanel1", target = "Enrichment Analysis")
req(FALSE)
})
} else if (input$BatchEffect_Column != "NULL" & input$PreProcessing_Procedure == "vst_DESeq"){
Expand All @@ -1493,6 +1516,15 @@ server <- function(input,output,session){
)
)
waiter$hide()
output$Statisitcs_Data <- renderText({
HTML("<span style='color: red;'>There has been an error</span><br>The current data might not be what you expect.<br>Ensure you change something within the data or the Pre-Processing,<br>and click 'Get Pre-Processing' again.<br><span style='color: red;'>You should not see this message before moving to analysis!</span><br>")
})
hideTab(inputId = "tabsetPanel1", target = "Sample Correlation")
hideTab(inputId = "tabsetPanel1", target = "Significance Analysis")
hideTab(inputId = "tabsetPanel1", target = "PCA")
hideTab(inputId = "tabsetPanel1", target = "Heatmap")
hideTab(inputId = "tabsetPanel1", target = "Single Gene Visualisations")
hideTab(inputId = "tabsetPanel1", target = "Enrichment Analysis")
req(FALSE)
})
} else {
Expand Down

0 comments on commit 7ad0b54

Please sign in to comment.