Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jlopez
RPACIB
Commits
e279abb8
Commit
e279abb8
authored
Mar 13, 2018
by
jlopez
Browse files
Fix bug
parent
9201b29a
Changes
4
Hide whitespace changes
Inline
Side-by-side
R/helper_functions.R
View file @
e279abb8
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"
)]
}
app.R
View file @
e279abb8
...
...
@@ -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('select_cran_package', 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
)
}
...
...
pages/pages_def_home.R
View file @
e279abb8
...
...
@@ -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"
),
...
...
server/opt_home.R
View file @
e279abb8
...
...
@@ -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
,
'"'
,
select
CRAN
[
pkg
],
'", '
)
listRBIO
<-
paste0
(
listRBIO
,
'"'
,
select
BIO
[
pkg
],
'", '
)
}
else
{
listRBIO
<-
paste0
(
listRBIO
,
'"'
,
select
CRAN
[
pkg
],
'")'
)
listRBIO
<-
paste0
(
listRBIO
,
'"'
,
select
BIO
[
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())
#
#})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment