diff --git a/R/2025-10-27_JF_R_Galaxy_functions.R b/R/2025-10-27_JF_R_Galaxy_functions.R
index e38dc2c..ca2d2a5 100644
--- a/R/2025-10-27_JF_R_Galaxy_functions.R
+++ b/R/2025-10-27_JF_R_Galaxy_functions.R
@@ -953,19 +953,20 @@ 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"
#' )
#' }
#'
#' @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,
@@ -973,32 +974,38 @@ galaxy_set_credentials <- function(api_key = NULL,
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)
}
diff --git a/README.md b/README.md
index fe24128..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.
@@ -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
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"
)
}