diff --git a/DESCRIPTION b/DESCRIPTION index 59700dea..c575234d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.0.9004 -Date: 2019-06-09 +Version: 0.7.0.9005 +Date: 2019-06-11 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NAMESPACE b/NAMESPACE index 4983e269..7c16744d 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -142,6 +142,7 @@ export(mo_family) export(mo_fullname) export(mo_genus) export(mo_gramstain) +export(mo_info) export(mo_kingdom) export(mo_name) export(mo_order) diff --git a/NEWS.md b/NEWS.md index ddba2af4..2202be29 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.0.9004 +# AMR 0.7.0.9005 #### New * Support for all scientifically published pathotypes of *E. coli* to date. Supported are: AIEC (Adherent-Invasive *E. coli*), ATEC (Atypical Entero-pathogenic *E. coli*), DAEC (Diffusely Adhering *E. coli*), EAEC (Entero-Aggresive *E. coli*), EHEC (Entero-Haemorrhagic *E. coli*), EIEC (Entero-Invasive *E. coli*), EPEC (Entero-Pathogenic *E. coli*), ETEC (Entero-Toxigenic *E. coli*), NMEC (Neonatal Meningitis‐causing *E. coli*), STEC (Shiga-toxin producing *E. coli*) and UPEC (Uropathogenic *E. coli*). All these lead to the microbial ID of *E. coli*: @@ -8,16 +8,20 @@ mo_fullname("UPEC") # "Escherichia coli" ``` +* Function `mo_info()` as an analogy to `ab_info()`. The `mo_info()` prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism #### Changed * Fixed bug in translation of microorganism names * Fixed bug in determining taxonomic kingdoms * Algorithm improvements for `as.ab()` and `as.mo()` to understand even more severely misspelled input +* Function `as.ab()` now allows spaces for coercing antibiotics names * Added `ggplot2` methods for automatically determining the scale type of classes `mo` and `ab` * Added names of object in the header in frequency tables, even when using pipes * Prevented `"bacteria"` from getting coerced by `as.ab()` because Bacterial is a brand name of trimethoprim (TMP) * Fixed a bug where setting an antibiotic would not work for `eucast_rules()` and `mdro()` * Fixed a EUCAST rule for Staphylococci, where amikacin resistance would not be inferred from tobramycin +* Removed `latest_annual_release` from the `catalogue_of_life_version()` function +* Removed antibiotic code `PVM1` from the `antibiotics` data set as this was a duplicate of `PME` #### Other * Fixed a note thrown by CRAN tests diff --git a/R/ab.R b/R/ab.R index 0b1b0565..2382ca3b 100755 --- a/R/ab.R +++ b/R/ab.R @@ -70,15 +70,15 @@ as.ab <- function(x) { x_bak <- x # remove suffices - x_bak_clean <- gsub("_(mic|rsi|disk|disc)$", "", x, ignore.case = TRUE) + x_bak_clean <- gsub("_(mic|rsi|dis[ck])$", "", x, ignore.case = TRUE) # remove disk concentrations, like LVX_NM -> LVX x_bak_clean <- gsub("_[A-Z]{2}[0-9_]{0,3}$", "", x_bak_clean, ignore.case = TRUE) - # clean rest of it - x_bak_clean <- gsub("[^A-Z0-9/-]", "", x_bak_clean, ignore.case = TRUE) - # keep only a-z when it's not an ATC code or only numbers - x_bak_clean[!x_bak_clean %like% "^([A-Z][0-9]{2}[A-Z]{2}[0-9]{2}|[0-9]+)$"] <- gsub("[^a-zA-Z]+", - "", - x_bak_clean[!x_bak_clean %like% "^([A-Z][0-9]{2}[A-Z]{2}[0-9]{2}|[0-9]+)$"]) + # remove part between brackets if that's followed by another string + x_bak_clean <- gsub("(.*)+ [(].*[)]", "\\1", x_bak_clean) + # keep only a-Z, 0-9, space, slash and dash + x_bak_clean <- gsub("[^A-Z0-9 /-]", "", x_bak_clean, ignore.case = TRUE) + # keep only max 1 space + x_bak_clean <- trimws(gsub(" +", " ", x_bak_clean, ignore.case = TRUE)) x <- unique(x_bak_clean) x_new <- rep(NA_character_, length(x)) x_unknown <- character(0) @@ -200,6 +200,24 @@ as.ab <- function(x) { next } + # try by removing all spaces + if (x[i] %like% " ") { + found <- suppressWarnings(as.ab(gsub(" +", "", x[i]))) + if (length(found) > 0) { + x_new[i] <- found[1L] + next + } + } + + # try by removing all spaces and numbers + if (x[i] %like% " " | x[i] %like% "[0-9]") { + found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i]))) + if (length(found) > 0) { + x_new[i] <- found[1L] + next + } + } + # not found x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) } diff --git a/R/ab_property.R b/R/ab_property.R index 848412e7..58d064a1 100644 --- a/R/ab_property.R +++ b/R/ab_property.R @@ -73,14 +73,13 @@ #' ab_name(21319) # "Flucloxacillin" (using CID) #' ab_name("J01CF05") # "Flucloxacillin" (using ATC) ab_name <- function(x, language = get_locale(), tolower = FALSE, ...) { - x <- ab_validate(x = x, property = "name", ...) - res <- t(x, language = language) + x <- translate_AMR(ab_validate(x = x, property = "name", ...), language = language) if (tolower == TRUE) { # use perl to only transform the first character # as we want "polymyxin B", not "polymyxin b" - res <- gsub("^([A-Z])", "\\L\\1", res, perl = TRUE) + x <- gsub("^([A-Z])", "\\L\\1", x, perl = TRUE) } - res + x } #' @rdname ab_property @@ -116,19 +115,19 @@ ab_tradenames <- function(x, ...) { #' @rdname ab_property #' @export ab_group <- function(x, language = get_locale(), ...) { - t(ab_validate(x = x, property = "group", ...), language = language) + translate_AMR(ab_validate(x = x, property = "group", ...), language = language) } #' @rdname ab_property #' @export ab_atc_group1 <- function(x, language = get_locale(), ...) { - t(ab_validate(x = x, property = "atc_group1", ...), language = language) + translate_AMR(ab_validate(x = x, property = "atc_group1", ...), language = language) } #' @rdname ab_property #' @export ab_atc_group2 <- function(x, language = get_locale(), ...) { - t(ab_validate(x = x, property = "atc_group2", ...), language = language) + translate_AMR(ab_validate(x = x, property = "atc_group2", ...), language = language) } #' @rdname ab_property @@ -150,8 +149,8 @@ ab_ddd <- function(x, administration = "oral", units = FALSE, ...) { #' @export ab_info <- function(x, language = get_locale(), ...) { x <- AMR::as.ab(x, ...) - base::list(ab = x, - atc = ab_atc(x), + base::list(ab = as.character(x), + atc = as.character(ab_atc(x)), cid = ab_cid(x), name = ab_name(x, language = language), group = ab_group(x, language = language), @@ -174,7 +173,7 @@ ab_property <- function(x, property = 'name', language = get_locale(), ...) { stop("invalid property: '", property, "' - use a column name of the `antibiotics` data set") } - t(ab_validate(x = x, property = property, ...), language = language) + translate_AMR(ab_validate(x = x, property = property, ...), language = language) } ab_validate <- function(x, property, ...) { diff --git a/R/catalogue_of_life.R b/R/catalogue_of_life.R index abd513d6..f1073be8 100755 --- a/R/catalogue_of_life.R +++ b/R/catalogue_of_life.R @@ -71,19 +71,17 @@ #' # [1] "Castellani et al., 1919" #' #' # Do not get mistaken - the package only includes microorganisms -#' mo_phylum("C. elegans") -#' # [1] "Cyanobacteria" # Bacteria?! -#' mo_fullname("C. elegans") +#' mo_kingdom("C. elegans") +#' # [1] "Bacteria" # Bacteria?! +#' mo_name("C. elegans") #' # [1] "Chroococcus limneticus elegans" # Because a microorganism was found NULL #' Version info of included Catalogue of Life #' -#' This function returns information about the included data from the Catalogue of Life. It also shows if the included version is their latest annual release. The Catalogue of Life releases their annual release in March each year. +#' This function returns information about the included data from the Catalogue of Life. #' @seealso \code{\link{microorganisms}} -#' @details The list item \code{...$catalogue_of_life$is_latest_annual_release} is based on the system date. -#' -#' For DSMZ, see \code{?microorganisms}. +#' @details For DSMZ, see \code{?microorganisms}. #' @return a \code{list}, which prints in pretty format #' @inheritSection catalogue_of_life Catalogue of Life #' @inheritSection AMR Read more on our website! @@ -99,8 +97,6 @@ catalogue_of_life_version <- function() { lst <- list(catalogue_of_life = list(version = gsub("{year}", catalogue_of_life$year, catalogue_of_life$version, fixed = TRUE), url = gsub("{year}", catalogue_of_life$year, catalogue_of_life$url_CoL, fixed = TRUE), - # annual release always somewhere in May, so before June is TRUE, FALSE otherwise - is_latest_annual_release = Sys.Date() < as.Date(paste0(catalogue_of_life$year + 1, "-06-01")), n = nrow(filter(AMR::microorganisms, source == "CoL"))), deutsche_sammlung_von_mikroorganismen_und_zellkulturen = list(version = "Prokaryotic Nomenclature Up-to-Date from DSMZ", @@ -125,7 +121,6 @@ print.catalogue_of_life_version <- function(x, ...) { underline(lst$catalogue_of_life$version), "\n", " Available at: ", lst$catalogue_of_life$url, "\n", " Number of included species: ", format(lst$catalogue_of_life$n, big.mark = ","), "\n", - " (based on your system time, this is most likely ", ifelse(lst$catalogue_of_life$is_latest_annual_release, "", "not "), "the latest annual release)\n\n", underline(paste0(lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$version, " (", lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$yearmonth, ")")), "\n", " Available at: ", lst$deutsche_sammlung_von_mikroorganismen_und_zellkulturen$url, "\n", diff --git a/R/data.R b/R/data.R index f4286a1b..e02c24c3 100755 --- a/R/data.R +++ b/R/data.R @@ -22,7 +22,7 @@ #' Data set with ~450 antibiotics #' #' A data set containing all antibiotics. Use \code{\link{as.ab}} or one of the \code{\link{ab_property}} functions to retrieve values from this data set. Three identifiers are included in this data set: an antibiotic ID (\code{ab}, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (\code{atc}) as defined by the WHO, and a Compound ID (\code{cid}) as found in PubChem. Other properties in this data set are derived from one or more of these codes. -#' @format A \code{\link{data.frame}} with 454 observations and 13 variables: +#' @format A \code{\link{data.frame}} with 453 observations and 13 variables: #' \describe{ #' \item{\code{ab}}{Antibiotic ID as used in this package (like \code{AMC}), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available} #' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like \code{J01CR02}} diff --git a/R/key_antibiotics.R b/R/key_antibiotics.R index 04e5d7dc..807f729d 100755 --- a/R/key_antibiotics.R +++ b/R/key_antibiotics.R @@ -26,17 +26,17 @@ #' @param y,z characters to compare #' @inheritParams first_isolate #' @param universal_1,universal_2,universal_3,universal_4,universal_5,universal_6 column names of \strong{broad-spectrum} antibiotics, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}. -#' @param GramPos_1,GramPos_2,GramPos_3,GramPos_4,GramPos_5,GramPos_6 column names of antibiotics for \strong{Gram positives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}. -#' @param GramNeg_1,GramNeg_2,GramNeg_3,GramNeg_4,GramNeg_5,GramNeg_6 column names of antibiotics for \strong{Gram negatives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}. +#' @param GramPos_1,GramPos_2,GramPos_3,GramPos_4,GramPos_5,GramPos_6 column names of antibiotics for \strong{Gram-positives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}. +#' @param GramNeg_1,GramNeg_2,GramNeg_3,GramNeg_4,GramNeg_5,GramNeg_6 column names of antibiotics for \strong{Gram-negatives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link{guess_ab_col}}. #' @param warnings give warning about missing antibiotic columns, they will anyway be ignored #' @param ... other parameters passed on to function #' @details The function \code{key_antibiotics} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{key_antibiotics_equal}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link{first_isolate}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link{first_isolate}}). Without key antibiotic comparison it would not. #' -#' At default, the antibiotics that are used for \strong{Gram positive bacteria} are (colum names): \cr -#' \code{"amox"}, \code{"amcl"}, \code{"cfur"}, \code{"pita"}, \code{"cipr"}, \code{"trsu"} (until here is universal), \code{"vanc"}, \code{"teic"}, \code{"tetr"}, \code{"eryt"}, \code{"oxac"}, \code{"rifa"}. +#' At default, the antibiotics that are used for \strong{Gram-positive bacteria} are: \cr +#' amoxicillin, amoxicillin/clavulanic acid, cefuroxime, piperacillin/tazobactam, ciprofloxacin, trimethoprim/sulfamethoxazole (until here is universal), vancomycin, teicoplanin, tetracycline, erythromycin, oxacillin, rifampin. #' -#' At default, the antibiotics that are used for \strong{Gram negative bacteria} are (colum names): \cr -#' \code{"amox"}, \code{"amcl"}, \code{"cfur"}, \code{"pita"}, \code{"cipr"}, \code{"trsu"} (until here is universal), \code{"gent"}, \code{"tobr"}, \code{"coli"}, \code{"cfot"}, \code{"cfta"}, \code{"mero"}. +#' At default, the antibiotics that are used for \strong{Gram-negative bacteria} are: \cr +#' amoxicillin, amoxicillin/clavulanic acid, cefuroxime, piperacillin/tazobactam, ciprofloxacin, trimethoprim/sulfamethoxazole (until here is universal), gentamicin, tobramycin, colistin, cefotaxime, ceftazidime, meropenem. #' #' #' The function \code{key_antibiotics_equal} checks the characters returned by \code{key_antibiotics} for equality, and returns a logical vector. @@ -50,7 +50,7 @@ #' @examples #' # septic_patients is a dataset available in the AMR package #' ?septic_patients - +#' #' library(dplyr) #' # set key antibiotics to a new variable #' my_patients <- septic_patients %>% @@ -78,24 +78,24 @@ #' # FALSE, because I is not ignored and so the 4th value differs key_antibiotics <- function(x, col_mo = NULL, - universal_1 = guess_ab_col(x, "AMX"), - universal_2 = guess_ab_col(x, "AMC"), - universal_3 = guess_ab_col(x, "CXM"), - universal_4 = guess_ab_col(x, "TZP"), - universal_5 = guess_ab_col(x, "CIP"), - universal_6 = guess_ab_col(x, "SXT"), - GramPos_1 = guess_ab_col(x, "VAN"), - GramPos_2 = guess_ab_col(x, "TEC"), - GramPos_3 = guess_ab_col(x, "TCY"), - GramPos_4 = guess_ab_col(x, "ERY"), - GramPos_5 = guess_ab_col(x, "OXA"), - GramPos_6 = guess_ab_col(x, "RIF"), - GramNeg_1 = guess_ab_col(x, "GEN"), - GramNeg_2 = guess_ab_col(x, "TOB"), - GramNeg_3 = guess_ab_col(x, "COL"), - GramNeg_4 = guess_ab_col(x, "CTX"), - GramNeg_5 = guess_ab_col(x, "CAZ"), - GramNeg_6 = guess_ab_col(x, "MEM"), + universal_1 = guess_ab_col(x, "amoxicillin"), + universal_2 = guess_ab_col(x, "amoxicillin/clavulanic acid"), + universal_3 = guess_ab_col(x, "cefuroxime"), + universal_4 = guess_ab_col(x, "piperacillin/tazobactam"), + universal_5 = guess_ab_col(x, "ciprofloxacin"), + universal_6 = guess_ab_col(x, "trimethoprim/sulfamethoxazole"), + GramPos_1 = guess_ab_col(x, "vancomycin"), + GramPos_2 = guess_ab_col(x, "teicoplanin"), + GramPos_3 = guess_ab_col(x, "tetracycline"), + GramPos_4 = guess_ab_col(x, "erythromycin"), + GramPos_5 = guess_ab_col(x, "oxacillin"), + GramPos_6 = guess_ab_col(x, "rifampin"), + GramNeg_1 = guess_ab_col(x, "gentamicin"), + GramNeg_2 = guess_ab_col(x, "tobramycin"), + GramNeg_3 = guess_ab_col(x, "colistin"), + GramNeg_4 = guess_ab_col(x, "cefotaxime"), + GramNeg_5 = guess_ab_col(x, "ceftazidime"), + GramNeg_6 = guess_ab_col(x, "meropenem"), warnings = TRUE, ...) { @@ -170,7 +170,7 @@ key_antibiotics <- function(x, gram_positive <- gram_positive[!is.null(gram_positive)] gram_positive <- gram_positive[!is.na(gram_positive)] if (length(gram_positive) < 12) { - warning("only using ", length(gram_positive), " different antibiotics as key antibiotics for Gram positives. See ?key_antibiotics.", call. = FALSE) + warning("only using ", length(gram_positive), " different antibiotics as key antibiotics for Gram-positives. See ?key_antibiotics.", call. = FALSE) } gram_negative = c(universal, @@ -179,7 +179,7 @@ key_antibiotics <- function(x, gram_negative <- gram_negative[!is.null(gram_negative)] gram_negative <- gram_negative[!is.na(gram_negative)] if (length(gram_negative) < 12) { - warning("only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram negatives. See ?key_antibiotics.", call. = FALSE) + warning("only using ", length(gram_negative), " different antibiotics as key antibiotics for Gram-negatives. See ?key_antibiotics.", call. = FALSE) } # join to microorganisms data set @@ -191,7 +191,7 @@ key_antibiotics <- function(x, # Gram + x <- x %>% mutate(key_ab = - if_else(gramstain == "Gram positive", + if_else(gramstain == "Gram-positive", apply(X = x[, gram_positive], MARGIN = 1, FUN = function(x) paste(x, collapse = "")), @@ -199,7 +199,7 @@ key_antibiotics <- function(x, # Gram - x <- x %>% mutate(key_ab = - if_else(gramstain == "Gram negative", + if_else(gramstain == "Gram-negative", apply(X = x[, gram_negative], MARGIN = 1, FUN = function(x) paste(x, collapse = "")), @@ -209,7 +209,8 @@ key_antibiotics <- function(x, key_abs <- x %>% pull(key_ab) %>% gsub('(NA|NULL)', '.', .) %>% - gsub('[^SIR]', '.', ., ignore.case = TRUE) + gsub('[^SIR]', '.', ., ignore.case = TRUE) %>% + toupper() key_abs @@ -295,7 +296,7 @@ key_antibiotics_equal <- function(y, result[i] <- points >= points_threshold } else { - stop('`', type, '` is not a valid value for type, must be "points" or "keyantibiotics". See ?first_isolate.') + stop('`', type, '` is not a valid value for type, must be "points" or "keyantibiotics". See ?key_antibiotics') } } } diff --git a/R/misc.R b/R/misc.R index e0cf3840..f1ace71b 100755 --- a/R/misc.R +++ b/R/misc.R @@ -253,7 +253,7 @@ stopifnot_installed_package <- function(package) { # translate strings based on inst/translations.tsv #' @importFrom dplyr %>% filter -t <- function(from, language = get_locale()) { +translate_AMR <- function(from, language = get_locale(), only_unknown = FALSE) { # if (getOption("AMR_locale", "en") != language) { # language <- getOption("AMR_locale", "en") # } @@ -274,6 +274,9 @@ t <- function(from, language = get_locale()) { } df_trans <- df_trans %>% filter(lang == language) + if (only_unknown == TRUE) { + df_trans <- df_trans %>% filter(pattern %like% "unknown") + } # default case sensitive if value if 'ignore.case' is missing: df_trans$ignore.case[is.na(df_trans$ignore.case)] <- FALSE diff --git a/R/mo_property.R b/R/mo_property.R index cb7aeb41..69b95e83 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -69,8 +69,8 @@ #' mo_shortname("E. coli") # "E. coli" #' #' ## other properties -#' mo_gramstain("E. coli") # "Gram negative" -#' mo_type("E. coli") # "Bacteria" (equal to kingdom) +#' mo_gramstain("E. coli") # "Gram-negative" +#' mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated) #' mo_rank("E. coli") # "species" #' mo_url("E. coli") # get the direct url to the online database entry #' @@ -84,7 +84,7 @@ #' mo_genus("MRSA") # "Staphylococcus" #' mo_species("MRSA") # "aureus" #' mo_shortname("MRSA") # "S. aureus" -#' mo_gramstain("MRSA") # "Gram positive" +#' mo_gramstain("MRSA") # "Gram-positive" #' #' mo_genus("VISA") # "Staphylococcus" #' mo_species("VISA") # "aureus" @@ -133,15 +133,15 @@ #' #' # get a list with the complete taxonomy (from kingdom to subspecies) #' mo_taxonomy("E. coli") +#' # get a list with the taxonomy, the authors and the URL to the online database +#' mo_info("E. coli") mo_name <- function(x, language = get_locale(), ...) { - mo_fullname(x = x, language = language, ... = ...) + translate_AMR(mo_validate(x = x, property = "fullname", ...), language = language, only_unknown = FALSE) } #' @rdname mo_property #' @export -mo_fullname <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "fullname", ...), language = language) -} +mo_fullname <- mo_name #' @rdname mo_property #' @importFrom dplyr %>% mutate pull @@ -184,70 +184,61 @@ mo_shortname <- function(x, language = get_locale(), ...) { res1[res1 != res2] <- res2_fullname result <- as.character(res1) - t(result, language = language) + translate_AMR(result, language = language, only_unknown = FALSE) } #' @rdname mo_property #' @export mo_subspecies <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "subspecies", ...), language = language) + translate_AMR(mo_validate(x = x, property = "subspecies", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_species <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "species", ...), language = language) + translate_AMR(mo_validate(x = x, property = "species", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_genus <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "genus", ...), language = language) + translate_AMR(mo_validate(x = x, property = "genus", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_family <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "family", ...), language = language) + translate_AMR(mo_validate(x = x, property = "family", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_order <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "order", ...), language = language) + translate_AMR(mo_validate(x = x, property = "order", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_class <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "class", ...), language = language) + translate_AMR(mo_validate(x = x, property = "class", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_phylum <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "phylum", ...), language = language) + translate_AMR(mo_validate(x = x, property = "phylum", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_kingdom <- function(x, language = get_locale(), ...) { - if (all(x %in% AMR::microorganisms$kingdom)) { - return(x) - } - x <- as.mo(x, ...) - kngdm <- mo_validate(x = x, property = "kingdom", ...) - if (language != "en") { - # translate only unknown, so "Bacteria" (the official taxonomic name) would not change - kngdm[identical(x, "UNKNOWN")] <- t(kngdm[identical(x, "UNKNOWN")], language = language) - } - kngdm + translate_AMR(mo_validate(x = x, property = "kingdom", ...), language = language, only_unknown = TRUE) } #' @rdname mo_property #' @export mo_type <- function(x, language = get_locale(), ...) { - t(mo_validate(x = x, property = "kingdom", ...), language = language) + translate_AMR(mo_validate(x = x, property = "kingdom", ...), language = language, only_unknown = FALSE) } #' @rdname mo_property @@ -255,16 +246,26 @@ mo_type <- function(x, language = get_locale(), ...) { mo_gramstain <- function(x, language = get_locale(), ...) { x.mo <- as.mo(x, ...) x.phylum <- mo_phylum(x.mo, language = "en") + # DETERMINE GRAM STAIN FOR BACTERIA + # Source: https://itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=956097 + # It says this: + # Kingdom Bacteria (Cavalier-Smith, 2002) + # Subkingdom Posibacteria (Cavalier-Smith, 2002) + # Direct Children: + # Phylum Actinobacteria (Cavalier-Smith, 2002) + # Phylum Chloroflexi (Garrity and Holt, 2002) + # Phylum Firmicutes (corrig. Gibbons and Murray, 1978) + # Phylum Tenericutes (Murray, 1984) + x <- NA_character_ + # make all bacteria Gram negative + x[mo_kingdom(x.mo, language = "en") == "Bacteria"] <- "Gram-negative" + # overwrite these phyla with Gram positive x[x.phylum %in% c("Actinobacteria", "Chloroflexi", "Firmicutes", - "Tenericutes")] <- "Gram positive" - x[x != "Gram positive"] <- "Gram negative" - x[mo_kingdom(x.mo, language = "en") != "Bacteria"] <- NA_character_ - x[x.mo == "B_GRAMP"] <- "Gram positive" - x[x.mo == "B_GRAMN"] <- "Gram negative" - - t(x, language = language) + "Tenericutes") + | x.mo == "B_GRAMP"] <- "Gram-positive" + translate_AMR(x, language = language, only_unknown = FALSE) } #' @rdname mo_property @@ -311,6 +312,15 @@ mo_taxonomy <- function(x, language = get_locale(), ...) { subspecies = mo_subspecies(x, language = language)) } +#' @rdname mo_property +#' @export +mo_info <- function(x, language = get_locale(), ...) { + x <- AMR::as.mo(x, ...) + c(mo_taxonomy(x, language = language), + list(url = unname(mo_url(x, open = FALSE)), + ref = mo_ref(x))) +} + #' @rdname mo_property #' @importFrom utils browseURL #' @importFrom dplyr %>% left_join select mutate case_when @@ -349,7 +359,7 @@ mo_property <- function(x, property = 'fullname', language = get_locale(), ...) stop("invalid property: '", property, "' - use a column name of the `microorganisms` data set") } - t(mo_validate(x = x, property = property, ...), language = language) + translate_AMR(mo_validate(x = x, property = property, ...), language = language, only_unknown = TRUE) } mo_validate <- function(x, property, ...) { diff --git a/R/sysdata.rda b/R/sysdata.rda index 7c43f0a4..ae5d9aeb 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/eucast_rules.tsv b/data-raw/eucast_rules.tsv index 5df26eb4..9c9ccae8 100644 --- a/data-raw/eucast_rules.tsv +++ b/data-raw/eucast_rules.tsv @@ -59,12 +59,12 @@ genus_species is Moraxella catarrhalis ERY S AZM, CLR, RXT S Moraxella catarrhal genus_species is Moraxella catarrhalis ERY I AZM, CLR, RXT I Moraxella catarrhalis Breakpoints genus_species is Moraxella catarrhalis ERY R AZM, CLR, RXT R Moraxella catarrhalis Breakpoints genus_species is Moraxella catarrhalis TCY S DOX, MNO S Moraxella catarrhalis Breakpoints -genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram positives Breakpoints -genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram positives Breakpoints -genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram positives Breakpoints -genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram negatives Breakpoints -genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram negatives Breakpoints -genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram negatives Breakpoints +genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram-positives Breakpoints +genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram-positives Breakpoints +genus one_of Actinomyces, Bifidobacterium, Clostridium, Cutibacterium, Eggerthella, Eubacterium, Lactobacillus, Propionibacterium PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram-positives Breakpoints +genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN S AMP, AMX, PIP, TZP, TIC S Anaerobic Gram-negatives Breakpoints +genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN I AMP, AMX, PIP, TZP, TIC I Anaerobic Gram-negatives Breakpoints +genus one_of Bacteroides, Bilophila , Fusobacterium, Mobiluncus, Porphyromonas, Prevotella PEN R AMP, AMX, PIP, TZP, TIC R Anaerobic Gram-negatives Breakpoints genus_species is Pasteurella multocida PEN S AMP, AMX S Pasteurella multocida Breakpoints genus_species is Pasteurella multocida PEN I AMP, AMX I Pasteurella multocida Breakpoints genus_species is Pasteurella multocida PEN R AMP, AMX R Pasteurella multocida Breakpoints @@ -135,7 +135,7 @@ genus is Neisseria TMP R Table 03: Intrinsic resistance in other Gram-negative genus_species is Campylobacter fetus FUS, streptogramins, TMP, NAL R Table 03: Intrinsic resistance in other Gram-negative bacteria Expert Rules genus_species is Campylobacter jejuni FUS, streptogramins, TMP R Table 03: Intrinsic resistance in other Gram-negative bacteria Expert Rules genus_species is Campylobacter coli FUS, streptogramins, TMP R Table 03: Intrinsic resistance in other Gram-negative bacteria Expert Rules -gramstain is Gram positive ATM, polymyxins, NAL R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules +gramstain is Gram-positive ATM, polymyxins, NAL R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules genus_species is Staphylococcus saprophyticus FUS, CAZ, FOS, NOV R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules genus_species is Staphylococcus cohnii CAZ, NOV R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules genus_species is Staphylococcus xylosus CAZ, NOV R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules diff --git a/data-raw/internals.R b/data-raw/internals.R index 29396bbe..596ba5f7 100644 --- a/data-raw/internals.R +++ b/data-raw/internals.R @@ -5,8 +5,8 @@ # "minopenicillins", "ureidopenicillins", "fluoroquinolones", "all_betalactams", # and all separate EARS-Net letter codes like "AMC". They can be separated by comma: "AMC, fluoroquinolones". # The mo_property can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain". -# This file contains references to the 'Burkholderia cepacia complex'. The species in this group can be found in: -# LiPuma JJ, 2015 (PMID 16217180). +# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. The species in this group can be found in: +# LiPuma JJ, Curr Opin Pulm Med. 2005 Nov;11(6):528-33. (PMID 16217180). eucast_rules_file <- dplyr::arrange( .data = utils::read.delim(file = "data-raw/eucast_rules.tsv", sep = "\t", diff --git a/data-raw/reproduction_of_antibiotics.R b/data-raw/reproduction_of_antibiotics.R index c03bb065..31e56183 100644 --- a/data-raw/reproduction_of_antibiotics.R +++ b/data-raw/reproduction_of_antibiotics.R @@ -289,6 +289,9 @@ antibiotics <- filter(antibiotics, ab != "MOX") antibiotics <- filter(antibiotics, ab != "RFP") antibiotics[which(antibiotics$ab == "RFP1"), "ab"] <- "RFP" antibiotics[which(antibiotics$ab == "RFP"), "abbreviations"][[1]] <- list(c("rifp")) +# PME and PVM1 (the J0 one) both mean 'Pivmecillinam', so: +antibiotics <- filter(antibiotics, ab != "PME") +antibiotics[which(antibiotics$ab == "PVM1"), "ab"] <- "PME" # ESBL E-test codes: antibiotics[which(antibiotics$ab == "CCV"), "abbreviations"][[1]] <- list(c("xtzl")) antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]] <- list(c(antibiotics[which(antibiotics$ab == "CAZ"), "abbreviations"][[1]], "xtz", "cefta")) diff --git a/data-raw/reproduction_of_microorganisms.R b/data-raw/reproduction_of_microorganisms.R index f2eb82d0..be15c580 100644 --- a/data-raw/reproduction_of_microorganisms.R +++ b/data-raw/reproduction_of_microorganisms.R @@ -318,13 +318,13 @@ MOs <- MOs %>% stringsAsFactors = FALSE), data.frame(mo = "B_GRAMN", col_id = NA_integer_, - fullname = "(unknown Gram negatives)", + fullname = "(unknown Gram-negatives)", kingdom = "Bacteria", phylum = "(unknown phylum)", class = "(unknown class)", order = "(unknown order)", family = "(unknown family)", - genus = "(unknown Gram negatives)", + genus = "(unknown Gram-negatives)", species = "(unknown species)", subspecies = "(unknown subspecies)", rank = "species", @@ -334,13 +334,13 @@ MOs <- MOs %>% stringsAsFactors = FALSE), data.frame(mo = "B_GRAMP", col_id = NA_integer_, - fullname = "(unknown Gram positives)", + fullname = "(unknown Gram-positives)", kingdom = "Bacteria", phylum = "(unknown phylum)", class = "(unknown class)", order = "(unknown order)", family = "(unknown family)", - genus = "(unknown Gram positives)", + genus = "(unknown Gram-positives)", species = "(unknown species)", subspecies = "(unknown subspecies)", rank = "species", @@ -457,7 +457,7 @@ MOs <- MOs %>% mutate(prevalence = case_when( class == "Gammaproteobacteria" | genus %in% c("Enterococcus", "Staphylococcus", "Streptococcus") - | mo == "UNKNOWN" + | mo %in% c("UNKNOWN", "B_GRAMN", "B_GRAMP") ~ 1, phylum %in% c("Proteobacteria", "Firmicutes", @@ -494,8 +494,8 @@ saveRDS(MOs, "microorganisms.rds") saveRDS(MOs.old, "microorganisms.old.rds") # on the server: -usethis::use_data(microorganisms, overwrite = TRUE) -usethis::use_data(microorganisms.old, overwrite = TRUE) +usethis::use_data(microorganisms, overwrite = TRUE, version = 2) +usethis::use_data(microorganisms.old, overwrite = TRUE, version = 2) rm(microorganisms) rm(microorganisms.old) # and update the year in R/data.R diff --git a/data-raw/translations.tsv b/data-raw/translations.tsv index 2a1c4df3..d8dcaed4 100644 --- a/data-raw/translations.tsv +++ b/data-raw/translations.tsv @@ -2,8 +2,8 @@ lang pattern replacement fixed ignore.case de Coagulase-negative Staphylococcus Koagulase-negative Staphylococcus FALSE FALSE de Coagulase-positive Staphylococcus Koagulase-positive Staphylococcus FALSE FALSE de Beta-haemolytic Streptococcus Beta-hämolytischer Streptococcus FALSE FALSE -de unknown Gram negatives unbekannte Gramnegativen FALSE FALSE -de unknown Gram positives unbekannte Grampositiven FALSE FALSE +de unknown Gram-negatives unbekannte Gramnegativen FALSE FALSE +de unknown Gram-positives unbekannte Grampositiven FALSE FALSE de unknown name unbekannte Name FALSE FALSE de unknown kingdom unbekanntes Reich FALSE FALSE de unknown phylum unbekannter Stamm FALSE FALSE @@ -16,8 +16,8 @@ de unknown subspecies unbekannte Unterart FALSE FALSE de unknown rank unbekannter Rang FALSE FALSE de (CoNS) (KNS) TRUE FALSE de (CoPS) (KPS) TRUE FALSE -de Gram negative Gramnegativ FALSE FALSE -de Gram positive Grampositiv FALSE FALSE +de Gram-negative Gramnegativ FALSE FALSE +de Gram-positive Grampositiv FALSE FALSE de Bacteria Bakterien FALSE FALSE de Fungi Hefen/Pilze FALSE FALSE de Protozoa Protozoen FALSE FALSE @@ -29,8 +29,8 @@ de ([([ ]*?)Group \\1Gruppe FALSE FALSE nl Coagulase-negative Staphylococcus Coagulase-negatieve Staphylococcus FALSE FALSE nl Coagulase-positive Staphylococcus Coagulase-positieve Staphylococcus FALSE FALSE nl Beta-haemolytic Streptococcus Beta-hemolytische Streptococcus FALSE FALSE -nl unknown Gram negatives onbekende Gram-negatieven FALSE FALSE -nl unknown Gram positives onbekende Gram-positieven FALSE FALSE +nl unknown Gram-negatives onbekende Gram-negatieven FALSE FALSE +nl unknown Gram-positives onbekende Gram-positieven FALSE FALSE nl unknown name onbekende naam FALSE FALSE nl unknown kingdom onbekend koninkrijk FALSE FALSE nl unknown phylum onbekend fylum FALSE FALSE @@ -43,8 +43,8 @@ nl unknown subspecies onbekende ondersoort FALSE FALSE nl unknown rank onbekende rang FALSE FALSE nl (CoNS) (CNS) TRUE FALSE nl (CoPS) (CPS) TRUE FALSE -nl Gram negative Gram-negatief FALSE FALSE -nl Gram positive Gram-positief FALSE FALSE +nl Gram-negative Gram-negatief FALSE FALSE +nl Gram-positive Gram-positief FALSE FALSE nl Bacteria Bacteriën FALSE FALSE nl Fungi Schimmels/gisten FALSE FALSE nl Protozoa protozoën FALSE FALSE @@ -55,8 +55,8 @@ nl ([([ ]*?)Group \\1Groep FALSE FALSE es Coagulase-negative Staphylococcus Staphylococcus coagulasa negativo FALSE FALSE es Coagulase-positive Staphylococcus Staphylococcus coagulasa positivo FALSE FALSE es Beta-haemolytic Streptococcus Streptococcus Beta-hemolítico FALSE FALSE -es unknown Gram negatives Gram negativos desconocidos FALSE FALSE -es unknown Gram positives Gram positivos desconocidos FALSE FALSE +es unknown Gram-negatives Gram negativos desconocidos FALSE FALSE +es unknown Gram-positives Gram positivos desconocidos FALSE FALSE es unknown name nombre desconocido FALSE FALSE es unknown kingdom reino desconocido FALSE FALSE es unknown phylum filo desconocido FALSE FALSE @@ -69,8 +69,8 @@ es unknown subspecies subespecie desconocida FALSE FALSE es unknown rank rango desconocido FALSE FALSE es (CoNS) (SCN) TRUE FALSE es (CoPS) (SCP) TRUE FALSE -es Gram negative Gram negativo FALSE FALSE -es Gram positive Gram positivo FALSE FALSE +es Gram-negative Gram negativo FALSE FALSE +es Gram-positive Gram positivo FALSE FALSE es Bacteria Bacterias FALSE FALSE es Fungi Hongos FALSE FALSE es Protozoa Protozoarios FALSE FALSE @@ -82,8 +82,8 @@ es ([([ ]*?)Group \\1Grupo FALSE FALSE it Coagulase-negative Staphylococcus Staphylococcus negativo coagulasi FALSE FALSE it Coagulase-positive Staphylococcus Staphylococcus positivo coagulasi FALSE FALSE it Beta-haemolytic Streptococcus Streptococcus Beta-emolitico FALSE FALSE -it unknown Gram negatives Gram negativi sconosciuti FALSE FALSE -it unknown Gram positives Gram positivi sconosciuti FALSE FALSE +it unknown Gram-negatives Gram negativi sconosciuti FALSE FALSE +it unknown Gram-positives Gram positivi sconosciuti FALSE FALSE it unknown name nome sconosciuto FALSE FALSE it unknown kingdom regno sconosciuto FALSE FALSE it unknown phylum phylum sconosciuto FALSE FALSE @@ -94,8 +94,8 @@ it unknown genus genere sconosciuto FALSE FALSE it unknown species specie sconosciute FALSE FALSE it unknown subspecies sottospecie sconosciute FALSE FALSE it unknown rank grado sconosciuto FALSE FALSE -it Gram negative Gram negativo FALSE FALSE -it Gram positive Gram positivo FALSE FALSE +it Gram-negative Gram negativo FALSE FALSE +it Gram-positive Gram positivo FALSE FALSE it Bacteria Batteri FALSE FALSE it Fungi Fungo FALSE FALSE it Protozoa Protozoi FALSE FALSE @@ -107,8 +107,8 @@ it ([([ ]*?)Group \\1Gruppo FALSE FALSE fr Coagulase-negative Staphylococcus Staphylococcus à coagulase négative FALSE FALSE fr Coagulase-positive Staphylococcus Staphylococcus à coagulase positif FALSE FALSE fr Beta-haemolytic Streptococcus Streptococcus Bêta-hémolytique FALSE FALSE -fr unknown Gram negatives Gram négatifs inconnus FALSE FALSE -fr unknown Gram positives Gram positifs inconnus FALSE FALSE +fr unknown Gram-negatives Gram négatifs inconnus FALSE FALSE +fr unknown Gram-positives Gram positifs inconnus FALSE FALSE fr unknown name nom inconnu FALSE FALSE fr unknown kingdom règme inconnu FALSE FALSE fr unknown phylum embranchement inconnu FALSE FALSE @@ -119,8 +119,8 @@ fr unknown genus genre inconnu FALSE FALSE fr unknown species espèce inconnue FALSE FALSE fr unknown subspecies sous-espèce inconnue FALSE FALSE fr unknown rank rang inconnu FALSE FALSE -fr Gram negative Gram négatif FALSE FALSE -fr Gram positive Gram positif FALSE FALSE +fr Gram-negative Gram négatif FALSE FALSE +fr Gram-positive Gram positif FALSE FALSE fr Bacteria Bactéries FALSE FALSE fr Fungi Champignons FALSE FALSE fr Protozoa Protozoaires FALSE FALSE @@ -131,8 +131,8 @@ fr ([([ ]*?)Group \\1Groupe FALSE FALSE pt Coagulase-negative Staphylococcus Staphylococcus coagulase negativo FALSE FALSE pt Coagulase-positive Staphylococcus Staphylococcus coagulase positivo FALSE FALSE pt Beta-haemolytic Streptococcus Streptococcus Beta-hemolítico FALSE FALSE -pt unknown Gram negatives Gram negativos desconhecidos FALSE FALSE -pt unknown Gram positives Gram positivos desconhecidos FALSE FALSE +pt unknown Gram-negatives Gram negativos desconhecidos FALSE FALSE +pt unknown Gram-positives Gram positivos desconhecidos FALSE FALSE pt unknown name nome desconhecido FALSE FALSE pt unknown kingdom reino desconhecido FALSE FALSE pt unknown phylum filo desconhecido FALSE FALSE @@ -143,8 +143,8 @@ pt unknown genus gênero desconhecido FALSE FALSE pt unknown species espécies desconhecida FALSE FALSE pt unknown subspecies subespécies desconhecida FALSE FALSE pt unknown rank classificação desconhecido FALSE FALSE -pt Gram negative Gram negativo FALSE FALSE -pt Gram positive Gram positivo FALSE FALSE +pt Gram-negative Gram negativo FALSE FALSE +pt Gram-positive Gram positivo FALSE FALSE pt Bacteria Bactérias FALSE FALSE pt Fungi Fungos FALSE FALSE pt Protozoa Protozoários FALSE FALSE diff --git a/data/antibiotics.rda b/data/antibiotics.rda index 4b6213b4..3cc00050 100755 Binary files a/data/antibiotics.rda and b/data/antibiotics.rda differ diff --git a/data/microorganisms.rda b/data/microorganisms.rda index a38d14b7..29c91c41 100755 Binary files a/data/microorganisms.rda and b/data/microorganisms.rda differ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 220fe472..b1b7a455 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 diff --git a/docs/articles/index.html b/docs/articles/index.html index d656272b..79ce3e0e 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 diff --git a/docs/authors.html b/docs/authors.html index da65d3e6..74efc566 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 diff --git a/docs/index.html b/docs/index.html index 4b64e58d..d2df906e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 diff --git a/docs/news/index.html b/docs/news/index.html index cc8feea5..f11c079d 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 @@ -232,9 +232,9 @@ -
+

