Commit 0fe3c7e3 authored by jlopez's avatar jlopez
Browse files

Add biocontainer

parent 9b7f3cc7
......@@ -14,3 +14,53 @@ getPackagesWithTitle <- function() {
db[, c("Package", "Title", "Version")]
}
getBioconductorPackage <- function() {
Tool = c("DiffExpIR",
"abyss",
"Aliscore"
)
Version = c("0.0.1",
"1.9.0",
"v.2.0"
)
Description = c("Differentially expressed intron retention",
"ABySS is a *de novo* sequence assembler",
"Aliscore is designed to filter alignment ambiguous or randomly similar sites in multiple sequence alignments (MSA)."
)
Link = c("<a href='https://github.com/r78v10a07/DiffExpIR'>documentation</a>",
"<a href='https://github.com/bcgsc/abyss#abyss'>documentation</a>",
"<a href='https://www.zfmk.de/dateien/atoms/files/aliscore_v.2.0_manual_0.pdf'>documentation</a>"
)
result <- data.frame(BioContainer_Tool=Tool,
Version=Version,
Description=Description,
Documentation=Link)
return(result)
}
getInstallToolPackageBioContainer <- function(tool) {
if(tool == "DiffExpIR") {
return("")
} else if(tool == "abyss") {
return("\tconda install abyss=1.9.0")
}
return("")
}
......@@ -6,7 +6,7 @@ library(DT)
library(dplyr)
library(tools)
library(githubinstall)
require(stringi)
require(stringi)
library(devtools)
source("./R/helper_functions.R", local = T)
......
......@@ -13,6 +13,11 @@ tabHome = fluidPage(align="left",
radioButtons("containerType", "Container type:", choices = list("Singularity" = "singularity"), selected = "singularity"),
br(),
#selectizeInput('rcranpackagelist', 'R CRAN:', choices = NULL, multiple=TRUE, options = list(maxItems = 30000)),
selectizeInput('rtemplate', 'R origin:', choices = c(`None` = 'none', `R from source` = 'source', `R from r-base` = 'base', `R from CRAN depo` = 'cran'), selected = "source", multiple = FALSE),
#selectizeInput('biocontainers', 'BioContainers tools :', choices = getBioconductorPackage(), multiple = TRUE),
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"),
......@@ -39,8 +44,12 @@ tabHome = fluidPage(align="left",
tabPanel('Github',
textInput("inputGithub", "Package name:", ""),
actionButton("findGithub", label = "Find", icon("paper-plane"), style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
selectizeInput('rgithubpackagelist', 'R Github selected:', choices = NULL, multiple=TRUE, options = list(maxItems = 30000)),
br(), br(),
DT::dataTableOutput('dtrgithubpackage'))
DT::dataTableOutput('dtrgithubpackage')),
tabPanel('BioContainer tools',
DT::dataTableOutput('dtbiocontainer')
)
)
)
),
......
......@@ -20,43 +20,78 @@ output$dtrgithubpackage <- DT::renderDataTable({
return(result)
}, filter='top', escape = FALSE, rownames= FALSE,server = TRUE)
output$dtbiocontainer <- DT::renderDataTable({
result <- data.frame(Tool=character(),
Version=character(),
Description=character())
result <- getBioconductorPackage()
return(result)
}, filter='top', escape = FALSE, rownames= FALSE,server = TRUE)
createContentFile <- function() {
haveR = FALSE
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")
if(input$rtemplate == "none") {
result <- paste(result, "%environment", sep = "\n")
} else if(input$rtemplate == "base") {
result <- paste(result, "%environment", sep = "\n")
result <- paste(result, "\tR_VERSION=3.2.5", 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")
} else {
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")
}
if(!is.null(input$dtbiocontainer_rows_all)) {
result <- paste(result, "\texport PATH=/opt/conda/bin:$PATH", sep = "\n")
result <- paste(result, "\texport PATH=/opt/biotools/bin:$PATH", 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, "%apprun run", sep = "\n")
result <- paste(result, '\texec /bin/bash "$@"', 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, "%apprun Rscript", sep = "\n")
result <- paste(result, '\texec Rscript "$@"', sep = "\n")
result <- paste(result, "%runscript", sep = "\n")
#result <- paste(result, '\texec R "$@"', sep = "\n")
result <- paste(result, '\texec /bin/bash "$@"', 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")
......@@ -65,103 +100,187 @@ createContentFile <- function() {
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, "\n", sep = "")
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_all,]
selectCRAN <- selectCRAN[,"Package"]
sizeCRAN <- length(selectCRAN)
if(!is.null(sizeCRAN)) {
if(sizeCRAN < length(allCRAN[,"Package"])) {
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, "\n", sep = "\n")
if(input$rtemplate != "none") {
haveR = TRUE
if(input$rtemplate == "source") {
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")
} else if(input$rtemplate == "base") {
result <- paste(result, "\tapt-get install -y r-base r-base-dev", sep = "\n")
} else if(input$rtemplate == "cran") {
result <- paste(result, "\tapt-get install -y software-properties-common", sep = "\n")
result <- paste(result, "\tadd-apt-repository 'deb http://cloud.r-project.org/bin/linux/ubuntu xenial/'", sep = "\n")
result <- paste(result, "\tapt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9", sep = "\n")
result <- paste(result, "\tapt-get update", sep = "\n")
result <- paste(result, "\tapt-get install -y r-base r-base-dev", sep = "\n")
}
selectBIO <- allBIO[input$dtrbioconductorpackage_rows_all,]
selectBIO <- selectBIO[,"Package"]
sizeBIO <- length(selectBIO)
print(sizeBIO)
if(!is.null(sizeBIO)) {
if(sizeBIO < length(allBIO[,"Package"])) {
if(sizeBIO >= 1) {
result <- paste(result, "\n", sep = "\n")
selectCRAN <- allCRAN[input$dtrcranpackage_rows_all,]
selectCRAN <- selectCRAN[,"Package"]
sizeCRAN <- length(selectCRAN)
if(!is.null(sizeCRAN)) {
if(sizeCRAN < length(allCRAN[,"Package"])) {
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 ')
}
}
print(listRCRAN)
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_all,]
selectBIO <- selectBIO[,"Package"]
sizeBIO <- length(selectBIO)
if(!is.null(sizeBIO)) {
if(sizeBIO < length(allBIO[,"Package"])) {
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, '\'',selectBIO[pkg],'\', ')
} else {
listRBIO <- paste0(listRBIO, '\'',selectBIO[pkg],'\')"')
}
}
result <- paste(result, listRBIO, sep = "\n")
}
}
}
result <- paste(result, "\n", sep = "\n")
selectGITHUB <- allGITHUB[input$dtrgithubpackage_rows_all,]
selectGITHUB <- selectGITHUB[,"Package"]
sizeGITHUB <- length(selectGITHUB)
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, '\'',selectBIO[pkg],'\', ')
} else {
listRBIO <- paste0(listRBIO, '\'',selectBIO[pkg],'\')"')
}
}
result <- paste(result, listRBIO, sep = "\n")
}
}
}
result <- paste(result, "\n", sep = "\n")
selectGITHUB <- allGITHUB[input$dtrgithubpackage_rows_all,]
selectGITHUB <- selectGITHUB[,"Package"]
print(selectGITHUB)
if(!is.null(sizeGITHUB)) {
if(sizeGITHUB < length(allGITHUB[,"Package"])) {
if(sizeGITHUB >= 1) {
listRGITHUB <- '\tR --slave -e "install_github(c('
for (pkg in 1:sizeGITHUB){
if(pkg < sizeGITHUB) {
listRGITHUB <- paste0(listRGITHUB, '\'',selectGITHUB[pkg],'\', ')
} else {
listRGITHUB <- paste0(listRGITHUB, '\'',selectGITHUB[pkg],'\'))"')
}
}
result <- paste(result, listRGITHUB, sep = "\n")
}
}
}
sizeGITHUB <- length(selectGITHUB)
} #END R
if(!is.null(sizeGITHUB)) {
if(sizeGITHUB < length(allGITHUB[,"Package"])) {
if(sizeGITHUB >= 1) {
if(!is.null(input$dtbiocontainer_rows_all)) {
listRGITHUB <- '\tR --slave -e "install_github(c('
for (pkg in 1:sizeGITHUB){
if(pkg < sizeGITHUB) {
listRGITHUB <- paste0(listRGITHUB, '\'',selectGITHUB[pkg],'\', ')
} else {
listRGITHUB <- paste0(listRGITHUB, '\'',selectGITHUB[pkg],'\'))"')
}
}
result <- paste(result, listRGITHUB, sep = "\n")
}
biotools = getBioconductorPackage()
selectBioTool<- biotools[input$dtbiocontainer_rows_all,]
selectBioTool <- selectBioTool[,"BioContainer_Tool"]
#result <- paste(result, "\tmv /etc/apt/sources.list /etc/apt/sources.list.bkp && \\",
# "\techo -e \"deb mirror://mirrors.ubuntu.com/mirrors.txt xenial main restricted universe multiverse\\n\\ ",
# "\tdeb mirror://mirrors.ubuntu.com/mirrors.txt xenial-updates main restricted universe multiverse\\n\\ ",
# "\tdeb mirror://mirrors.ubuntu.com/mirrors.txt xenial-backports main restricted universe multiverse\\n\\ ",
# "\tdeb mirror://mirrors.ubuntu.com/mirrors.txt xenial-security main restricted universe multiverse\\n\\n\\\" > /etc/apt/sources.list && \\ ",
# "\tcat /etc/apt/sources.list.bkp >> /etc/apt/sources.list && \\ ",
# "\tcat /etc/apt/sources.list", sep = "\n")
result <- paste0(result, "\n")
result <- paste(result, "\tapt-get install -y autotools-dev automake cmake curl grep sed dpkg fuse git zip openjdk-8-jre build-essential pkg-config python python-dev python-pip bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 mercurial subversion zlib1g-dev", sep = "\n")
result <- paste0(result, "\n")
result <- paste(result, "\techo \'export PATH=/opt/conda/bin:$PATH\' > /etc/profile.d/conda.sh && \\",
"\twget --quiet https://repo.continuum.io/miniconda/Miniconda2-4.0.5-Linux-x86_64.sh -O ~/miniconda.sh && \\",
"\t/bin/bash ~/miniconda.sh -b -p /opt/conda && \\",
"\trm ~/miniconda.sh", sep = "\n")
result <- paste0(result, "\n")
result <- paste(result, "\tTINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o \"/v.*\\\"\" | sed \'s:^..\\(.*\\).$:\\1:\'` && \\",
"\tcurl -L \"https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb\" > tini.deb && \\",
"\tdpkg -i tini.deb && \\",
"\trm tini.deb && \\",
"\tapt-get clean", sep = "\n")
result <- paste0(result, "\n")
result <- paste(result, "\mkdir /opt/biotools/bin", sep = "\n")
result <- paste(result, "\tchmod 777 -R /opt/biotools/", sep = "\n")
result <- paste(result, "\texport PATH=/opt/biotools/bin:$PATH", sep = "\n")
result <- paste(result, "\tchmod 777 -R /opt/conda/", sep = "\n")
result <- paste(result, "\texport PATH=/opt/conda/bin:$PATH", sep = "\n")
#result <- paste(result, "\techo 'export PATH=/opt/conda/bin:$PATH' >> $SINGULARITY_ENVIRONMENT", sep = "\n")
if(!haveR) {
result <- paste(result, "\tconda config --add channels r", sep = "\n")
}
result <- paste(result, "\tconda config --add channels bioconda", sep = "\n")
result <- paste(result, "\tconda upgrade conda", sep = "\n")
result <- paste0(result, "\n")
for (tool in selectBioTool){
result <- paste(result, getInstallToolPackageBioContainer(tool), sep="\n")
}
}
result <- paste(result, "\n", sep = "\n")
result <- paste(result, input$customDataContainer, sep = "\t\n")
return(result)
}
......@@ -186,20 +305,33 @@ output$downloadContainerFile <- downloadHandler(
paste("Singularity",input$imageName, sep = ".")
},
content = function(file) {
print(file)
result <- createContentFile()
print(result)
write(result,file=file)
}
)
#observeEvent(input$dtrcranpackage_rows_selected, {
# selectCRAN <- allCRAN[input$dtrcranpackage_rows_selected,]
# selectCRAN <- selectCRAN[,"Package"]
#
# updateSelectizeInput(session,"rcranpackagelist", choices = selectCRAN, selected = selectCRAN, options = list())
#
#})
observeEvent(input$dtrgithubpackage_rows_selected, {
selectGITHUB <- allGITHUB[input$dtrgithubpackage_rows_selected,]
selectGITHUB <- selectGITHUB[,"Package"]
if(is.null(input$rgithubpackagelist)) {
element <- selectGITHUB
} else {
element <- selectGITHUB
for(x in input$rgithubpackagelist) {
de <- list(Package=x)
element = rbind(element,de)
}
}
updateSelectizeInput(session,"rgithubpackagelist", choices = element, selected = element, options = list())
})
observeEvent(input$findGithub, {
......
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