Skip to content

Commit 4535223

Browse files
committed
trycatch around DE analysis + info on uploading raw intensities
1 parent de2cf5a commit 4535223

3 files changed

Lines changed: 75 additions & 55 deletions

File tree

server/de_analysis_server.R

Lines changed: 72 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -82,58 +82,78 @@ observeEvent(input$performDEAnalysis, {
8282
robust <- input$deLimmaRobust
8383

8484
# run DE analysis
85-
de_results <- run_DE(reactiveVals$se,
86-
comparisons = comparisons,
87-
ain = ain,
88-
condition = condition,
89-
DE_method = method,
90-
logFC = logfc_b,
91-
logFC_up = logfc,
92-
logFC_down = -logfc,
93-
p_adj = padj_b,
94-
alpha = p,
95-
K = K,
96-
B = B,
97-
DEqMS_PSMs_column = DEqMS_column)
98-
99-
# save current settings
100-
de_current <- data.table("Method" = c(method),
101-
"Input Data" = c(ain),
102-
"Comparisons" = c(comparisons)
103-
)
104-
if(method == "ROTS"){
105-
de_current$K <- c(K)
106-
de_current$B <- c(B)
107-
}
108-
if(method == "DEqMS"){
109-
de_current$DEqMS_column <- c(DEqMS_column)
110-
}
111-
if(logfc_b){
112-
de_current[ , ":=" ("LogFC Thr" = logfc)]
113-
}
114-
if(padj_b){
115-
de_current[ , ":=" ("P.Adj Thr" = p)]
116-
} else {
117-
de_current[ , ":=" ("P.Value Thr" = p)]
118-
}
119-
120-
reactiveVals$de_current <- de_current
121-
reactiveVals$de_results <- de_results
122-
reactiveVals$de_condition <- condition
123-
124-
updatePickerInput(session = session, inputId = "deVisComparison", choices = comparisons, selected = comparisons)
125-
updatePickerInput(session = session, inputId = "deVisAin", choices = ain, selected = ain)
126-
127-
# check if gene names column empty
128-
#rd <- as.data.table(rowData(reactiveVals$se))
129-
#if(sum(is.na(rd$Gene.Names)) == nrow(rd)){
130-
# biomarker_col <- c("Protein.IDs")
131-
#} else {
132-
# biomarker_col <- c("Protein.IDs", "Gene.Names")
133-
#}
134-
#updatePickerInput(session = session, inputId = "deBiomarkerColumn", choices = biomarker_col, selected = biomarker_col[[1]])
135-
shinyjs::runjs("openBox('deEvaluation')")
136-
shinyjs::runjs("openBox('deOverviewVis')")
85+
tryCatch({
86+
de_results <- run_DE(reactiveVals$se,
87+
comparisons = comparisons,
88+
ain = ain,
89+
condition = condition,
90+
DE_method = method,
91+
logFC = logfc_b,
92+
logFC_up = logfc,
93+
logFC_down = -logfc,
94+
p_adj = padj_b,
95+
alpha = p,
96+
K = K,
97+
B = B,
98+
DEqMS_PSMs_column = DEqMS_column)
99+
100+
# save current settings
101+
de_current <- data.table("Method" = c(method),
102+
"Input Data" = c(ain),
103+
"Comparisons" = c(comparisons)
104+
)
105+
if(method == "ROTS"){
106+
de_current$K <- c(K)
107+
de_current$B <- c(B)
108+
}
109+
if(method == "DEqMS"){
110+
de_current$DEqMS_column <- c(DEqMS_column)
111+
}
112+
if(logfc_b){
113+
de_current[ , ":=" ("LogFC Thr" = logfc)]
114+
}
115+
if(padj_b){
116+
de_current[ , ":=" ("P.Adj Thr" = p)]
117+
} else {
118+
de_current[ , ":=" ("P.Value Thr" = p)]
119+
}
120+
121+
reactiveVals$de_current <- de_current
122+
reactiveVals$de_results <- de_results
123+
reactiveVals$de_condition <- condition
124+
125+
updatePickerInput(session = session, inputId = "deVisComparison", choices = comparisons, selected = comparisons)
126+
updatePickerInput(session = session, inputId = "deVisAin", choices = ain, selected = ain)
127+
128+
# check if gene names column empty
129+
#rd <- as.data.table(rowData(reactiveVals$se))
130+
#if(sum(is.na(rd$Gene.Names)) == nrow(rd)){
131+
# biomarker_col <- c("Protein.IDs")
132+
#} else {
133+
# biomarker_col <- c("Protein.IDs", "Gene.Names")
134+
#}
135+
#updatePickerInput(session = session, inputId = "deBiomarkerColumn", choices = biomarker_col, selected = biomarker_col[[1]])
136+
shinyjs::runjs("openBox('deEvaluation')")
137+
shinyjs::runjs("openBox('deOverviewVis')")
138+
}, error = function(e){
139+
shinyalert(
140+
inputId = "confirmDEAnalysisFailure",
141+
title = "DE Analysis Failed With the Following Message:",
142+
text = HTML(sprintf("<b>%s</b>", e$message)),
143+
size = "s",
144+
closeOnEsc = TRUE,
145+
closeOnClickOutside = FALSE,
146+
html = TRUE,
147+
type = "error",
148+
showConfirmButton = FALSE,
149+
showCancelButton = TRUE,
150+
cancelButtonText = "Close",
151+
timer = 5000,
152+
imageUrl = "",
153+
animation = TRUE,
154+
immediate = FALSE
155+
)
156+
})
137157
waiter_hide(id ="app")
138158
})
139159

server/upload_server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ output$currentData <- renderInfoBox({
460460
overview_current <- c(overview_current, list(refSamplesText))
461461
}
462462
if(!is.null(batchColumn)){
463-
overview_current <- c(overview_current, list(h5(HTML("<p style=\"color:grey;\">Batch</p>")), batchColumn))
463+
overview_current <- c(overview_current, list(h5(HTML("<p style=\"color:grey;\">Batch Column</p>")), batchColumn))
464464
}
465465
metadatalist <- NULL
466466
if(is.null(overview_current)){

ui/upload_ui.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ uploadBody <- function() {
7272
bsPopover(
7373
id = "dataFileInfo",
7474
title = "A CSV or Txt file with the proteomics data.",
75-
content = "A file containing the intensities of proteins for multiple samples (samples specified in metadata file). For example, the output file proteinGroups.txt of MaxQuant.</b>"
75+
content = "A file containing the RAW intensities of proteins for multiple samples (samples specified in metadata file). For example, the output file proteinGroups.txt of MaxQuant.</b>"
7676
)
7777

7878
columnNamePopover <-
@@ -146,7 +146,7 @@ uploadBody <- function() {
146146
width = 6,
147147
fileInput(
148148
"dataFile",
149-
span("Choose Proteomics Data File ", tags$i(class = "fa fa-circle-info", style = "color: rgb(0,166,90)"), id = "dataFileInfo"),
149+
span("Choose Proteomics Data File (Raw)", tags$i(class = "fa fa-circle-info", style = "color: rgb(0,166,90)"), id = "dataFileInfo"),
150150
width = "100%",
151151
multiple = FALSE,
152152
accept = c(".csv", ".txt"),

0 commit comments

Comments
 (0)