-
Notifications
You must be signed in to change notification settings - Fork 0
/
server-ortho.R
100 lines (73 loc) · 2.63 KB
/
server-ortho.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#server-ortho.R
OrthoRun <- reactiveValues(OrthoRunValue = FALSE) # to precise the run button has not been clicked
observeEvent(input$orthogo,{ # when the button is clicked
progressSweetAlert( # progress bar
session = session,
id = "orthoProgress",
title = "Orthology in progress",
display_pct = TRUE,
value = 0
)
search <- unlist(strsplit(input$ortho_ids, split = '\n')) # takes the gene set
updateProgressBar( # update progress bar
session = session,
id = "orthoProgress",
title = "Orthology in progress...",
value = 50
)
res_ortho <- gorth(search,
source_organism = input$orthinputorg,
target_organism = input$orthtargetorg,
)
res_ortho <- res_ortho[,-1]
updateProgressBar( # updating the progress bar
session = session,
id = "orthoProgress",
title = "Orthology in progress...",
value = 75
)
output$OrthoResultTable <- DT::renderDataTable({ # result table
DT::datatable(
res_ortho,
extensions = 'Buttons', # download button
option = list(
paging = TRUE,
searching = TRUE,
fixedColumns = TRUE,
autoWidth = TRUE,
ordering = TRUE,
dom = 'Bfrtip',
buttons = list(list(
extend = 'collection',
buttons = list(extend='csv',
filename = "results_orthology"),
text = 'Download')),
scrollX = TRUE,
pageLength = 10,
searchHighlight = TRUE, # search bar
orderClasses = TRUE
),
class = "display")
}, server = FALSE)
OrthoRun$OrthoRunValue <- input$orthogo # precise the run button has been clicked
updateNavbarPage(session, "ortabs", "redirectres") # redirection to the result table after the enrichment is done
closeSweetAlert(session = session) # close alert that the enrichment is done
sendSweetAlert(session = session,
title = "DONE",
text = "Orthology was successfully performed.",
type = "success")
##########
})
# result table render
output$OrthoResults <- renderUI({
if(OrthoRun$OrthoRunValue){ # if the run button has been clicked, then show the results
tagList(
fluidRow(column(
12, dataTableOutput('OrthoResultTable') %>% withSpinner()
)))} else {
if(length(res_ortho) == 0){
helpText("No results to show")
}else{# if not message to do it
helpText("Run Orthology to obtain the Result Table.")
}}
})