-AMR 0.7.0.9004 Unreleased +AMR 0.7.0.9005 Unreleased

@@ -247,6 +247,7 @@ mo_fullname("UPEC") # "Escherichia coli"

+
  • Function mo_info() as an analogy to ab_info(). The mo_info() prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism

  • @@ -256,6 +257,7 @@
  • Fixed bug in translation of microorganism names
  • Fixed bug in determining taxonomic kingdoms
  • Algorithm improvements for as.ab() and as.mo() to understand even more severely misspelled input
  • +
  • Function as.ab() now allows spaces for coercing antibiotics names
  • Added ggplot2 methods for automatically determining the scale type of classes mo and ab
  • Added names of object in the header in frequency tables, even when using pipes
  • @@ -263,6 +265,9 @@
  • Fixed a bug where setting an antibiotic would not work for eucast_rules() and mdro()
  • Fixed a EUCAST rule for Staphylococci, where amikacin resistance would not be inferred from tobramycin
  • +
  • Removed latest_annual_release from the catalogue_of_life_version() function
  • +
  • Removed antibiotic code PVM1 from the antibiotics data set as this was a duplicate of PME +
  • @@ -1101,7 +1106,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

    @@ -165,13 +165,6 @@ Create frequency tables -
  • - - - - Use the G-test - -
  • @@ -252,7 +245,7 @@

    Format

    -

    A data.frame with 454 observations and 13 variables:

    +

    A data.frame with 453 observations and 13 variables:

    ab

    Antibiotic ID as used in this package (like AMC), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available

    atc

    ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC, like J01CR02

    cid

    Compound ID as found in PubChem

    diff --git a/docs/reference/catalogue_of_life.html b/docs/reference/catalogue_of_life.html index 61b77eab..76812308 100644 --- a/docs/reference/catalogue_of_life.html +++ b/docs/reference/catalogue_of_life.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9000 + 0.7.0.9005
  • @@ -165,13 +165,6 @@ Create frequency tables -
  • - - - - Use the G-test - -
  • @@ -307,9 +300,9 @@ Function as.mo() to use the data for intel # [1] "Castellani et al., 1919" # Do not get mistaken - the package only includes microorganisms -mo_phylum("C. elegans") -# [1] "Cyanobacteria" # Bacteria?! -mo_fullname("C. elegans") +mo_kingdom("C. elegans") +# [1] "Bacteria" # Bacteria?! +mo_name("C. elegans") # [1] "Chroococcus limneticus elegans" # Because a microorganism was found # } diff --git a/docs/reference/catalogue_of_life_version.html b/docs/reference/catalogue_of_life_version.html index e040dc2f..785c0aae 100644 --- a/docs/reference/catalogue_of_life_version.html +++ b/docs/reference/catalogue_of_life_version.html @@ -47,7 +47,7 @@ - + @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9000 + 0.7.0.9005 @@ -165,13 +165,6 @@ Create frequency tables
  • -
  • - - - - Use the G-test - -
  • @@ -244,7 +237,7 @@
    -

    This function returns information about the included data from the Catalogue of Life. It also shows if the included version is their latest annual release. The Catalogue of Life releases their annual release in March each year.

    +

    This function returns information about the included data from the Catalogue of Life.

    @@ -256,8 +249,7 @@

    Details

    -

    The list item ...$catalogue_of_life$is_latest_annual_release is based on the system date.

    -

    For DSMZ, see ?microorganisms.

    +

    For DSMZ, see ?microorganisms.

    Catalogue of Life

    diff --git a/docs/reference/index.html b/docs/reference/index.html index 1d6d5810..13cff779 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9004 + 0.7.0.9005 @@ -373,7 +373,7 @@ -

    mo_name() mo_fullname() mo_shortname() mo_subspecies() mo_species() mo_genus() mo_family() mo_order() mo_class() mo_phylum() mo_kingdom() mo_type() mo_gramstain() mo_ref() mo_authors() mo_year() mo_rank() mo_taxonomy() mo_url() mo_property()

    +

    mo_name() mo_fullname() mo_shortname() mo_subspecies() mo_species() mo_genus() mo_family() mo_order() mo_class() mo_phylum() mo_kingdom() mo_type() mo_gramstain() mo_ref() mo_authors() mo_year() mo_rank() mo_taxonomy() mo_info() mo_url() mo_property()

    Property of a microorganism

    diff --git a/docs/reference/key_antibiotics.html b/docs/reference/key_antibiotics.html index 0c7a475c..5cc65ab1 100644 --- a/docs/reference/key_antibiotics.html +++ b/docs/reference/key_antibiotics.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.0.9000 + 0.7.0.9005 @@ -165,13 +165,6 @@ Create frequency tables
  • -
  • - - - - Use the G-test - -
  • @@ -248,19 +241,22 @@ -
    key_antibiotics(x, col_mo = NULL, universal_1 = guess_ab_col(x, "AMX"),
    -  universal_2 = guess_ab_col(x, "AMC"), universal_3 = guess_ab_col(x,
    -  "CXM"), universal_4 = guess_ab_col(x, "TZP"),
    -  universal_5 = guess_ab_col(x, "CIP"), universal_6 = guess_ab_col(x,
    -  "SXT"), GramPos_1 = guess_ab_col(x, "VAN"),
    -  GramPos_2 = guess_ab_col(x, "TEC"), GramPos_3 = guess_ab_col(x,
    -  "TCY"), GramPos_4 = guess_ab_col(x, "ERY"),
    -  GramPos_5 = guess_ab_col(x, "OXA"), GramPos_6 = guess_ab_col(x,
    -  "RIF"), GramNeg_1 = guess_ab_col(x, "GEN"),
    -  GramNeg_2 = guess_ab_col(x, "TOB"), GramNeg_3 = guess_ab_col(x,
    -  "COL"), GramNeg_4 = guess_ab_col(x, "CTX"),
    -  GramNeg_5 = guess_ab_col(x, "CAZ"), GramNeg_6 = guess_ab_col(x,
    -  "MEM"), warnings = TRUE, ...)
    +    
    key_antibiotics(x, col_mo = NULL, universal_1 = guess_ab_col(x,
    +  "amoxicillin"), universal_2 = guess_ab_col(x,
    +  "amoxicillin/clavulanic acid"), universal_3 = guess_ab_col(x,
    +  "cefuroxime"), universal_4 = guess_ab_col(x,
    +  "piperacillin/tazobactam"), universal_5 = guess_ab_col(x,
    +  "ciprofloxacin"), universal_6 = guess_ab_col(x,
    +  "trimethoprim/sulfamethoxazole"), GramPos_1 = guess_ab_col(x,
    +  "vancomycin"), GramPos_2 = guess_ab_col(x, "teicoplanin"),
    +  GramPos_3 = guess_ab_col(x, "tetracycline"),
    +  GramPos_4 = guess_ab_col(x, "erythromycin"),
    +  GramPos_5 = guess_ab_col(x, "oxacillin"), GramPos_6 = guess_ab_col(x,
    +  "rifampin"), GramNeg_1 = guess_ab_col(x, "gentamicin"),
    +  GramNeg_2 = guess_ab_col(x, "tobramycin"),
    +  GramNeg_3 = guess_ab_col(x, "colistin"), GramNeg_4 = guess_ab_col(x,
    +  "cefotaxime"), GramNeg_5 = guess_ab_col(x, "ceftazidime"),
    +  GramNeg_6 = guess_ab_col(x, "meropenem"), warnings = TRUE, ...)
     
     key_antibiotics_equal(y, z, type = c("keyantibiotics", "points"),
       ignore_I = TRUE, points_threshold = 2, info = FALSE)
    @@ -282,11 +278,11 @@ GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6 -

    column names of antibiotics for Gram positives, case-insensitive. At default, the columns containing these antibiotics will be guessed with guess_ab_col.

    +

    column names of antibiotics for Gram-positives, case-insensitive. At default, the columns containing these antibiotics will be guessed with guess_ab_col.

    GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6 -

    column names of antibiotics for Gram negatives, case-insensitive. At default, the columns containing these antibiotics will be guessed with guess_ab_col.

    +

    column names of antibiotics for Gram-negatives, case-insensitive. At default, the columns containing these antibiotics will be guessed with guess_ab_col.

    warnings @@ -321,10 +317,10 @@

    Details

    The function key_antibiotics returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using key_antibiotics_equal, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot ("."). The first_isolate function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible S. aureus (MSSA) found within the same episode (see episode parameter of first_isolate). Without key antibiotic comparison it would not.

    -

    At default, the antibiotics that are used for Gram positive bacteria are (colum names):
    - "amox", "amcl", "cfur", "pita", "cipr", "trsu" (until here is universal), "vanc", "teic", "tetr", "eryt", "oxac", "rifa".

    -

    At default, the antibiotics that are used for Gram negative bacteria are (colum names):
    - "amox", "amcl", "cfur", "pita", "cipr", "trsu" (until here is universal), "gent", "tobr", "coli", "cfot", "cfta", "mero".

    +

    At default, the antibiotics that are used for Gram-positive bacteria are:
    + amoxicillin, amoxicillin/clavulanic acid, cefuroxime, piperacillin/tazobactam, ciprofloxacin, trimethoprim/sulfamethoxazole (until here is universal), vancomycin, teicoplanin, tetracycline, erythromycin, oxacillin, rifampin.

    +

    At default, the antibiotics that are used for Gram-negative bacteria are:
    + amoxicillin, amoxicillin/clavulanic acid, cefuroxime, piperacillin/tazobactam, ciprofloxacin, trimethoprim/sulfamethoxazole (until here is universal), gentamicin, tobramycin, colistin, cefotaxime, ceftazidime, meropenem.

    The function key_antibiotics_equal checks the characters returned by key_antibiotics for equality, and returns a logical vector.

    Key antibiotics

    @@ -350,6 +346,7 @@
    # NOT RUN {
     # septic_patients is a dataset available in the AMR package
     ?septic_patients
    +
     library(dplyr)
     # set key antibiotics to a new variable
     my_patients <- septic_patients %>%
    diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html
    index 3533ed43..8acbf27c 100644
    --- a/docs/reference/mo_property.html
    +++ b/docs/reference/mo_property.html
    @@ -80,7 +80,7 @@
           
           
             AMR (for R)
    -        0.7.0.9000
    +        0.7.0.9005
           
         
     
    @@ -165,13 +165,6 @@
             Create frequency tables
           
         
  • -
  • - - - - Use the G-test - -
  • @@ -284,6 +277,8 @@ mo_taxonomy(x, language = get_locale(), ...) +mo_info(x, language = get_locale(), ...) + mo_url(x, open = FALSE, ...) mo_property(x, property = "fullname", language = get_locale(), ...) @@ -378,8 +373,8 @@ This package contains the complete taxonomic tree of almost all microorganisms ( mo_shortname("E. coli") # "E. coli" ## other properties -mo_gramstain("E. coli") # "Gram negative" -mo_type("E. coli") # "Bacteria" (equal to kingdom) +mo_gramstain("E. coli") # "Gram-negative" +mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated) mo_rank("E. coli") # "species" mo_url("E. coli") # get the direct url to the online database entry @@ -393,7 +388,7 @@ This package contains the complete taxonomic tree of almost all microorganisms ( mo_genus("MRSA") # "Staphylococcus" mo_species("MRSA") # "aureus" mo_shortname("MRSA") # "S. aureus" -mo_gramstain("MRSA") # "Gram positive" +mo_gramstain("MRSA") # "Gram-positive" mo_genus("VISA") # "Staphylococcus" mo_species("VISA") # "aureus" @@ -442,6 +437,8 @@ This package contains the complete taxonomic tree of almost all microorganisms ( # get a list with the complete taxonomy (from kingdom to subspecies) mo_taxonomy("E. coli") +# get a list with the taxonomy, the authors and the URL to the online database +mo_info("E. coli") # }