Skip to content

Commit

Permalink
fix issue with multiple compounds per mol file
Browse files Browse the repository at this point in the history
  • Loading branch information
Aariq committed Dec 9, 2024
1 parent 8178e75 commit 758a30a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions R/get_mol_kegg.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,5 @@ dl_mol_kegg <- function(compound_ids) {

#maps over list, but returns it to a single character vector to simplify wrangling code
purrr::map(compound_id_list, .dl_mol_kegg) %>%
purrr::list_c() %>%
glue::glue_collapse()
purrr::list_c()
}
11 changes: 11 additions & 0 deletions tests/testthat/test-get_mol_kegg.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,14 @@ test_that("works with pathway modules", {
expect_true(all(file.exists(out$mol_path)))
})

test_that("one compound per mol", {
skip_on_cran()
skip_if_offline()

dir <- withr::local_tempdir()
mols <- get_mol_kegg(c("C16181", "C00042"), dir = dir)
mol1 <- readLines(mols$mol_path[1])
mol2 <- readLines(mols$mol_path[2])
expect_equal(sum(stringr::str_detect(mol1, "END")), 1)
expect_equal(sum(stringr::str_detect(mol2, "END")), 1)
})

0 comments on commit 758a30a

Please sign in to comment.