Commit ef8c01fb authored by Devin OKelly's avatar Devin OKelly
Browse files

Merge branch 'vizapp_fix_ui' into containerized_vizapp

parents 1c8d7409 5314baf8
Pipeline #10476 failed with stages
in 40 seconds
......@@ -10,12 +10,41 @@ rootdir <- Sys.getenv('outputDir')
shinyServer(function(input, output, session) {
shinyFileChoose(input, 'files', roots=c('output'=rootdir), session=session)
## print to console to see how the value of the shinyFiles
## button changes after clicking and selection
# The backend for a simple file chooser, restricted to the
# rootdir we obtained above.
# See https://github.com/thomasp85/shinyFiles
observe({
shinyFileChoose(input, 'files', roots=c('output'=rootdir), filetypes=c(''
,'txt'), session=session)
if (is.integer(input$files)) {
cat("No files have been selected (shinyFileChoose)")
} else {
cat("\ninput$files value:\n\n")
print(input$files)
files <- parseFilePaths(c('output'=rootdir), input$files)
print(files)
wordcounts <- read.table(files$datapath[1], quote="\"", comment.char="")
colnames(wordcounts) <- c("count","word");
wordcounts_total <- sum(wordcounts$count);
wordcounts$freq <- wordcounts$count / wordcounts_total;
wordcounts <- wordcounts[,c("word", "count", "freq")];
wordcounts$rank = order(wordcounts$count)
wordcounts <- wordcounts[wordcounts$count>3,]
wordcounts_total <- sum(wordcounts$count);
wordcounts$freq <- wordcounts$count / wordcounts_total;
output$table <- renderDataTable(wordcounts)
output$plot <- renderPlotly(
plot1 <- plot_ly(x = wordcounts$rank, y = wordcounts$freq)
)
}
})
})
......@@ -6,25 +6,30 @@ shinyUI(fluidPage(
verticalLayout(
# Application title
titlePanel("Astrocyte Example"),
wellPanel(
# Application title
titlePanel("Astrocyte Example"),
helpText("This is a minimal example, demonstrating how
a Shiny visualization application can access the output of a workflow.
Here we provide a file browser using the shinyFiles package. Real
Astrocyte vizapps would provide custom methods to access and visualize
output."),
wellPanel(
helpText("This is a minimal example, demonstrating how
a Shiny visualization application can access the output of a workflow.
Here we provide a file browser using the shinyFiles package. Real
Astrocyte vizapps would provide custom methods to access and visualize
output."),
helpText("The workflow output is in the directory set in the
outputDir environment variable. this can be retrieved in R with the
command Sys.getenv('outputDir')"),
outputDir environment variable. this can be retrieved in R with the
command Sys.getenv('outputDir')"),
# A simple file browser within the workflow output directory
# See https://github.com/thomasp85/shinyFiles
shinyFilesButton('files', label='Browse workflow output', title='Please select a file', multiple=FALSE)
)
),
plotlyOutput('plot'),
dataTableOutput('table')
)
))
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment