Skip to content
Snippets Groups Projects
Commit 051382b6 authored by Peng Lian's avatar Peng Lian
Browse files

Merge branch 'containerized_vizapp' into 'master'

Fix to defaults so that singularity is in the biohpc.config as the default,...

Closes #1

See merge request biohpc/astrocyte_example_wordcount!4
parents 96d532f2 108ed90e
Branches
Tags
1 merge request!4Fix to defaults so that singularity is in the biohpc.config as the default,...
Pipeline #10588 failed with stages
......@@ -133,8 +133,6 @@ cache_docker_image:
singularity_astrocyte_test:
stage: test_singularity
script:
# Note the biohpc_singularity.config replacement.
- sed -i 's|nextflow_config\x3A \x27biohpc.config\x27|nextflow_config\x3A \x27biohpc_singularity.config\x27|' astrocyte_pkg.yml
- astrocyte_cli run "$CI_PROJECT_DIR" --option=q
- test -s "$CI_PROJECT_DIR/workflow/output/mobydick.txt.uppercase.tolines.wordcount"
......@@ -181,5 +179,6 @@ astrocyte_shiny:
- sleep 5
- unset http_proxy
- unset all_proxy
- unset https_proxy
- wget "http://127.0.0.1:8123"
......@@ -20,6 +20,10 @@ The workflow `workflow/main.nf` has three processes:
There is a single parameter `story`. This provides 1 or more files that the
workflow should run on.
## Containers
The default configuration for this workflow is located in ./workflow/configs/biohpc.config . This configuration will cause the Nextflow command to use the singularity executor for the uppercase, toLines, and wordcount processes, using Docker.io endpoints. The biohpc_*_gitlab.config files show how to instead use images pulled from a specified GitLab repository.
## Questions
If you have any questions about this workflow example, or Astrocyte in general,
......
......@@ -171,14 +171,13 @@ workflow_parameters:
# The workflow must publish all final output into $baseDir
# Name of the R module that the vizapp will run against
vizapp_r_module: 'R/3.4.1-gccmkl'
vizapp_r_module: 'R/3.6.1-gccmkl'
# List of any CRAN packages, not provided by the modules, that must be made
# available to the vizapp
vizapp_cran_packages:
- shiny
- shinyFiles
- plotly
# # List of any Bioconductor packages, not provided by the modules, that must be made
# available to the vizapp
vizapp_bioc_packages:
......
......@@ -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)
)
}
})
})
library(shiny)
library(shinyFiles)
library(plotly)
shinyUI(fluidPage(
verticalLayout(
# Application title
titlePanel("Astrocyte Example"),
wellPanel(
# Application title
titlePanel("Astrocyte Example"),
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("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
))
......@@ -6,4 +6,13 @@ singularity {
process {
executor = 'local'
withName:uppercase {
container = 'ubuntu:latest'
}
withName:tolines {
container = 'ubuntu:latest'
}
withName:wordcounts {
container = 'centos:centos8'
}
}
......@@ -7,12 +7,12 @@ docker {
process {
executor = 'local'
withName:uppercase {
container = 'git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/ubuntu:latest'
container = 'git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/ubuntu:latest'
}
withName:tolines {
container = 'git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/ubuntu:latest'
container = 'git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/ubuntu:latest'
}
withName:wordcounts {
container = 'git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/centos:centos8'
container = 'git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/centos:centos8'
}
}
singularity {
enabled = true
runOptions = '--bind /vagrant:/vagrant'
cacheDir = "$baseDir/images/singularity"
}
process {
executor = 'local'
withName:uppercase {
container = 'ubuntu:latest'
}
withName:tolines {
container = 'ubuntu:latest'
}
withName:wordcounts {
container = 'centos:centos8'
}
}
......@@ -8,15 +8,15 @@ singularity {
process {
executor = 'local'
withName:parameters {
container = 'git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/ubuntu:latest'
container = 'git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/ubuntu:latest'
}
withName:uppercase {
container = 'docker://git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/ubuntu:latest'
container = 'docker://git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/ubuntu:latest'
}
withName:tolines {
container = 'docker://git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/ubuntu:latest'
container = 'docker://git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/ubuntu:latest'
}
withName:wordcounts {
container = 'docker://git.biohpc.swmed.edu:5050/s190450/astrocyte_example_wordcount/centos:centos8'
container = 'docker://git.biohpc.swmed.edu:5050/biohpc/astrocyte_example_wordcount/centos:centos8'
}
}
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