1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 11:51:59 +02:00

speed improvement for as.mo, more old taxonomic names

This commit is contained in:
2018-09-27 23:23:48 +02:00
parent 450992baea
commit 2b0080995e
18 changed files with 481 additions and 441 deletions

View File

@ -15,7 +15,7 @@ test_that("as.mo works", {
expect_equal(as.character(as.mo("Escherichia species")), "B_ESCHR")
expect_equal(as.character(as.mo("Escherichia")), "B_ESCHR")
expect_equal(as.character(as.mo(" B_ESCHR_COL ")), "B_ESCHR_COL")
#expect_equal(as.character(as.mo("coli")), "B_ESCHR_COL") # not Campylobacter
expect_equal(as.character(as.mo("e coli")), "B_ESCHR_COL") # not Campylobacter
expect_equal(as.character(as.mo("klpn")), "B_KLBSL_PNE")
expect_equal(as.character(as.mo("Klebsiella")), "B_KLBSL")
expect_equal(as.character(as.mo("K. pneu rhino")), "B_KLBSL_PNE_RHI") # K. pneumoniae subspp. rhinoscleromatis
@ -34,9 +34,6 @@ test_that("as.mo works", {
expect_equal(as.character(as.mo("P. aer")), "B_PDMNS_AER") # not Pasteurella aerogenes
# expect_equal(as.character(as.mo("Negative rods")), "GNR")
# expect_equal(as.character(as.mo("Gram negative rods")), "GNR")
# GLIMS
expect_equal(as.character(as.mo("bctfgr")), "B_BCTRD_FRA")

View File

@ -8,11 +8,13 @@ test_that("mo_property works", {
expect_equal(mo_family("E. coli"), "Enterobacteriaceae")
expect_equal(mo_genus("E. coli"), "Escherichia")
expect_equal(mo_species("E. coli"), "coli")
expect_equal(mo_subspecies("E. coli"), "")
expect_equal(mo_subspecies("E. coli"), NA_character_)
expect_equal(mo_fullname("E. coli"), "Escherichia coli")
expect_equal(mo_type("E. coli", language = "en"), "Bacteria")
expect_equal(mo_gramstain("E. coli", language = "en"), "Gram negative")
expect_equal(class(mo_taxonomy("E. coli")), "list")
expect_equal(names(mo_taxonomy("E. coli")), c("subkingdom", "phylum", "class", "order",
"family", "genus", "species", "subspecies"))
expect_equal(mo_shortname("MRSA"), "S. aureus")
expect_equal(mo_shortname("MRSA", Becker = TRUE), "S. aureus")
@ -21,12 +23,8 @@ test_that("mo_property works", {
expect_equal(mo_shortname("S. aga", Lancefield = TRUE), "GBS")
# test integrity
# library(dplyr)
# rnd <- sample(1:nrow(AMR::microorganisms), 500, replace = FALSE) # random 500 rows
# MOs <- AMR::microorganisms %>% filter(!is.na(mo),
# species != "species",
# dplyr::row_number() %in% rnd)
# expect_identical(MOs$fullname, mo_fullname(MOs$fullname, language = "en"))
MOs <- AMR::microorganisms
expect_identical(MOs$fullname, mo_fullname(MOs$fullname, language = "en"))
# check languages
expect_equal(mo_type("E. coli", language = "de"), "Bakterien")