-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error Handling enrichment Analysis (#164)
* Correct tryCatch placement, shiny does not fail anymore when supplying wrong organism or type of annotation. * Switching between Modals now, no double appearance. * Small adjustment to modal. * Added Contactmail
- Loading branch information
1 parent
ff79bc1
commit 72ea5bd
Showing
2 changed files
with
59 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,11 +725,16 @@ enrichment_analysis_Server <- function(id, data, params, updates){ | |
anno_results <- check_annotation_enrichment_analysis(ea_reactives$data) | ||
ea_reactives$data <- anno_results$new_data | ||
ea_reactives$can_start <- anno_results$can_start | ||
if(anno_results$no_ann){ | ||
translation_modal <- function(){ | ||
showModal(modalDialog( | ||
title = "No annotation type detected", | ||
footer = NULL, | ||
p("No valid annotation type was detected in your row annotation. Please indicate the type of annotation with which you uploaded your genes."), | ||
p(paste0( | ||
"No valid annotation type was detected in your row annotation. ", | ||
"Please indicate the type of annotation with which you uploaded your genes.\n", | ||
"Here are the first 5 rownames of your row annotation: \n", | ||
toString(rownames(ea_reactives$data)[1:5]) | ||
)), | ||
selectInput( | ||
inputId = ns("AnnotationSelection"), | ||
label = "Which annotation are you using?", | ||
|
@@ -739,6 +744,9 @@ enrichment_analysis_Server <- function(id, data, params, updates){ | |
), | ||
actionButton(inputId = ns("AMC"), label = "Proceed"), | ||
)) | ||
} | ||
if(anno_results$no_ann){ | ||
translation_modal() | ||
}else if(anno_results$can_start == FALSE){ | ||
if(input$ORA_or_GSE == "GeneSetEnrichment"){ | ||
ea_reactives$data <- translate_genes_ea( | ||
|
@@ -757,25 +765,54 @@ enrichment_analysis_Server <- function(id, data, params, updates){ | |
} | ||
ea_reactives$can_start <- TRUE | ||
} | ||
# Modal in case translation fails | ||
observeEvent(input$translation_again, { | ||
# close modal | ||
removeModal() | ||
# call translation again | ||
translation_modal() | ||
}) | ||
# close modal on button click | ||
observeEvent(input$AMC, { | ||
anno_results$base_annotation <- input$AnnotationSelection | ||
removeModal() | ||
if(input$ORA_or_GSE == "GeneSetEnrichment"){ | ||
ea_reactives$data <- translate_genes_ea( | ||
data = ea_reactives$data, | ||
annotation_results = anno_results, | ||
input = input | ||
) | ||
}else{ | ||
ea_reactives$tmp_genes <<- translate_genes_oa( | ||
annotation_results = anno_results, | ||
input = input, | ||
geneSetChoice = ea_reactives$tmp_genes, | ||
geneSet2Enrich = input$GeneSet2Enrich | ||
tryCatch( | ||
{ | ||
if(input$ORA_or_GSE == "GeneSetEnrichment"){ | ||
ea_reactives$data <- translate_genes_ea( | ||
data = ea_reactives$data, | ||
annotation_results = anno_results, | ||
input = input | ||
) | ||
}else{ | ||
ea_reactives$tmp_genes <- translate_genes_oa( | ||
annotation_results = anno_results, | ||
input = input, | ||
geneSetChoice = ea_reactives$tmp_genes, | ||
geneSet2Enrich = input$GeneSet2Enrich | ||
) | ||
} | ||
ea_reactives$can_start <- TRUE | ||
}, | ||
error=function(e){ | ||
showModal(modalDialog( | ||
title = HTML("<font color='red'>An Error occured</font>"), | ||
footer = actionButton( | ||
inputId = ns("translation_again"), | ||
label = "Choose another annotation type" | ||
), | ||
HTML(paste0( | ||
"<font color='red'>Error: ",e$message,"</font><br><br>", | ||
"It is highly likely that the error is caused by the fact that the ", | ||
"gene names in your data set do not match the gene names in the ", | ||
"annotation you selected. Please check your data set and annotation ", | ||
"and try again.<br><br>", | ||
"Otherwise, please contact the cOmicsArtist Lea and Paul ", | ||
"(<a href = 'mailto: [email protected]'>[email protected]</a>)." | ||
)) | ||
)) | ||
} | ||
) | ||
} | ||
ea_reactives$can_start <- TRUE | ||
}) | ||
# start the analysis if ea_reactives$can_start == TRUE | ||
observeEvent(ea_reactives$can_start, { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters