Commit e279abb8 authored by jlopez's avatar jlopez
Browse files

Fix bug

parent 9201b29a
getPackagesWithTitle <- function() {
contrib.url(getOption("repos")["CRAN"], "source")
description <- sprintf("%s/web/packages/packages.rds",
getOption("repos")["CRAN"])
con <- if(substring(description, 1L, 7L) == "file://") {
file(description, "rb")
} else {
url(description, "rb")
}
on.exit(close(con))
db <- readRDS(gzcon(con))
rownames(db) <- NULL
db[, c("Package", "Title", "Version")]
}
......@@ -4,7 +4,9 @@ library(shinyjs)
library(shinycssloaders)
library(DT)
library(dplyr)
library(tools)
source("./R/helper_functions.R", local = T)
source("./R/menugauche.R", local = T)
source("./pages/pages_def_home.R", local = T)
......@@ -31,24 +33,18 @@ UI <- dashboardPage(
server <- function( input, output, session) {
shinyCheckBoxPackage <- function(df ) {
inputs = sprintf('<input id="%s" type="checkbox">', df[,"Package"])
inputs
}
source("https://bioconductor.org/biocLite.R")
allCRAN <<- as.data.frame(available.packages(repo = "http://cran.us.r-project.org")[, c("Package", "Version")])
allBIO <<- as.data.frame(available.packages(repo = biocinstallRepos()[1])[, c("Package", "Version")])
hide("downloadContainerFile")
session$userData <- c()
#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"])
disable("rcranpackagelist")
#allCRAN <- allCRAN[c("select", "Package", "Version")]
#allBIO <- allBIO[c("select", "Package", "Version")]
#allCRAN <<- as.data.frame(available.packages(repo = "http://cran.us.r-project.org")[, c("Package")])
allCRAN <<- as.data.frame(getPackagesWithTitle())
allBIO <<- as.data.frame(available.packages(repo = biocinstallRepos()[1])[, c("Package", "Version")])
hide("downloadContainerFile")
source("./server/opt_home.R", local=TRUE)
}
......
......@@ -12,6 +12,7 @@ tabHome = fluidPage(align="left",
br(),
radioButtons("containerType", "Container type:", choices = list("Singularity" = "singularity"), selected = "singularity"),
br(),
#selectizeInput('rcranpackagelist', 'R CRAN:', choices = NULL, multiple=TRUE, options = list(maxItems = 30000)),
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"),
......
......@@ -79,35 +79,52 @@ createContentFile <- function() {
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 ')
if(!is.null(sizeCRAN)) {
if(sizeCRAN >= 1) {
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, 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)
print(sizeBIO)
if(!is.null(sizeBIO)) {
if(sizeBIO >= 1) {
result <- paste(result, '\tR --slave -e "source(\'https://bioconductor.org/biocLite.R\'); \\', sep = "\n")
result <- paste(result, "\tbiocLite()\n", sep = "\n")
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],'", ')
listRBIO <- paste0(listRBIO, '"',selectBIO[pkg],'", ')
} else {
listRBIO <- paste0(listRBIO, '"',selectCRAN[pkg],'")')
listRBIO <- paste0(listRBIO, '"',selectBIO[pkg],'")')
}
}
result <- paste(result, listRBIO, sep = "\n")
}
}
result <- paste(result, "\n", sep = "\n")
result <- paste(result, "\n", sep = "\n")
......@@ -143,4 +160,10 @@ output$downloadContainerFile <- downloadHandler(
}
)
#observeEvent(input$dtrcranpackage_rows_selected, {
# selectCRAN <- allCRAN[input$dtrcranpackage_rows_selected,]
# selectCRAN <- selectCRAN[,"Package"]
#
# updateSelectizeInput(session,"rcranpackagelist", choices = selectCRAN, selected = selectCRAN, options = list())
#
#})
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