(v2.1.1.9070) fix for mo_current mo (no-verify)

This commit is contained in:
dr. M.S. (Matthijs) Berends 2024-07-19 18:04:45 +02:00
parent 83907c9c65
commit 573c0346ed
6 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 2.1.1.9068 Version: 2.1.1.9070
Date: 2024-07-17 Date: 2024-07-19
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@ -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).)* *(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).)*

14
R/mo.R
View File

@ -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 # 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 # we need the MO of Fusarium pulicaris robiniae to return the MO of Fusarium sambucinum
idx <- !is.na(is_still_synonym) & is_still_synonym must_be_corrected <- !is.na(is_still_synonym) & is_still_synonym
x_gbif <- dataset$gbif_renamed_to[match(out[idx], dataset$mo)] x_gbif <- dataset$gbif_renamed_to[match(out, dataset$mo)]
x_mycobank <- dataset$mycobank_renamed_to[match(out[idx], dataset$mo)] x_mycobank <- dataset$mycobank_renamed_to[match(out, dataset$mo)]
x_lpsn <- dataset$lpsn_renamed_to[match(out[idx], 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[must_be_corrected & !is.na(x_gbif)] <- dataset$mo[match(x_gbif[must_be_corrected & !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[must_be_corrected & !is.na(x_mycobank)] <- dataset$mo[match(x_mycobank[must_be_corrected & !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_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" is_still_synonym <- dataset$status[match(out, dataset$mo)] == "synonym"
} }

View File

@ -928,7 +928,7 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), keep_synonyms =
# overwrite with LPSN: # 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)) 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) # 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 names(u) <- x.name

View File

@ -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_authors("Escherichia coli"), "Castellani et al.")
expect_equal(mo_year("Escherichia coli"), 1919) 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") expect_true(mo_url("Escherichia coli") %like% "lpsn.dsmz.de")
# test integrity of getting back full names # test integrity of getting back full names

View File

@ -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"))) expect_identical(out_vet$FLR, as.sir(c("S", "S", NA, "S", "S", NA, "I", "R", NA, "R", "R")))
sir_history <- sir_interpretation_history() sir_history <- sir_interpretation_history()
print(sir_history$host)
expect_identical(sort(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", 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", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "cattle", "dogs",