Commit 6c53ec66 authored by jlopez's avatar jlopez
Browse files

Proto

parent 0e306969
......@@ -31,3 +31,4 @@ vignettes/*.pdf
# Temporary files created by R markdown
*.utf8.md
*.knit.md
.Rproj.user
MenuGauche = sidebarMenu(id = "sidebarmenu",
menuItem("Home", tabName = "Home", icon = icon("home", lib="font-awesome")),
tags$br(), tags$br(), tags$br(),
menuItem("Team", icon = icon("book", lib="font-awesome"),
menuItem("Jimmy Lopez", href = "http://www.isem.univ-montp2.fr/recherche/les-plate-formes/bioinformatique-labex/personnel/", newtab = TRUE, icon = shiny::icon("male"), selected = NULL )
)
)
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
library(shiny)
library(shinydashboard)
library(shinyjs)
library(shinycssloaders)
library(DT)
library(dplyr)
source("./R/menugauche.R", local = T)
source("./pages/pages_def_home.R", local = T)
options(encoding = 'UTF-8')
#style <- tags$style(HTML(readLines("www/added_styles.css")) )
UI <- dashboardPage(
skin = "green",
dashboardHeader(title = "RPACIB"),
dashboardSidebar(MenuGauche),
dashboardBody(
shinyjs::useShinyjs(),
tags$head(tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap.min.readable.css")) ,
#tags$head(style),
tabItems(
tabItem(tabName = "Home", tabHome)
)
)
)
server <- function( input, output, session) {
shinyCheckBoxPackage <- function(df ) {
inputs = sprintf('<input id="%s" type="checkbox">', df[,"Package"])
inputs
}
allCRAN <<- as.data.frame(available.packages()[, c("Package", "Version")])
allBIO <<- as.data.frame(available.packages(repo = biocinstallRepos()[1])[, c("Package", "Version")])
hide("downloadContainerFile")
#allCRAN$select <- sprintf('<input id="chekcboxCRAN_%s" type="checkbox" onclick=\"Shiny.onInputChange(&#39;select_cran_package&#39;, this.id)\">', allCRAN[,"Package"])
#allBIO$select <- sprintf('<input id="chekcboxBIO_%s" type="checkbox">', allBIO[,"Package"])
#allCRAN <- allCRAN[c("select", "Package", "Version")]
#allBIO <- allBIO[c("select", "Package", "Version")]
source("./server/opt_home.R", local=TRUE)
}
shinyApp(ui = UI, server = server)
\ No newline at end of file
tabHome = fluidPage(align="left",
column(width = 2,
box(
title = "Params",
width = NULL,
collapsible = TRUE,
solidHeader = TRUE,
status="primary",
textInput("imageName", "Image Name", ""),
br(),
radioButtons("containerType", "Container type:", choices = list("Singularity" = "singularity"), selected = "singularity"),
br(),
textAreaInput("customDataContainer", "Add custom line to container file:"),
br(), br(),
actionButton("createContainer", label = "Create", icon("paper-plane"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
downloadButton('downloadContainerFile', label = "Dowload", style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
)),
column(width = 10,
box(
title = "R Packages",
width = NULL,
collapsible = TRUE,
solidHeader = TRUE,
status="primary",
tabsetPanel( id='rpackages',
tabPanel('CRAN',
withSpinner(DT::dataTableOutput('dtrcranpackage'), type = 4, proxy.height = "150px")
),
tabPanel('Bioconductor',
DT::dataTableOutput('dtrbioconductorpackage')),
tabPanel('Github',
DT::dataTableOutput('dtrgithubpackage'))
)
)
),
column(width = 12,
box(
title = "Preview File:",
width = NULL,
collapsible = TRUE,
solidHeader = TRUE,
status="primary",
style='height:1000px; overflow-y: scroll',
verbatimTextOutput("previewContainer")
)
)
)
\ No newline at end of file
output$dtrcranpackage <- DT::renderDataTable({
result <- allCRAN
return(result)
}, filter='top', escape = FALSE, rownames= FALSE,server = TRUE)
output$dtrbioconductorpackage <- DT::renderDataTable({
result <- allBIO
return(result)
}, filter='top', escape = FALSE, rownames= FALSE,server = TRUE)
output$dtrgithubpackage <- DT::renderDataTable({
result <- data.frame(Package=character(),
Version=character())
return(result)
}, filter='top', escape = FALSE, rownames= FALSE,server = TRUE)
createContentFile <- function() {
result <- "Bootstrap: docker"
result <- paste(result, "From: ubuntu:16.04", sep = "\n")
result <- paste(result, "IncludeCmd: yes", sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "%environment", sep = "\n")
result <- paste(result, "\tR_VERSION=3.4.3", sep = "\n")
result <- paste(result, "\texport R_VERSION", sep = "\n")
result <- paste(result, "\tR_CONFIG_DIR=/etc/R/", sep = "\n")
result <- paste(result, "\texport R_CONFIG_DIR", sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "%labels", sep = "\n")
result <- paste(result, "\tAuthor Jimmy Lopez", sep = "\n")
result <- paste(result, "\tVersion v0.0.1", sep = "\n")
result <- paste(result, "\tR_Version 3.4.3", sep = "\n")
result <- paste0(result, "\n\tbuild_date ", format(Sys.time(), "%Y %b %d"), "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "%apprun R", sep = "\n")
result <- paste(result, '\texec R "$@"', sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "%apprun Rscript", sep = "\n")
result <- paste(result, '\texec Rscript "$@"', sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "%runscript", sep = "\n")
result <- paste(result, '\texec R "$@"', sep = "\n")
result <- paste(result, "%post", sep = "\n")
result <- paste(result, "\tapt-get update", sep = "\n")
result <- paste(result, "\tapt-get install -y wget libblas3 libblas-dev liblapack-dev liblapack3 curl", sep = "\n")
result <- paste(result, "\tapt-get install -y gcc fort77 aptitude", sep = "\n")
result <- paste(result, "\taptitude install -y g++ xorg-dev libreadline-dev gfortran", sep = "\n")
result <- paste(result, "\tapt-get install -y libssl-dev libxml2-dev libpcre3-dev liblzma-dev libbz2-dev libcurl4-openssl-dev", sep = "\n")
result <- paste(result, "\tapt-get update", sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, '\tcd $HOME', sep = "\n")
result <- paste(result, '\twget https://cran.rstudio.com/src/base/R-3/R-3.4.3.tar.gz', sep = "\n")
result <- paste(result, '\ttar xvf R-3.4.3.tar.gz', sep = "\n")
result <- paste(result, '\tcd R-3.4.3', sep = "\n")
result <- paste(result, "\t./configure --enable-R-static-lib --with-blas --with-lapack --enable-R-shlib=yes ", sep = "\n")
result <- paste(result, "\tmake", sep = "\n")
result <- paste(result, "\tmake install", sep = "\n")
result <- paste(result, "\n", sep = "\n")
selectCRAN <- allCRAN[input$dtrcranpackage_rows_selected,]
selectCRAN <- selectCRAN[,"Package"]
sizeCRAN <- length(selectCRAN)
listRCRAN <- '\techo install.packages\\(c('
for (pkg in 1:sizeCRAN){
if(pkg < sizeCRAN) {
listRCRAN <- paste0(listRCRAN, '"',selectCRAN[pkg],'", ')
} else {
listRCRAN <- paste0(listRCRAN, '"',selectCRAN[pkg],'"), repos\\=\'https://cloud.r-project.org\'\\) | R --slave ')
}
}
result <- paste(result, listRCRAN, sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, '\tR --slave -e "source(\'https://bioconductor.org/biocLite.R\'); \\', sep = "\n")
result <- paste(result, "\tbiocLite()\n", sep = "\n")
selectBIO <- allBIO[input$dtrbioconductorpackage_rows_selected,]
selectBIO <- selectBIO[,"Package"]
sizeBIO <- length(selectBIO)
listRBIO <- '\tR --slave -e "source(\'https://bioconductor.org/biocLite.R\'); \\'
listRBIO <- paste0(listRBIO, "\n\tbiocLite(")
for (pkg in 1:sizeBIO){
if(pkg < sizeBIO) {
listRBIO <- paste0(listRBIO, '"',selectCRAN[pkg],'", ')
} else {
listRBIO <- paste0(listRBIO, '"',selectCRAN[pkg],'")')
}
}
result <- paste(result, listRBIO, sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "\n", sep = "\n")
result <- paste(result, input$customDataContainer, sep = "\t\n")
return(result)
}
createContainerPackage <- eventReactive(input$createContainer, {
result <- createContentFile()
show("downloadContainerFile")
HTML(result)
})
output$previewContainer <- renderText({
createContainerPackage()
})
output$downloadContainerFile <- downloadHandler(
filename = function() {
paste("Singularity",input$imageName, sep = ".")
},
content = function(file) {
print(file)
result <- createContentFile()
print(result)
write(result,file=file)
}
)
Supports Markdown
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