diff --git a/DESCRIPTION b/DESCRIPTION index 71db0a23..6634ff0c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 2.1.1.9068 -Date: 2024-07-17 +Version: 2.1.1.9070 +Date: 2024-07-19 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index cbdf835a..a3fab19b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9068 +# AMR 2.1.1.9070 *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)* diff --git a/R/mo.R b/R/mo.R index 8436e1b9..942b79d4 100755 --- a/R/mo.R +++ b/R/mo.R @@ -1258,14 +1258,14 @@ synonym_mo_to_accepted_mo <- function(x, fill_in_accepted = FALSE, dataset = AMR # make sure to get the latest name, e.g. Fusarium pulicaris robiniae was first renamed to Fusarium roseum, then to Fusarium sambucinum # we need the MO of Fusarium pulicaris robiniae to return the MO of Fusarium sambucinum - idx <- !is.na(is_still_synonym) & is_still_synonym - x_gbif <- dataset$gbif_renamed_to[match(out[idx], dataset$mo)] - x_mycobank <- dataset$mycobank_renamed_to[match(out[idx], dataset$mo)] - x_lpsn <- dataset$lpsn_renamed_to[match(out[idx], dataset$mo)] + must_be_corrected <- !is.na(is_still_synonym) & is_still_synonym + x_gbif <- dataset$gbif_renamed_to[match(out, dataset$mo)] + x_mycobank <- dataset$mycobank_renamed_to[match(out, dataset$mo)] + x_lpsn <- dataset$lpsn_renamed_to[match(out, dataset$mo)] - out[idx][!is.na(x_gbif)] <- dataset$mo[match(x_gbif[idx][!is.na(x_gbif)], dataset$gbif)] - out[idx][!is.na(x_mycobank)] <- dataset$mo[match(x_mycobank[idx][!is.na(x_mycobank)], dataset$mycobank)] - out[idx][!is.na(x_lpsn)] <- dataset$mo[match(x_lpsn[idx][!is.na(x_lpsn)], dataset$lpsn)] + out[must_be_corrected & !is.na(x_gbif)] <- dataset$mo[match(x_gbif[must_be_corrected & !is.na(x_gbif)], dataset$gbif)] + out[must_be_corrected & !is.na(x_mycobank)] <- dataset$mo[match(x_mycobank[must_be_corrected & !is.na(x_mycobank)], dataset$mycobank)] + out[must_be_corrected & !is.na(x_lpsn)] <- dataset$mo[match(x_lpsn[must_be_corrected & !is.na(x_lpsn)], dataset$lpsn)] is_still_synonym <- dataset$status[match(out, dataset$mo)] == "synonym" } diff --git a/R/mo_property.R b/R/mo_property.R index 634b5b40..bc00eedd 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -928,7 +928,7 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), keep_synonyms = # overwrite with LPSN: u[!is.na(x.lpsn)] <- paste0(TAXONOMY_VERSION$LPSN$url, "/", x.rank[!is.na(x.lpsn)], "/", gsub(" ", "-", tolower(x.name[!is.na(x.lpsn)]), fixed = TRUE)) # overwrite with MycoBank (bacteria from LPSN will not be overwritten since MycoBank has no bacteria) - u[!is.na(x.mycobank)] <- paste0(TAXONOMY_VERSION$MycoBank$url, "/name/", gsub(" ", "%20", tolower(x.name[!is.na(x.mycobank)]), fixed = TRUE)) + u[!is.na(x.mycobank)] <- paste0(TAXONOMY_VERSION$MycoBank$url, "/mb/", gsub(" ", "%20", tolower(x.mycobank[!is.na(x.mycobank)]), fixed = TRUE)) names(u) <- x.name diff --git a/inst/tinytest/test-mo_property.R b/inst/tinytest/test-mo_property.R index 51848a60..0051c6b7 100644 --- a/inst/tinytest/test-mo_property.R +++ b/inst/tinytest/test-mo_property.R @@ -113,7 +113,8 @@ expect_equal(mo_ref("Escherichia coli"), "Castellani et al., 1919") expect_equal(mo_authors("Escherichia coli"), "Castellani et al.") expect_equal(mo_year("Escherichia coli"), 1919) -expect_true(mo_url("Candida albicans") %like% "gbif.org") +expect_true(mo_url("Amoeba dysenteriae") %like% "gbif.org") +expect_true(mo_url("Candida albicans") %like% "mycobank.org") expect_true(mo_url("Escherichia coli") %like% "lpsn.dsmz.de") # test integrity of getting back full names diff --git a/inst/tinytest/test-sir.R b/inst/tinytest/test-sir.R index 70c3c909..cfd6667b 100644 --- a/inst/tinytest/test-sir.R +++ b/inst/tinytest/test-sir.R @@ -326,7 +326,6 @@ expect_identical(out_vet$PRA, rep(NA_sir_, 11)) expect_identical(out_vet$FLR, as.sir(c("S", "S", NA, "S", "S", NA, "I", "R", NA, "R", "R"))) sir_history <- sir_interpretation_history() -print(sir_history$host) expect_identical(sort(sir_history$host), c("cats", "cats", "cats", "cats", "cats", "cats", "cats", "cats", "cats", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "dogs",