From cb2f508241f912379f57b0e48fab237eb2505ef4 Mon Sep 17 00:00:00 2001 From: Zoe <59600387+zoeschindler@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:07:06 +0100 Subject: [PATCH 1/3] Update 2025-10-27_JF_R_Galaxy_functions.R --- R/2025-10-27_JF_R_Galaxy_functions.R | 37 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/R/2025-10-27_JF_R_Galaxy_functions.R b/R/2025-10-27_JF_R_Galaxy_functions.R index e38dc2c..c58a945 100644 --- a/R/2025-10-27_JF_R_Galaxy_functions.R +++ b/R/2025-10-27_JF_R_Galaxy_functions.R @@ -961,44 +961,51 @@ galaxy_history_size <- function(history_id, #' #' @export galaxy_set_credentials <- function(api_key = NULL, - galaxy_url = NULL, - username = NULL, - password = NULL, - overwrite = TRUE) { - + username = NULL, + password = NULL, + galaxy_url = "https://usegalaxy.eu", + overwrite = TRUE) { + + # rename inputs values <- list( GALAXY_API_KEY = api_key, GALAXY_URL = galaxy_url, GALAXY_USERNAME = username, GALAXY_PASSWORD = password ) - - if(galaxy_has_key() & overwrite) { + + # replace previous key + if (galaxy_has_key() & overwrite) { warning("There was already an API key set which will be overwritten") } - + + # loop over inputs set_values <- list() - for (name in names(values)) { value <- values[[name]] - + + # skip empty values if (is.null(value)) { next } - + + # stop at empty strings if (!nzchar(value)) { stop(name, " must be a non-empty string.") } - + + # check whether environmental variable is set already existing <- Sys.getenv(name, unset = NA_character_) if (!isTRUE(overwrite) && !is.na(existing) && nzchar(existing)) { stop(name, " already set; use overwrite = TRUE to replace.") } - - Sys.setenv(structure(value, names = name)) + + # sets variable + do.call(Sys.setenv, as.list(structure(value, names = name))) set_values[[name]] <- value } - + + # returns list of set variables invisible(set_values) } From 1bf839817465d659920952f222f5c11003566a90 Mon Sep 17 00:00:00 2001 From: Zoe <59600387+zoeschindler@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:08:00 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fe24128..60942aa 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,13 @@ You can either: ### Option 1: Set it once per session ```r -galaxy_set_api_key("YOUR_GALAXY_API_KEY") +galaxy_set_credentials("your-secret-key") ``` ### Option 2: Add it to `~/.Renviron` (recommended) ``` -GALAXY_API_KEY=your-secret-key +#usethis::edit_r_environ() +GALAXY_API_KEY = your-secret-key ``` Restart R after editing `.Renviron`. @@ -102,7 +103,7 @@ job_id <- galaxy_run_tool( text_input = "added text", infile = list( src = "hda", - id = file_id$id + id = file_id ), options = "header" # add text at the top of the file ) @@ -178,8 +179,8 @@ Terminal states: --- -Author: -Julian Frey -Chair of Forest Growth and Dendroecology +Author:
+Julian Frey
+Chair of Forest Growth and Dendroecology
University of Freiburg From cb742953076847daffd1564c06b7b92c92f296bb Mon Sep 17 00:00:00 2001 From: zoeschindler Date: Mon, 19 Jan 2026 19:28:26 +0100 Subject: [PATCH 3/3] small changes to credential setting & readme --- R/2025-10-27_JF_R_Galaxy_functions.R | 22 +++++++++++----------- README.md | 4 ++-- inst/CITATION | 10 ++++++++++ man/galaxy_set_credentials.Rd | 12 ++++++------ 4 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 inst/CITATION diff --git a/R/2025-10-27_JF_R_Galaxy_functions.R b/R/2025-10-27_JF_R_Galaxy_functions.R index c58a945..ca2d2a5 100644 --- a/R/2025-10-27_JF_R_Galaxy_functions.R +++ b/R/2025-10-27_JF_R_Galaxy_functions.R @@ -953,9 +953,9 @@ galaxy_history_size <- function(history_id, #' \dontrun{ #' galaxy_set_credentials( #' api_key = "your-secret-key", -#' galaxy_url = "https://usegalaxy.eu", #' username = "your-username", -#' password = "your-password" +#' password = "your-password", +#' galaxy_url = "https://usegalaxy.eu" #' ) #' } #' @@ -965,7 +965,7 @@ galaxy_set_credentials <- function(api_key = NULL, password = NULL, galaxy_url = "https://usegalaxy.eu", overwrite = TRUE) { - + # rename inputs values <- list( GALAXY_API_KEY = api_key, @@ -973,38 +973,38 @@ galaxy_set_credentials <- function(api_key = NULL, GALAXY_USERNAME = username, GALAXY_PASSWORD = password ) - + # replace previous key if (galaxy_has_key() & overwrite) { warning("There was already an API key set which will be overwritten") } - - # loop over inputs + + # loop over inputs set_values <- list() for (name in names(values)) { value <- values[[name]] - + # skip empty values if (is.null(value)) { next } - + # stop at empty strings if (!nzchar(value)) { stop(name, " must be a non-empty string.") } - + # check whether environmental variable is set already existing <- Sys.getenv(name, unset = NA_character_) if (!isTRUE(overwrite) && !is.na(existing) && nzchar(existing)) { stop(name, " already set; use overwrite = TRUE to replace.") } - + # sets variable do.call(Sys.setenv, as.list(structure(value, names = name))) set_values[[name]] <- value } - + # returns list of set variables invisible(set_values) } diff --git a/README.md b/README.md index 60942aa..016dc0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# GalaxyRTools +# GalaxyR -**GalaxyRTools** is an R package for programmatic interaction with the **Galaxy API** (tested primarily against [Galaxy Europe](https://usegalaxy.eu)). +**GalaxyR** is an R package for programmatic interaction with the **Galaxy API** (tested primarily against [Galaxy Europe](https://usegalaxy.eu)). It allows you to manage histories, upload data, run tools and workflows, wait for jobs to complete, and download results — all directly from R. This package is designed for **automation, reproducibility, and scripting**, not UI replacement. diff --git a/inst/CITATION b/inst/CITATION new file mode 100644 index 0000000..f0bbbc1 --- /dev/null +++ b/inst/CITATION @@ -0,0 +1,10 @@ +citHeader("To cite GalaxyR in publications use:") + +citEntry( + entry = "misc", + title = "GalaxyR", + author = "Julian Frey", + year = "2026", + url = "https://github.com/JulFrey/GalaxyR", + textVersion = "Frey, J. (2026) GalaxyR. https://github.com/JulFrey/GalaxyR" +) diff --git a/man/galaxy_set_credentials.Rd b/man/galaxy_set_credentials.Rd index ccfd4c7..3aba735 100644 --- a/man/galaxy_set_credentials.Rd +++ b/man/galaxy_set_credentials.Rd @@ -6,22 +6,22 @@ \usage{ galaxy_set_credentials( api_key = NULL, - galaxy_url = NULL, username = NULL, password = NULL, + galaxy_url = "https://usegalaxy.eu", overwrite = TRUE ) } \arguments{ \item{api_key}{Character. Galaxy API key.} -\item{galaxy_url}{Character. Base URL of the Galaxy instance -(e.g. \code{"https://usegalaxy.eu"}). If set all galaxy_url arguments of functions will be ignored.} - \item{username}{Character. Galaxy username (only required for FTP uploads).} \item{password}{Character. Galaxy password (only required for FTP uploads).} +\item{galaxy_url}{Character. Base URL of the Galaxy instance +(e.g. \code{"https://usegalaxy.eu"}). If set all galaxy_url arguments of functions will be ignored.} + \item{overwrite}{Logical. Whether to overwrite existing environment variables. Default: \code{TRUE}.} } @@ -49,9 +49,9 @@ Only arguments that are provided (non-NULL) are set. \dontrun{ galaxy_set_credentials( api_key = "your-secret-key", - galaxy_url = "https://usegalaxy.eu", username = "your-username", - password = "your-password" + password = "your-password", + galaxy_url = "https://usegalaxy.eu" ) }