Skip to content

Commit

Permalink
users can now download the trace file from the shiny app
Browse files Browse the repository at this point in the history
  • Loading branch information
0ldM4j0r committed Jul 18, 2017
1 parent 8176ad9 commit c446428
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ui <- fluidPage(
downloadButton(outputId = "downloadDefaultConfigurationFile", label = "Download Default Configuration File"),
fileInput(inputId = "configFile", label = "Upload Configuration File")
),
# Row For Running Simulation
# Row for running simulation
fluidRow(
h3(strong(em("Run Kaphi"))),
actionButton(inputId = "runKaphi", label = "Run Kaphi")
Expand Down Expand Up @@ -99,13 +99,13 @@ ui <- fluidPage(
title = "Priors Distributions",
uiOutput(outputId = "priorsDistributionsPlots")
),
# Tab for feedback/diagnosis
# Tab for feedback, diagnosis, and results
tabPanel(
title = "Feedback/Diagnosis",
verbatimTextOutput("console")
),
# Tab for simulation results
tabPanel(title = "Simulation Results")
title = "SMC-ABC Run",
verbatimTextOutput("consoleHeading"),
verbatimTextOutput("console"),
uiOutput("downloadTraceFileButton")
)
)
)

Expand Down Expand Up @@ -216,6 +216,21 @@ server <- function(input, output, session) {
logText <- reactive({
trace[["log"]] <- capture.output(res <- run.smc(ws, trace.file = sprintf("tmp/%s.tsv", uniqueTraceFileName), model=input$specificModel))
})
output$consoleHeading <- renderText("Trace of SMC-ABC Run:")
# Rendering download button to download trace file
output$downloadTraceFileButton <- renderUI({
downloadButton(outputId = "downloadTraceFile", label = "Download Trace File")
})
}
)

# Downloading the generated trace file
output$downloadTraceFile <- downloadHandler(
filename = function() {
sprintf("%s.tsv", uniqueTraceFileName)
},
content = function(file) {
file.copy(sprintf("tmp/%s.tsv", uniqueTraceFileName), file)
}
)

Expand Down

0 comments on commit c446428

Please sign in to comment.