Skip to content

Commit

Permalink
update importBugphyzz and tests with Zenodo DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed Apr 16, 2024
1 parent 8e189a9 commit 6c63337
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: bugphyzz
Title: A harmonized data resource and software for enrichment analysis of microbial physiologies
Version: 0.99.0
Version: 0.99.1
Authors@R:
c(
person(
Expand Down
4 changes: 2 additions & 2 deletions R/bugphyzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ utils::globalVariables(c(
#' names(bp)
#'
importBugphyzz <- function(
version = "d3fd894", force_download = FALSE, v = 0.5,
version = "10.5281/zenodo.10980813", force_download = FALSE, v = 0.5,
exclude_rarely = TRUE

) {
Expand Down Expand Up @@ -367,7 +367,7 @@ getTaxonSignatures <- function(tax, bp, ...) {

output <- vector("list", length(files))
for (i in seq_along(output)) {
output[[i]] <- utils::read.csv(files, header = TRUE, skip = 1) |>
output[[i]] <- utils::read.csv(files[i], header = TRUE, skip = 1) |>
dplyr::mutate(Attribute = tolower(Attribute))
}
return(output)
Expand Down
2 changes: 1 addition & 1 deletion man/importBugphyzz.Rd

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

11 changes: 11 additions & 0 deletions tests/testthat/test-importBugphyzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ test_that("importBugphyzz works with hash", {
expect_true(all(map_lgl(bp, checkUniqueAnnotations)))
})

test_that("importBugphyzz works with Zenodo DOI", {
bp <- importBugphyzz(version = "10.5281/zenodo.10980813", force_download = TRUE)
expect_true(all("data.frame" == map_chr(bp, class)))
expect_true(all(map_lgl(bp, ~ nrow(.x) > 0)))
expect_true(all(map_lgl(bp, checkColumnNames)))
expect_true(all(map_lgl(bp, checkColumnTypes)))
expect_true(all(map_lgl(bp, checkNAs)))
expect_true(all(map_lgl(bp, checkCuration)))
expect_true(all(map_lgl(bp, checkUniqueAnnotations)))
})

## TODO create test for using Zenodo
test_that("importBugphyzz doesn't work with other words", {
expect_error(importBugphyzz(version = "abcd-1234", force_download = TRUE))
Expand Down

0 comments on commit 6c63337

Please sign in to comment.