From a45b094ca7487d3651a982d5031fabc7572ffd87 Mon Sep 17 00:00:00 2001 From: Jianfeng Date: Thu, 16 Aug 2018 13:51:12 +0800 Subject: [PATCH] improve instant UI --- ChangeLog | 2 + DESCRIPTION | 2 +- .../shiny/shiny.bioinstaller.parameters.toml | 6 +- .../config/shiny/shiny.conda.parameters.toml | 53 +++++++++++++---- inst/extdata/config/shiny/shiny.config.yaml | 4 +- .../shiny.datasets2tools.parameters.toml | 12 ++-- .../shiny/shiny.geoquery.parameters.toml | 59 +++++++++++++++++++ .../config/shiny/shiny.pubmed.parameters.toml | 2 +- .../config/shiny/shiny.spack.parameters.toml | 39 ++++++++---- inst/extdata/shiny/server_download.R | 8 +-- inst/extdata/shiny/ui_body_download.R | 2 +- 11 files changed, 151 insertions(+), 38 deletions(-) create mode 100644 inst/extdata/config/shiny/shiny.geoquery.parameters.toml diff --git a/ChangeLog b/ChangeLog index efc41c4..83b6dae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2018-08-16 Li Jianfeng * add pubmed search tool + * add geoquery instant plugin + * improve instant spack and code plugins 2018-08-15 Li Jianfeng diff --git a/DESCRIPTION b/DESCRIPTION index 12469e4..73a30eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: BioInstaller Title: Integrator of Bioinformatics Resources -Version: 0.3.5.4000 +Version: 0.3.5.5000 Authors@R: person("Jianfeng", "Li", email = "lee_jianfeng@sjtu.edu.cn", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2349-208X")) Maintainer: Jianfeng Li Description: diff --git a/inst/extdata/config/shiny/shiny.bioinstaller.parameters.toml b/inst/extdata/config/shiny/shiny.bioinstaller.parameters.toml index 9126309..6f991ea 100644 --- a/inst/extdata/config/shiny/shiny.bioinstaller.parameters.toml +++ b/inst/extdata/config/shiny/shiny.bioinstaller.parameters.toml @@ -12,7 +12,7 @@ rcmd_last = """ """ progressbar_message = "Running BioInstaller functions." -render_id = "bioinstaller_bioinstaller_input_box" +render_id = "bioinstaller_input_box" #!!!!! input_ui_order required related section input_ui_order = ["single_input", "start_analysis"] @@ -37,7 +37,7 @@ label = "Run" section_type = "output" rcmd_last = "BioInstaller::install.bioinfo(show.all.names = TRUE)[1:10]" render_type = "shiny::renderPrint" -render_id = "bioinstaller_bioinstaller_output_text" +render_id = "bioinstaller_output_text" output_type = "shiny::verbatimTextOutput" progressbar_message = "BioInstaller bioinstaller_output_text" @@ -77,6 +77,6 @@ if (object_type != "all") { obj <- cbind(obj, resources_db) """ render_type = "DT::renderDataTable" -render_id = "bioinstaller_bioinstaller_output_table" +render_id = "bioinstaller_output_table" output_type = "DT::dataTableOutput" progressbar_message = "BioInstaller bioinstaller_output_table" diff --git a/inst/extdata/config/shiny/shiny.conda.parameters.toml b/inst/extdata/config/shiny/shiny.conda.parameters.toml index 76acd50..91e78c3 100644 --- a/inst/extdata/config/shiny/shiny.conda.parameters.toml +++ b/inst/extdata/config/shiny/shiny.conda.parameters.toml @@ -1,30 +1,63 @@ [conda.ui.sections] -order = ["readfiles", "outputFields"] +order = ["conda_input_box", "conda_output_box_text", "conda_output_box_table"] [conda.ui.sections.ui_basic] -readfiles = "title = 'Input', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" -outputFields = "title = 'Output of conda', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +conda_input_box = "title = 'Input', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +conda_output_box_text = "title = 'Output of conda (Text)', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +conda_output_box_table = "title = 'Output of conda (Table)', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" -[conda.paramters.readfiles] +[conda.paramters.conda_input_box] # For reading annovarR shiny APP conda tool input files section_type = "input" rcmd_last = """ """ progressbar_message = "Running conda functions." -render_id = "conda_readfiles" +render_id = "conda_input_box" #!!!!! input_ui_order required related section -input_ui_order = ["start_analysis"] +input_ui_order = ["single_input", "start_analysis"] -[conda.paramters.readfiles.input.start_analysis] +[conda.paramters.conda_input_box.input.single_input] +title = "Parameters:" +title_control = "class = 'input-section-p'" +varname = ["conda_sub_cmd", "conda_env_name", "conda_params"] +input_id = ["input_conda_1", "input_conda_2", "input_conda_3"] +type = ["shiny::selectInput", "shiny::selectInput", "shiny::textInput"] +label = ["Conda subcommands", "Conda environment", "Conda parameters"] + +[conda.paramters.conda_input_box.input.single_input.choices] +conda_sub_cmd = ["clean", "config", "create", "info", "install", + "list", "package", "remove", "uninstall", + "search", "update", "upgrade"] +conda_env_name = "!!glue {BioInstaller::conda.env.list()[,1]}" +[conda.paramters.conda_input_box.input.single_input.selected] +conda_sub_cmd = "list" +conda_env_name = "base" + +[conda.paramters.conda_input_box.input.start_analysis] input_id = "start_conda_analysis" type = "shiny::actionButton" label = "Run" -[conda.paramters.outputFields] +[conda.paramters.conda_output_box_text] section_type = "output" -rcmd_last = "BioInstaller::conda.list()" +rcmd_last = """ +conda_env_cmd <- sprintf("source activate %s;", conda_env_name) +conda_params <- sprintf("%s %s", conda_sub_cmd, conda_params) +cat(conda(conda_params, conda_env_cmd)) +""" render_type = "shiny::renderPrint" render_id = "conda_output" output_type = "shiny::verbatimTextOutput" -progressbar_message = "conda ouput" +progressbar_message = "conda ouput_box_text" + +[conda.paramters.conda_output_box_table] +section_type = "output" +rcmd_last = """ +if (conda_sub_cmd == 'list') +conda.list(conda_env_name) +""" +render_type = "DT::renderDataTable" +render_id = "conda_output_table" +output_type = "DT::dataTableOutput" +progressbar_message = "conda ouput_box_table" diff --git a/inst/extdata/config/shiny/shiny.config.yaml b/inst/extdata/config/shiny/shiny.config.yaml index e049997..751770c 100644 --- a/inst/extdata/config/shiny/shiny.config.yaml +++ b/inst/extdata/config/shiny/shiny.config.yaml @@ -46,10 +46,11 @@ shiny_tools: pipeline: easy_project instant: - bioinstaller - - conda - spack + - conda - datasets2tools - pubmed + - geoquery - maftools shiny_tools_params: require: @@ -62,6 +63,7 @@ shiny_tools_params: pubmed: - rentrez - XML + geoquery: GEOquery maftools: maftools shiny_upload: upload_dir: ~/.BioInstaller/upload diff --git a/inst/extdata/config/shiny/shiny.datasets2tools.parameters.toml b/inst/extdata/config/shiny/shiny.datasets2tools.parameters.toml index 530a04c..a890023 100644 --- a/inst/extdata/config/shiny/shiny.datasets2tools.parameters.toml +++ b/inst/extdata/config/shiny/shiny.datasets2tools.parameters.toml @@ -20,9 +20,11 @@ for (i in input_params) { json_dat <- getForm(url, .params=datasets2tools_params) json_dat <- jsonlite::fromJSON(json_dat) json_dat <- as.data.frame(json_dat) -for(i in 1:ncol(json_dat)) { - if (typeof(json_dat[,i]) == "list") { - json_dat[,i] <- unlist(lapply(json_dat[,i], function(x) {paste0(x, collapse = ", ")})) +if (length(json_dat) > 0) { + for(i in 1:ncol(json_dat)) { + if (typeof(json_dat[,i]) == "list") { + json_dat[,i] <- unlist(lapply(json_dat[,i], function(x) {paste0(x, collapse = ", ")})) + } } } """ @@ -42,7 +44,7 @@ input_id = ["input_datasets2tools_1", "input_datasets2tools_2", type = ["shiny::selectInput", "shiny::textInput", "shiny::textInput", "shiny::textInput", "shiny::textInput", "shiny::textInput", "shiny::textInput", "shiny::numericInput"] label = ["Query type", "Key Words", "Dataset Accession (e.g. GSE775)", "Tool name", "Disease name", - "Canned nalysis Cccession", "Geneset", "Page size"] + "Canned nalysis Cccession", "Geneset", "Counts"] [datasets2tools.paramters.dataset2tools_input_box.input.single_input.choices] object_type = ["canned_analysis", "dataset", "tool"] @@ -53,7 +55,7 @@ page_size = 100 [datasets2tools.paramters.dataset2tools_input_box.input.start_analysis] input_id = "start_datasets2tools_analysis" type = "shiny::actionButton" -label = "Submit" +label = "Run" [datasets2tools.paramters.dataset2tools_out_box] section_type = "output" diff --git a/inst/extdata/config/shiny/shiny.geoquery.parameters.toml b/inst/extdata/config/shiny/shiny.geoquery.parameters.toml new file mode 100644 index 0000000..c7efa84 --- /dev/null +++ b/inst/extdata/config/shiny/shiny.geoquery.parameters.toml @@ -0,0 +1,59 @@ +[geoquery.ui.sections] +order = ["geoquery_input_box", "geoquery_output_text_1", "geoquery_output_table_1"] +[geoquery.ui.sections.ui_basic] +geoquery_input_box = "title = 'Input', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +geoquery_output_text_1 = "title = 'Output of geoquery', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +geoquery_output_table_1 = "title = 'Output of geoquery (Table)', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" + +[geoquery.paramters.geoquery_input_box] +# For reading annovarR shiny APP geoquery tool input files +section_type = "input" +rcmd_last = """ +gds <- "" +gsm <- "" +if (gds_file != "") gds <- getGEO(filename=gds_file) +if (gsm_file != "") gsm <- getGEO(filename=gsm_file) +""" +progressbar_message = "Running geoquery functions." +render_id = "geoquery_input_box" + +#!!!!! input_ui_order required related section +input_ui_order = ["single_input", "start_analysis"] + +[geoquery.paramters.geoquery_input_box.input.single_input] +title = "Parameters:" +title_control = "class = 'input-section-p'" +varname = ["gds_file", "gsm_file"] +input_id = ["input_geoquery_1", "input_geoquery_2"] +type = ["shiny::selectInput", "shiny::selectInput"] +label = ["GDS File", "GSE File"] + +[geoquery.paramters.geoquery_input_box.input.single_input.choices] +gds_file = "!!glue {c(system.file('extdata', 'GDS507.soft.gz', package = 'GEOquery'), featch_files()$file_path, '')}" +gsm_file = "!!glue {c(system.file('extdata', 'GSM11805.txt.gz', package = 'GEOquery'), featch_files()$file_path, '')}" +[geoquery.paramters.geoquery_input_box.input.single_input.selected] +gds_file = "" +gsm_file = "" + +[geoquery.paramters.geoquery_input_box.input.start_analysis] +input_id = "start_geoquery_analysis" +type = "shiny::actionButton" +label = "Run" + +[geoquery.paramters.geoquery_output_text_1] +section_type = "output" +rcmd_last = "head(Meta(gsm))" +render_type = "shiny::renderPrint" +render_id = "geoquery_output_text_1" +output_type = "shiny::verbatimTextOutput" +progressbar_message = "GEOquery geoquery_output_text_1" + +[geoquery.paramters.geoquery_output_table_1] +section_type = "output" +rcmd_last = """ +Table(gsm) +""" +render_type = "DT::renderDataTable" +render_id = "geoquery_output_table_1" +output_type = "DT::dataTableOutput" +progressbar_message = "GEOquery geoquery_output_table_1" diff --git a/inst/extdata/config/shiny/shiny.pubmed.parameters.toml b/inst/extdata/config/shiny/shiny.pubmed.parameters.toml index 57ea4ae..95aba17 100644 --- a/inst/extdata/config/shiny/shiny.pubmed.parameters.toml +++ b/inst/extdata/config/shiny/shiny.pubmed.parameters.toml @@ -86,7 +86,7 @@ if (!is.null(objs) && (max_n_items >= 500)){ colnames(result) <- c("PMID", "DOI", "Title", "Abstract", "PublishDate", "JournalName", "BookName") """ progressbar_message = "Running pubmed functions." -render_id = "pubmed_pubmed_input_box" +render_id = "pubmed_input_box" #!!!!! input_ui_order required related section input_ui_order = ["single_input", "start_analysis"] diff --git a/inst/extdata/config/shiny/shiny.spack.parameters.toml b/inst/extdata/config/shiny/shiny.spack.parameters.toml index ff3a069..75aeaa0 100644 --- a/inst/extdata/config/shiny/shiny.spack.parameters.toml +++ b/inst/extdata/config/shiny/shiny.spack.parameters.toml @@ -1,29 +1,44 @@ [spack.ui.sections] -order = ["readfiles", "outputFields"] +order = ["spack_input_box", "spack_output_box_text"] [spack.ui.sections.ui_basic] -readfiles = "title = 'Input', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" -outputFields = "title = 'Output of spack', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +spack_input_box = "title = 'Input', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" +spack_output_box_text = "title = 'Output of spack', status = 'primary', width = 12, collapsed = FALSE, collapsible = TRUE" -[spack.paramters.readfiles] +[spack.paramters.spack_input_box] # For reading annovarR shiny APP spack tool input files section_type = "input" -rcmd_last = """ - -""" +rcmd_last = "" progressbar_message = "Running spack functions." -render_id = "spack_readfiles" +render_id = "spack_input_box" #!!!!! input_ui_order required related section -input_ui_order = ["start_analysis"] +input_ui_order = ["single_input", "start_analysis"] + +[spack.paramters.spack_input_box.input.single_input] +title = "Parameters:" +title_control = "class = 'input-section-p'" +varname = ["spack_sub_cmd", "spack_params"] +input_id = ["input_spack_1", "input_spack_2"] +type = ["shiny::selectInput", "shiny::textInput"] +label = ["spack subcommands", "spack parameters"] + +[spack.paramters.spack_input_box.input.single_input.choices] +spack_sub_cmd = ["list", "info", "find", "install", "uninstall", + "spec", "load", + "module", "unload", + "view", "create", "edit", + "arch", "compilers"] +[spack.paramters.spack_input_box.input.single_input.selected] +spack_sub_cmd = "find" -[spack.paramters.readfiles.input.start_analysis] +[spack.paramters.spack_input_box.input.start_analysis] input_id = "start_spack_analysis" type = "shiny::actionButton" label = "Run" -[spack.paramters.outputFields] +[spack.paramters.spack_output_box_text] section_type = "output" -rcmd_last = "cat(BioInstaller::spack('find'))" +rcmd_last = "cat(BioInstaller::spack(sprintf('%s %s', spack_sub_cmd, spack_params)))" render_type = "shiny::renderPrint" render_id = "spack_output" output_type = "shiny::verbatimTextOutput" diff --git a/inst/extdata/shiny/server_download.R b/inst/extdata/shiny/server_download.R index 408ec9e..357a22e 100644 --- a/inst/extdata/shiny/server_download.R +++ b/inst/extdata/shiny/server_download.R @@ -70,7 +70,7 @@ download_section_server <- function(input, output) { output$conda_installer_ui <- renderUI({ conda_envs <- BioInstaller::conda.env.list()[,1] HTML( - paste0(shiny::selectInput("installer_conda_sub_command", "Sub command of conda", + paste0(shiny::selectInput("installer_conda_sub_command", "Conda subcommands", c("clean", "config", "create", "info", "install", "list", "package", @@ -80,8 +80,8 @@ download_section_server <- function(input, output) { shiny::selectInput("installer_conda_env_name", label = "Conda environment", choices = conda_envs, selected = "base"), - shiny::textAreaInput("installer_conda_parameters", label = "Parameters"), - actionButton("installer_conda_run", label = "Run") + shiny::textAreaInput("installer_conda_parameters", label = "Conda parameters"), + actionButton("installer_conda_run", label = "Submit") ), collapse = "\n") }) @@ -97,7 +97,7 @@ download_section_server <- function(input, output) { "arch", "compilers"), selected = "find"), shiny::textAreaInput("installer_spack_parameters", label = "Parameters"), - actionButton("installer_spack_run", label = "Run") + actionButton("installer_spack_run", label = "Submit") ), collapse = "\n") }) diff --git a/inst/extdata/shiny/ui_body_download.R b/inst/extdata/shiny/ui_body_download.R index 59ad954..197357b 100644 --- a/inst/extdata/shiny/ui_body_download.R +++ b/inst/extdata/shiny/ui_body_download.R @@ -35,7 +35,7 @@ get_download_tabItem_ui <- function(){ "save.to.db", "overwrite") ), shiny::textInput("extra.paramters", "Extra parameters", "list()"), - actionButton("install_run", "Run") + actionButton("install_run", "Submit") ), box( title = "Conda",