mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 20:06:12 +01:00
Support for German and Spanish microorganism properties, cleanup
This commit is contained in:
parent
5405002119
commit
b388e3fee7
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 0.3.0.9006
|
Version: 0.3.0.9007
|
||||||
Date: 2018-09-01
|
Date: 2018-09-04
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(
|
person(
|
||||||
|
@ -94,12 +94,10 @@ export(mo_family)
|
|||||||
export(mo_fullname)
|
export(mo_fullname)
|
||||||
export(mo_genus)
|
export(mo_genus)
|
||||||
export(mo_gramstain)
|
export(mo_gramstain)
|
||||||
export(mo_gramstain_nl)
|
|
||||||
export(mo_property)
|
export(mo_property)
|
||||||
export(mo_species)
|
export(mo_species)
|
||||||
export(mo_subspecies)
|
export(mo_subspecies)
|
||||||
export(mo_type)
|
export(mo_type)
|
||||||
export(mo_type_nl)
|
|
||||||
export(n_rsi)
|
export(n_rsi)
|
||||||
export(p.symbol)
|
export(p.symbol)
|
||||||
export(portion_I)
|
export(portion_I)
|
||||||
|
10
NEWS.md
10
NEWS.md
@ -10,7 +10,15 @@
|
|||||||
* Column names of datasets `microorganisms` and `septic_patients`
|
* Column names of datasets `microorganisms` and `septic_patients`
|
||||||
* All old syntaxes will still work with this version, but will throw warnings
|
* All old syntaxes will still work with this version, but will throw warnings
|
||||||
* Functions `as.atc` and `is.atc` to transform/look up antibiotic ATC codes as defined by the WHO. The existing function `guess_atc` is now an alias of `as.atc`.
|
* Functions `as.atc` and `is.atc` to transform/look up antibiotic ATC codes as defined by the WHO. The existing function `guess_atc` is now an alias of `as.atc`.
|
||||||
* Aliases for existing function `mo_property`: `mo_family`, `mo_genus`, `mo_species`, `mo_subspecies`, `mo_fullname`, `mo_type`, `mo_gramstain`, `mo_aerobic`, `mo_type_nl` and `mo_gramstain_nl`
|
* Aliases for existing function `mo_property`: `mo_family`, `mo_genus`, `mo_species`, `mo_subspecies`, `mo_fullname`, `mo_aerobic`, `mo_type`, `mo_gramstain`. The last two functions have a `language` parameter, with support for Spanish, German and Dutch:
|
||||||
|
```r
|
||||||
|
mo_gramstain("E. coli")
|
||||||
|
# [1] "Negative rods"
|
||||||
|
mo_gramstain("E. coli", language = "de") # "de" = Deutsch / German
|
||||||
|
# [1] "Negative Staebchen"
|
||||||
|
mo_gramstain("E. coli", language = "es") # "es" = Español / Spanish
|
||||||
|
# [1] "Bacilos negativos"
|
||||||
|
```
|
||||||
* Function `ab_property` and its aliases: `ab_official`, `ab_tradenames`, `ab_certe`, `ab_umcg`, `ab_official_nl` and `ab_trivial_nl`
|
* Function `ab_property` and its aliases: `ab_official`, `ab_tradenames`, `ab_certe`, `ab_umcg`, `ab_official_nl` and `ab_trivial_nl`
|
||||||
* Introduction to AMR as a vignette
|
* Introduction to AMR as a vignette
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
ab_property <- function(x, property = 'official') {
|
ab_property <- function(x, property = 'official') {
|
||||||
property <- property[1]
|
property <- property[1]
|
||||||
if (!property %in% colnames(antibiotics)) {
|
if (!property %in% colnames(antibiotics)) {
|
||||||
stop("invalid property: ", property, " - use a column name of `antibiotics`")
|
stop("invalid property: ", property, " - use a column name of the `antibiotics` data set")
|
||||||
}
|
}
|
||||||
if (!is.atc(x)) {
|
if (!is.atc(x)) {
|
||||||
x <- as.atc(x) # this will give a warning if x cannot be coerced
|
x <- as.atc(x) # this will give a warning if x cannot be coerced
|
||||||
|
4
R/atc.R
4
R/atc.R
@ -17,9 +17,9 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
|
|
||||||
#' Find ATC code based on antibiotic property
|
#' Transform to ATC code
|
||||||
#'
|
#'
|
||||||
#' Use this function to determine the ATC code of one or more antibiotics. The dataset \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.
|
#' Use this function to determine the ATC code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.
|
||||||
#' @param x character vector to determine \code{ATC} code
|
#' @param x character vector to determine \code{ATC} code
|
||||||
#' @rdname as.atc
|
#' @rdname as.atc
|
||||||
#' @aliases atc
|
#' @aliases atc
|
||||||
|
8
R/data.R
8
R/data.R
@ -123,7 +123,7 @@
|
|||||||
#' Data set with human pathogenic microorganisms
|
#' Data set with human pathogenic microorganisms
|
||||||
#'
|
#'
|
||||||
#' A data set containing 2,664 (potential) human pathogenic microorganisms. MO codes can be looked up using \code{\link{guess_mo}}.
|
#' A data set containing 2,664 (potential) human pathogenic microorganisms. MO codes can be looked up using \code{\link{guess_mo}}.
|
||||||
#' @format A \code{\link{tibble}} with 2,664 observations and 12 variables:
|
#' @format A \code{\link{tibble}} with 2,664 observations and 16 variables:
|
||||||
#' \describe{
|
#' \describe{
|
||||||
#' \item{\code{mo}}{ID of microorganism}
|
#' \item{\code{mo}}{ID of microorganism}
|
||||||
#' \item{\code{bactsys}}{Bactsyscode of microorganism}
|
#' \item{\code{bactsys}}{Bactsyscode of microorganism}
|
||||||
@ -132,11 +132,15 @@
|
|||||||
#' \item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
#' \item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
||||||
#' \item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
#' \item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
||||||
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
#' \item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
||||||
|
#' \item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
||||||
#' \item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
#' \item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
||||||
#' \item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
#' \item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
||||||
#' \item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
#' \item{\code{type_de}}{Type of microorganism in German, like \code{"Bakterien"} and \code{"Pilz/Hefe"}}
|
||||||
|
#' \item{\code{gramstain_de}}{Gram of microorganism in German, like \code{"Negative Staebchen"}}
|
||||||
#' \item{\code{type_nl}}{Type of microorganism in Dutch, like \code{"Bacterie"} and \code{"Schimmel/gist"}}
|
#' \item{\code{type_nl}}{Type of microorganism in Dutch, like \code{"Bacterie"} and \code{"Schimmel/gist"}}
|
||||||
#' \item{\code{gramstain_nl}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
|
#' \item{\code{gramstain_nl}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
|
||||||
|
#' \item{\code{type_es}}{Type of microorganism in Spanish, like \code{"Bacteria"} and \code{"Hongo/levadura"}}
|
||||||
|
#' \item{\code{gramstain_es}}{Gram of microorganism in Spanish, like \code{"Bacilos negativos"}}
|
||||||
#' }
|
#' }
|
||||||
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl}
|
# source MOLIS (LIS of Certe) - \url{https://www.certe.nl}
|
||||||
# new <- microorganisms %>% filter(genus == "Bacteroides") %>% .[1,]
|
# new <- microorganisms %>% filter(genus == "Bacteroides") %>% .[1,]
|
||||||
|
37
R/mo.R
37
R/mo.R
@ -19,15 +19,19 @@
|
|||||||
#' Transform to microorganism ID
|
#' Transform to microorganism ID
|
||||||
#'
|
#'
|
||||||
#' Use this function to determine a valid ID based on a genus (and species). This input can be a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), or just a genus. You could also \code{\link{select}} a genus and species column, zie Examples.
|
#' Use this function to determine a valid ID based on a genus (and species). This input can be a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), or just a genus. You could also \code{\link{select}} a genus and species column, zie Examples.
|
||||||
#' @param x a character vector or a dataframe with one or two columns
|
#' @param x a character vector or a \code{data.frame} with one or two columns
|
||||||
#' @param Becker a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1]. This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".
|
#' @param Becker a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1].
|
||||||
#' @param Lancefield a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L. Groups D and E will be ignored, since they are \emph{Enterococci}.
|
#'
|
||||||
|
#' This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".
|
||||||
|
#' @param Lancefield a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L.
|
||||||
|
#'
|
||||||
|
#' This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.
|
||||||
#' @rdname as.mo
|
#' @rdname as.mo
|
||||||
#' @aliases mo
|
#' @aliases mo
|
||||||
#' @keywords mo Becker becker Lancefield lancefield guess
|
#' @keywords mo Becker becker Lancefield lancefield guess
|
||||||
#' @details \code{guess_mo} is an alias of \code{as.mo}.
|
#' @details \code{guess_mo} is an alias of \code{as.mo}.
|
||||||
#'
|
#'
|
||||||
#' Use the \code{\link{mo_property}} functions to get properties based on the returned mo, see Examples.
|
#' Use the \code{\link{mo_property}} functions to get properties based on the returned code, see Examples.
|
||||||
#'
|
#'
|
||||||
#' Some exceptions have been built in to get more logical results, based on prevalence of human pathogens. These are:
|
#' Some exceptions have been built in to get more logical results, based on prevalence of human pathogens. These are:
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
@ -39,10 +43,9 @@
|
|||||||
#' Moreover, this function also supports ID's based on only Gram stain, when the species is not known. \cr
|
#' Moreover, this function also supports ID's based on only Gram stain, when the species is not known. \cr
|
||||||
#' For example, \code{"Gram negative rods"} and \code{"GNR"} will both return the ID of a Gram negative rod: \code{GNR}.
|
#' For example, \code{"Gram negative rods"} and \code{"GNR"} will both return the ID of a Gram negative rod: \code{GNR}.
|
||||||
#' @source
|
#' @source
|
||||||
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \cr
|
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
#' \url{https://dx.doi.org/10.1128/CMR.00109-13} \cr
|
#'
|
||||||
#' [2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \cr
|
#' [2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
#' \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
|
||||||
#' @export
|
#' @export
|
||||||
#' @importFrom dplyr %>% pull left_join
|
#' @importFrom dplyr %>% pull left_join
|
||||||
#' @return Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
|
#' @return Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
|
||||||
@ -63,7 +66,7 @@
|
|||||||
#' guess_mo("S. epidermidis") # will remain species: STAEPI
|
#' guess_mo("S. epidermidis") # will remain species: STAEPI
|
||||||
#' guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
|
#' guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
|
||||||
#'
|
#'
|
||||||
#' guess_mo("S. pyogenes") # will remain species: STCAGA
|
#' guess_mo("S. pyogenes") # will remain species: STCPYO
|
||||||
#' guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
|
#' guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
|
||||||
#'
|
#'
|
||||||
#' # Use mo_* functions to get a specific property based on `mo`
|
#' # Use mo_* functions to get a specific property based on `mo`
|
||||||
@ -177,10 +180,17 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
if (tolower(x[i]) %like% 'coagulase negative'
|
if (tolower(x[i]) %like% 'coagulase negative'
|
||||||
| tolower(x[i]) %like% 'cns'
|
| tolower(x[i]) %like% 'cns'
|
||||||
| tolower(x[i]) %like% 'cons') {
|
| tolower(x[i]) %like% 'cons') {
|
||||||
# coerce S. coagulase negative, also as CNS and CoNS
|
# coerce S. coagulase negative
|
||||||
x[i] <- 'STACNS'
|
x[i] <- 'STACNS'
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
if (tolower(x[i]) %like% 'coagulase positive'
|
||||||
|
| tolower(x[i]) %like% 'cps'
|
||||||
|
| tolower(x[i]) %like% 'cops') {
|
||||||
|
# coerce S. coagulase positive
|
||||||
|
x[i] <- 'STACPS'
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
# translate known trivial names to genus+species
|
# translate known trivial names to genus+species
|
||||||
if (!is.na(x_trimmed[i])) {
|
if (!is.na(x_trimmed[i])) {
|
||||||
@ -204,7 +214,7 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
next
|
next
|
||||||
}
|
}
|
||||||
if (toupper(x_trimmed[i]) %in% c('PISP', 'PRSP', 'VISP', 'VRSP')) {
|
if (toupper(x_trimmed[i]) %in% c('PISP', 'PRSP', 'VISP', 'VRSP')) {
|
||||||
# peni R, peni I, vanco I, vanco R: S. pneumoniae
|
# peni I, peni R, vanco I, vanco R: S. pneumoniae
|
||||||
x[i] <- 'STCPNE'
|
x[i] <- 'STCPNE'
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
@ -327,7 +337,7 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lancefield == TRUE) {
|
if (Lancefield == TRUE | Lancefield == "all") {
|
||||||
# group A
|
# group A
|
||||||
x[x == "STCPYO"] <- "STCGRA" # S. pyogenes
|
x[x == "STCPYO"] <- "STCGRA" # S. pyogenes
|
||||||
# group B
|
# group B
|
||||||
@ -338,6 +348,9 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
"zooepidemicus", "dysgalactiae")) %>%
|
"zooepidemicus", "dysgalactiae")) %>%
|
||||||
pull(mo)
|
pull(mo)
|
||||||
x[x %in% S_groupC] <- "STCGRC" # S. agalactiae
|
x[x %in% S_groupC] <- "STCGRC" # S. agalactiae
|
||||||
|
if (Lancefield == "all") {
|
||||||
|
x[substr(x, 1, 3) == "ENC"] <- "STCGRD" # all Enterococci
|
||||||
|
}
|
||||||
# group F
|
# group F
|
||||||
x[x == "STCANG"] <- "STCGRF" # S. anginosus
|
x[x == "STCANG"] <- "STCGRF" # S. anginosus
|
||||||
# group H
|
# group H
|
||||||
|
130
R/mo_property.R
130
R/mo_property.R
@ -18,59 +18,80 @@
|
|||||||
|
|
||||||
#' Property of a microorganism
|
#' Property of a microorganism
|
||||||
#'
|
#'
|
||||||
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set, based on their \code{mo}. Get such an ID with \code{\link{as.mo}}.
|
#' Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}.
|
||||||
#' @param x a (vector of a) valid \code{\link{mo}} or any text that can be coerced to a valid microorganism code with \code{\link{as.mo}}
|
#' @param x any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}
|
||||||
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}
|
#' @param property one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}
|
||||||
|
#' @inheritParams as.mo
|
||||||
|
#' @param language language of the returned text, either one of \code{"en"} (English), \code{"de"} (German) or \code{"nl"} (Dutch)
|
||||||
|
#' @source
|
||||||
|
#' [1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
|
#'
|
||||||
|
#' [2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
#' @importFrom dplyr %>% left_join pull
|
#' @importFrom dplyr %>% left_join pull
|
||||||
#' @seealso \code{\link{microorganisms}}
|
#' @seealso \code{\link{microorganisms}}
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # All properties
|
#' # All properties
|
||||||
#' mo_family("E. coli") # Enterobacteriaceae
|
#' mo_family("E. coli") # "Enterobacteriaceae"
|
||||||
#' mo_genus("E. coli") # Escherichia
|
#' mo_genus("E. coli") # "Escherichia"
|
||||||
#' mo_species("E. coli") # coli
|
#' mo_species("E. coli") # "coli"
|
||||||
#' mo_subspecies("E. coli") # <NA>
|
#' mo_subspecies("E. coli") # <NA>
|
||||||
#' mo_fullname("E. coli") # Escherichia coli
|
#' mo_fullname("E. coli") # "Escherichia coli"
|
||||||
#' mo_type("E. coli") # Bacteria
|
#' mo_type("E. coli") # "Bacteria"
|
||||||
#' mo_gramstain("E. coli") # Negative rods
|
#' mo_gramstain("E. coli") # "Negative rods"
|
||||||
#' mo_aerobic("E. coli") # TRUE
|
#' mo_aerobic("E. coli") # TRUE
|
||||||
#' mo_type_nl("E. coli") # Bacterie
|
#'
|
||||||
#' mo_gramstain_nl("E. coli") # Negatieve staven
|
#' # language support for Spanish, German and Dutch
|
||||||
|
#' mo_type("E. coli", "es") # "Bakteria"
|
||||||
|
#' mo_type("E. coli", "de") # "Bakterien"
|
||||||
|
#' mo_type("E. coli", "nl") # "Bacterie"
|
||||||
|
#' mo_gramstain("E. coli", "es") # "Bacilos negativos"
|
||||||
|
#' mo_gramstain("E. coli", "de") # "Negative Staebchen"
|
||||||
|
#' mo_gramstain("E. coli", "nl") # "Negatieve staven"
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' # Abbreviations known in the field
|
#' # Abbreviations known in the field
|
||||||
#' mo_genus("EHEC") # Escherichia
|
#' mo_genus("MRSA") # "Staphylococcus"
|
||||||
#' mo_species("EHEC") # coli
|
#' mo_species("MRSA") # "aureus"
|
||||||
#' mo_subspecies("EHEC") # EHEC
|
#' mo_gramstain("MRSA") # "Positive cocci"
|
||||||
#' mo_fullname("EHEC") # Escherichia coli (EHEC)
|
|
||||||
#'
|
#'
|
||||||
#' mo_genus("MRSA") # Staphylococcus
|
#' mo_genus("VISA") # "Staphylococcus"
|
||||||
#' mo_species("MRSA") # aureus
|
#' mo_species("VISA") # "aureus"
|
||||||
#' mo_gramstain("MRSA") # Positive cocci
|
|
||||||
#'
|
|
||||||
#' mo_genus("VISA") # Staphylococcus
|
|
||||||
#' mo_species("VISA") # aureus
|
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' # Known subspecies
|
#' # Known subspecies
|
||||||
#' mo_genus("doylei") # Campylobacter
|
#' mo_genus("EHEC") # "Escherichia"
|
||||||
#' mo_species("doylei") # jejuni
|
#' mo_species("EHEC") # "coli"
|
||||||
#' mo_fullname("doylei") # Campylobacter jejuni (doylei)
|
#' mo_subspecies("EHEC") # "EHEC"
|
||||||
|
#' mo_fullname("EHEC") # "Escherichia coli (EHEC)"
|
||||||
|
#'
|
||||||
|
#' mo_genus("doylei") # "Campylobacter"
|
||||||
|
#' mo_species("doylei") # "jejuni"
|
||||||
|
#' mo_fullname("doylei") # "Campylobacter jejuni (doylei)"
|
||||||
|
#'
|
||||||
|
#' mo_fullname("K. pneu rh") # "Klebsiella pneumoniae (rhinoscleromatis)"
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' # Anaerobic bacteria
|
#' # Anaerobic bacteria
|
||||||
#' mo_genus("B. fragilis") # Bacteroides
|
#' mo_genus("B. fragilis") # "Bacteroides"
|
||||||
#' mo_species("B. fragilis") # fragilis
|
#' mo_species("B. fragilis") # "fragilis"
|
||||||
#' mo_aerobic("B. fragilis") # FALSE
|
#' mo_aerobic("B. fragilis") # FALSE
|
||||||
mo_property <- function(x, property = 'fullname') {
|
#'
|
||||||
property <- property[1]
|
#'
|
||||||
|
#' # Becker classification, see ?as.mo
|
||||||
|
#' mo_fullname("S. epidermidis") # "Staphylococcus epidermidis"
|
||||||
|
#' mo_fullname("S. epidermidis", Becker = TRUE) # "Coagulase Negative Staphylococcus (CoNS)"
|
||||||
|
#'
|
||||||
|
#' # Lancefield classification, see ?as.mo
|
||||||
|
#' mo_fullname("S. pyogenes") # "Streptococcus pyogenes"
|
||||||
|
#' mo_fullname("S. pyogenes", Lancefield = TRUE) # "Streptococcus group A"
|
||||||
|
mo_property <- function(x, property = 'fullname', Becker = FALSE, Lancefield = FALSE) {
|
||||||
|
property <- tolower(property[1])
|
||||||
if (!property %in% colnames(microorganisms)) {
|
if (!property %in% colnames(microorganisms)) {
|
||||||
stop("invalid property: ", property, " - use a column name of `microorganisms`")
|
stop("invalid property: ", property, " - use a column name of the `microorganisms` data set")
|
||||||
}
|
|
||||||
if (!is.mo(x)) {
|
|
||||||
x <- as.mo(x) # this will give a warning if x cannot be coerced
|
|
||||||
}
|
}
|
||||||
|
x <- as.mo(x = x, Becker = Becker, Lancefield = Lancefield) # this will give a warning if x cannot be coerced
|
||||||
suppressWarnings(
|
suppressWarnings(
|
||||||
data.frame(mo = x, stringsAsFactors = FALSE) %>%
|
data.frame(mo = x, stringsAsFactors = FALSE) %>%
|
||||||
left_join(AMR::microorganisms, by = "mo") %>%
|
left_join(AMR::microorganisms, by = "mo") %>%
|
||||||
@ -92,32 +113,32 @@ mo_genus <- function(x) {
|
|||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_species <- function(x) {
|
mo_species <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
||||||
mo_property(x, "species")
|
mo_property(x, "species", Becker = Becker, Lancefield = Lancefield)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_subspecies <- function(x) {
|
mo_subspecies <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
||||||
mo_property(x, "subspecies")
|
mo_property(x, "subspecies", Becker = Becker, Lancefield = Lancefield)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_fullname <- function(x) {
|
mo_fullname <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
||||||
mo_property(x, "fullname")
|
mo_property(x, "fullname", Becker = Becker, Lancefield = Lancefield)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_type <- function(x) {
|
mo_type <- function(x, language = "en") {
|
||||||
mo_property(x, "type")
|
mo_property(x, paste0("type", checklang(language)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
#' @export
|
#' @export
|
||||||
mo_gramstain <- function(x) {
|
mo_gramstain <- function(x, language = "en") {
|
||||||
mo_property(x, "gramstain")
|
mo_property(x, paste0("gramstain", checklang(language)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
#' @rdname mo_property
|
||||||
@ -126,14 +147,15 @@ mo_aerobic <- function(x) {
|
|||||||
mo_property(x, "aerobic")
|
mo_property(x, "aerobic")
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname mo_property
|
checklang <- function(language) {
|
||||||
#' @export
|
language <- tolower(language[1])
|
||||||
mo_type_nl <- function(x) {
|
supported <- c("en", "de", "nl", "es")
|
||||||
mo_property(x, "type_nl")
|
if (!language %in% c(NULL, "", supported)) {
|
||||||
}
|
stop("invalid language: ", language, " - use one of ", paste0("'", sort(supported), "'", collapse = ", "), call. = FALSE)
|
||||||
|
}
|
||||||
#' @rdname mo_property
|
if (language %in% c(NULL, "", "en")) {
|
||||||
#' @export
|
""
|
||||||
mo_gramstain_nl <- function(x) {
|
} else {
|
||||||
mo_property(x, "gramstain_nl")
|
paste0("_", language)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ This `AMR` package basically does four important things:
|
|||||||
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. Since it uses `as.mo` internally, AI is supported. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. These functions can be used to add new variables to your data.
|
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. Some functions can return results in Spanish, German and Dutch. These functions can be used to add new variables to your data.
|
||||||
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
3. It **analyses the data** with convenient functions that use well-known methods.
|
3. It **analyses the data** with convenient functions that use well-known methods.
|
||||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
\alias{atc}
|
\alias{atc}
|
||||||
\alias{guess_atc}
|
\alias{guess_atc}
|
||||||
\alias{is.atc}
|
\alias{is.atc}
|
||||||
\title{Find ATC code based on antibiotic property}
|
\title{Transform to ATC code}
|
||||||
\usage{
|
\usage{
|
||||||
as.atc(x)
|
as.atc(x)
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ is.atc(x)
|
|||||||
Character (vector) with class \code{"act"}. Unknown values will return \code{NA}.
|
Character (vector) with class \code{"act"}. Unknown values will return \code{NA}.
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Use this function to determine the ATC code of one or more antibiotics. The dataset \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.
|
Use this function to determine the ATC code of one or more antibiotics. The data set \code{\link{antibiotics}} will be searched for abbreviations, official names and trade names.
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
Use the \code{\link{ab_property}} functions to get properties based on the returned ATC code, see Examples.
|
Use the \code{\link{ab_property}} functions to get properties based on the returned ATC code, see Examples.
|
||||||
|
21
man/as.mo.Rd
21
man/as.mo.Rd
@ -7,10 +7,9 @@
|
|||||||
\alias{guess_mo}
|
\alias{guess_mo}
|
||||||
\title{Transform to microorganism ID}
|
\title{Transform to microorganism ID}
|
||||||
\source{
|
\source{
|
||||||
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \cr
|
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
\url{https://dx.doi.org/10.1128/CMR.00109-13} \cr
|
|
||||||
[2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \cr
|
[2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
\url{https://dx.doi.org/10.1084/jem.57.4.571}
|
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
as.mo(x, Becker = FALSE, Lancefield = FALSE)
|
as.mo(x, Becker = FALSE, Lancefield = FALSE)
|
||||||
@ -20,11 +19,15 @@ is.mo(x)
|
|||||||
guess_mo(x, Becker = FALSE, Lancefield = FALSE)
|
guess_mo(x, Becker = FALSE, Lancefield = FALSE)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{a character vector or a dataframe with one or two columns}
|
\item{x}{a character vector or a \code{data.frame} with one or two columns}
|
||||||
|
|
||||||
\item{Becker}{a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1]. This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".}
|
\item{Becker}{a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1].
|
||||||
|
|
||||||
\item{Lancefield}{a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L. Groups D and E will be ignored, since they are \emph{Enterococci}.}
|
This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".}
|
||||||
|
|
||||||
|
\item{Lancefield}{a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L.
|
||||||
|
|
||||||
|
This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.}
|
||||||
}
|
}
|
||||||
\value{
|
\value{
|
||||||
Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
|
Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}.
|
||||||
@ -35,7 +38,7 @@ Use this function to determine a valid ID based on a genus (and species). This i
|
|||||||
\details{
|
\details{
|
||||||
\code{guess_mo} is an alias of \code{as.mo}.
|
\code{guess_mo} is an alias of \code{as.mo}.
|
||||||
|
|
||||||
Use the \code{\link{mo_property}} functions to get properties based on the returned mo, see Examples.
|
Use the \code{\link{mo_property}} functions to get properties based on the returned code, see Examples.
|
||||||
|
|
||||||
Some exceptions have been built in to get more logical results, based on prevalence of human pathogens. These are:
|
Some exceptions have been built in to get more logical results, based on prevalence of human pathogens. These are:
|
||||||
\itemize{
|
\itemize{
|
||||||
@ -63,7 +66,7 @@ as.mo("VRSA") # Vancomycin Resistant S. aureus
|
|||||||
guess_mo("S. epidermidis") # will remain species: STAEPI
|
guess_mo("S. epidermidis") # will remain species: STAEPI
|
||||||
guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
|
guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: STACNS
|
||||||
|
|
||||||
guess_mo("S. pyogenes") # will remain species: STCAGA
|
guess_mo("S. pyogenes") # will remain species: STCPYO
|
||||||
guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
|
guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: STCGRA
|
||||||
|
|
||||||
# Use mo_* functions to get a specific property based on `mo`
|
# Use mo_* functions to get a specific property based on `mo`
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
\name{microorganisms}
|
\name{microorganisms}
|
||||||
\alias{microorganisms}
|
\alias{microorganisms}
|
||||||
\title{Data set with human pathogenic microorganisms}
|
\title{Data set with human pathogenic microorganisms}
|
||||||
\format{A \code{\link{tibble}} with 2,664 observations and 12 variables:
|
\format{A \code{\link{tibble}} with 2,664 observations and 16 variables:
|
||||||
\describe{
|
\describe{
|
||||||
\item{\code{mo}}{ID of microorganism}
|
\item{\code{mo}}{ID of microorganism}
|
||||||
\item{\code{bactsys}}{Bactsyscode of microorganism}
|
\item{\code{bactsys}}{Bactsyscode of microorganism}
|
||||||
@ -13,11 +13,15 @@
|
|||||||
\item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
\item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
||||||
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
||||||
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
||||||
|
\item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
||||||
\item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
\item{\code{type}}{Type of microorganism, like \code{"Bacteria"} and \code{"Fungus/yeast"}}
|
||||||
\item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
\item{\code{gramstain}}{Gram of microorganism, like \code{"Negative rods"}}
|
||||||
\item{\code{aerobic}}{Logical whether bacteria is aerobic}
|
\item{\code{type_de}}{Type of microorganism in German, like \code{"Bakterien"} and \code{"Pilz/Hefe"}}
|
||||||
|
\item{\code{gramstain_de}}{Gram of microorganism in German, like \code{"Negative Staebchen"}}
|
||||||
\item{\code{type_nl}}{Type of microorganism in Dutch, like \code{"Bacterie"} and \code{"Schimmel/gist"}}
|
\item{\code{type_nl}}{Type of microorganism in Dutch, like \code{"Bacterie"} and \code{"Schimmel/gist"}}
|
||||||
\item{\code{gramstain_nl}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
|
\item{\code{gramstain_nl}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
|
||||||
|
\item{\code{type_es}}{Type of microorganism in Spanish, like \code{"Bacteria"} and \code{"Hongo/levadura"}}
|
||||||
|
\item{\code{gramstain_es}}{Gram of microorganism in Spanish, like \code{"Bacilos negativos"}}
|
||||||
}}
|
}}
|
||||||
\usage{
|
\usage{
|
||||||
microorganisms
|
microorganisms
|
||||||
|
@ -10,78 +10,105 @@
|
|||||||
\alias{mo_type}
|
\alias{mo_type}
|
||||||
\alias{mo_gramstain}
|
\alias{mo_gramstain}
|
||||||
\alias{mo_aerobic}
|
\alias{mo_aerobic}
|
||||||
\alias{mo_type_nl}
|
|
||||||
\alias{mo_gramstain_nl}
|
|
||||||
\title{Property of a microorganism}
|
\title{Property of a microorganism}
|
||||||
|
\source{
|
||||||
|
[1] Becker K \emph{et al.} \strong{Coagulase-Negative Staphylococci}. 2014. Clin Microbiol Rev. 27(4): 870–926. \url{https://dx.doi.org/10.1128/CMR.00109-13}
|
||||||
|
|
||||||
|
[2] Lancefield RC \strong{A serological differentiation of human and other groups of hemolytic streptococci}. 1933. J Exp Med. 57(4): 571–95. \url{https://dx.doi.org/10.1084/jem.57.4.571}
|
||||||
|
}
|
||||||
\usage{
|
\usage{
|
||||||
mo_property(x, property = "fullname")
|
mo_property(x, property = "fullname", Becker = FALSE,
|
||||||
|
Lancefield = FALSE)
|
||||||
|
|
||||||
mo_family(x)
|
mo_family(x)
|
||||||
|
|
||||||
mo_genus(x)
|
mo_genus(x)
|
||||||
|
|
||||||
mo_species(x)
|
mo_species(x, Becker = FALSE, Lancefield = FALSE)
|
||||||
|
|
||||||
mo_subspecies(x)
|
mo_subspecies(x, Becker = FALSE, Lancefield = FALSE)
|
||||||
|
|
||||||
mo_fullname(x)
|
mo_fullname(x, Becker = FALSE, Lancefield = FALSE)
|
||||||
|
|
||||||
mo_type(x)
|
mo_type(x, language = "en")
|
||||||
|
|
||||||
mo_gramstain(x)
|
mo_gramstain(x, language = "en")
|
||||||
|
|
||||||
mo_aerobic(x)
|
mo_aerobic(x)
|
||||||
|
|
||||||
mo_type_nl(x)
|
|
||||||
|
|
||||||
mo_gramstain_nl(x)
|
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{x}{a (vector of a) valid \code{\link{mo}} or any text that can be coerced to a valid microorganism code with \code{\link{as.mo}}}
|
\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link{as.mo}}}
|
||||||
|
|
||||||
\item{property}{one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}}
|
\item{property}{one of the column names of one of the \code{\link{microorganisms}} data set, like \code{"mo"}, \code{"bactsys"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"fullname"}, \code{"gramstain"} and \code{"aerobic"}}
|
||||||
|
|
||||||
|
\item{Becker}{a logical to indicate whether \emph{Staphylococci} should be categorised into Coagulase Negative \emph{Staphylococci} ("CoNS") and Coagulase Positive \emph{Staphylococci} ("CoPS") instead of their own species, according to Karsten Becker \emph{et al.} [1].
|
||||||
|
|
||||||
|
This excludes \emph{Staphylococcus aureus} at default, use \code{Becker = "all"} to also categorise \emph{S. aureus} as "CoPS".}
|
||||||
|
|
||||||
|
\item{Lancefield}{a logical to indicate whether beta-haemolytic \emph{Streptococci} should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield [2]. These \emph{Streptococci} will be categorised in their first group, i.e. \emph{Streptococcus dysgalactiae} will be group C, although officially it was also categorised into groups G and L.
|
||||||
|
|
||||||
|
This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D.}
|
||||||
|
|
||||||
|
\item{language}{language of the returned text, either one of \code{"en"} (English), \code{"de"} (German) or \code{"nl"} (Dutch)}
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set, based on their \code{mo}. Get such an ID with \code{\link{as.mo}}.
|
Use these functions to return a specific property of a microorganism from the \code{\link{microorganisms}} data set. All input values will be evaluated internally with \code{\link{as.mo}}.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
# All properties
|
# All properties
|
||||||
mo_family("E. coli") # Enterobacteriaceae
|
mo_family("E. coli") # "Enterobacteriaceae"
|
||||||
mo_genus("E. coli") # Escherichia
|
mo_genus("E. coli") # "Escherichia"
|
||||||
mo_species("E. coli") # coli
|
mo_species("E. coli") # "coli"
|
||||||
mo_subspecies("E. coli") # <NA>
|
mo_subspecies("E. coli") # <NA>
|
||||||
mo_fullname("E. coli") # Escherichia coli
|
mo_fullname("E. coli") # "Escherichia coli"
|
||||||
mo_type("E. coli") # Bacteria
|
mo_type("E. coli") # "Bacteria"
|
||||||
mo_gramstain("E. coli") # Negative rods
|
mo_gramstain("E. coli") # "Negative rods"
|
||||||
mo_aerobic("E. coli") # TRUE
|
mo_aerobic("E. coli") # TRUE
|
||||||
mo_type_nl("E. coli") # Bacterie
|
|
||||||
mo_gramstain_nl("E. coli") # Negatieve staven
|
# language support for Spanish, German and Dutch
|
||||||
|
mo_type("E. coli", "es") # "Bakteria"
|
||||||
|
mo_type("E. coli", "de") # "Bakterien"
|
||||||
|
mo_type("E. coli", "nl") # "Bacterie"
|
||||||
|
mo_gramstain("E. coli", "es") # "Bacilos negativos"
|
||||||
|
mo_gramstain("E. coli", "de") # "Negative Staebchen"
|
||||||
|
mo_gramstain("E. coli", "nl") # "Negatieve staven"
|
||||||
|
|
||||||
|
|
||||||
# Abbreviations known in the field
|
# Abbreviations known in the field
|
||||||
mo_genus("EHEC") # Escherichia
|
mo_genus("MRSA") # "Staphylococcus"
|
||||||
mo_species("EHEC") # coli
|
mo_species("MRSA") # "aureus"
|
||||||
mo_subspecies("EHEC") # EHEC
|
mo_gramstain("MRSA") # "Positive cocci"
|
||||||
mo_fullname("EHEC") # Escherichia coli (EHEC)
|
|
||||||
|
|
||||||
mo_genus("MRSA") # Staphylococcus
|
mo_genus("VISA") # "Staphylococcus"
|
||||||
mo_species("MRSA") # aureus
|
mo_species("VISA") # "aureus"
|
||||||
mo_gramstain("MRSA") # Positive cocci
|
|
||||||
|
|
||||||
mo_genus("VISA") # Staphylococcus
|
|
||||||
mo_species("VISA") # aureus
|
|
||||||
|
|
||||||
|
|
||||||
# Known subspecies
|
# Known subspecies
|
||||||
mo_genus("doylei") # Campylobacter
|
mo_genus("EHEC") # "Escherichia"
|
||||||
mo_species("doylei") # jejuni
|
mo_species("EHEC") # "coli"
|
||||||
mo_fullname("doylei") # Campylobacter jejuni (doylei)
|
mo_subspecies("EHEC") # "EHEC"
|
||||||
|
mo_fullname("EHEC") # "Escherichia coli (EHEC)"
|
||||||
|
|
||||||
|
mo_genus("doylei") # "Campylobacter"
|
||||||
|
mo_species("doylei") # "jejuni"
|
||||||
|
mo_fullname("doylei") # "Campylobacter jejuni (doylei)"
|
||||||
|
|
||||||
|
mo_fullname("K. pneu rh") # "Klebsiella pneumoniae (rhinoscleromatis)"
|
||||||
|
|
||||||
|
|
||||||
# Anaerobic bacteria
|
# Anaerobic bacteria
|
||||||
mo_genus("B. fragilis") # Bacteroides
|
mo_genus("B. fragilis") # "Bacteroides"
|
||||||
mo_species("B. fragilis") # fragilis
|
mo_species("B. fragilis") # "fragilis"
|
||||||
mo_aerobic("B. fragilis") # FALSE
|
mo_aerobic("B. fragilis") # FALSE
|
||||||
|
|
||||||
|
|
||||||
|
# Becker classification, see ?as.mo
|
||||||
|
mo_fullname("S. epidermidis") # "Staphylococcus epidermidis"
|
||||||
|
mo_fullname("S. epidermidis", Becker = TRUE) # "Coagulase Negative Staphylococcus (CoNS)"
|
||||||
|
|
||||||
|
# Lancefield classification, see ?as.mo
|
||||||
|
mo_fullname("S. pyogenes") # "Streptococcus pyogenes"
|
||||||
|
mo_fullname("S. pyogenes", Lancefield = TRUE) # "Streptococcus group A"
|
||||||
}
|
}
|
||||||
\seealso{
|
\seealso{
|
||||||
\code{\link{microorganisms}}
|
\code{\link{microorganisms}}
|
||||||
|
@ -8,4 +8,7 @@ test_that("ab_property works", {
|
|||||||
expect_equal(ab_umcg("amox"), "AMOX")
|
expect_equal(ab_umcg("amox"), "AMOX")
|
||||||
expect_equal(class(ab_tradenames("amox")), "character")
|
expect_equal(class(ab_tradenames("amox")), "character")
|
||||||
expect_equal(class(ab_tradenames(c("amox", "amox"))), "list")
|
expect_equal(class(ab_tradenames(c("amox", "amox"))), "list")
|
||||||
|
expect_equal(ab_atc("amox"), as.character(as.atc("amox")))
|
||||||
|
|
||||||
|
expect_error(ab_property("amox", "invalid property"))
|
||||||
})
|
})
|
||||||
|
@ -16,9 +16,11 @@ test_that("deprecated functions work", {
|
|||||||
|
|
||||||
old_mo <- "ESCCOL"
|
old_mo <- "ESCCOL"
|
||||||
class(old_mo) <- "bactid"
|
class(old_mo) <- "bactid"
|
||||||
|
df_oldmo <- data.frame(test = old_mo)
|
||||||
# print
|
# print
|
||||||
expect_output(print(old_mo))
|
expect_output(print(old_mo))
|
||||||
# test data.frame and pull
|
# test pull
|
||||||
expect_equal(as.character(dplyr::pull(data.frame(test = old_mo), test)), "ESCCOL")
|
library(dplyr)
|
||||||
|
expect_identical(df_oldmo %>% pull(test), old_mo)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -12,7 +12,7 @@ test_that("as.mo works", {
|
|||||||
expect_equal(as.character(as.mo("klpn")), "KLEPNE")
|
expect_equal(as.character(as.mo("klpn")), "KLEPNE")
|
||||||
expect_equal(as.character(as.mo("Klebsiella")), "KLE")
|
expect_equal(as.character(as.mo("Klebsiella")), "KLE")
|
||||||
expect_equal(as.character(as.mo("K. pneu rhino")), "KLEPNERH") # K. pneumoniae subspp. rhinoscleromatis
|
expect_equal(as.character(as.mo("K. pneu rhino")), "KLEPNERH") # K. pneumoniae subspp. rhinoscleromatis
|
||||||
expect_equal(as.character(as.mo("coagulase negative")), "STACNS")
|
expect_equal(as.character(as.mo("Bartonella")), "BAR")
|
||||||
|
|
||||||
expect_equal(as.character(as.mo("P. aer")), "PSEAER") # not Pasteurella aerogenes
|
expect_equal(as.character(as.mo("P. aer")), "PSEAER") # not Pasteurella aerogenes
|
||||||
|
|
||||||
@ -30,16 +30,21 @@ test_that("as.mo works", {
|
|||||||
expect_equal(as.character(as.mo("VISP")), "STCPNE")
|
expect_equal(as.character(as.mo("VISP")), "STCPNE")
|
||||||
expect_equal(as.character(as.mo("VRSP")), "STCPNE")
|
expect_equal(as.character(as.mo("VRSP")), "STCPNE")
|
||||||
|
|
||||||
|
expect_equal(as.character(as.mo("CNS")), "STACNS")
|
||||||
|
expect_equal(as.character(as.mo("CoNS")), "STACNS")
|
||||||
|
expect_equal(as.character(as.mo("CPS")), "STACPS")
|
||||||
|
expect_equal(as.character(as.mo("CoPS")), "STACPS")
|
||||||
|
|
||||||
expect_identical(
|
expect_identical(
|
||||||
as.character(
|
as.character(
|
||||||
as.mo(c("stau",
|
as.mo(c("stau",
|
||||||
"STAU",
|
"STAU",
|
||||||
"staaur",
|
"staaur",
|
||||||
"S. aureus",
|
"S. aureus",
|
||||||
"S aureus",
|
"S aureus",
|
||||||
"Staphylococcus aureus",
|
"Staphylococcus aureus",
|
||||||
"MRSA",
|
"MRSA",
|
||||||
"VISA"))),
|
"VISA"))),
|
||||||
rep("STAAUR", 8))
|
rep("STAAUR", 8))
|
||||||
|
|
||||||
# check for Becker classification
|
# check for Becker classification
|
||||||
@ -55,19 +60,23 @@ test_that("as.mo works", {
|
|||||||
expect_identical(as.character(guess_mo("STAAUR", Becker = "all")), "STACPS")
|
expect_identical(as.character(guess_mo("STAAUR", Becker = "all")), "STACPS")
|
||||||
|
|
||||||
# check for Lancefield classification
|
# check for Lancefield classification
|
||||||
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = FALSE)), "STCPYO")
|
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = FALSE)), "STCPYO")
|
||||||
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = TRUE)), "STCGRA")
|
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = TRUE)), "STCGRA")
|
||||||
expect_identical(as.character(guess_mo("STCPYO", Lancefield = TRUE)), "STCGRA")
|
expect_identical(as.character(guess_mo("STCPYO", Lancefield = TRUE)), "STCGRA") # group A
|
||||||
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = FALSE)), "STCAGA")
|
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = FALSE)), "STCAGA")
|
||||||
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = TRUE)), "STCGRB") # group B
|
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = TRUE)), "STCGRB") # group B
|
||||||
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = FALSE)), "STCEQS")
|
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = FALSE)), "STCEQS")
|
||||||
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = TRUE)), "STCGRC") # group C
|
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = TRUE)), "STCGRC") # group C
|
||||||
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = FALSE)), "STCANG")
|
# Enterococci must only be influenced if Lancefield = "all"
|
||||||
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = TRUE)), "STCGRF") # group F
|
expect_identical(as.character(guess_mo("E. faecium", Lancefield = FALSE)), "ENCFAC")
|
||||||
expect_identical(as.character(guess_mo("S. sanguis", Lancefield = FALSE)), "STCSAN")
|
expect_identical(as.character(guess_mo("E. faecium", Lancefield = TRUE)), "ENCFAC")
|
||||||
expect_identical(as.character(guess_mo("S. sanguis", Lancefield = TRUE)), "STCGRH") # group H
|
expect_identical(as.character(guess_mo("E. faecium", Lancefield = "all")), "STCGRD") # group D
|
||||||
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = FALSE)), "STCSAL")
|
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = FALSE)), "STCANG")
|
||||||
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = TRUE)), "STCGRK") # group K
|
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = TRUE)), "STCGRF") # group F
|
||||||
|
expect_identical(as.character(guess_mo("S. sanguis", Lancefield = FALSE)), "STCSAN")
|
||||||
|
expect_identical(as.character(guess_mo("S. sanguis", Lancefield = TRUE)), "STCGRH") # group H
|
||||||
|
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = FALSE)), "STCSAL")
|
||||||
|
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = TRUE)), "STCGRK") # group K
|
||||||
|
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
|
|
||||||
|
@ -9,6 +9,12 @@ test_that("mo_property works", {
|
|||||||
expect_equal(mo_type("E. coli"), "Bacteria")
|
expect_equal(mo_type("E. coli"), "Bacteria")
|
||||||
expect_equal(mo_gramstain("E. coli"), "Negative rods")
|
expect_equal(mo_gramstain("E. coli"), "Negative rods")
|
||||||
expect_equal(mo_aerobic("E. coli"), TRUE)
|
expect_equal(mo_aerobic("E. coli"), TRUE)
|
||||||
expect_equal(mo_type_nl("E. coli"), "Bacterie")
|
|
||||||
expect_equal(mo_gramstain_nl("E. coli"), "Negatieve staven")
|
expect_equal(mo_type("E. coli", language = "de"), "Bakterien")
|
||||||
|
expect_equal(mo_gramstain("E. coli", language = "de"), "Negative Staebchen")
|
||||||
|
|
||||||
|
expect_equal(mo_type("E. coli", language = "nl"), "Bacterie")
|
||||||
|
expect_equal(mo_gramstain("E. coli", language = "nl"), "Negatieve staven")
|
||||||
|
|
||||||
|
expect_error(mo_type("E. coli", language = "INVALID"))
|
||||||
})
|
})
|
||||||
|
1
vignettes/.gitignore
vendored
1
vignettes/.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
figure
|
figure
|
||||||
*.html
|
*.html
|
||||||
*.md
|
*.md
|
||||||
|
*.R
|
||||||
rsconnect
|
rsconnect
|
||||||
|
@ -34,7 +34,7 @@ This `AMR` package basically does four important things:
|
|||||||
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
* Use `first_isolate` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
|
||||||
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
|
||||||
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
* Use `MDRO` (abbreviation of Multi Drug Resistant Organisms) to check your isolates for exceptional resistance with country-specific guidelines or EUCAST rules. Currently, national guidelines for Germany and the Netherlands are supported.
|
||||||
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 2,650 microorganisms (2,207 bacteria, 285 fungi/yeasts, 153 parasites, 1 other). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. Since it uses `as.mo` internally, AI is supported. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. These functions can be used to add new variables to your data.
|
* The data set `microorganisms` contains the family, genus, species, subspecies, colloquial name and Gram stain of almost 3,000 potential human pathogenic microorganisms (bacteria, fungi/yeasts and parasites). This enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus`, `mo_family` or `mo_gramstain`. As they use `as.mo` internally, they also use artificial intelligence. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. Some functions can return results in Spanish, German and Dutch. These functions can be used to add new variables to your data.
|
||||||
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
* The data set `antibiotics` contains the ATC code, LIS codes, official name, trivial name and DDD of both oral and parenteral administration. It also contains a total of 298 trade names. Use functions like `ab_official` and `ab_tradenames` to look up values. As the `mo_*` functions use `as.mo` internally, the `ab_*` functions use `as.atc` internally so it uses AI to guess your expected result. For example, `ab_official("Fluclox")`, `ab_official("Floxapen")` and `ab_official("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
|
||||||
|
|
||||||
3. It **analyses the data** with convenient functions that use well-known methods.
|
3. It **analyses the data** with convenient functions that use well-known methods.
|
||||||
@ -52,7 +52,6 @@ This `AMR` package basically does four important things:
|
|||||||
* Results of 40 antibiotics (each antibiotic in its own column) with a total of 38,414 antimicrobial results
|
* Results of 40 antibiotics (each antibiotic in its own column) with a total of 38,414 antimicrobial results
|
||||||
* Real and genuine data
|
* Real and genuine data
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
```{r, echo = FALSE}
|
```{r, echo = FALSE}
|
||||||
# this will print "2018" in 2018, and "2018-yyyy" after 2018.
|
# this will print "2018" in 2018, and "2018-yyyy" after 2018.
|
||||||
|
Loading…
Reference in New Issue
Block a user