-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.R
52 lines (46 loc) · 1.46 KB
/
server.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
source("shiny_lmor_func.R")
options(shiny.maxRequestSize=500*1024^2)
library(readr)
shinyServer(function(input, output) {
withProgress(message = "LOADING . . . PLEASE WAIT", value = 0.9,
{
# Number of times we'll go through the loop
#load("uk10k_af")
})
output$contents <- renderTable({
# input$file1 will be NULL initially. After the user selects and uploads a
# file, it will be a data frame with 'name', 'size', 'type', and 'datapath'
# columns. The 'datapath' column will contain the local filenames where the
# data can be found.
inFile <- input$file1
if (is.null(inFile))
{
return(NULL)
}
x <- read_delim(inFile$datapath, col_names=T, delim = input$sep)
c.names <- colnames(x)
if (length(which(c.names == "K")) == 1)
{
bound <<- LmToOddsRatio(x, x$K, 0)
} else
{
bound <<- LmToOddsRatio(x, input$numericK, 0)
}
return(head(bound, 50))
})
output$download <- downloadHandler(
filename = function() {
paste0("transformed_", input$file1)
},
content = function(file) {
write.table(bound, file, sep = "\t", row.names = FALSE, quote = FALSE)
}
)
# Show the first "n" observations
output$view <- renderTable({
input.df <- data.frame(input$numericB, input$numericK, input$numericP)
colnames(input.df) <- c("BETA", "K", "FREQ")
bound <<- LmToOddsRatio(input.df, input$numericK, 0)
bound
}, include.rownames=FALSE)
})