diff --git a/DESCRIPTION b/DESCRIPTION
index 9d62c704..a2047d31 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: AMR
-Version: 0.5.0.9017
-Date: 2019-02-14
+Version: 0.5.0.9018
+Date: 2019-02-18
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(
diff --git a/NAMESPACE b/NAMESPACE
index 4a7ba715..c87056bd 100755
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -108,7 +108,6 @@ export(labels_rsi_count)
export(left_join_microorganisms)
export(like)
export(mdro)
-export(mo_TSN)
export(mo_authors)
export(mo_class)
export(mo_failures)
diff --git a/NEWS.md b/NEWS.md
index 096fbcc9..73952f58 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,8 +1,21 @@
# AMR 0.5.0.90xx
**Note: this is the development version, which will eventually be released as AMR 0.6.0.**
+**New website!**
+
+We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.gitlab.io/AMR/) (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
+
+* Contains the complete manual of this package and all of its functions with an explanation of their parameters
+* Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis, import data from WHONET or SPSS and many more.
+
#### New
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo()` to identify an MO code.
+* Catalogue of Life (CoL) inclusion for data about microorganisms, which also contains all ITIS data we used previously. The `microorganisms` data set now contains:
+ * Almost 60,000 species from six different kingdoms
+ * Almost 15,000 previously accepted names which are now taxonomic 'synonyms'
+ * All (sub)species from the kingdoms Archaea, Bacteria, Chromista, Protozoa and Viruses
+ * All (sub)species from the orders Eurotiales, Saccharomycetales and Onygenales of the kingdom Fungi. The complete taxonomy of this kingdom has more than 130,000 species. The orders we included contains at least all memebers of the families *Candida*, *Aspergillus* and *Trichophyton*.
+ * Due to this change, the ID of *Streptococcus* was changed from `B_STRPTC` to `B_STRPT`.
* Support for data from [WHONET](https://whonet.org/) and [EARS-Net](https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net) (European Antimicrobial Resistance Surveillance Network):
* Exported files from WHONET can be read and used in this package. For functions like `first_isolate()` and `eucast_rules()`, all parameters will be filled in automatically.
* This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the `antibiotics` data set now contains a column `ears_net`.
@@ -18,9 +31,6 @@
ab_tradenames -> atc_tradenames()
```
These functions use `as.atc()` internally. The old `atc_property` has been renamed `atc_online_property()`. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class `atc` or must be coerable to this class. Properties of these classes should start with the same class name, analogous to `as.mo()` and e.g. `mo_genus`.
-* New website: https://msberends.gitlab.io/AMR (built with the great [`pkgdown`](https://pkgdown.r-lib.org/))
- * Contains the complete manual of this package and all of its functions with an explanation of their parameters
- * Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis
* New functions `set_mo_source()` and `get_mo_source()` to use your own predefined MO codes as input for `as.mo()` and consequently all `mo_*` functions
* Support for the upcoming [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0
* New function `guess_ab_col()` to find an antibiotic column in a table
@@ -57,7 +67,7 @@
* Fixed a critical bug where some rules that depend on previous applied rules would not be applied adequately
* Emphasised in manual that penicillin is meant as benzylpenicillin (ATC [J01CE01](https://www.whocc.no/atc_ddd_index/?code=J01CE01))
* New info is returned when running this function, stating exactly what has been changed or added. Use `eucast_rules(..., verbose = TRUE)` to get a data set with all changed per bug and drug combination.
-* Added 605 *Aspergillus* species and 23 *Trichophyton* species to the `microorganisms` data set
+* Removed data sets `microorganisms.oldDT`, `microorganisms.prevDT`, `microorganisms.unprevDT` and `microorganismsDT` since they were no longer needed and only contained info already available in the `microorganisms` data set
* Added 65 antibiotics to the `antibiotics` data set, from the [Pharmaceuticals Community Register](http://ec.europa.eu/health/documents/community-register/html/atc.htm) of the European Commission
* Removed columns `atc_group1_nl` and `atc_group2_nl` from the `antibiotics` data set
* Functions `atc_ddd()` and `atc_groups()` have been renamed `atc_online_ddd()` and `atc_online_groups()`. The old functions are deprecated and will be removed in a future version.
diff --git a/R/data.R b/R/data.R
index 42e76ea2..3dac1489 100755
--- a/R/data.R
+++ b/R/data.R
@@ -130,14 +130,14 @@
#
"antibiotics"
-#' Data set with ~20,000 microorganisms
+#' Data set with ~60,000 microorganisms
#'
-#' A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa from ITIS. MO codes can be looked up using \code{\link{as.mo}}.
+#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
#' @inheritSection ITIS ITIS
-#' @format A \code{\link{data.frame}} with 19,456 observations and 15 variables:
+#' @format A \code{\link{data.frame}} with 56,659 observations and 15 variables:
#' \describe{
#' \item{\code{mo}}{ID of microorganism}
-#' \item{\code{tsn}}{Taxonomic Serial Number (TSN), as defined by ITIS}
+#' \item{\code{col_id}}{Catalogue of Life ID}
#' \item{\code{genus}}{Taxonomic genus of the microorganism as found in ITIS, see Source}
#' \item{\code{species}}{Taxonomic species of the microorganism as found in ITIS, see Source}
#' \item{\code{subspecies}}{Taxonomic subspecies of the microorganism as found in ITIS, see Source}
@@ -155,15 +155,10 @@
#' @source Integrated Taxonomic Information System (ITIS) public online database, \url{https://www.itis.gov}.
#' @details Manually added were:
#' \itemize{
-#' \item{605 species of Aspergillus (as Aspergillus misses from ITIS, list from https://en.wikipedia.org/wiki/List_of_Aspergillus_species on 2019-02-05)}
-#' \item{23 species of Trichophyton (as Trichophyton misses from ITIS, list from https://en.wikipedia.org/wiki/Trichophyton on 2019-02-05)}
-#' \item{9 species of Streptococcus (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)}
-#' \item{2 species of Straphylococcus (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
-#' \item{1 species of Candida (C. glabrata)}
+#' \item{9 species of \emph{Streptococcus} (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)}
+#' \item{2 species of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
#' \item{2 other undefined (unknown Gram negatives and unknown Gram positives)}
#' }
-#'
-#' These manual entries have no Taxonomic Serial Number (TSN), so can be looked up with \code{filter(microorganisms, is.na(tsn)}.
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.codes}}
"microorganisms"
@@ -172,12 +167,12 @@
#'
#' A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by \code{\link{as.mo}}.
#' @inheritSection as.mo ITIS
-#' @format A \code{\link{data.frame}} with 2,383 observations and 4 variables:
+#' @format A \code{\link{data.frame}} with 14,506 observations and 4 variables:
#' \describe{
-#' \item{\code{tsn}}{Old Taxonomic Serial Number (TSN), as defined by ITIS}
-#' \item{\code{name}}{Old taxonomic name of the microorganism as found in ITIS, see Source}
-#' \item{\code{tsn_new}}{New Taxonomic Serial Number (TSN), as defined by ITIS}
-#' \item{\code{ref}}{Author(s) and year of concerning publication as found in ITIS, see Source}
+#' \item{\code{col_id}}{Catalogue of Life ID}
+#' \item{\code{tsn_new}}{New Catalogue of Life ID}
+#' \item{\code{fullname}}{Old taxonomic name of the microorganism as found in the CoL, see Source}
+#' \item{\code{ref}}{Author(s) and year of concerning publication as found in the CoL, see Source}
#' }
#' @source [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
#' @inheritSection AMR Read more on our website!
@@ -250,36 +245,3 @@
#' }
#' @inheritSection AMR Read more on our website!
"WHONET"
-
-#' Supplementary Data
-#'
-#' These \code{\link{data.table}s} are transformed from the \code{\link{microorganisms}} and \code{\link{microorganisms}} data sets to improve speed of \code{\link{as.mo}}. They are meant for internal use only, and are only mentioned here for reference.
-#' @rdname supplementary_data
-#' @name supplementary_data
-#' @inheritSection AMR Read more on our website!
-# # Renew data:
-# # sorted on (1) bacteria, (2) fungi, (3) protozoa and then human pathogenic prevalence and then TSN:
-# microorganismsDT <- data.table::as.data.table(AMR::microorganisms)
-# data.table::setkey(microorganismsDT, kingdom, prevalence, fullname)
-# microorganisms.prevDT <- microorganismsDT[prevalence != 9999,]
-# microorganisms.unprevDT <- microorganismsDT[prevalence == 9999,]
-# microorganisms.oldDT <- data.table::as.data.table(AMR::microorganisms.old)
-# data.table::setkey(microorganisms.oldDT, tsn, name)
-# usethis::use_data(microorganismsDT, overwrite = TRUE)
-# usethis::use_data(microorganisms.prevDT, overwrite = TRUE)
-# usethis::use_data(microorganisms.unprevDT, overwrite = TRUE)
-# usethis::use_data(microorganisms.oldDT, overwrite = TRUE)
-# rm(microorganismsDT)
-# rm(microorganisms.prevDT)
-# rm(microorganisms.unprevDT)
-# rm(microorganisms.oldDT)
-"microorganismsDT"
-
-#' @rdname supplementary_data
-"microorganisms.prevDT"
-
-#' @rdname supplementary_data
-"microorganisms.unprevDT"
-
-#' @rdname supplementary_data
-"microorganisms.oldDT"
diff --git a/R/eucast_rules.R b/R/eucast_rules.R
index 77b734df..4739fbea 100755
--- a/R/eucast_rules.R
+++ b/R/eucast_rules.R
@@ -548,6 +548,7 @@ eucast_rules <- function(tbl,
tbl <- tbl %>%
mutate_at(vars(col_mo), as.mo) %>%
left_join_microorganisms(by = col_mo, suffix = c("_oldcols", "")) %>%
+ mutate(gramstain = mo_gramstain(pull(., col_mo))) %>%
as.data.frame(stringsAsFactors = FALSE)
if (info == TRUE) {
diff --git a/R/first_isolate.R b/R/first_isolate.R
index 7e9faa5e..deb9da10 100755
--- a/R/first_isolate.R
+++ b/R/first_isolate.R
@@ -70,7 +70,7 @@
#' @keywords isolate isolates first
#' @seealso \code{\link{key_antibiotics}}
#' @export
-#' @importFrom dplyr arrange_at lag between row_number filter mutate arrange
+#' @importFrom dplyr arrange_at lag between row_number filter mutate arrange pull
#' @importFrom crayon blue bold silver
#' @return Logical vector
#' @source Methodology of this function is based on: \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
diff --git a/R/key_antibiotics.R b/R/key_antibiotics.R
index b5804a11..17310e5f 100755
--- a/R/key_antibiotics.R
+++ b/R/key_antibiotics.R
@@ -43,7 +43,7 @@
#' @inheritSection first_isolate Key antibiotics
#' @rdname key_antibiotics
#' @export
-#' @importFrom dplyr %>% mutate if_else
+#' @importFrom dplyr %>% mutate if_else pull
#' @importFrom crayon blue bold
#' @seealso \code{\link{first_isolate}}
#' @inheritSection AMR Read more on our website!
@@ -149,7 +149,8 @@ key_antibiotics <- function(tbl,
tbl <- tbl %>%
mutate_at(vars(col_mo), as.mo) %>%
left_join_microorganisms(by = col_mo) %>%
- mutate(key_ab = NA_character_)
+ mutate(key_ab = NA_character_,
+ gramstain = mo_gramstain(pull(., col_mo)))
# Gram +
tbl <- tbl %>% mutate(key_ab =
diff --git a/R/mo.R b/R/mo.R
index 8b015b05..85b2dfc1 100755
--- a/R/mo.R
+++ b/R/mo.R
@@ -47,7 +47,8 @@
#' | | | ----> subspecies, a 3-4 letter acronym
#' | | ----> species, a 3-4 letter acronym
#' | ----> genus, a 5-7 letter acronym, mostly without vowels
-#' ----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
+#' ----> taxonomic kingdom: A (Archaea), B (Bacteria), C (Chromista),
+#' F (Fungi), P (Protozoa) or V (Viruses)
#' }
#'
#' Use the \code{\link{mo_property}} functions to get properties based on the returned code, see Examples.
@@ -81,7 +82,7 @@
#'
#' Examples:
#' \itemize{
-#' \item{\code{"Streptococcus group B (known as S. agalactiae)"}. The text between brackets will be removed and a warning will be thrown that the result \emph{Streptococcus group B} (\code{B_STRPTC_GRB}) needs review.}
+#' \item{\code{"Streptococcus group B (known as S. agalactiae)"}. The text between brackets will be removed and a warning will be thrown that the result \emph{Streptococcus group B} (\code{B_STRPT_GRB}) needs review.}
#' \item{\code{"S. aureus - please mind: MRSA"}. The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result \emph{Staphylococcus aureus} (\code{B_STPHY_AUR}) needs review.}
#' \item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.}
#' \item{\code{"Fluoroquinolone-resistant Neisseria gonorrhoeae"}. The first word will be stripped, after which the function will try to find a match. A warning will be thrown that the result \emph{Neisseria gonorrhoeae} (\code{B_NESSR_GON}) needs review.}
@@ -118,8 +119,6 @@
#' as.mo("MRSA") # Methicillin Resistant S. aureus
#' as.mo("VISA") # Vancomycin Intermediate S. aureus
#' as.mo("VRSA") # Vancomycin Resistant S. aureus
-#' as.mo(369) # Search on TSN (Taxonomic Serial Number), a unique identifier
-#' # for the Integrated Taxonomic Information System (ITIS)
#'
#' as.mo("Streptococcus group A")
#' as.mo("GAS") # Group A Streptococci
@@ -128,8 +127,8 @@
#' as.mo("S. epidermidis") # will remain species: B_STPHY_EPI
#' as.mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CNS
#'
-#' as.mo("S. pyogenes") # will remain species: B_STRPTC_PYO
-#' as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA
+#' as.mo("S. pyogenes") # will remain species: B_STRPT_PYO
+#' as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPT_GRA
#'
#' # Use mo_* functions to get a specific property based on `mo`
#' Ecoli <- as.mo("E. coli") # returns `B_ESCHR_COL`
@@ -178,11 +177,7 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
if (!"AMR" %in% base::.packages()) {
library("AMR")
- # These data.tables are available as data sets when the AMR package is loaded:
- # microorganismsDT # this one is sorted by kingdom (B 0) {
x[i] <- found[1L]
next
}
- found <- microorganisms.prevDT[tsn == x_trimmed[i], ..property][[1]]
- # is a valid TSN
+ found <- microorganisms.superprevDT[mo == toupper(x_backup[i]), ..property][[1]]
+ # is a valid mo
+ if (length(found) > 0) {
+ x[i] <- found[1L]
+ next
+ }
+ found <- microorganisms.superprevDT[tolower(fullname) == tolower(x_trimmed_without_group[i]), ..property][[1]]
+ if (length(found) > 0) {
+ x[i] <- found[1L]
+ next
+ }
+
+ # try any match keeping spaces ----
+ found <- microorganisms.superprevDT[fullname %like% x_withspaces_start_end[i], ..property][[1]]
+ if (length(found) > 0 & nchar(x_trimmed[i]) >= 6) {
+ x[i] <- found[1L]
+ next
+ }
+
+ # try any match keeping spaces, not ending with $ ----
+ found <- microorganisms.superprevDT[fullname %like% x_withspaces_start_only[i], ..property][[1]]
+ if (length(found) > 0 & nchar(x_trimmed[i]) >= 6) {
+ x[i] <- found[1L]
+ next
+ }
+
+ # try any match diregarding spaces ----
+ found <- microorganisms.superprevDT[fullname %like% x[i], ..property][[1]]
+ if (length(found) > 0 & nchar(x_trimmed[i]) >= 6) {
+ x[i] <- found[1L]
+ next
+ }
+
+ # try splitting of characters in the middle and then find ID ----
+ # only when text length is 6 or lower
+ # like esco = E. coli, klpn = K. pneumoniae, stau = S. aureus, staaur = S. aureus
+ if (nchar(x_trimmed[i]) <= 6) {
+ x_length <- nchar(x_trimmed[i])
+ x[i] <- paste0(x_trimmed[i] %>% substr(1, x_length / 2),
+ '.* ',
+ x_trimmed[i] %>% substr((x_length / 2) + 1, x_length))
+ found <- microorganisms.superprevDT[fullname %like% paste0('^', x[i]), ..property][[1]]
+ if (length(found) > 0) {
+ x[i] <- found[1L]
+ next
+ }
+ }
+
+ # try fullname without start and stop regex, to also find subspecies ----
+ # like "K. pneu rhino" >> "Klebsiella pneumoniae (rhinoscleromatis)" = KLEPNERH
+ found <- microorganisms.superprevDT[fullname %like% x_withspaces_start_only[i], ..property][[1]]
+ if (length(found) > 0) {
+ x[i] <- found[1L]
+ next
+ }
+
+ # TRY PREVALENT IN HUMAN INFECTIONS ----
+ found <- microorganisms.prevDT[tolower(fullname) %in% tolower(c(x_backup[i], x_trimmed[i])), ..property][[1]]
+ # most probable: is exact match in fullname
if (length(found) > 0) {
x[i] <- found[1L]
next
@@ -559,7 +620,7 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
next
}
- # THEN TRY ALL OTHERS ----
+ # THEN UNPREVALENT IN HUMAN INFECTIONS ----
found <- microorganisms.unprevDT[tolower(fullname) == tolower(x_backup[i]), ..property][[1]]
# most probable: is exact match in fullname
if (length(found) > 0) {
@@ -572,12 +633,6 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
x[i] <- found[1L]
next
}
- found <- microorganisms.unprevDT[tsn == x_trimmed[i], ..property][[1]]
- # is a valid TSN
- if (length(found) > 0) {
- x[i] <- found[1L]
- next
- }
found <- microorganisms.unprevDT[mo == toupper(x_backup[i]), ..property][[1]]
# is a valid mo
if (length(found) > 0) {
@@ -633,23 +688,23 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
# MISCELLANEOUS ----
# look for old taxonomic names ----
- found <- microorganisms.oldDT[tolower(name) == tolower(x_backup[i])
- | tsn == x_trimmed[i]
- | name %like% x_withspaces_start_end[i],]
+ found <- microorganisms.oldDT[tolower(fullname) == tolower(x_backup[i])
+ | fullname %like% x_withspaces_start_end[i],]
if (NROW(found) > 0) {
+ col_id_new <- found[1, col_id_new]
# when property is "ref" (which is the case in mo_ref, mo_authors and mo_year), return the old value, so:
# mo_ref("Chlamydia psittaci) = "Page, 1968" (with warning)
# mo_ref("Chlamydophila psittaci) = "Everett et al., 1999"
if (property == "ref") {
x[i] <- found[1, ref]
} else {
- x[i] <- microorganismsDT[tsn == found[1, tsn_new], ..property][[1]]
+ x[i] <- microorganismsDT[col_id == found[1, col_id_new], ..property][[1]]
}
- was_renamed(name_old = found[1, name],
- name_new = microorganismsDT[tsn == found[1, tsn_new], fullname],
+ was_renamed(name_old = found[1, fullname],
+ name_new = microorganismsDT[col_id == found[1, col_id_new], fullname],
ref_old = found[1, ref],
- ref_new = microorganismsDT[tsn == found[1, tsn_new], ref],
- mo = microorganismsDT[tsn == found[1, tsn_new], mo])
+ ref_new = microorganismsDT[col_id == found[1, col_id_new], ref],
+ mo = microorganismsDT[col_id == found[1, col_id_new], mo])
next
}
@@ -673,9 +728,9 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
}
# (2) look again for old taxonomic names, now for G. species ----
- found <- microorganisms.oldDT[name %like% c.x_withspaces_start_end
- | name %like% d.x_withspaces_start_only
- | name %like% e.x,]
+ found <- microorganisms.oldDT[fullname %like% c.x_withspaces_start_end
+ | fullname %like% d.x_withspaces_start_only
+ | fullname %like% e.x,]
if (NROW(found) > 0 & nchar(b.x_trimmed) >= 6) {
if (property == "ref") {
# when property is "ref" (which is the case in mo_ref, mo_authors and mo_year), return the old value, so:
@@ -683,15 +738,15 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
# mo_ref("Chlamydophila psittaci) = "Everett et al., 1999"
x <- found[1, ref]
} else {
- x <- microorganismsDT[tsn == found[1, tsn_new], ..property][[1]]
+ x <- microorganismsDT[col_id == found[1, col_id_new], ..property][[1]]
}
- was_renamed(name_old = found[1, name],
- name_new = microorganismsDT[tsn == found[1, tsn_new], fullname],
+ was_renamed(name_old = found[1, fullname],
+ name_new = microorganismsDT[col_id == found[1, col_id_new], fullname],
ref_old = found[1, ref],
- ref_new = microorganismsDT[tsn == found[1, tsn_new], ref],
- mo = microorganismsDT[tsn == found[1, tsn_new], mo])
+ ref_new = microorganismsDT[col_id == found[1, col_id_new], ref],
+ mo = microorganismsDT[col_id == found[1, col_id_new], mo])
uncertainties <<- c(uncertainties,
- paste0("'", a.x_backup, "' >> ", found[1, name], " (TSN ", found[1, tsn], ")"))
+ paste0("'", a.x_backup, "' >> ", found[1, fullname], " (Catalogue of Life ID ", found[1, col_id], ")"))
return(x)
}
@@ -835,25 +890,25 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
# Lancefield ----
if (Lancefield == TRUE | Lancefield == "all") {
# group A - S. pyogenes
- x[x == microorganismsDT[mo == 'B_STRPTC_PYO', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPTC_GRA', ..property][[1]][1L]
+ x[x == microorganismsDT[mo == 'B_STRPT_PYO', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPT_GRA', ..property][[1]][1L]
# group B - S. agalactiae
- x[x == microorganismsDT[mo == 'B_STRPTC_AGA', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPTC_GRB', ..property][[1]][1L]
+ x[x == microorganismsDT[mo == 'B_STRPT_AGA', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPT_GRB', ..property][[1]][1L]
# group C
S_groupC <- microorganismsDT %>% filter(genus == "Streptococcus",
species %in% c("equisimilis", "equi",
"zooepidemicus", "dysgalactiae")) %>%
pull(property)
- x[x %in% S_groupC] <- microorganismsDT[mo == 'B_STRPTC_GRC', ..property][[1]][1L]
+ x[x %in% S_groupC] <- microorganismsDT[mo == 'B_STRPT_GRC', ..property][[1]][1L]
if (Lancefield == "all") {
# all Enterococci
- x[x %like% "^(Enterococcus|B_ENTRC)"] <- microorganismsDT[mo == 'B_STRPTC_GRD', ..property][[1]][1L]
+ x[x %like% "^(Enterococcus|B_ENTRC)"] <- microorganismsDT[mo == 'B_STRPT_GRD', ..property][[1]][1L]
}
# group F - S. anginosus
- x[x == microorganismsDT[mo == 'B_STRPTC_ANG', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPTC_GRF', ..property][[1]][1L]
+ x[x == microorganismsDT[mo == 'B_STRPT_ANG', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPT_GRF', ..property][[1]][1L]
# group H - S. sanguinis
- x[x == microorganismsDT[mo == 'B_STRPTC_SAN', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPTC_GRH', ..property][[1]][1L]
+ x[x == microorganismsDT[mo == 'B_STRPT_SAN', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPT_GRH', ..property][[1]][1L]
# group K - S. salivarius
- x[x == microorganismsDT[mo == 'B_STRPTC_SAL', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPTC_GRK', ..property][[1]][1L]
+ x[x == microorganismsDT[mo == 'B_STRPT_SAL', ..property][[1]][1L]] <- microorganismsDT[mo == 'B_STRPT_GRK', ..property][[1]][1L]
}
@@ -875,8 +930,6 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE,
if (property == "mo") {
class(x) <- "mo"
- } else if (property == "tsn") {
- x <- as.integer(x)
}
if (length(mo_renamed()) > 0) {
diff --git a/R/mo_property.R b/R/mo_property.R
index 5d67e37d..9443687e 100755
--- a/R/mo_property.R
+++ b/R/mo_property.R
@@ -38,7 +38,7 @@
#' @rdname mo_property
#' @name mo_property
#' @return \itemize{
-#' \item{An \code{integer} in case of \code{mo_TSN} and \code{mo_year}}
+#' \item{An \code{integer} in case of \code{mo_year}}
#' \item{A \code{list} in case of \code{mo_taxonomy}}
#' \item{A \code{character} in all other cases}
#' }
@@ -57,7 +57,6 @@
#' mo_genus("E. coli") # "Escherichia"
#' mo_species("E. coli") # "coli"
#' mo_subspecies("E. coli") # NA
-#' mo_TSN("E. coli") # 285 (Taxonomic Serial Number)
#'
#' ## colloquial properties
#' mo_fullname("E. coli") # "Escherichia coli"
@@ -242,17 +241,15 @@ mo_type <- function(x, language = get_locale(), ...) {
#' @rdname mo_property
#' @export
mo_gramstain <- function(x, language = get_locale(), ...) {
- mo_translate(mo_validate(x = x, property = "gramstain", ...), language = language)
-}
-
-#' @rdname mo_property
-#' @export
-mo_TSN <- function(x, ...) {
- res <- mo_validate(x = x, property = "tsn", ...)
- if (any(is.na(res))) {
- warning("Some results do not have a TSN, because they are missing from ITIS and were added manually. See ?microorganisms.")
- }
- res
+ x.bak <- x
+ x <- mo_phylum(x, ...)
+ x[x %in% c("Actinobacteria",
+ "Chloroflexi",
+ "Firmicutes",
+ "Tenericutes")] <- "Gram positive"
+ x[x != "Gram positive"] <- "Gram negative"
+ x[mo_kingdom(x.bak) != "Bacteria"] <- NA_character_
+ mo_translate(x, language = language)
}
#' @rdname mo_property
@@ -284,7 +281,6 @@ mo_year <- function(x, ...) {
mo_taxonomy <- function(x, ...) {
x <- AMR::as.mo(x, ...)
base::list(kingdom = mo_kingdom(x),
- subkingdom = mo_subkingdom(x),
phylum = mo_phylum(x),
class = mo_class(x),
order = mo_order(x),
@@ -472,11 +468,7 @@ mo_validate <- function(x, property, ...) {
if (!"AMR" %in% base::.packages()) {
library("AMR")
- # These data.tables are available as data sets when the AMR package is loaded:
- # microorganismsDT # this one is sorted by kingdom (B%
+ mutate(prevalent = ifelse(phylum %in% c("Proteobacteria",
+ "Firmicutes",
+ "Actinobacteria",
+ "Bacteroidetes")
+ | genus %in% c("Candida",
+ "Aspergillus",
+ "Trichophyton",
+ "Giardia",
+ "Dientamoeba",
+ "Entamoeba"),
+ 0,
+ 1),
+ superprevalent = ifelse(
+ # most important Gram negatives
+ class == "Gammaproteobacteria"
+ # Streptococci and Staphylococci
+ | order %in% c("Lactobacillales",
+ "Bacillales"),
+ 0,
+ 1)) %>%
+ as.data.table()
+ setkey(microorganismsDT, kingdom, superprevalent, prevalent, fullname)
+ microorganisms.superprevDT <- microorganismsDT[superprevalent == 0,]
+ microorganisms.prevDT <- microorganismsDT[superprevalent == 1 & prevalent == 0,]
+ microorganisms.unprevDT <- microorganismsDT[superprevalent == 1 & prevalent == 1,]
+ microorganisms.oldDT <- as.data.table(AMR::microorganisms.old)
+ setkey(microorganisms.oldDT, col_id, fullname)
+
+ assign(x = "microorganismsDT",
+ value = microorganismsDT,
+ envir = asNamespace("AMR"))
+
+ assign(x = "microorganisms.superprevDT",
+ value = microorganisms.superprevDT,
+ envir = asNamespace("AMR"))
+
+ assign(x = "microorganisms.prevDT",
+ value = microorganisms.prevDT,
+ envir = asNamespace("AMR"))
+
+ assign(x = "microorganisms.unprevDT",
+ value = microorganisms.unprevDT,
+ envir = asNamespace("AMR"))
+
+ assign(x = "microorganisms.oldDT",
+ value = microorganisms.oldDT,
+ envir = asNamespace("AMR"))
+
+ # packageStartupMessage("OK.", appendLF = TRUE)
+ }
}
diff --git a/data/microorganisms.codes.rda b/data/microorganisms.codes.rda
index a7f81ff2..e5254a13 100644
Binary files a/data/microorganisms.codes.rda and b/data/microorganisms.codes.rda differ
diff --git a/data/microorganisms.old.rda b/data/microorganisms.old.rda
index 178ff45c..02c8c939 100644
Binary files a/data/microorganisms.old.rda and b/data/microorganisms.old.rda differ
diff --git a/data/microorganisms.oldDT.rda b/data/microorganisms.oldDT.rda
deleted file mode 100644
index a9d189ef..00000000
Binary files a/data/microorganisms.oldDT.rda and /dev/null differ
diff --git a/data/microorganisms.prevDT.rda b/data/microorganisms.prevDT.rda
deleted file mode 100644
index a84a2d25..00000000
Binary files a/data/microorganisms.prevDT.rda and /dev/null differ
diff --git a/data/microorganisms.rda b/data/microorganisms.rda
index 9c7a29d4..24a35f47 100755
Binary files a/data/microorganisms.rda and b/data/microorganisms.rda differ
diff --git a/data/microorganisms.unprevDT.rda b/data/microorganisms.unprevDT.rda
deleted file mode 100644
index 78e1b8d4..00000000
Binary files a/data/microorganisms.unprevDT.rda and /dev/null differ
diff --git a/data/microorganismsDT.rda b/data/microorganismsDT.rda
deleted file mode 100644
index 2b4f8a68..00000000
Binary files a/data/microorganismsDT.rda and /dev/null differ
diff --git a/data/septic_patients.rda b/data/septic_patients.rda
index 4fa1a989..e189e0ae 100755
Binary files a/data/septic_patients.rda and b/data/septic_patients.rda differ
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html
index 78f0eccf..8c8e0abf 100644
--- a/docs/LICENSE-text.html
+++ b/docs/LICENSE-text.html
@@ -78,7 +78,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html
index 26a20446..212c53ae 100644
--- a/docs/articles/AMR.html
+++ b/docs/articles/AMR.html
@@ -40,7 +40,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
@@ -192,7 +192,7 @@
How to conduct AMR analysis
Matthijs S. Berends
-
14 February 2019
+
18 February 2019
AMR.Rmd
@@ -201,7 +201,7 @@
-
Note: values on this page will change with every website update since they are based on randomly created values and the page was written in RMarkdown. However, the methodology remains unchanged. This page was generated on 14 February 2019.
+
Note: values on this page will change with every website update since they are based on randomly created values and the page was written in RMarkdown. However, the methodology remains unchanged. This page was generated on 18 February 2019.
So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values M and F. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.
The data is already quite clean, but we still need to transform some variables. The bacteria column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate() function of the dplyr package makes this really easy:
Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.
+
Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics() function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.
If a column exists with a name like ‘key(…)ab’ the first_isolate() function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:
Instead of 1, now 9 isolates are flagged. In total, 79.3% of all isolates are marked ‘first weighted’ - 51% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
+
Instead of 2, now 4 isolates are flagged. In total, 79% of all isolates are marked ‘first weighted’ - 50.8% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
The functions portion_R, portion_RI, portion_I, portion_IS and portion_S can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own:
Now all variables of the microorganisms dataset have been joined to the septic_patients dataset. The microorganisms dataset consists of the following variables:
Contains the complete manual of this package and all of its functions with an explanation of their parameters
+
Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis, import data from WHONET or SPSS and many more.
+
New
BREAKING: removed deprecated functions, parameters and references to ‘bactid’. Use as.mo() to identify an MO code.
+
Catalogue of Life (CoL) inclusion for data about microorganisms, which also contains all ITIS data we used previously. The microorganisms data set now contains:
+
+
Almost 60,000 species from six different kingdoms
+
Almost 15,000 previously accepted names which are now taxonomic ‘synonyms’
+
All (sub)species from the kingdoms Archaea, Bacteria, Chromista, Protozoa and Viruses
+
All (sub)species from the orders Eurotiales, Saccharomycetales and Onygenales of the kingdom Fungi. The complete taxonomy of this kingdom has more than 130,000 species. The orders we included contains at least all memebers of the families Candida, Aspergillus and Trichophyton.
+
Due to this change, the ID of Streptococcus was changed from B_STRPTC to B_STRPT.
+
+
Support for data from WHONET and EARS-Net (European Antimicrobial Resistance Surveillance Network):
Exported files from WHONET can be read and used in this package. For functions like first_isolate() and eucast_rules(), all parameters will be filled in automatically.
These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
-
New info is returned when running this function, stating exactly what has been changed or added. Use eucast_rules(..., verbose = TRUE) to get a data set with all changed per bug and drug combination.
-
Added 605 Aspergillus species and 23 Trichophyton species to the microorganisms data set
+
Removed data sets microorganisms.oldDT, microorganisms.prevDT, microorganisms.unprevDT and microorganismsDT since they were no longer needed and only contained info already available in the microorganisms data set
diff --git a/docs/reference/AMR-deprecated.html b/docs/reference/AMR-deprecated.html
index 58c0c043..a224f671 100644
--- a/docs/reference/AMR-deprecated.html
+++ b/docs/reference/AMR-deprecated.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/AMR.html b/docs/reference/AMR.html
index ef80a315..3147b145 100644
--- a/docs/reference/AMR.html
+++ b/docs/reference/AMR.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/ITIS.html b/docs/reference/ITIS.html
index e2cf9b6a..12a08129 100644
--- a/docs/reference/ITIS.html
+++ b/docs/reference/ITIS.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/WHOCC.html b/docs/reference/WHOCC.html
index a1bd7443..83e33dfc 100644
--- a/docs/reference/WHOCC.html
+++ b/docs/reference/WHOCC.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/WHONET.html b/docs/reference/WHONET.html
index b25d7f49..24336a43 100644
--- a/docs/reference/WHONET.html
+++ b/docs/reference/WHONET.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/abname.html b/docs/reference/abname.html
index 34e3e196..e3230a1f 100644
--- a/docs/reference/abname.html
+++ b/docs/reference/abname.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/age.html b/docs/reference/age.html
index 60a469dd..8f2123c0 100644
--- a/docs/reference/age.html
+++ b/docs/reference/age.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html
index 9436195a..2b538a24 100644
--- a/docs/reference/age_groups.html
+++ b/docs/reference/age_groups.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/antibiotics.html b/docs/reference/antibiotics.html
index 457f6757..9c5ac1db 100644
--- a/docs/reference/antibiotics.html
+++ b/docs/reference/antibiotics.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/as.atc.html b/docs/reference/as.atc.html
index fd39f120..4ed669e7 100644
--- a/docs/reference/as.atc.html
+++ b/docs/reference/as.atc.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html
index 4dbe3ae2..c83cf55a 100644
--- a/docs/reference/as.mic.html
+++ b/docs/reference/as.mic.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html
index 0e5fb0f2..ce6138ea 100644
--- a/docs/reference/as.mo.html
+++ b/docs/reference/as.mo.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
@@ -296,7 +296,8 @@
| | | ----> subspecies, a 3-4 letter acronym
| | ----> species, a 3-4 letter acronym
| ----> genus, a 5-7 letter acronym, mostly without vowels
- ----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
+ ----> taxonomic kingdom: A (Archaea), B (Bacteria), C (Chromista),
+ F (Fungi), P (Protozoa) or V (Viruses)
Use the mo_property functions to get properties based on the returned code, see Examples.
This function uses Artificial Intelligence (AI) to help getting fast and logical results. It tries to find matches in this order:
@@ -320,7 +321,7 @@ When using allow_uncertain = TRUE (which is the default setting), i
It tries to look for some manual changes which are not yet published to the ITIS database (like Propionibacterium not yet being Cutibacterium)
Examples:
-
"Streptococcus group B (known as S. agalactiae)". The text between brackets will be removed and a warning will be thrown that the result Streptococcus group B (B_STRPTC_GRB) needs review.
+
"Streptococcus group B (known as S. agalactiae)". The text between brackets will be removed and a warning will be thrown that the result Streptococcus group B (B_STRPT_GRB) needs review.
"S. aureus - please mind: MRSA". The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result Staphylococcus aureus (B_STPHY_AUR) needs review.
"D. spartina". This is the abbreviation of an old taxonomic name: Didymosphaeria spartinae (the last "e" was missing from the input). This fungus was renamed to Leptosphaeria obiones, so a warning will be thrown that this result (F_LPTSP_OBI) needs review.
"Fluoroquinolone-resistant Neisseria gonorrhoeae". The first word will be stripped, after which the function will try to find a match. A warning will be thrown that the result Neisseria gonorrhoeae (B_NESSR_GON) needs review.
@@ -369,8 +370,6 @@ The mo_property functions (like as.mo("MRSA") # Methicillin Resistant S. aureusas.mo("VISA") # Vancomycin Intermediate S. aureusas.mo("VRSA") # Vancomycin Resistant S. aureus
-as.mo(369) # Search on TSN (Taxonomic Serial Number), a unique identifier
- # for the Integrated Taxonomic Information System (ITIS)as.mo("Streptococcus group A")
as.mo("GAS") # Group A Streptococci
@@ -379,8 +378,8 @@ The mo_property functions (like as.mo("S. epidermidis") # will remain species: B_STPHY_EPIas.mo("S. epidermidis", Becker=TRUE) # will not remain species: B_STPHY_CNS
-as.mo("S. pyogenes") # will remain species: B_STRPTC_PYO
-as.mo("S. pyogenes", Lancefield=TRUE) # will not remain species: B_STRPTC_GRA
+as.mo("S. pyogenes") # will remain species: B_STRPT_PYO
+as.mo("S. pyogenes", Lancefield=TRUE) # will not remain species: B_STRPT_GRA# Use mo_* functions to get a specific property based on `mo`Ecoli<-as.mo("E. coli") # returns `B_ESCHR_COL`
diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html
index c8fd8819..89243b8d 100644
--- a/docs/reference/as.rsi.html
+++ b/docs/reference/as.rsi.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html
index 784499b0..78630ac8 100644
--- a/docs/reference/atc_online.html
+++ b/docs/reference/atc_online.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/atc_property.html b/docs/reference/atc_property.html
index 557beda6..cf774c22 100644
--- a/docs/reference/atc_property.html
+++ b/docs/reference/atc_property.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/availability.html b/docs/reference/availability.html
index bbbf1bd0..27692c60 100644
--- a/docs/reference/availability.html
+++ b/docs/reference/availability.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/count.html b/docs/reference/count.html
index e984dccf..914666f7 100644
--- a/docs/reference/count.html
+++ b/docs/reference/count.html
@@ -81,7 +81,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html
index 8572aa1a..00699728 100644
--- a/docs/reference/eucast_rules.html
+++ b/docs/reference/eucast_rules.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html
index bfd3a422..1d8c76ee 100644
--- a/docs/reference/first_isolate.html
+++ b/docs/reference/first_isolate.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/freq.html b/docs/reference/freq.html
index 48abe66f..8ec16413 100644
--- a/docs/reference/freq.html
+++ b/docs/reference/freq.html
@@ -81,7 +81,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/g.test.html b/docs/reference/g.test.html
index 40c73902..a599f7f5 100644
--- a/docs/reference/g.test.html
+++ b/docs/reference/g.test.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/get_locale.html b/docs/reference/get_locale.html
index 38f155cb..722d2934 100644
--- a/docs/reference/get_locale.html
+++ b/docs/reference/get_locale.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html
index a797afa8..9b5f418f 100644
--- a/docs/reference/ggplot_rsi.html
+++ b/docs/reference/ggplot_rsi.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/guess_ab_col.html b/docs/reference/guess_ab_col.html
index aceb1f4c..834611b5 100644
--- a/docs/reference/guess_ab_col.html
+++ b/docs/reference/guess_ab_col.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/index.html b/docs/reference/index.html
index c8d15d3b..e2e04d62 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -78,7 +78,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
@@ -349,7 +349,7 @@
@@ -362,7 +360,6 @@ On our website https://msberends.gitla
mo_genus("E. coli") # "Escherichia"mo_species("E. coli") # "coli"mo_subspecies("E. coli") # NA
-mo_TSN("E. coli") # 285 (Taxonomic Serial Number)## colloquial propertiesmo_fullname("E. coli") # "Escherichia coli"
diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html
index 1b50389a..ddab3618 100644
--- a/docs/reference/mo_source.html
+++ b/docs/reference/mo_source.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/p.symbol.html b/docs/reference/p.symbol.html
index 3987f63e..df30b5e0 100644
--- a/docs/reference/p.symbol.html
+++ b/docs/reference/p.symbol.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/portion.html b/docs/reference/portion.html
index 07963fb7..392ddc38 100644
--- a/docs/reference/portion.html
+++ b/docs/reference/portion.html
@@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/read.4D.html b/docs/reference/read.4D.html
index dbb6dacc..d9be3749 100644
--- a/docs/reference/read.4D.html
+++ b/docs/reference/read.4D.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html
index 8b8fcbc1..03ab934b 100644
--- a/docs/reference/resistance_predict.html
+++ b/docs/reference/resistance_predict.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/rsi.html b/docs/reference/rsi.html
index 10a1179f..4df75462 100644
--- a/docs/reference/rsi.html
+++ b/docs/reference/rsi.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/septic_patients.html b/docs/reference/septic_patients.html
index 2bd58b88..4c05279b 100644
--- a/docs/reference/septic_patients.html
+++ b/docs/reference/septic_patients.html
@@ -80,7 +80,7 @@
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/reference/skewness.html b/docs/reference/skewness.html
index 90b85a9c..223d8b20 100644
--- a/docs/reference/skewness.html
+++ b/docs/reference/skewness.html
@@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
AMR (for R)
- 0.5.0.9017
+ 0.5.0.9018
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
index be3e9d04..98017506 100644
--- a/docs/sitemap.xml
+++ b/docs/sitemap.xml
@@ -126,9 +126,6 @@
https://msberends.gitlab.io/AMR/reference/skewness.html
-
- https://msberends.gitlab.io/AMR/reference/supplementary_data.html
- https://msberends.gitlab.io/AMR/articles/AMR.html
diff --git a/man/as.mo.Rd b/man/as.mo.Rd
index 25d6d8cc..662f6996 100644
--- a/man/as.mo.Rd
+++ b/man/as.mo.Rd
@@ -54,7 +54,8 @@ A microbial ID from this package (class: \code{mo}) typically looks like these e
| | | ----> subspecies, a 3-4 letter acronym
| | ----> species, a 3-4 letter acronym
| ----> genus, a 5-7 letter acronym, mostly without vowels
- ----> taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
+ ----> taxonomic kingdom: A (Archaea), B (Bacteria), C (Chromista),
+ F (Fungi), P (Protozoa) or V (Viruses)
}
Use the \code{\link{mo_property}} functions to get properties based on the returned code, see Examples.
@@ -88,7 +89,7 @@ When using \code{allow_uncertain = TRUE} (which is the default setting), it will
Examples:
\itemize{
- \item{\code{"Streptococcus group B (known as S. agalactiae)"}. The text between brackets will be removed and a warning will be thrown that the result \emph{Streptococcus group B} (\code{B_STRPTC_GRB}) needs review.}
+ \item{\code{"Streptococcus group B (known as S. agalactiae)"}. The text between brackets will be removed and a warning will be thrown that the result \emph{Streptococcus group B} (\code{B_STRPT_GRB}) needs review.}
\item{\code{"S. aureus - please mind: MRSA"}. The last word will be stripped, after which the function will try to find a match. If it does not, the second last word will be stripped, etc. Again, a warning will be thrown that the result \emph{Staphylococcus aureus} (\code{B_STPHY_AUR}) needs review.}
\item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.}
\item{\code{"Fluoroquinolone-resistant Neisseria gonorrhoeae"}. The first word will be stripped, after which the function will try to find a match. A warning will be thrown that the result \emph{Neisseria gonorrhoeae} (\code{B_NESSR_GON}) needs review.}
@@ -137,8 +138,6 @@ as.mo("Staphylococcus aureus (MRSA)")
as.mo("MRSA") # Methicillin Resistant S. aureus
as.mo("VISA") # Vancomycin Intermediate S. aureus
as.mo("VRSA") # Vancomycin Resistant S. aureus
-as.mo(369) # Search on TSN (Taxonomic Serial Number), a unique identifier
- # for the Integrated Taxonomic Information System (ITIS)
as.mo("Streptococcus group A")
as.mo("GAS") # Group A Streptococci
@@ -147,8 +146,8 @@ as.mo("GBS") # Group B Streptococci
as.mo("S. epidermidis") # will remain species: B_STPHY_EPI
as.mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CNS
-as.mo("S. pyogenes") # will remain species: B_STRPTC_PYO
-as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA
+as.mo("S. pyogenes") # will remain species: B_STRPT_PYO
+as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPT_GRA
# Use mo_* functions to get a specific property based on `mo`
Ecoli <- as.mo("E. coli") # returns `B_ESCHR_COL`
diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd
index 2af82bf4..c8731931 100755
--- a/man/microorganisms.Rd
+++ b/man/microorganisms.Rd
@@ -3,11 +3,11 @@
\docType{data}
\name{microorganisms}
\alias{microorganisms}
-\title{Data set with ~20,000 microorganisms}
-\format{A \code{\link{data.frame}} with 19,456 observations and 15 variables:
+\title{Data set with ~60,000 microorganisms}
+\format{A \code{\link{data.frame}} with 56,659 observations and 15 variables:
\describe{
\item{\code{mo}}{ID of microorganism}
- \item{\code{tsn}}{Taxonomic Serial Number (TSN), as defined by ITIS}
+ \item{\code{col_id}}{Catalogue of Life ID}
\item{\code{genus}}{Taxonomic genus of the microorganism as found in ITIS, see Source}
\item{\code{species}}{Taxonomic species of the microorganism as found in ITIS, see Source}
\item{\code{subspecies}}{Taxonomic subspecies of the microorganism as found in ITIS, see Source}
@@ -29,20 +29,15 @@ Integrated Taxonomic Information System (ITIS) public online database, \url{http
microorganisms
}
\description{
-A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa from ITIS. MO codes can be looked up using \code{\link{as.mo}}.
+A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
}
\details{
Manually added were:
\itemize{
- \item{605 species of Aspergillus (as Aspergillus misses from ITIS, list from https://en.wikipedia.org/wiki/List_of_Aspergillus_species on 2019-02-05)}
- \item{23 species of Trichophyton (as Trichophyton misses from ITIS, list from https://en.wikipedia.org/wiki/Trichophyton on 2019-02-05)}
- \item{9 species of Streptococcus (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)}
- \item{2 species of Straphylococcus (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
- \item{1 species of Candida (C. glabrata)}
+ \item{9 species of \emph{Streptococcus} (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)}
+ \item{2 species of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
\item{2 other undefined (unknown Gram negatives and unknown Gram positives)}
}
-
-These manual entries have no Taxonomic Serial Number (TSN), so can be looked up with \code{filter(microorganisms, is.na(tsn)}.
}
\section{ITIS}{
diff --git a/man/microorganisms.old.Rd b/man/microorganisms.old.Rd
index e67579a2..315220c4 100644
--- a/man/microorganisms.old.Rd
+++ b/man/microorganisms.old.Rd
@@ -4,12 +4,12 @@
\name{microorganisms.old}
\alias{microorganisms.old}
\title{Data set with previously accepted taxonomic names}
-\format{A \code{\link{data.frame}} with 2,383 observations and 4 variables:
+\format{A \code{\link{data.frame}} with 14,506 observations and 4 variables:
\describe{
- \item{\code{tsn}}{Old Taxonomic Serial Number (TSN), as defined by ITIS}
- \item{\code{name}}{Old taxonomic name of the microorganism as found in ITIS, see Source}
- \item{\code{tsn_new}}{New Taxonomic Serial Number (TSN), as defined by ITIS}
- \item{\code{ref}}{Author(s) and year of concerning publication as found in ITIS, see Source}
+ \item{\code{col_id}}{Catalogue of Life ID}
+ \item{\code{tsn_new}}{New Catalogue of Life ID}
+ \item{\code{fullname}}{Old taxonomic name of the microorganism as found in the CoL, see Source}
+ \item{\code{ref}}{Author(s) and year of concerning publication as found in the CoL, see Source}
}}
\source{
[3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}.
diff --git a/man/mo_property.Rd b/man/mo_property.Rd
index 42cd46cc..ab81734a 100644
--- a/man/mo_property.Rd
+++ b/man/mo_property.Rd
@@ -15,7 +15,6 @@
\alias{mo_kingdom}
\alias{mo_type}
\alias{mo_gramstain}
-\alias{mo_TSN}
\alias{mo_ref}
\alias{mo_authors}
\alias{mo_year}
@@ -48,8 +47,6 @@ mo_type(x, language = get_locale(), ...)
mo_gramstain(x, language = get_locale(), ...)
-mo_TSN(x, ...)
-
mo_ref(x, ...)
mo_authors(x, ...)
@@ -71,7 +68,7 @@ mo_property(x, property = "fullname", language = get_locale(), ...)
}
\value{
\itemize{
- \item{An \code{integer} in case of \code{mo_TSN} and \code{mo_year}}
+ \item{An \code{integer} in case of \code{mo_year}}
\item{A \code{list} in case of \code{mo_taxonomy}}
\item{A \code{character} in all other cases}
}
@@ -129,7 +126,6 @@ mo_family("E. coli") # "Enterobacteriaceae"
mo_genus("E. coli") # "Escherichia"
mo_species("E. coli") # "coli"
mo_subspecies("E. coli") # NA
-mo_TSN("E. coli") # 285 (Taxonomic Serial Number)
## colloquial properties
mo_fullname("E. coli") # "Escherichia coli"
diff --git a/man/supplementary_data.Rd b/man/supplementary_data.Rd
deleted file mode 100644
index d1aebe82..00000000
--- a/man/supplementary_data.Rd
+++ /dev/null
@@ -1,30 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/data.R
-\docType{data}
-\name{supplementary_data}
-\alias{supplementary_data}
-\alias{microorganismsDT}
-\alias{microorganisms.prevDT}
-\alias{microorganisms.unprevDT}
-\alias{microorganisms.oldDT}
-\title{Supplementary Data}
-\format{An object of class \code{data.table} (inherits from \code{data.frame}) with 19456 rows and 15 columns.}
-\usage{
-microorganismsDT
-
-microorganisms.prevDT
-
-microorganisms.unprevDT
-
-microorganisms.oldDT
-}
-\description{
-These \code{\link{data.table}s} are transformed from the \code{\link{microorganisms}} and \code{\link{microorganisms}} data sets to improve speed of \code{\link{as.mo}}. They are meant for internal use only, and are only mentioned here for reference.
-}
-\section{Read more on our website!}{
-
-\if{html}{\figure{logo.png}{options: height=40px style=margin-bottom:5px} \cr}
-On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
-}
-
-\keyword{datasets}
diff --git a/tests/testthat/test-first_isolate.R b/tests/testthat/test-first_isolate.R
index 526961f1..2fd92574 100755
--- a/tests/testthat/test-first_isolate.R
+++ b/tests/testthat/test-first_isolate.R
@@ -22,7 +22,7 @@
context("first_isolate.R")
test_that("first isolates work", {
- # septic_patients contains 1317 out of 2000 first isolates
+ # first isolates
expect_equal(
sum(
first_isolate(tbl = septic_patients,
@@ -31,9 +31,9 @@ test_that("first isolates work", {
col_mo = "mo",
info = TRUE),
na.rm = TRUE),
- 1317)
+ 1274)
- # septic_patients contains 1413 out of 2000 first *weighted* isolates
+ # first *weighted* isolates
expect_equal(
suppressWarnings(
sum(
@@ -46,7 +46,7 @@ test_that("first isolates work", {
type = "keyantibiotics",
info = TRUE),
na.rm = TRUE)),
- 1413)
+ 1369)
# should be same for tibbles
expect_equal(
suppressWarnings(
@@ -60,8 +60,8 @@ test_that("first isolates work", {
type = "keyantibiotics",
info = TRUE),
na.rm = TRUE)),
- 1413)
- # and 1436 when not ignoring I
+ 1369)
+ # when not ignoring I
expect_equal(
suppressWarnings(
sum(
@@ -74,8 +74,8 @@ test_that("first isolates work", {
type = "keyantibiotics",
info = TRUE),
na.rm = TRUE)),
- 1436)
- # and 1417 when using points
+ 1392)
+ # when using points
expect_equal(
suppressWarnings(
sum(
@@ -87,9 +87,9 @@ test_that("first isolates work", {
type = "points",
info = TRUE),
na.rm = TRUE)),
- 1417)
+ 1372)
- # septic_patients contains 1163 out of 2000 first non-ICU isolates
+ # first non-ICU isolates
expect_equal(
sum(
first_isolate(septic_patients,
@@ -100,7 +100,7 @@ test_that("first isolates work", {
info = TRUE,
icu_exclude = TRUE),
na.rm = TRUE),
- 1163)
+ 1129)
# set 1500 random observations to be of specimen type 'Urine'
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
diff --git a/tests/testthat/test-mo.R b/tests/testthat/test-mo.R
index 1dcec564..39ccbd0f 100644
--- a/tests/testthat/test-mo.R
+++ b/tests/testthat/test-mo.R
@@ -41,27 +41,25 @@ test_that("as.mo works", {
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
expect_equal(as.character(as.mo("Bartonella")), "B_BRTNL")
- expect_equal(as.character(as.mo("C. difficile")), "B_CTRDM_DIF")
+ expect_equal(as.character(as.mo("C. difficile")), "B_CLSTR_DIF")
expect_equal(as.character(as.mo("L. pneumophila")), "B_LGNLL_PNE")
- expect_equal(as.character(as.mo("Strepto")), "B_STRPTC")
- expect_equal(as.character(as.mo("Streptococcus")), "B_STRPTC") # not Peptostreptoccus
+ expect_equal(as.character(as.mo("Strepto")), "B_STRPT")
+ expect_equal(as.character(as.mo("Streptococcus")), "B_STRPT") # not Peptostreptoccus
- expect_equal(as.character(as.mo(c("GAS", "GBS"))), c("B_STRPTC_GRA", "B_STRPTC_GRB"))
+ expect_equal(as.character(as.mo(c("GAS", "GBS"))), c("B_STRPT_GRA", "B_STRPT_GRB"))
- expect_equal(as.character(as.mo("S. pyo")), "B_STRPTC_PYO") # not Actinomyces pyogenes
-
- expect_equal(as.character(as.mo("P. aer")), "B_PDMNS_AER") # not Pasteurella aerogenes
+ expect_equal(as.character(as.mo("S. pyo")), "B_STRPT_PYO") # not Actinomyces pyogenes
# GLIMS
expect_equal(as.character(as.mo("bctfgr")), "B_BCTRD_FRA")
expect_equal(as.character(as.mo("MRSE")), "B_STPHY_EPI")
expect_equal(as.character(as.mo("VRE")), "B_ENTRC")
- expect_equal(as.character(as.mo("MRPA")), "B_PDMNS_AER")
- expect_equal(as.character(as.mo("PISP")), "B_STRPTC_PNE")
- expect_equal(as.character(as.mo("PRSP")), "B_STRPTC_PNE")
- expect_equal(as.character(as.mo("VISP")), "B_STRPTC_PNE")
- expect_equal(as.character(as.mo("VRSP")), "B_STRPTC_PNE")
+ expect_equal(as.character(as.mo("MRPA")), "B_PSDMN_AER")
+ expect_equal(as.character(as.mo("PISP")), "B_STRPT_PNE")
+ expect_equal(as.character(as.mo("PRSP")), "B_STRPT_PNE")
+ expect_equal(as.character(as.mo("VISP")), "B_STRPT_PNE")
+ expect_equal(as.character(as.mo("VRSP")), "B_STRPT_PNE")
expect_equal(as.character(as.mo("CNS")), "B_STPHY_CNS")
expect_equal(as.character(as.mo("CoNS")), "B_STPHY_CNS")
@@ -85,13 +83,11 @@ test_that("as.mo works", {
# unprevalent MO
expect_identical(
as.character(
- as.mo(c("buno",
- "BUNO",
- "burnod",
+ as.mo(c("burnod",
"B. nodosa",
"B nodosa",
"Burkholderia nodosa"))),
- rep("B_BRKHL_NOD", 6))
+ rep("B_BRKHL_NOD", 4))
# empty values
expect_identical(as.character(as.mo(c("", NA, NaN))), rep(NA_character_, 3))
@@ -105,7 +101,7 @@ test_that("as.mo works", {
expect_identical(as.character(as.mo("S. epidermidis", Becker = FALSE)), "B_STPHY_EPI")
expect_identical(as.character(as.mo("S. epidermidis", Becker = TRUE)), "B_STPHY_CNS")
expect_identical(as.character(as.mo("STAEPI", Becker = TRUE)), "B_STPHY_CNS")
- expect_identical(as.character(as.mo("S. intermedius", Becker = FALSE)), "B_STRPTC_INT") # Strep (!) intermedius
+ expect_identical(as.character(as.mo("S. intermedius", Becker = FALSE)), "B_STPHY_INT")
expect_identical(as.character(as.mo("Sta intermedius",Becker = FALSE)), "B_STPHY_INT")
expect_identical(as.character(as.mo("Sta intermedius",Becker = TRUE)), "B_STPHY_CPS")
expect_identical(as.character(as.mo("STAINT", Becker = TRUE)), "B_STPHY_CPS")
@@ -115,23 +111,23 @@ test_that("as.mo works", {
expect_identical(as.character(as.mo("STAAUR", Becker = "all")), "B_STPHY_CPS")
# check for Lancefield classification
- expect_identical(as.character(as.mo("S. pyogenes", Lancefield = FALSE)), "B_STRPTC_PYO")
- expect_identical(as.character(as.mo("S. pyogenes", Lancefield = TRUE)), "B_STRPTC_GRA")
- expect_identical(as.character(as.mo("STCPYO", Lancefield = TRUE)), "B_STRPTC_GRA") # group A
- expect_identical(as.character(as.mo("S. agalactiae", Lancefield = FALSE)), "B_STRPTC_AGA")
- expect_identical(as.character(as.mo("S. agalactiae", Lancefield = TRUE)), "B_STRPTC_GRB") # group B
- expect_identical(as.character(as.mo("S. equisimilis", Lancefield = FALSE)), "B_STRPTC_DYS_EQU")
- expect_identical(as.character(as.mo("S. equisimilis", Lancefield = TRUE)), "B_STRPTC_GRC") # group C
+ expect_identical(as.character(as.mo("S. pyogenes", Lancefield = FALSE)), "B_STRPT_PYO")
+ expect_identical(as.character(as.mo("S. pyogenes", Lancefield = TRUE)), "B_STRPT_GRA")
+ expect_identical(as.character(as.mo("STCPYO", Lancefield = TRUE)), "B_STRPT_GRA") # group A
+ expect_identical(as.character(as.mo("S. agalactiae", Lancefield = FALSE)), "B_STRPT_AGA")
+ expect_identical(as.character(as.mo("S. agalactiae", Lancefield = TRUE)), "B_STRPT_GRB") # group B
+ expect_identical(as.character(as.mo("S. equisimilis", Lancefield = FALSE)), "B_STRPT_DYS_EQU")
+ expect_identical(as.character(as.mo("S. equisimilis", Lancefield = TRUE)), "B_STRPT_GRC") # group C
# Enterococci must only be influenced if Lancefield = "all"
expect_identical(as.character(as.mo("E. faecium", Lancefield = FALSE)), "B_ENTRC_IUM")
expect_identical(as.character(as.mo("E. faecium", Lancefield = TRUE)), "B_ENTRC_IUM")
- expect_identical(as.character(as.mo("E. faecium", Lancefield = "all")), "B_STRPTC_GRD") # group D
- expect_identical(as.character(as.mo("S. anginosus", Lancefield = FALSE)), "B_STRPTC_ANG")
- expect_identical(as.character(as.mo("S. anginosus", Lancefield = TRUE)), "B_STRPTC_GRF") # group F
- expect_identical(as.character(as.mo("S. sanguinis", Lancefield = FALSE)), "B_STRPTC_SAN")
- expect_identical(as.character(as.mo("S. sanguinis", Lancefield = TRUE)), "B_STRPTC_GRH") # group H
- expect_identical(as.character(as.mo("S. salivarius", Lancefield = FALSE)), "B_STRPTC_SAL")
- expect_identical(as.character(as.mo("S. salivarius", Lancefield = TRUE)), "B_STRPTC_GRK") # group K
+ expect_identical(as.character(as.mo("E. faecium", Lancefield = "all")), "B_STRPT_GRD") # group D
+ expect_identical(as.character(as.mo("S. anginosus", Lancefield = FALSE)), "B_STRPT_ANG")
+ expect_identical(as.character(as.mo("S. anginosus", Lancefield = TRUE)), "B_STRPT_GRF") # group F
+ expect_identical(as.character(as.mo("S. sanguinis", Lancefield = FALSE)), "B_STRPT_SAN")
+ expect_identical(as.character(as.mo("S. sanguinis", Lancefield = TRUE)), "B_STRPT_GRH") # group H
+ expect_identical(as.character(as.mo("S. salivarius", Lancefield = FALSE)), "B_STRPT_SAL")
+ expect_identical(as.character(as.mo("S. salivarius", Lancefield = TRUE)), "B_STRPT_GRK") # group K
library(dplyr)
@@ -164,10 +160,6 @@ test_that("as.mo works", {
# print
expect_output(print(as.mo(c("B_ESCHR_COL", NA))))
- # helper function
- expect_identical(as.mo("B_ESCHR_COL"),
- as.mo("B_ESCHR_COL"))
-
# test pull
expect_equal(nrow(septic_patients %>% mutate(mo = as.mo(mo))),
2000)
@@ -192,11 +184,11 @@ test_that("as.mo works", {
# check old names
expect_equal(suppressMessages(as.character(as.mo("Escherichia blattae"))), "B_SHMWL_BLA")
- # - Didymosphaeria spartinae (unprevalent)
- expect_warning(suppressMessages(as.mo("D spartin", allow_uncertain = TRUE)))
- # - was renamed to Leptosphaeria obiones
- expect_equal(suppressWarnings(suppressMessages(as.character(as.mo("D spartin", allow_uncertain = TRUE)))),
- "F_LPTSP_OBI")
+ # # - Didymosphaeria spartinae (unprevalent)
+ # expect_warning(suppressMessages(as.mo("D spartin", allow_uncertain = TRUE)))
+ # # - was renamed to Leptosphaeria obiones
+ # expect_equal(suppressWarnings(suppressMessages(as.character(as.mo("D spartin", allow_uncertain = TRUE)))),
+ # "F_LPTSP_OBI")
# check uncertain names
expect_equal(suppressWarnings(as.character(as.mo("esco extra_text", allow_uncertain = FALSE))), NA_character_)
@@ -217,10 +209,6 @@ test_that("as.mo works", {
expect_identical(as.character(as.mo(c("B_ESCHR_COL", "ESCCOL"))),
c("B_ESCHR_COL", "B_ESCHR_COL"))
- # TSN of prevalent and non prevalent ones
- expect_equal(mo_TSN(c("Gomphosphaeria aponina delicatula", "Escherichia coli")),
- c(717, 285))
-
# expect_equal(mo_fullname(c("E. spp.",
# "E. spp",
# "E. species")),
@@ -236,7 +224,7 @@ test_that("as.mo works", {
c("Microbacterium paraoxidans",
"Streptococcus suis (bovis gr)",
"Raoultella (here some text) terrigena")))),
- c("B_MCRBC", "B_STRPTC_SUI", "B_RLTLL_TER"))
+ c("B_MCRBC", "B_STRPT_SUI", "B_RLTLL_TER"))
# Salmonella (City) are all actually Salmonella enterica spp (City)
expect_equal(as.character(suppressMessages(as.mo("Salmonella Goettingen"))),
diff --git a/tests/testthat/test-mo_property.R b/tests/testthat/test-mo_property.R
index 95930843..2df716bb 100644
--- a/tests/testthat/test-mo_property.R
+++ b/tests/testthat/test-mo_property.R
@@ -23,31 +23,29 @@ context("mo_property.R")
test_that("mo_property works", {
expect_equal(mo_kingdom("E. coli"), "Bacteria")
- expect_equal(mo_subkingdom("E. coli"), "Negibacteria")
expect_equal(mo_phylum("E. coli"), "Proteobacteria")
expect_equal(mo_class("E. coli"), "Gammaproteobacteria")
expect_equal(mo_order("E. coli"), "Enterobacteriales")
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"), NA_character_)
+ expect_equal(mo_subspecies("E. coli"), "")
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(mo_TSN("E. coli"), 285)
expect_equal(class(mo_taxonomy("E. coli")), "list")
- expect_equal(names(mo_taxonomy("E. coli")), c("kingdom", "subkingdom", "phylum", "class", "order",
+ expect_equal(names(mo_taxonomy("E. coli")), c("kingdom", "phylum", "class", "order",
"family", "genus", "species", "subspecies"))
- expect_equal(mo_ref("E. coli"), "Castellani and Chalmers, 1919")
- expect_equal(mo_authors("E. coli"), "Castellani and Chalmers")
+ expect_equal(mo_ref("E. coli"), "(Migula, 1895) Castellani and Chalmers, 1919")
+ expect_equal(mo_authors("E. coli"), "(Migula) Castellani and Chalmers")
expect_equal(mo_year("E. coli"), 1919)
expect_equal(mo_shortname("MRSA"), "S. aureus")
expect_equal(mo_shortname("MRSA", Becker = TRUE), "S. aureus")
expect_equal(mo_shortname("MRSA", Becker = "all", language = "en"), "CoPS")
- expect_equal(mo_shortname("S. aga"), "S. agalactiae")
- expect_equal(mo_shortname("S. aga", Lancefield = TRUE), "GBS")
+ expect_equal(mo_shortname("S. agalac"), "S. agalactiae")
+ expect_equal(mo_shortname("S. agalac", Lancefield = TRUE), "GBS")
# test integrity
MOs <- AMR::microorganisms