Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: enviPathR
Title: Client for the 'enviPath' 'RESTful' API
Version: 1.0.1
Version: 1.0.2
Authors@R:
c(person(given = "Giulio", family = "Benedetti",
role = c("aut", "cre", "cph"),
Expand Down
8 changes: 4 additions & 4 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Changes in version 0.99.x
* Introduced epTypes, epLogin, epLogout, epList, epLink, epGet and epModel

Changes in version 1.0.x
* Submitted to CRAN
* Submitted to CRAN

Changes in version 0.99.x
* Introduced epTypes, epLogin, epLogout, epList, epLink, epGet and epModel
4 changes: 1 addition & 3 deletions R/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' not serial. (Default: \code{5})
#'
#' @returns
#' A list of objects
#' A list of objects.
#'
#' @examples
#' \dontshow{
Expand Down Expand Up @@ -76,8 +76,6 @@ epGet <- function(type, init = NULL, pkg = NULL, property = NULL,
SIMPLIFY = FALSE,
BPPARAM = BPPARAM
)
# Reduce list to single object
if( length(out) == 1L ) out <- out[[1L]]
return(out)
}

Expand Down
6 changes: 5 additions & 1 deletion R/link.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ epLink <- function(from, to, init = NULL, pkg = NULL, BPPARAM = bpparam(), rate
if( by == "pathway2compound" ){
linkmap[to] <- str_remove(linkmap[[to]], "/structure/.*")
}
if( by == "pathway2reaction" ){
rxn_df <- epList("reaction", pkg = pkg)
linkmap[to] <- rxn_df$id[rxn_df$name %in% linkmap[[to]]]
}
# Remove id prefix
linkmap[to] <- str_remove(linkmap[[to]], ".*/")
return(linkmap)
Expand Down Expand Up @@ -142,7 +146,7 @@ epLink <- function(from, to, init = NULL, pkg = NULL, BPPARAM = bpparam(), rate
# Check if pkg exists
is_init <- !is.null(init)
# Check pkg format
if( is_init && !all(is.character(init) & nzchar(init)) ){
if( is_init && (!is.character(init) || !all(nzchar(init))) ){
stop(
"'init' must be a character vector specifying the unique ",
"identifiers of type 'from' that should be mapped on 'to'.",
Expand Down
6 changes: 3 additions & 3 deletions R/login.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' @name epLogin
#'
#' @description
#' epLogin lets you perform login to enviPath. An account is required to use the
#' enviPath API.
#' epLogin and epLogout let you log in and out of enviPath, respectively. An
#' account is required to use the enviPath API.
#'
#' @param username \code{Character scalar}. String specifying the username
#' used to log into an enviPath personal account.
Expand All @@ -13,7 +13,7 @@
#' used to log into an enviPath personal account.
#'
#' @returns
#' A message upon successful login.
#' A message upon successful login or logout.
#'
#' @examples
#' \dontshow{
Expand Down
3 changes: 2 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
pathway2compound = c(item = "nodes", var = "idcomp"),
pathway2edge = c(item = "links", var = "id"),
pathway2node = c(item = "nodes", var = "id"),
pathway2reaction = c(item = "links", var = "idreaction"),
# pathway2reaction = c(item = "links", var = "idreaction"),
pathway2reaction = c(item = "links", var = "name"),
pathway2structure = c(item = "nodes", var = "idcomp"),
reaction2compound = list(item = c("educts", "products"), var = "id"),
reaction2ec = c(item = "ecNumbers", var = "id"),
Expand Down
2 changes: 1 addition & 1 deletion man/epGet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/epLogin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/httptest/get/package_reaction/wrong.R

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/httptest/link/package_compound/wrong.R

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/httptest/list/package/wrong/reaction.R

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/httptest/login/NA-2f7c1a-POST.R

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/httptest/model/util-e1f28b-POST.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
structure(list(method = "POST", url = "https://util", status_code = 403L,
headers = structure(list(Server = "nginx/1.24.0 (Ubuntu)",
Date = "Fri, 16 Oct 2026 03:48:10 GMT", `Content-Type` = "application/json; charset=utf-8",
Date = "Sat, 24 Oct 2026 03:32:47 GMT", `Content-Type` = "application/json; charset=utf-8",
`Content-Length` = "139", Connection = "keep-alive",
Vary = "Authorization, Cookie", `X-Frame-Options` = "DENY",
`X-Content-Type-Options` = "nosniff", `Referrer-Policy` = "same-origin",
`Cross-Origin-Opener-Policy` = "same-origin"), class = "httr2_headers"),
body = charToRaw("{\"message\": \"Getting Setting with id https://envipath.org/setting/1d915a48-286a-4394-9693-bfaa187326a5 failed due to insufficient rights!\"}"),
timing = c(redirect = 0, namelookup = 3.2e-05, connect = 0,
pretransfer = 0.000166, starttransfer = 0.347267, total = 0.347304
timing = c(redirect = 0, namelookup = 3.3e-05, connect = 0,
pretransfer = 0.000128, starttransfer = 0.412069, total = 0.412121
), cache = new.env(parent = emptyenv())), class = "httr2_response")
2 changes: 1 addition & 1 deletion tests/testthat/test-get.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ with_mock_dir("../httptest/get", {
rxn <- epGet("reaction", rxn_id, BPPARAM = BPPARAM)

expect_type(rxn, "list")
expect_length(rxn, 15L)
expect_length(rxn[[1L]], 15L)
})
})
6 changes: 6 additions & 0 deletions tests/testthat/test-link.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ with_mock_dir("../httptest/link", {
fixed = TRUE
)

expect_error(
epLink(types[1], types[2], factor(cpd_id), BPPARAM = BPPARAM),
"'init' must be a character vector specifying the unique identifiers of type 'from' that should be mapped on 'to'.",
fixed = TRUE
)

cpd2inchikey <- epLink(types[1], types[2], cpd_id, BPPARAM = BPPARAM)

expect_named(cpd2inchikey, types)
Expand Down
Loading