diff --git a/DESCRIPTION b/DESCRIPTION index 6dd34bb6..d9a94b3d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.8.0.9032 -Date: 2019-11-15 +Version: 0.8.0.9033 +Date: 2019-11-18 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 7a5ce649..e8825b6b 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 0.8.0.9032 -Last updated: 15-Nov-2019 +# AMR 0.8.0.9033 +## Last updated: 18-Nov-2019 ### Breaking * Adopted Adeolu *et al.* (2016), [PMID 27620848](https://www.ncbi.nlm.nih.gov/pubmed/27620848) for the `microorganisms` data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like *Morganellaceae* and *Yersiniaceae*). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with `mdro()` will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family. @@ -25,6 +25,7 @@ * Support for a new MDRO guideline: Magiorakos AP, Srinivasan A *et al.* "Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance." Clinical Microbiology and Infection (2012). * This is now the new default guideline for the `mdro()` function * The new Verbose mode (`mdro(...., verbose = TRUE)`) returns an informative data set where the reason for MDRO determination is given for every isolate, and an list of the resistant antimicrobial agents +* Data set `antivirals`, containing all entries from the ATC J05 group with their DDDs for oral and parenteral treatment ### Changes * Improvements to algorithm in `as.mo()`: @@ -48,13 +49,14 @@ * When running `as.rsi()` over a data set, it will now print the guideline that will be used if it is not specified by the user * Improvements for `eucast_rules()`: * Fix where *Stenotrophomonas maltophilia* would always become ceftazidime R (following EUCAST v3.1) - * Fix where *Leuconostoc* and *Pediococcus* would not always become glyopeptides R + * Fix where *Leuconostoc* and *Pediococcus* would not always become glycopeptides R * non-EUCAST rules in `eucast_rules()` are now applied first and not as last anymore. This is to improve the dependency on certain antibiotics for the official EUCAST rules. Please see `?eucast_rules`. * Fix for interpreting MIC values with `as.rsi()` where the input is `NA` * Added "imi" and "imp" as allowed abbreviation for Imipenem (IPM) * Fix for automatically determining columns with antibiotic results in `mdro()` and `eucast_rules()` * Added ATC codes for ceftaroline, ceftobiprole and faropenem and fixed two typos in the `antibiotics` data set * More robust way of determining valid MIC values +* Small changed to the `example_isolates` data set to better reflect reality ### Other * Change dependency on `clean` to `cleaner`, as this package was renamed accordingly upon CRAN request diff --git a/R/data.R b/R/data.R index 4244bc6a..f1fbb0a7 100755 --- a/R/data.R +++ b/R/data.R @@ -34,7 +34,7 @@ #' \item{\code{abbr}}{List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)} #' \item{\code{synonyms}}{Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID} #' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} -#' \item{\code{oral_units}}{Units of \code{ddd_units}} +#' \item{\code{oral_units}}{Units of \code{oral_ddd}} #' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} #' \item{\code{iv_units}}{Units of \code{iv_ddd}} #' } @@ -48,9 +48,28 @@ #' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{http://ec.europa.eu/health/documents/community-register/html/atc.htm} #' @inheritSection WHOCC WHOCC #' @inheritSection AMR Read more on our website! -#' @seealso \code{\link{microorganisms}} +#' @seealso \code{\link{antivirals}} \code{\link{microorganisms}} "antibiotics" +#' Data set with ~100 antivirals +#' +#' A data set containing all antivirals, according to the ATC code group 'J05' (Antivirals for systemic use). +#' @format A \code{\link{data.frame}} with 102 observations and 7 variables: +#' \describe{ +#' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC} +#' \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO} +#' \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC} +#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} +#' \item{\code{oral_units}}{Units of \code{oral_ddd}} +#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} +#' \item{\code{iv_units}}{Units of \code{iv_ddd}} +#' } +#' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/} +#' @inheritSection WHOCC WHOCC +#' @inheritSection AMR Read more on our website! +#' @seealso \code{\link{antibiotics}} \code{\link{microorganisms}} +"antivirals" + #' Data set with ~70,000 microorganisms #' #' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}. @@ -126,9 +145,9 @@ catalogue_of_life <- list( #' @seealso \code{\link{as.mo}} \code{\link{microorganisms}} "microorganisms.codes" -#' Data set with 2,000 blood culture isolates +#' Data set with 2,000 example isolates #' -#' An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found 4 different hospitals in the Netherlands, between 2001 and 2017. This \code{data.frame} can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}. +#' A data set containing 2,000 microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}. #' @format A \code{\link{data.frame}} with 2,000 observations and 49 variables: #' \describe{ #' \item{\code{date}}{date of receipt at the laboratory} @@ -138,7 +157,7 @@ catalogue_of_life <- list( #' \item{\code{ward_outpatient}}{logical to determine if ward is an outpatient clinic} #' \item{\code{age}}{age of the patient} #' \item{\code{gender}}{gender of the patient} -#' \item{\code{patient_id}}{ID of the patient, first 10 characters of an SHA hash containing irretrievable information} +#' \item{\code{patient_id}}{ID of the patient} #' \item{\code{mo}}{ID of microorganism created with \code{\link{as.mo}}, see also \code{\link{microorganisms}}} #' \item{\code{PEN:RIF}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{ab_name}}} #' } @@ -183,17 +202,17 @@ catalogue_of_life <- list( #' Data set for RSI interpretation #' #' Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use \code{\link{as.rsi}} to transform MICs or disks measurements to RSI values. -#' @format A \code{\link{data.frame}} with 11,559 observations and 9 variables: +#' @format A \code{\link{data.frame}} with 13,975 observations and 9 variables: #' \describe{ #' \item{\code{guideline}}{Name of the guideline} +#' \item{\code{method}}{Either "MIC" or "DISK"} +#' \item{\code{site}}{Body site, e.g. "Oral" or "Respiratory"} #' \item{\code{mo}}{Microbial ID, see \code{\link{as.mo}}} #' \item{\code{ab}}{Antibiotic ID, see \code{\link{as.ab}}} #' \item{\code{ref_tbl}}{Info about where the guideline rule can be found} -#' \item{\code{S_mic}}{Lowest MIC value that leads to "S"} -#' \item{\code{R_mic}}{Highest MIC value that leads to "R"} -#' \item{\code{dose_disk}}{Dose of the used disk diffusion method} -#' \item{\code{S_disk}}{Lowest number of millimeters that leads to "S"} -#' \item{\code{R_disk}}{Highest number of millimeters that leads to "R"} +#' \item{\code{disk_dose}}{Dose of the used disk diffusion method} +#' \item{\code{breakpoint_S}}{Lowest MIC value or highest number of millimeters that leads to "S"} +#' \item{\code{breakpoint_R}}{Highest MIC value or lowest number of millimeters that leads to "R"} #' } #' @inheritSection AMR Read more on our website! "rsi_translation" diff --git a/R/eucast_rules.R b/R/eucast_rules.R index 8d6d4915..6f10cae5 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -163,6 +163,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' } #' @inheritSection AMR Read more on our website! #' @examples +#' \donttest{ #' a <- data.frame(mo = c("Staphylococcus aureus", #' "Enterococcus faecalis", #' "Escherichia coli", @@ -198,7 +199,6 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" #' # 5 Pseudomonas aeruginosa R R - - R R R #' #' -#' \donttest{ #' # do not apply EUCAST rules, but rather get a data.frame #' # with 18 rows, containing all details about the transformations: #' c <- eucast_rules(a, verbose = TRUE) diff --git a/R/mdro.R b/R/mdro.R index f9c47449..7a923c1a 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -54,29 +54,24 @@ #' @rdname mdro #' @aliases MDR XDR PDR BRMO 3MRGN 4MRGN #' @importFrom dplyr %>% filter_at vars all_vars pull mutate_at -#' @importFrom crayon blue bold italic +#' @importFrom crayon blue bold italic red #' @importFrom cleaner percentage #' @export #' @inheritSection AMR Read more on our website! #' @source #' Please see Details for the list of publications used for this function. #' @examples +#' \donttest{ #' library(dplyr) #' #' example_isolates %>% #' mdro() %>% #' freq() #' -#' \donttest{ #' example_isolates %>% #' mutate(EUCAST = eucast_exceptional_phenotypes(.), #' BRMO = brmo(.), #' MRGN = mrgn(.)) -#' -#' example_isolates %>% -#' rename(PIP = TZP) %>% # no piperacillin, so take piperacillin/tazobactam -#' mrgn() %>% # check German guideline -#' freq() # check frequencies #' } mdro <- function(x, guideline = NULL, @@ -155,7 +150,7 @@ mdro <- function(x, guideline$name <- "Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance." guideline$author <- "Magiorakos AP, Srinivasan A, Carey RB, ..., Vatopoulos A, Weber JT, Monnet DL" guideline$version <- "N/A" - guideline$source <- "Magiorakos et al. (2012) Clinical Microbiology and Infection 18:3. DOI: 10.1111/j.1469-0691.2011.03570.x" + guideline$source <- "Clinical Microbiology and Infection 18:3, 2012. DOI: 10.1111/j.1469-0691.2011.03570.x" } else if (guideline$code == "eucast") { guideline$name <- "EUCAST Expert Rules, \"Intrinsic Resistance and Exceptional Phenotypes Tables\"" @@ -174,7 +169,7 @@ mdro <- function(x, guideline$name <- "Cross-border comparison of the Dutch and German guidelines on multidrug-resistant Gram-negative microorganisms" guideline$author <- "M\u00fcller J, Voss A, K\u00f6ck R, ..., Kern WV, Wendt C, Friedrich AW" guideline$version <- "N/A" - guideline$source <- "M\u00fcller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6" + guideline$source <- "Antimicrobial Resistance and Infection Control 4:7, 2015. DOI: 10.1186/s13756-015-0047-6" } else if (guideline$code == "brmo") { guideline$name <- "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)" @@ -422,9 +417,9 @@ mdro <- function(x, if (info == TRUE) { if (combine_SI == TRUE) { - cat("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n") + cat(red("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n")) } else { - cat("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n") + cat(red("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n")) } cat("\nDetermining multidrug-resistant organisms (MDRO), according to:\n", bold("Guideline: "), italic(guideline$name), "\n", diff --git a/R/mo.R b/R/mo.R index 3f44bd27..6e5eb645 100755 --- a/R/mo.R +++ b/R/mo.R @@ -572,22 +572,21 @@ exec_as.mo <- function(x, # add start en stop regex x <- paste0("^", x, "$") - x_withspaces_start_only <- paste0("^", x_withspaces) x_withspaces_end_only <- paste0(x_withspaces, "$") x_withspaces_start_end <- paste0("^", x_withspaces, "$") if (isTRUE(debug)) { - cat(paste0(blue('x'), ' "', x, '"\n')) - cat(paste0(blue('x_species'), ' "', x_species, '"\n')) - cat(paste0(blue('x_withspaces_start_only'), ' "', x_withspaces_start_only, '"\n')) - cat(paste0(blue('x_withspaces_end_only'), ' "', x_withspaces_end_only, '"\n')) - cat(paste0(blue('x_withspaces_start_end'), ' "', x_withspaces_start_end, '"\n')) - cat(paste0(blue('x_backup'), ' "', x_backup, '"\n')) - cat(paste0(blue('x_backup_without_spp'), ' "', x_backup_without_spp, '"\n')) - cat(paste0(blue('x_trimmed'), ' "', x_trimmed, '"\n')) - cat(paste0(blue('x_trimmed_species'), ' "', x_trimmed_species, '"\n')) - cat(paste0(blue('x_trimmed_without_group'), ' "', x_trimmed_without_group, '"\n')) + cat(paste0(blue("x"), ' "', x, '"\n')) + cat(paste0(blue("x_species"), ' "', x_species, '"\n')) + cat(paste0(blue("x_withspaces_start_only"), ' "', x_withspaces_start_only, '"\n')) + cat(paste0(blue("x_withspaces_end_only"), ' "', x_withspaces_end_only, '"\n')) + cat(paste0(blue("x_withspaces_start_end"), ' "', x_withspaces_start_end, '"\n')) + cat(paste0(blue("x_backup"), ' "', x_backup, '"\n')) + cat(paste0(blue("x_backup_without_spp"), ' "', x_backup_without_spp, '"\n')) + cat(paste0(blue("x_trimmed"), ' "', x_trimmed, '"\n')) + cat(paste0(blue("x_trimmed_species"), ' "', x_trimmed_species, '"\n')) + cat(paste0(blue("x_trimmed_without_group"), ' "', x_trimmed_without_group, '"\n')) } progress <- progress_estimated(n = length(x), min_time = 3) @@ -1782,6 +1781,7 @@ pillar_shaft.mo <- function(x, ...) { out[is.na(x)] <- pillar::style_na(" NA") out[x == "UNKNOWN"] <- pillar::style_na(" UNKNOWN") + # make it always fit exactly pillar::new_pillar_shaft_simple(out, align = "left", width = max(nchar(x))) } diff --git a/R/whocc.R b/R/whocc.R index b031d8c5..bddc5ef8 100755 --- a/R/whocc.R +++ b/R/whocc.R @@ -24,7 +24,7 @@ #' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology. #' @section WHOCC: #' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} -#' This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). +#' This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). #' #' These have become the gold standard for international drug utilisation monitoring and research. #' diff --git a/_pkgdown.yml b/_pkgdown.yml index 2e0b6ed2..f74f913b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -83,6 +83,62 @@ navbar: href: "LICENSE-text.html" reference: + - title: "Cleaning your data" + desc: > + Functions for cleaning and optimising your data, to be able to add + variables later on (like taxonomic properties) or to fix and extend + antibiotic interpretations by applying [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/). + contents: + - starts_with("as.") + - "`eucast_rules`" + - "`guess_ab_col`" + - "`mo_source`" + - "`read.4D`" + - "`rsi_translation`" + - title: "Enhancing your data" + desc: > + Functions to add new data to your existing data, such as the determination + of first isolates, multi-drug resistant microorganisms (MDRO), getting + properties of microorganisms or antibiotics and determining the age of + patients or divide ages into age groups. + contents: + - "`ab_property`" + - "`age_groups`" + - "`age`" + - "`atc_online_property`" + - "`first_isolate`" + - "`join`" + - "`key_antibiotics`" + - "`mdro`" + - "`mo_property`" + - "`p_symbol`" + - title: "Analysing your data" + desc: > + Functions for conducting AMR analysis, like counting isolates, calculating + resistance or susceptibility, or make plots. + contents: + - "`availability`" + - "`bug_drug_combinations`" + - "`count`" + - "`filter_ab_class`" + - "`g.test`" + - "`ggplot_rsi`" + - "`kurtosis`" + - "`portion`" + - "`resistance_predict`" + - "`skewness`" + - title: "Included data sets" + desc: > + Scientifically reliable references for microorganisms and + antibiotics, and example data sets to use for practise. + contents: + - "`antibiotics`" + - "`antivirals`" + - "`example_isolates`" + - "`microorganisms.codes`" + - "`microorganisms.old`" + - "`microorganisms`" + - "`WHONET`" - title: "Background information" desc: > Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html) @@ -92,61 +148,6 @@ reference: - "`catalogue_of_life`" - "`catalogue_of_life_version`" - "`WHOCC`" - - title: "Cleaning your data" - desc: > - Functions for cleaning and optimising your data, to be able to add - variables later on (like taxonomic properties) or to fix and extend - antibiotic interpretations by applying [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/). - contents: - - starts_with("as.") - - "`mo_source`" - - "`eucast_rules`" - - "`rsi_translation`" - - "`guess_ab_col`" - - "`read.4D`" - - title: "Adding variables to your data" - desc: > - Functions to add new data to existing data, like the determination - of first isolates, multi-drug resistant microorganisms (MDRO), getting - properties of microorganisms or antibiotics and determining the age of - patients or divide ages into age groups. - contents: - - "`first_isolate`" - - "`mdro`" - - "`key_antibiotics`" - - "`mo_property`" - - "`ab_property`" - - "`age`" - - "`age_groups`" - - "`p_symbol`" - - "`join`" - - "`atc_online_property`" - - title: "Analysing your data" - desc: > - Functions for conducting AMR analysis, like counting isolates, calculating - resistance or susceptibility, or make plots. - contents: - - "`availability`" - - "`bug_drug_combinations`" - - "`count`" - - "`portion`" - - "`filter_ab_class`" - - "`g.test`" - - "`ggplot_rsi`" - - "`kurtosis`" - - "`resistance_predict`" - - "`skewness`" - - title: "Included data sets" - desc: > - References for microorganisms and antibiotics, and even a - genuine data set with isolates from septic patients. - contents: - - "`antibiotics`" - - "`microorganisms`" - - "`example_isolates`" - - "`WHONET`" - - "`microorganisms.codes`" - - "`microorganisms.old`" - title: Other functions desc: > These functions are mostly for internal use, but some of @@ -160,9 +161,10 @@ reference: These functions are extensions of functions in other packages. contents: - "`extended-functions`" + - "`reexports`" - title: functions desc: > - These functions are deprecated, meaning that they still + These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed in a future version. contents: diff --git a/data-raw/reproduction_of_antibiotics.R b/data-raw/reproduction_of_antibiotics.R index 75bd702a..6274fe78 100644 --- a/data-raw/reproduction_of_antibiotics.R +++ b/data-raw/reproduction_of_antibiotics.R @@ -1,3 +1,23 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Analysis # +# # +# SOURCE # +# https://gitlab.com/msberends/AMR # +# # +# LICENCE # +# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) # +# # +# This R package is free software; you can freely use and distribute # +# it for both personal and commercial purposes under the terms of the # +# GNU General Public License version 2.0 (GNU GPL-2), as published by # +# the Free Software Foundation. # +# # +# This R package was created for academic research and was publicly # +# released in the hope that it will be useful, but it comes WITHOUT # +# ANY WARRANTY OR LIABILITY. # +# Visit our website for more info: https://msberends.gitlab.io/AMR. # +# ==================================================================== # library(dplyr) diff --git a/data-raw/reproduction_of_antivirals.R b/data-raw/reproduction_of_antivirals.R new file mode 100644 index 00000000..6f781161 --- /dev/null +++ b/data-raw/reproduction_of_antivirals.R @@ -0,0 +1,62 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Analysis # +# # +# SOURCE # +# https://gitlab.com/msberends/AMR # +# # +# LICENCE # +# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) # +# # +# This R package is free software; you can freely use and distribute # +# it for both personal and commercial purposes under the terms of the # +# GNU General Public License version 2.0 (GNU GPL-2), as published by # +# the Free Software Foundation. # +# # +# This R package was created for academic research and was publicly # +# released in the hope that it will be useful, but it comes WITHOUT # +# ANY WARRANTY OR LIABILITY. # +# Visit our website for more info: https://msberends.gitlab.io/AMR. # +# ==================================================================== # + +# get all data from the WHOCC website + +get_atc_table <- function(atc_group) { + # give as input J0XXX, like atc_group = "J05AB" + downloaded <- read_html(paste0("https://www.whocc.no/atc_ddd_index/?code=", atc_group, "&showdescription=no")) + table_title <- downloaded %>% html_nodes(paste0('a[href="./?code=', atc_group, '"]')) %>% html_text() + table_content <- downloaded %>% + html_nodes("table") %>% + html_table(header = TRUE) %>% + # returns list, so make data.frame out of it + as.data.frame(stringsAsFactors = FALSE) %>% + # select right columns + select(atc = ATC.code, name = Name, ddd = DDD, unit = U, ddd_type = Adm.R) %>% + # fill empty rows + mutate(atc = ifelse(atc == "", lag(atc), atc), name = ifelse(name == "", lag(name), name)) %>% + pivot_wider(names_from = ddd_type, values_from = c(ddd, unit)) %>% + mutate(atc_group = table_title) + if (!"ddd_O" %in% colnames(table_content)) { + table_content <- table_content %>% mutate(ddd_O = NA_real_, unit_O = NA_character_) + } + if (!"ddd_P" %in% colnames(table_content)) { + table_content <- table_content %>% mutate(ddd_P = NA_real_, unit_P = NA_character_) + } + table_content %>% select(atc, name, atc_group, + oral_ddd = ddd_O, oral_units = unit_O, + iv_ddd = ddd_P, iv_units = unit_P) +} + +# these are the relevant groups for input: https://www.whocc.no/atc_ddd_index/?code=J05A (J05 only contains J05A) +atc_groups <- c("J05AA", "J05AB", "J05AC", "J05AD", "J05AE", "J05AF", "J05AG", "J05AH", "J05AP", "J05AR", "J05AX") + +# get the first +antivirals <- get_atc_table(atc_groups[1]) +# bind all others to it +for (i in 2:length(atc_groups)) { + antivirals <- rbind(antivirals, get_atc_table(atc_groups[i])) +} + +# arrange on name, untibble it and save +antivirals <- antivirals %>% arrange(name) %>% as.data.frame(stringsAsFactors = FALSE) +usethis::use_data(antivirals, overwrite = TRUE) diff --git a/data/antivirals.rda b/data/antivirals.rda new file mode 100644 index 00000000..8217fe01 Binary files /dev/null and b/data/antivirals.rda differ diff --git a/data/example_isolates.rda b/data/example_isolates.rda index 15c315bc..04b026c0 100644 Binary files a/data/example_isolates.rda and b/data/example_isolates.rda differ diff --git a/docs/404.html b/docs/404.html index f98b3192..ae0ed72b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index ab0c5143..1f557fd1 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 412273a1..9e658236 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0.9031 + 0.8.0.9032 @@ -187,7 +187,7 @@

How to conduct AMR analysis

Matthijs S. Berends

-

15 November 2019

+

18 November 2019

@@ -196,7 +196,7 @@ -

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 15 November 2019.

+

Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 18 November 2019.

Introduction

@@ -212,21 +212,21 @@ -2019-11-15 +2019-11-18 abcd Escherichia coli S S -2019-11-15 +2019-11-18 abcd Escherichia coli S R -2019-11-15 +2019-11-18 efgh Escherichia coli R @@ -321,8 +321,8 @@ -2015-09-02 -V3 +2011-03-27 +O9 Hospital B Escherichia coli S @@ -332,41 +332,30 @@ F -2017-06-27 -H4 +2015-09-08 +U5 Hospital C Escherichia coli -R -R S S -M - - -2012-05-31 -X3 -Hospital B -Streptococcus pneumoniae -I -S S S F - -2013-06-08 -K2 -Hospital B + +2014-09-10 +L5 +Hospital C Staphylococcus aureus -I S +R S S M - -2012-02-10 -M5 + +2011-07-28 +D7 Hospital A Escherichia coli S @@ -375,16 +364,27 @@ S M + +2013-04-12 +N6 +Hospital A +Escherichia coli +I +S +S +S +F + -2010-06-25 -N7 -Hospital D +2017-03-29 +F1 +Hospital A Escherichia coli S S S S -F +M @@ -406,8 +406,8 @@ # # Item Count Percent Cum. Count Cum. Percent # --- ----- ------- -------- ----------- ------------- -# 1 M 10,309 51.55% 10,309 51.55% -# 2 F 9,691 48.46% 20,000 100.00% +# 1 M 10,413 52.06% 10,413 52.06% +# 2 F 9,587 47.94% 20,000 100.00%

So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values M and F. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.

The data is already quite clean, but we still need to transform some variables. The bacteria column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate() function of the dplyr package makes this really easy:

data <- data %>%
@@ -422,8 +422,8 @@
 # Other rules by this AMR package
 # Non-EUCAST: inherit amoxicillin results for unavailable ampicillin (no changes)
 # Non-EUCAST: inherit ampicillin results for unavailable amoxicillin (no changes)
-# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (3,022 values changed)
-# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (151 values changed)
+# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,986 values changed)
+# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (176 values changed)
 # Non-EUCAST: set piperacillin = R where piperacillin/tazobactam = R (no changes)
 # Non-EUCAST: set piperacillin/tazobactam = S where piperacillin = S (no changes)
 # Non-EUCAST: set trimethoprim = R where trimethoprim/sulfa = R (no changes)
@@ -448,14 +448,14 @@
 # Pasteurella multocida (no changes)
 # Staphylococcus (no changes)
 # Streptococcus groups A, B, C, G (no changes)
-# Streptococcus pneumoniae (1,071 values changed)
+# Streptococcus pneumoniae (1,015 values changed)
 # Viridans group streptococci (no changes)
 # 
 # EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1,282 values changed)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,284 values changed)
 # Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
 # Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2,783 values changed)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,796 values changed)
 # Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
 # Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
 # Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
@@ -463,15 +463,15 @@
 # Table 13: Interpretive rules for quinolones (no changes)
 # 
 # --------------------------------------------------------------------------
-# EUCAST rules affected 6,586 out of 20,000 rows, making a total of 8,309 edits
+# EUCAST rules affected 6,569 out of 20,000 rows, making a total of 8,257 edits
 # => added 0 test results
 # 
-# => changed 8,309 test results
-#    - 129 test results changed from S to I
-#    - 4,834 test results changed from S to R
-#    - 1,222 test results changed from I to S
-#    - 324 test results changed from I to R
-#    - 1,800 test results changed from R to S
+# => changed 8,257 test results
+#    - 123 test results changed from S to I
+#    - 4,779 test results changed from S to R
+#    - 1,134 test results changed from I to S
+#    - 369 test results changed from I to R
+#    - 1,852 test results changed from R to S
 # --------------------------------------------------------------------------
 # 
 # Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.
@@ -499,8 +499,8 @@ # NOTE: Using column `bacteria` as input for `col_mo`. # NOTE: Using column `date` as input for `col_date`. # NOTE: Using column `patient_id` as input for `col_patient_id`. -# => Found 5,688 first isolates (28.4% of total)
-

So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

+# => Found 5,699 first isolates (28.5% of total) +

So only 28.5% is suitable for resistance analysis! We can now filter on it with the filter() function, also from the dplyr package:

data_1st <- data %>% 
   filter(first == TRUE)

For future use, the above two syntaxes can be shortened with the filter_first_isolate() function:

@@ -510,7 +510,7 @@

First weighted isolates

-

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient I9, sorted on date:

+

We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient X7, sorted on date:

@@ -526,19 +526,19 @@ - - + + - + - - + + @@ -548,30 +548,30 @@ - - + + - - - + + + - - + + - - + + - - + + @@ -581,19 +581,19 @@ - - + + + - - + - - + + @@ -603,8 +603,8 @@ - - + + @@ -614,23 +614,23 @@ - - + + - + - - + + - + @@ -647,7 +647,7 @@ # NOTE: Using column `patient_id` as input for `col_patient_id`.# NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.# [Criterion] Inclusion based on key antibiotics, ignoring I -# => Found 15,051 first weighted isolates (75.3% of total) +# => Found 15,085 first weighted isolates (75.4% of total)
isolate
12010-02-08I92010-03-18X7 B_ESCHR_COLI S SRS S TRUE
22010-03-05I92010-04-28X7 B_ESCHR_COLI S S
32010-05-14I92010-06-26X7 B_ESCHR_COLISSS RSSS FALSE
42010-12-10I92010-08-06X7 B_ESCHR_COLIR SRSS S FALSE
52010-12-17I92010-08-31X7 B_ESCHR_COLI S S
62011-04-18I92010-10-15X7 B_ESCHR_COLIR S S SSTRUEFALSE
72011-04-25I92010-11-19X7 B_ESCHR_COLI R S
82011-06-06I92011-01-20X7 B_ESCHR_COLI S S
92011-07-14I92011-04-10X7 B_ESCHR_COLI S S S SFALSETRUE
102011-07-31I92011-04-12X7 B_ESCHR_COLI S SRS S FALSE
@@ -664,80 +664,68 @@ - - + + - + - - + + - + - - + + - - - + + + - - + + - - + + - - + + - + - - - - - - - - - - - - - - + + @@ -746,10 +734,22 @@ + + + + + + + + + + + + - - + + @@ -760,35 +760,35 @@ - - + + - - + + - - + + - + - +
isolate
12010-02-08I92010-03-18X7 B_ESCHR_COLI S SRS S TRUE TRUE
22010-03-05I92010-04-28X7 B_ESCHR_COLI S S S S FALSETRUEFALSE
32010-05-14I92010-06-26X7 B_ESCHR_COLISSS RSSS FALSE TRUE
42010-12-10I92010-08-06X7 B_ESCHR_COLIR SRSS S FALSE TRUE
52010-12-17I92010-08-31X7 B_ESCHR_COLI S S S S FALSETRUEFALSE
62011-04-18I9B_ESCHR_COLISSSSTRUETRUE
72011-04-25I92010-10-15X7 B_ESCHR_COLI R SFALSE TRUE
72010-11-19X7B_ESCHR_COLIRSSSFALSEFALSE
82011-06-06I92011-01-20X7 B_ESCHR_COLI S S
92011-07-14I92011-04-10X7 B_ESCHR_COLI S S S SFALSEFALSETRUETRUE
102011-07-31I92011-04-12X7 B_ESCHR_COLI S SRS S FALSETRUEFALSE
-

Instead of 2, now 9 isolates are flagged. In total, 75.3% of all isolates are marked ‘first weighted’ - 46.8% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

+

Instead of 2, now 6 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 46.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.

As with filter_first_isolate(), there’s a shortcut for this new algorithm too:

data_1st <- data %>% 
   filter_first_weighted_isolate()
-

So we end up with 15,051 isolates for analysis.

+

So we end up with 15,085 isolates for analysis.

We can remove unneeded columns:

data_1st <- data_1st %>% 
   select(-c(first, keyab))
@@ -813,13 +813,29 @@ -2 -2017-06-27 -H4 -Hospital C +1 +2011-03-27 +O9 +Hospital B B_ESCHR_COLI -R -R +S +S +S +S +F +Gram-negative +Escherichia +coli +TRUE + + +4 +2011-07-28 +D7 +Hospital A +B_ESCHR_COLI +S +S S S M @@ -828,59 +844,27 @@ coli TRUE - -3 -2012-05-31 -X3 -Hospital B + +8 +2015-08-23 +M1 +Hospital D B_STRPT_PNMN -I -I +R +R S R -F +M Gram-positive Streptococcus pneumoniae TRUE - -4 -2013-06-08 -K2 -Hospital B -B_STPHY_AURS -I -S -S -S -M -Gram-positive -Staphylococcus -aureus -TRUE - -5 -2012-02-10 -M5 -Hospital A -B_ESCHR_COLI -S -S -S -S -M -Gram-negative -Escherichia -coli -TRUE - - -7 -2015-10-03 -B7 -Hospital A +9 +2017-03-08 +G2 +Hospital B B_KLBSL_PNMN R S @@ -892,20 +876,36 @@ pneumoniae TRUE - -9 -2016-04-27 -O7 -Hospital B -B_STRPT_PNMN -S -S -S + +10 +2013-11-09 +Q8 +Hospital A +B_STPHY_AURS R +S +S +S F Gram-positive -Streptococcus -pneumoniae +Staphylococcus +aureus +TRUE + + +16 +2010-06-08 +O4 +Hospital A +B_ESCHR_COLI +R +S +S +S +F +Gram-negative +Escherichia +coli TRUE @@ -927,7 +927,7 @@
data_1st %>% freq(genus, species)

Frequency table

Class: character
-Length: 15,051 (of which NA: 0 = 0%)
+Length: 15,085 (of which NA: 0 = 0%)
Unique: 4

Shortest: 16
Longest: 24

@@ -944,33 +944,33 @@ Longest: 24

1 Escherichia coli -7,443 -49.45% -7,443 -49.45% +7,426 +49.23% +7,426 +49.23% 2 Staphylococcus aureus -3,689 -24.51% -11,132 -73.96% +3,769 +24.99% +11,195 +74.21% 3 Streptococcus pneumoniae -2,398 -15.93% -13,530 -89.89% +2,340 +15.51% +13,535 +89.72% 4 Klebsiella pneumoniae -1,521 -10.11% -15,051 +1,550 +10.28% +15,085 100.00% @@ -982,7 +982,7 @@ Longest: 24

The functions resistance() and susceptibility() can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions proportion_S(), proportion_SI(), proportion_I(), proportion_IR() and proportion_R() can be used to determine the proportion of a specific antimicrobial outcome.

As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (proportion_R(), equal to resistance()) and susceptibility as the proportion of S and I (proportion_SI(), equal to susceptibility()). These functions can be used on their own:

data_1st %>% resistance(AMX)
-# [1] 0.4655505
+# [1] 0.4684123

Or can be used in conjuction with group_by() and summarise(), both from the dplyr package:

data_1st %>% 
   group_by(hospital) %>% 
@@ -995,19 +995,19 @@ Longest: 24

Hospital A -0.4651671 +0.4666964 Hospital B -0.4687618 +0.4711845 Hospital C -0.4569626 +0.4627451 Hospital D -0.4668462 +0.4704102 @@ -1025,23 +1025,23 @@ Longest: 24

Hospital A -0.4651671 -4579 +0.4666964 +4489 Hospital B -0.4687618 -5282 +0.4711845 +5327 Hospital C -0.4569626 -2219 +0.4627451 +2295 Hospital D -0.4668462 -2971 +0.4704102 +2974 @@ -1061,27 +1061,27 @@ Longest: 24

Escherichia -0.9183125 -0.9039366 -0.9934166 +0.9243200 +0.8955023 +0.9934016 Klebsiella -0.9119001 -0.8954635 -0.9960552 +0.9174194 +0.9019355 +0.9967742 Staphylococcus -0.9262673 -0.9227433 -0.9951206 +0.9193420 +0.9211993 +0.9936323 Streptococcus -0.6092577 +0.6128205 0.0000000 -0.6092577 +0.6128205 @@ -1155,7 +1155,7 @@ Longest: 24

Independence test

-

The next example uses the included example_isolates, which is an anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. This data.frame can be used to practice AMR analysis.

+

The next example uses the example_isolates data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis.

We will compare the resistance to fosfomycin (column FOS) in hospital A and D. The input for the fisher.test() can be retrieved with a transformation like this:

# use package 'tidyr' to pivot data; 
 # it gets installed with this 'AMR' package
diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png
index 1c0a9842..157e8a6b 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png
index 8c3a0329..81c7a283 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png
index a3a91508..6191bf74 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png
index d929dd38..39b50936 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ
diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html
index 26ddcd76..cfdb6474 100644
--- a/docs/articles/EUCAST.html
+++ b/docs/articles/EUCAST.html
@@ -41,7 +41,7 @@
       
       
         AMR (for R)
-        0.8.0.9029
+        0.8.0.9032
       
     
@@ -187,7 +187,7 @@

How to apply EUCAST rules

Matthijs S. Berends

-

10 November 2019

+

18 November 2019

diff --git a/docs/articles/MDR.html b/docs/articles/MDR.html index 6dc404a3..1620590b 100644 --- a/docs/articles/MDR.html +++ b/docs/articles/MDR.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0.9029 + 0.8.0.9032
@@ -187,7 +187,7 @@

How to determine multi-drug resistance (MDR)

Matthijs S. Berends

-

10 November 2019

+

18 November 2019

@@ -196,11 +196,11 @@ -

With the function mdro(), you can determine multi-drug resistant organisms (MDRO).

+

With the function mdro(), you can determine which micro-organisms are multi-drug resistant organisms (MDRO).

Type of input

-

The mdro() takes a data set as input, such as a regular data.frame. It automatically determines the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command ?mdro.

+

The mdro() function takes a data set as input, such as a regular data.frame. It tries to automatically determine the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command ?mdro.

For WHONET data (and most other data), all settings are automatically set correctly.

@@ -229,7 +229,8 @@ The German national guideline - Mueller et al. (2015) Antimicrobial Resistance a

Examples

-

The mdro() function always returns an ordered factor. For example, the output of the default guideline by Magiorakos et al. returns a factor with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order. If we test that guideline on the included example_isolates data set, we get:

+

The mdro() function always returns an ordered factor. For example, the output of the default guideline by Magiorakos et al. returns a factor with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.

+

The next example uses the example_isolates data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:

library(dplyr) # to support pipes: %>%

Create a frequency table of the results:

freq(my_TB_data$mdr)

Frequency table

@@ -356,40 +357,40 @@ Unique: 5

1 Mono-resistant -3243 -64.86% -3243 -64.86% +3281 +65.62% +3281 +65.62% 2 Negative -680 -13.60% -3923 -78.46% +659 +13.18% +3940 +78.80% 3 Multi-drug-resistant -587 -11.74% -4510 -90.20% +571 +11.42% +4511 +90.22% 4 Poly-resistant -302 -6.04% -4812 -96.24% +278 +5.56% +4789 +95.78% 5 Extensively drug-resistant -188 -3.76% +211 +4.22% 5000 100.00% diff --git a/docs/articles/SPSS.html b/docs/articles/SPSS.html index f467342e..da2b9b85 100644 --- a/docs/articles/SPSS.html +++ b/docs/articles/SPSS.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0.9031 + 0.8.0.9032
@@ -187,7 +187,7 @@

How to import data from SPSS / SAS / Stata

Matthijs S. Berends

-

15 November 2019

+

18 November 2019

diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html index 522992c6..f26bcf94 100644 --- a/docs/articles/WHONET.html +++ b/docs/articles/WHONET.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0.9029 + 0.8.0.9032
@@ -187,7 +187,7 @@

How to work with WHONET data

Matthijs S. Berends

-

10 November 2019

+

18 November 2019

diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 8016368f..d4cd63f6 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0 + 0.8.0.9032
@@ -187,7 +187,7 @@

Benchmarks

Matthijs S. Berends

-

16 October 2019

+

18 November 2019

@@ -221,21 +221,21 @@ times = 10) print(S.aureus, unit = "ms", signif = 2) # Unit: milliseconds -# expr min lq mean median uq max neval -# as.mo("sau") 9.9 10 14 11 12 35 10 -# as.mo("stau") 33.0 33 39 38 39 52 10 -# as.mo("STAU") 32.0 36 44 38 56 68 10 -# as.mo("staaur") 10.0 10 13 11 11 34 10 -# as.mo("STAAUR") 10.0 11 19 12 33 42 10 -# as.mo("S. aureus") 25.0 26 32 28 32 53 10 -# as.mo("S aureus") 24.0 25 31 27 30 52 10 -# as.mo("Staphylococcus aureus") 31.0 32 39 34 38 84 10 -# as.mo("Staphylococcus aureus (MRSA)") 610.0 640 680 680 710 770 10 -# as.mo("Sthafilokkockus aaureuz") 330.0 340 350 350 360 370 10 -# as.mo("MRSA") 9.8 10 13 11 12 34 10 -# as.mo("VISA") 20.0 22 29 24 31 57 10 -# as.mo("VRSA") 20.0 20 29 23 42 47 10 -# as.mo(22242419) 21.0 23 30 25 43 47 10
+# expr min lq mean median uq max neval +# as.mo("sau") 10 10 16 11 13 58 10 +# as.mo("stau") 33 34 50 45 67 80 10 +# as.mo("STAU") 34 38 44 39 43 72 10 +# as.mo("staaur") 10 11 16 12 15 44 10 +# as.mo("STAAUR") 11 11 17 12 14 59 10 +# as.mo("S. aureus") 26 30 37 33 48 54 10 +# as.mo("S aureus") 26 27 31 28 32 48 10 +# as.mo("Staphylococcus aureus") 31 35 37 37 40 44 10 +# as.mo("Staphylococcus aureus (MRSA)") 650 690 750 710 840 900 10 +# as.mo("Sthafilokkockus aaureuz") 380 410 430 430 440 500 10 +# as.mo("MRSA") 10 11 20 11 37 44 10 +# as.mo("VISA") 20 22 51 29 47 220 10 +# as.mo("VRSA") 21 23 32 25 41 57 10 +# as.mo(22242419) 20 21 23 22 23 27 10

In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.

To achieve this speed, the as.mo function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of Methanosarcina semesiae (B_MTHNSR_SEMS), a bug probably never found before in humans:

@@ -247,19 +247,19 @@ times = 10) print(M.semesiae, unit = "ms", signif = 4) # Unit: milliseconds -# expr min lq mean median uq -# as.mo("metsem") 1343.00 1385.00 1398.00 1403.00 1418.0 -# as.mo("METSEM") 1299.00 1356.00 1397.00 1396.00 1442.0 -# as.mo("M. semesiae") 1892.00 2028.00 2052.00 2041.00 2084.0 -# as.mo("M. semesiae") 1990.00 2017.00 2062.00 2032.00 2094.0 -# as.mo("Methanosarcina semesiae") 32.63 33.24 38.58 35.82 40.2 +# expr min lq mean median uq +# as.mo("metsem") 1415.00 1467.00 1505.00 1493.00 1537.00 +# as.mo("METSEM") 1447.00 1488.00 1530.00 1521.00 1555.00 +# as.mo("M. semesiae") 2216.00 2239.00 2293.00 2284.00 2351.00 +# as.mo("M. semesiae") 2143.00 2212.00 2304.00 2307.00 2332.00 +# as.mo("Methanosarcina semesiae") 32.44 35.59 43.59 38.19 45.88 # max neval -# 1437.00 10 -# 1488.00 10 -# 2169.00 10 -# 2245.00 10 -# 57.04 10 -

That takes 14.3 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like Methanosarcina semesiae) are almost fast - these are the most probable input from most data sets.

+# 1627.00 10 +# 1628.00 10 +# 2395.00 10 +# 2535.00 10 +# 69.48 10 +

That takes 13.8 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like Methanosarcina semesiae) are almost fast - these are the most probable input from most data sets.

In the figure below, we compare Escherichia coli (which is very common) with Prevotella brevis (which is moderately common) and with Methanosarcina semesiae (which is uncommon):

In reality, the as.mo() functions learns from its own output to speed up determinations for next times. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use as.mo() yourself:

@@ -296,8 +296,8 @@ print(run_it, unit = "ms", signif = 3) # Unit: milliseconds # expr min lq mean median uq max neval -# mo_name(x) 645 661 683 672 686 771 10 -

So transforming 500,000 values (!!) of 50 unique values only takes 0.67 seconds (671 ms). You only lose time on your unique input values.

+# mo_name(x) 642 674 702 687 713 843 10 +

So transforming 500,000 values (!!) of 50 unique values only takes 0.69 seconds (686 ms). You only lose time on your unique input values.

@@ -309,10 +309,10 @@ times = 10) print(run_it, unit = "ms", signif = 3) # Unit: milliseconds -# expr min lq mean median uq max neval -# A 6.380 6.530 7.750 7.180 8.21 11.30 10 -# B 24.300 25.500 30.400 26.900 31.60 54.80 10 -# C 0.803 0.827 0.926 0.869 0.95 1.22 10

+# expr min lq mean median uq max neval +# A 6.350 6.420 6.880 6.530 7.180 8.56 10 +# B 24.600 25.100 31.300 25.700 27.900 62.80 10 +# C 0.798 0.867 0.914 0.892 0.931 1.14 10

So going from mo_name("Staphylococcus aureus") to "Staphylococcus aureus" takes 0.0009 seconds - it doesn’t even start calculating if the result would be the same as the expected resulting value. That goes for all helper functions:

run_it <- microbenchmark(A = mo_species("aureus"),
                          B = mo_genus("Staphylococcus"),
@@ -326,14 +326,14 @@
 print(run_it, unit = "ms", signif = 3)
 # Unit: milliseconds
 #  expr   min    lq  mean median    uq   max neval
-#     A 0.509 0.530 0.681  0.565 0.661 1.630    10
-#     B 0.518 0.526 0.598  0.553 0.564 0.875    10
-#     C 0.848 0.882 1.100  0.990 1.180 1.920    10
-#     D 0.566 0.592 0.734  0.714 0.765 1.120    10
-#     E 0.486 0.522 0.555  0.542 0.551 0.681    10
-#     F 0.466 0.493 0.598  0.553 0.586 1.110    10
-#     G 0.462 0.498 0.598  0.525 0.671 0.921    10
-#     H 0.480 0.489 0.566  0.508 0.628 0.756    10
+# A 0.446 0.459 0.471 0.475 0.481 0.485 10 +# B 0.502 0.506 0.518 0.513 0.521 0.568 10 +# C 0.774 0.802 0.811 0.815 0.823 0.838 10 +# D 0.505 0.511 0.532 0.515 0.534 0.627 10 +# E 0.467 0.469 0.495 0.478 0.481 0.676 10 +# F 0.457 0.467 0.478 0.479 0.484 0.509 10 +# G 0.452 0.460 0.467 0.471 0.472 0.478 10 +# H 0.460 0.469 0.473 0.473 0.480 0.486 10

Of course, when running mo_phylum("Firmicutes") the function has zero knowledge about the actual microorganism, namely S. aureus. But since the result would be "Firmicutes" too, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.

@@ -359,14 +359,14 @@ times = 10) print(run_it, unit = "ms", signif = 4) # Unit: milliseconds -# expr min lq mean median uq max neval -# en 20.01 20.76 28.07 22.47 29.04 54.04 10 -# de 21.95 22.28 26.91 22.72 24.24 58.36 10 -# nl 27.57 27.96 47.86 31.50 54.01 149.80 10 -# es 22.08 22.13 28.59 24.11 26.45 58.61 10 -# it 21.73 22.33 25.39 25.30 26.90 29.57 10 -# fr 22.23 22.98 24.95 23.45 23.70 34.08 10 -# pt 22.02 23.03 24.80 24.37 27.14 28.33 10
+# expr min lq mean median uq max neval +# en 20.49 21.64 27.36 23.44 27.96 53.91 10 +# de 23.26 23.37 28.22 24.42 26.13 60.60 10 +# nl 28.62 29.74 36.90 30.18 33.12 72.41 10 +# es 21.77 23.08 27.71 24.75 26.98 55.14 10 +# it 22.54 23.37 25.19 25.25 26.41 29.08 10 +# fr 23.04 23.99 30.97 26.14 30.78 52.61 10 +# pt 22.40 23.07 24.26 23.14 24.44 31.60 10

Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.

diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png index b1ec4b1d..a0ab03d1 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png differ diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png index 3bc10897..8189a9e9 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png index e85fcf12..07b95fbd 100644 Binary files a/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 309c4158..130e31fb 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 diff --git a/docs/articles/resistance_predict.html b/docs/articles/resistance_predict.html index 3ad919fe..95212fe6 100644 --- a/docs/articles/resistance_predict.html +++ b/docs/articles/resistance_predict.html @@ -41,7 +41,7 @@ AMR (for R) - 0.8.0 + 0.8.0.9032 @@ -187,7 +187,7 @@

How to predict antimicrobial resistance

Matthijs S. Berends

-

16 October 2019

+

18 November 2019

diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png index 7974a6c5..ecf3994d 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png index 1b425435..7c729e28 100644 Binary files a/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/authors.html b/docs/authors.html index a256fc58..6f9ff702 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 diff --git a/docs/extra.css b/docs/extra.css index c40042cc..2c97a9df 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -139,6 +139,11 @@ help { font-size: 1.5em; } +/* Beautify manually added 'Last updated' text of NEWS */ +div[id^=last-updated] h2 { + padding-top: 10px; +} + .version.label { display: none; } diff --git a/docs/index.html b/docs/index.html index 7e0c75e4..2dd54fee 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 @@ -200,8 +200,8 @@ A methods paper about this package has been preprinted at bioRxiv. It was update

What is AMR (for R)?

-

AMR is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 60 countries (source: CRAN logs, 2019).

-

After installing this package, R knows ~70,000 microorganisms (distinct microbial species) and ~450 antibiotics by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.

+

AMR is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 70 countries (source: CRAN logs, 2019).

+

After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.

We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software (see Copyright).

Used to SPSS? Read our tutorial on how to import data from SPSS, SAS or Stata.

@@ -297,7 +297,7 @@ A methods paper about this package has been preprinted at bioRxiv. It was update

Antimicrobial reference data

-

This package contains all ~450 antimicrobial drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission.

+

This package contains all ~550 antibiotic, antimycotic and antiviral drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission.

NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.

Read more about the data from WHOCC in our manual.

@@ -330,9 +330,9 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
  • 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() to determine which micro-organisms are multi-drug resistant organisms (MDRO). It supports a variety of international guidelines, such as the MDR-paper by Magiorakos et al. (2012, PMID 21793988), the exceptional phenotype definitions of EUCAST and the WHO guideline on multi-drug resistant TB. It also supports the national guidelines of the Netherlands and Germany.
  • The data set microorganisms contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which 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(), mo_gramstain() or even mo_phylum(). As they use as.mo() internally, they also use the same intelligent rules for determination. For example, mo_genus("MRSA") and mo_genus("S. aureus") will both return "Staphylococcus". They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
  • -
  • The data set antibiotics contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. The function ab_atc() will return the ATC code of an antibiotic as defined by the WHO. Use functions like ab_name(), ab_group() and ab_tradenames() to look up values. The ab_* functions use as.ab() internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox"), ab_name("Floxapen") and ab_name("J01CF05") will all return "Flucloxacillin". These functions can again be used to add new variables to your data.
  • +
  • The data set antibiotics contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like ab_name(), ab_group(), ab_atc() and ab_tradenames() to look up values. The ab_* functions use as.ab() internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox"), ab_name("Floxapen") and ab_name("J01CF05") will all return "Flucloxacillin". These functions can again be used to add new variables to your data.
  • @@ -349,13 +349,7 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
  • Aside from this website with many tutorials, the package itself contains extensive help pages with many examples for all functions.
  • The package also contains example data sets:
      -
    • The example_isolates data set. This data set contains: -
        -
      • 2,000 blood culture isolates from anonymised septic patients between 2001 and 2017 in the Northern Netherlands
      • -
      • Results of 40 antibiotics (each antibiotic in its own column) with a total ~40,000 antimicrobial results
      • -
      • Real and genuine data
      • -
      -
    • +
    • The example_isolates data set. This data set contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis.
    • The WHONET data set. This data set only contains fake data, but with the exact same structure as files exported by WHONET. Read more about WHONET on its tutorial page.
  • diff --git a/docs/news/index.html b/docs/news/index.html index 71eaf50d..50c6df90 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033
    @@ -231,11 +231,14 @@
    -
    +

    -AMR 0.8.0.9032 Unreleased +AMR 0.8.0.9033 Unreleased

    -

    Last updated: 15-Nov-2019

    +
    +

    +Last updated: 18-Nov-2019 +

    Breaking

    @@ -271,6 +274,7 @@
  • The new Verbose mode (mdro(...., verbose = TRUE)) returns an informative data set where the reason for MDRO determination is given for every isolate, and an list of the resistant antimicrobial agents
  • +
  • Data set antivirals, containing all entries from the ATC J05 group with their DDDs for oral and parenteral treatment

  • @@ -303,7 +307,7 @@
  • Improvements for eucast_rules():
    • Fix where Stenotrophomonas maltophilia would always become ceftazidime R (following EUCAST v3.1)
    • -
    • Fix where Leuconostoc and Pediococcus would not always become glyopeptides R
    • +
    • Fix where Leuconostoc and Pediococcus would not always become glycopeptides R
    • non-EUCAST rules in eucast_rules() are now applied first and not as last anymore. This is to improve the dependency on certain antibiotics for the official EUCAST rules. Please see ?eucast_rules.
  • @@ -314,6 +318,7 @@
  • Added ATC codes for ceftaroline, ceftobiprole and faropenem and fixed two typos in the antibiotics data set
  • More robust way of determining valid MIC values
  • +
  • Small changed to the example_isolates data set to better reflect reality
  • @@ -324,6 +329,7 @@
  • Added Dr. Sofia Ny as contributor
  • +

    @@ -1385,7 +1391,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

    diff --git a/docs/reference/AMR.html b/docs/reference/AMR.html index 7f3cb451..f13f14db 100644 --- a/docs/reference/AMR.html +++ b/docs/reference/AMR.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9030 + 0.8.0.9032
    diff --git a/docs/reference/WHOCC.html b/docs/reference/WHOCC.html index 20b13dd2..7b9565fb 100644 --- a/docs/reference/WHOCC.html +++ b/docs/reference/WHOCC.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 @@ -244,7 +244,7 @@


    -This package contains all ~450 antimicrobial drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    +This package contains all ~550 antibiotic, antimycotic and antiviral drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    These have become the gold standard for international drug utilisation monitoring and research.

    The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.

    NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.

    diff --git a/docs/reference/WHONET.html b/docs/reference/WHONET.html index 4cb5788b..7ab33ea1 100644 --- a/docs/reference/WHONET.html +++ b/docs/reference/WHONET.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/ab_property.html b/docs/reference/ab_property.html index 0832b935..79bfa8b1 100644 --- a/docs/reference/ab_property.html +++ b/docs/reference/ab_property.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/age.html b/docs/reference/age.html index 7b1cfb42..9ea06299 100644 --- a/docs/reference/age.html +++ b/docs/reference/age.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index 6996c161..77b2a19f 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/antibiotics.html b/docs/reference/antibiotics.html index 81cfbee0..4724a72b 100644 --- a/docs/reference/antibiotics.html +++ b/docs/reference/antibiotics.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 @@ -253,7 +253,7 @@
    abbr

    List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)

    synonyms

    Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID

    oral_ddd

    Defined Daily Dose (DDD), oral treatment

    -
    oral_units

    Units of ddd_units

    +
    oral_units

    Units of oral_ddd

    iv_ddd

    Defined Daily Dose (DDD), parenteral treatment

    iv_units

    Units of iv_ddd

    @@ -272,7 +272,7 @@


    -This package contains all ~450 antimicrobial drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    +This package contains all ~550 antibiotic, antimycotic and antiviral drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    These have become the gold standard for international drug utilisation monitoring and research.

    The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.

    NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.

    @@ -283,7 +283,7 @@ This package contains all ~450 antimicrobial drugs and their An

    On our website https://msberends.gitlab.io/AMR you can find a tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.

    See also

    -

    microorganisms

    +

    antivirals microorganisms

    @@ -273,7 +273,7 @@


    -This package contains all ~450 antimicrobial drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    +This package contains all ~550 antibiotic, antimycotic and antiviral drugs and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the Pharmaceuticals Community Register of the European Commission (http://ec.europa.eu/health/documents/community-register/html/atc.htm).

    These have become the gold standard for international drug utilisation monitoring and research.

    The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.

    NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.

    diff --git a/docs/reference/as.disk.html b/docs/reference/as.disk.html index 90ffcee0..61fa87ea 100644 --- a/docs/reference/as.disk.html +++ b/docs/reference/as.disk.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index 0826fd1a..88811896 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index ee6f6662..bb52836f 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9031 + 0.8.0.9032 diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 00f1d8ed..52caf178 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9030 + 0.8.0.9032 diff --git a/docs/reference/atc_online.html b/docs/reference/atc_online.html index ccf87195..730425d6 100644 --- a/docs/reference/atc_online.html +++ b/docs/reference/atc_online.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/availability.html b/docs/reference/availability.html index a251ca19..6d1646cc 100644 --- a/docs/reference/availability.html +++ b/docs/reference/availability.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9029 + 0.8.0.9032 diff --git a/docs/reference/bug_drug_combinations.html b/docs/reference/bug_drug_combinations.html index c55ecfc4..274b406a 100644 --- a/docs/reference/bug_drug_combinations.html +++ b/docs/reference/bug_drug_combinations.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/catalogue_of_life.html b/docs/reference/catalogue_of_life.html index 6bd0d959..08e5ff57 100644 --- a/docs/reference/catalogue_of_life.html +++ b/docs/reference/catalogue_of_life.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/catalogue_of_life_version.html b/docs/reference/catalogue_of_life_version.html index eea29753..77ceae90 100644 --- a/docs/reference/catalogue_of_life_version.html +++ b/docs/reference/catalogue_of_life_version.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/count.html b/docs/reference/count.html index e43891c4..e342195e 100644 --- a/docs/reference/count.html +++ b/docs/reference/count.html @@ -86,7 +86,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible( AMR (for R) - 0.8.0.9030 + 0.8.0.9032 diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 5372f500..09701e32 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -86,7 +86,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 0.8.0.9031 + 0.8.0.9032 @@ -394,7 +394,8 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied

    On our website https://msberends.gitlab.io/AMR you can find a tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.

    Examples

    -
    a <- data.frame(mo = c("Staphylococcus aureus",
    +    
    # \donttest{
    +a <- data.frame(mo = c("Staphylococcus aureus",
                            "Enterococcus faecalis",
                            "Escherichia coli",
                            "Klebsiella pneumoniae",
    @@ -429,7 +430,6 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
     # 5 Pseudomonas aeruginosa    R    R    -    -    R    R    R
     
     
    -# \donttest{
     # do not apply EUCAST rules, but rather get a data.frame
     # with 18 rows, containing all details about the transformations:
     c <- eucast_rules(a, verbose = TRUE)
    diff --git a/docs/reference/example_isolates.html b/docs/reference/example_isolates.html
    index 14bb5108..c213ba64 100644
    --- a/docs/reference/example_isolates.html
    +++ b/docs/reference/example_isolates.html
    @@ -6,7 +6,7 @@
     
     
     
    -Data set with 2,000 blood culture isolates — example_isolates • AMR (for R)
    +Data set with 2,000 example isolates — example_isolates • AMR (for R)
     
     
     
    @@ -50,8 +50,8 @@
       
       
     
    -
    -
    +
    +
     
     
     
    @@ -85,7 +85,7 @@
           
           
             AMR (for R)
    -        0.8.0.9027
    +        0.8.0.9032
           
         
     
    @@ -228,13 +228,13 @@
     
    -

    An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found 4 different hospitals in the Netherlands, between 2001 and 2017. This data.frame can be used to practice AMR analysis. For examples, please read the tutorial on our website.

    +

    A data set containing 2,000 microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read the tutorial on our website.

    example_isolates
    @@ -250,7 +250,7 @@
    ward_outpatient

    logical to determine if ward is an outpatient clinic

    age

    age of the patient

    gender

    gender of the patient

    -
    patient_id

    ID of the patient, first 10 characters of an SHA hash containing irretrievable information

    +
    patient_id

    ID of the patient

    mo

    ID of microorganism created with as.mo, see also microorganisms

    PEN:RIF

    40 different antibiotics with class rsi (see as.rsi); these column names occur in antibiotics data set and can be translated with ab_name

    diff --git a/docs/reference/extended-functions.html b/docs/reference/extended-functions.html index 279bf6e8..ec19c987 100644 --- a/docs/reference/extended-functions.html +++ b/docs/reference/extended-functions.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032
    diff --git a/docs/reference/filter_ab_class.html b/docs/reference/filter_ab_class.html index f3c0e4e0..25359ca9 100644 --- a/docs/reference/filter_ab_class.html +++ b/docs/reference/filter_ab_class.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9021 + 0.8.0.9032
    diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 84235158..565ce03f 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9029 + 0.8.0.9032 diff --git a/docs/reference/g.test.html b/docs/reference/g.test.html index 2e2ee242..b3f4246e 100644 --- a/docs/reference/g.test.html +++ b/docs/reference/g.test.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/ggplot_rsi.html b/docs/reference/ggplot_rsi.html index 36b1a078..fb78880d 100644 --- a/docs/reference/ggplot_rsi.html +++ b/docs/reference/ggplot_rsi.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9029 + 0.8.0.9032 diff --git a/docs/reference/guess_ab_col.html b/docs/reference/guess_ab_col.html index 2045ded8..ed78a93a 100644 --- a/docs/reference/guess_ab_col.html +++ b/docs/reference/guess_ab_col.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/index.html b/docs/reference/index.html index db35b2b9..1c0fe3da 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9032 + 0.8.0.9033 @@ -239,38 +239,6 @@ - - -

    Background information

    -

    Some pages about our package and its external sources. Be sure to read our How To’s for more information about how to work with functions in this package.

    - - - - - -

    AMR

    - -

    The AMR Package

    - - - -

    catalogue_of_life

    - -

    The Catalogue of Life

    - - - -

    catalogue_of_life_version()

    - -

    Version info of included Catalogue of Life

    - - - -

    WHOCC

    - -

    WHOCC: WHO Collaborating Centre for Drug Statistics Methodology

    - -

    Cleaning your data

    @@ -309,80 +277,50 @@

    Class 'rsi'

    - -

    set_mo_source() get_mo_source()

    - -

    Use predefined reference data set

    - -

    eucast_rules()

    EUCAST rules

    - -

    rsi_translation

    - -

    Data set for RSI interpretation

    - -

    guess_ab_col()

    Guess antibiotic column

    + +

    set_mo_source() get_mo_source()

    + +

    Use predefined reference data set

    + +

    read.4D()

    Read data from 4D database

    + + + +

    rsi_translation

    + +

    Data set for RSI interpretation

    -

    Adding variables to your data

    -

    Functions to add new data to existing data, like the determination of first isolates, multi-drug resistant microorganisms (MDRO), getting properties of microorganisms or antibiotics and determining the age of patients or divide ages into age groups.

    +

    Enhancing your data

    +

    Functions to add new data to your existing data, such as the determination of first isolates, multi-drug resistant microorganisms (MDRO), getting properties of microorganisms or antibiotics and determining the age of patients or divide ages into age groups.

    - -

    first_isolate() filter_first_isolate() filter_first_weighted_isolate()

    - -

    Determine first (weighted) isolates

    - - - -

    mdro() brmo() mrgn() mdr_tb() mdr_cmi2012() eucast_exceptional_phenotypes()

    - -

    Determine multidrug-resistant organisms (MDRO)

    - - - -

    key_antibiotics() key_antibiotics_equal()

    - -

    Key antibiotics for first weighted isolates

    - - - -

    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_synonyms() mo_info() mo_url() mo_property()

    - -

    Property of a microorganism

    - -

    ab_name() ab_atc() ab_cid() ab_synonyms() ab_tradenames() ab_group() ab_atc_group1() ab_atc_group2() ab_ddd() ab_info() ab_property()

    Property of an antibiotic

    - -

    age()

    - -

    Age in years of individuals

    - -

    age_groups()

    @@ -390,9 +328,21 @@ -

    p_symbol()

    +

    age()

    -

    Symbol of a p value

    +

    Age in years of individuals

    + + + +

    atc_online_property() atc_online_groups() atc_online_ddd()

    + +

    Get ATC properties from WHOCC website

    + + + +

    first_isolate() filter_first_isolate() filter_first_weighted_isolate()

    + +

    Determine first (weighted) isolates

    @@ -402,9 +352,27 @@ -

    atc_online_property() atc_online_groups() atc_online_ddd()

    +

    key_antibiotics() key_antibiotics_equal()

    -

    Get ATC properties from WHOCC website

    +

    Key antibiotics for first weighted isolates

    + + + +

    mdro() brmo() mrgn() mdr_tb() mdr_cmi2012() eucast_exceptional_phenotypes()

    + +

    Determine multidrug-resistant organisms (MDRO)

    + + + +

    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_synonyms() mo_info() mo_url() mo_property()

    + +

    Property of a microorganism

    + + + +

    p_symbol()

    + +

    Symbol of a p value

    @@ -433,12 +401,6 @@

    Count isolates

    - -

    resistance() susceptibility() proportion_R() proportion_IR() proportion_I() proportion_SI() proportion_S() proportion_df() rsi_df()

    - -

    Calculate microbial resistance

    - -

    filter_ab_class() filter_aminoglycosides() filter_carbapenems() filter_cephalosporins() filter_1st_cephalosporins() filter_2nd_cephalosporins() filter_3rd_cephalosporins() filter_4th_cephalosporins() filter_5th_cephalosporins() filter_fluoroquinolones() filter_glycopeptides() filter_macrolides() filter_tetracyclines()

    @@ -463,6 +425,12 @@

    Kurtosis of the sample

    + +

    resistance() susceptibility() proportion_R() proportion_IR() proportion_I() proportion_SI() proportion_S() proportion_df() rsi_df()

    + +

    Calculate microbial resistance

    + +

    resistance_predict() rsi_predict() plot(<resistance_predict>) ggplot_rsi_predict()

    @@ -478,7 +446,7 @@

    Included data sets

    -

    References for microorganisms and antibiotics, and even a genuine data set with isolates from septic patients.

    +

    Scientifically reliable references for microorganisms and antibiotics, and example data sets to use for practise.

    @@ -490,21 +458,15 @@ -

    microorganisms

    +

    antivirals

    -

    Data set with ~70,000 microorganisms

    +

    Data set with ~100 antivirals

    example_isolates

    -

    Data set with 2,000 blood culture isolates

    - - - -

    WHONET

    - -

    Data set with 500 isolates - WHONET example

    +

    Data set with 2,000 example isolates

    @@ -517,6 +479,50 @@

    microorganisms.old

    Data set with previously accepted taxonomic names

    + + + +

    microorganisms

    + +

    Data set with ~70,000 microorganisms

    + + + +

    WHONET

    + +

    Data set with 500 isolates - WHONET example

    + + + + +

    Background information

    +

    Some pages about our package and its external sources. Be sure to read our How To’s for more information about how to work with functions in this package.

    + + + + + +

    AMR

    + +

    The AMR Package

    + + + +

    catalogue_of_life

    + +

    The Catalogue of Life

    + + + +

    catalogue_of_life_version()

    + +

    Version info of included Catalogue of Life

    + + + +

    WHOCC

    + +

    WHOCC: WHO Collaborating Centre for Drug Statistics Methodology

    @@ -551,12 +557,18 @@

    scale_type.mo() scale_type.ab()

    Extended functions

    + + + +

    reexports

    + +

    Objects exported from other packages

    functions

    -

    These functions are deprecated, meaning that they still work but show a warning with every use and will be removed in a future version.

    +

    These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed in a future version.

    @@ -573,11 +585,11 @@ diff --git a/docs/reference/key_antibiotics.html b/docs/reference/key_antibiotics.html index ba5f9e2d..f79575ea 100644 --- a/docs/reference/key_antibiotics.html +++ b/docs/reference/key_antibiotics.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/kurtosis.html b/docs/reference/kurtosis.html index 8aeb49e9..29b19287 100644 --- a/docs/reference/kurtosis.html +++ b/docs/reference/kurtosis.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/like.html b/docs/reference/like.html index 6111c680..f9aefc61 100644 --- a/docs/reference/like.html +++ b/docs/reference/like.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index 36f0ddb0..1a449711 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9030 + 0.8.0.9032 @@ -419,22 +419,17 @@

    On our website https://msberends.gitlab.io/AMR you can find a tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.

    Examples

    -
    library(dplyr)
    +    
    # \donttest{
    +library(dplyr)
     
     example_isolates %>%
       mdro() %>%
       freq()
     
    -# \donttest{
     example_isolates %>%
       mutate(EUCAST = eucast_exceptional_phenotypes(.),
              BRMO = brmo(.),
              MRGN = mrgn(.))
    -
    -example_isolates %>%
    -  rename(PIP = TZP) %>% # no piperacillin, so take piperacillin/tazobactam
    -  mrgn() %>%            # check German guideline
    -  freq()                # check frequencies
     # }
    diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index c9199617..c0692755 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/microorganisms.old.html b/docs/reference/microorganisms.old.html index 8484316a..cea10cb0 100644 --- a/docs/reference/microorganisms.old.html +++ b/docs/reference/microorganisms.old.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index c8f4e454..62ccf34b 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html index f35068a4..161ded70 100644 --- a/docs/reference/mo_source.html +++ b/docs/reference/mo_source.html @@ -86,7 +86,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/p_symbol.html b/docs/reference/p_symbol.html index b4f99832..36779c4d 100644 --- a/docs/reference/p_symbol.html +++ b/docs/reference/p_symbol.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/proportion.html b/docs/reference/proportion.html index 356d678f..9e2d044b 100644 --- a/docs/reference/proportion.html +++ b/docs/reference/proportion.html @@ -86,7 +86,7 @@ resistance() should be used to calculate resistance, susceptibility() should be AMR (for R) - 0.8.0.9030 + 0.8.0.9032 diff --git a/docs/reference/read.4D.html b/docs/reference/read.4D.html index 6bb71a21..84db8e42 100644 --- a/docs/reference/read.4D.html +++ b/docs/reference/read.4D.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index c4947971..f3a5db5e 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -90,7 +90,7 @@ below to see their documentation. AMR (for R) - 0.8.0.9021 + 0.8.0.9032 diff --git a/docs/reference/resistance_predict.html b/docs/reference/resistance_predict.html index 0d1cc210..37ca3826 100644 --- a/docs/reference/resistance_predict.html +++ b/docs/reference/resistance_predict.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9031 + 0.8.0.9032 diff --git a/docs/reference/rsi_translation.html b/docs/reference/rsi_translation.html index d061e360..2f74af5e 100644 --- a/docs/reference/rsi_translation.html +++ b/docs/reference/rsi_translation.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 @@ -242,16 +242,16 @@

    Format

    -

    A data.frame with 11,559 observations and 9 variables:

    +

    A data.frame with 13,975 observations and 9 variables:

    guideline

    Name of the guideline

    +
    method

    Either "MIC" or "DISK"

    +
    site

    Body site, e.g. "Oral" or "Respiratory"

    mo

    Microbial ID, see as.mo

    ab

    Antibiotic ID, see as.ab

    ref_tbl

    Info about where the guideline rule can be found

    -
    S_mic

    Lowest MIC value that leads to "S"

    -
    R_mic

    Highest MIC value that leads to "R"

    -
    dose_disk

    Dose of the used disk diffusion method

    -
    S_disk

    Lowest number of millimeters that leads to "S"

    -
    R_disk

    Highest number of millimeters that leads to "R"

    +
    disk_dose

    Dose of the used disk diffusion method

    +
    breakpoint_S

    Lowest MIC value or highest number of millimeters that leads to "S"

    +
    breakpoint_R

    Highest MIC value or lowest number of millimeters that leads to "R"

    Read more on our website!

    diff --git a/docs/reference/skewness.html b/docs/reference/skewness.html index 09fbc614..a5841cb6 100644 --- a/docs/reference/skewness.html +++ b/docs/reference/skewness.html @@ -86,7 +86,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/reference/translate.html b/docs/reference/translate.html index e1c442e9..8c7d326d 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -85,7 +85,7 @@ AMR (for R) - 0.8.0.9027 + 0.8.0.9032 diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 092414d3..131eb24d 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -27,6 +27,9 @@ https://msberends.gitlab.io/AMR/reference/antibiotics.html + + https://msberends.gitlab.io/AMR/reference/antivirals.html + https://msberends.gitlab.io/AMR/reference/as.ab.html diff --git a/git_premaster.sh b/git_premaster.sh index f53c316d..190194a5 100755 --- a/git_premaster.sh +++ b/git_premaster.sh @@ -37,7 +37,7 @@ sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION # update 1st line of NEWS.md sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md # add date to 2nd line of NEWS.md -sed -i -- "2s/.*/\Last updated: $(date '+%d-%b-%Y')\<\/small\>/" NEWS.md +sed -i -- "2s/.*/## \Last updated: $(date '+%d-%b-%Y')\<\/small\>/" NEWS.md rm *-- || true echo "• First 3 lines of DESCRIPTION:" head -3 DESCRIPTION diff --git a/index.md b/index.md index 3965e0e7..c153a5ce 100644 --- a/index.md +++ b/index.md @@ -10,9 +10,9 @@ ### What is `AMR` (for R)? -`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 60 countries (source: [CRAN logs, 2019](https://cran-logs.rstudio.com)). +`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Since its first public release in early 2018, this package has been downloaded over 25,000 times from more than 70 countries (source: [CRAN logs, 2019](https://cran-logs.rstudio.com)). -After installing this package, R knows [**~70,000 microorganisms**](./reference/microorganisms.html) (distinct microbial species) and [**~450 antibiotics**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data. +After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data. We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is [actively maintained](./news) and is free software (see [Copyright](#copyright)). @@ -109,7 +109,7 @@ Read more about which data from the Catalogue of Life [in our manual](./referenc #### Antimicrobial reference data -This package contains **all ~450 antimicrobial drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the [Pharmaceuticals Community Register of the European Commission](http://ec.europa.eu/health/documents/community-register/html/atc.htm). +This package contains **all ~550 antibiotic, antimycotic and antiviral drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, https://www.whocc.no) and the [Pharmaceuticals Community Register of the European Commission](http://ec.europa.eu/health/documents/community-register/html/atc.htm). **NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See https://www.whocc.no/copyright_disclaimer/.** @@ -137,9 +137,9 @@ The `AMR` package basically does four important things: * Use `eucast_rules()` to apply [EUCAST expert rules to isolates](http://www.eucast.org/expert_rules_and_intrinsic_resistance/) (not the translation from MIC to RSI values, use `as.rsi()` for that). * 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. - * 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()` to determine which micro-organisms are multi-drug resistant organisms (MDRO). It supports a variety of international guidelines, such as the MDR-paper by Magiorakos *et al.* (2012, [PMID 21793988](https://www.ncbi.nlm.nih.gov/pubmed/?term=21793988)), the exceptional phenotype definitions of EUCAST and the WHO guideline on multi-drug resistant TB. It also supports the national guidelines of the Netherlands and Germany. * The [data set `microorganisms`](./reference/microorganisms.html) contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which 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()`, `mo_gramstain()` or even `mo_phylum()`. As they use `as.mo()` internally, they also use the same intelligent rules for determination. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data. - * The [data set `antibiotics`](./reference/antibiotics.html) contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. The function `ab_atc()` will return the ATC code of an antibiotic as defined by the WHO. Use functions like `ab_name()`, `ab_group()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data. + * The [data set `antibiotics`](./reference/antibiotics.html) contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like `ab_name()`, `ab_group()`, `ab_atc()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("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. @@ -151,10 +151,7 @@ The `AMR` package basically does four important things: * Aside from this website with many tutorials, the package itself contains extensive help pages with many examples for all functions. * The package also contains example data sets: - * The [`example_isolates` data set](./reference/example_isolates.html). This data set contains: - * 2,000 blood culture isolates from anonymised septic patients between 2001 and 2017 in the Northern Netherlands - * Results of 40 antibiotics (each antibiotic in its own column) with a total ~40,000 antimicrobial results - * Real and genuine data + * The [`example_isolates` data set](./reference/example_isolates.html). This data set contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. * The [`WHONET` data set](./reference/WHONET.html). This data set only contains fake data, but with the exact same structure as files exported by WHONET. Read more about WHONET [on its tutorial page](./articles/WHONET.html). ### Copyright diff --git a/man/WHOCC.Rd b/man/WHOCC.Rd index ef6aa3dc..c99c8ec1 100644 --- a/man/WHOCC.Rd +++ b/man/WHOCC.Rd @@ -9,7 +9,7 @@ All antimicrobial drugs and their official names, ATC codes, ATC groups and defi \section{WHOCC}{ \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} -This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). +This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). These have become the gold standard for international drug utilisation monitoring and research. diff --git a/man/antibiotics.Rd b/man/antibiotics.Rd index 8b1e37ea..e694bf2c 100644 --- a/man/antibiotics.Rd +++ b/man/antibiotics.Rd @@ -16,7 +16,7 @@ \item{\code{abbr}}{List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)} \item{\code{synonyms}}{Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID} \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} - \item{\code{oral_units}}{Units of \code{ddd_units}} + \item{\code{oral_units}}{Units of \code{oral_ddd}} \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} \item{\code{iv_units}}{Units of \code{iv_ddd}} }} @@ -41,7 +41,7 @@ Synonyms (i.e. trade names) are derived from the Compound ID (\code{cid}) and co \section{WHOCC}{ \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} -This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). +This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). These have become the gold standard for international drug utilisation monitoring and research. @@ -56,6 +56,6 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// } \seealso{ -\code{\link{microorganisms}} +\code{\link{antivirals}} \code{\link{microorganisms}} } \keyword{datasets} diff --git a/man/antivirals.Rd b/man/antivirals.Rd new file mode 100644 index 00000000..a3306fd8 --- /dev/null +++ b/man/antivirals.Rd @@ -0,0 +1,46 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{antivirals} +\alias{antivirals} +\title{Data set with ~100 antivirals} +\format{A \code{\link{data.frame}} with 102 observations and 7 variables: +\describe{ + \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC} + \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO} + \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC} + \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment} + \item{\code{oral_units}}{Units of \code{oral_ddd}} + \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment} + \item{\code{iv_units}}{Units of \code{iv_ddd}} +}} +\source{ +World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/} +} +\usage{ +antivirals +} +\description{ +A data set containing all antivirals, according to the ATC code group 'J05' (Antivirals for systemic use). +} +\section{WHOCC}{ + +\if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} +This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). + +These have become the gold standard for international drug utilisation monitoring and research. + +The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest. + +\strong{NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.} +} + +\section{Read more on our website!}{ + +On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}. +} + +\seealso{ +\code{\link{antibiotics}} \code{\link{microorganisms}} +} +\keyword{datasets} diff --git a/man/as.ab.Rd b/man/as.ab.Rd index 745b185c..bfdf2c8a 100644 --- a/man/as.ab.Rd +++ b/man/as.ab.Rd @@ -37,7 +37,7 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt \section{WHOCC}{ \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr} -This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). +This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}). These have become the gold standard for international drug utilisation monitoring and research. diff --git a/man/eucast_rules.Rd b/man/eucast_rules.Rd index 24b6e799..764eed66 100644 --- a/man/eucast_rules.Rd +++ b/man/eucast_rules.Rd @@ -158,6 +158,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// } \examples{ +\donttest{ a <- data.frame(mo = c("Staphylococcus aureus", "Enterococcus faecalis", "Escherichia coli", @@ -193,7 +194,6 @@ b # 5 Pseudomonas aeruginosa R R - - R R R -\donttest{ # do not apply EUCAST rules, but rather get a data.frame # with 18 rows, containing all details about the transformations: c <- eucast_rules(a, verbose = TRUE) diff --git a/man/example_isolates.Rd b/man/example_isolates.Rd index 456de6cf..e94b7182 100644 --- a/man/example_isolates.Rd +++ b/man/example_isolates.Rd @@ -3,7 +3,7 @@ \docType{data} \name{example_isolates} \alias{example_isolates} -\title{Data set with 2,000 blood culture isolates} +\title{Data set with 2,000 example isolates} \format{A \code{\link{data.frame}} with 2,000 observations and 49 variables: \describe{ \item{\code{date}}{date of receipt at the laboratory} @@ -13,7 +13,7 @@ \item{\code{ward_outpatient}}{logical to determine if ward is an outpatient clinic} \item{\code{age}}{age of the patient} \item{\code{gender}}{gender of the patient} - \item{\code{patient_id}}{ID of the patient, first 10 characters of an SHA hash containing irretrievable information} + \item{\code{patient_id}}{ID of the patient} \item{\code{mo}}{ID of microorganism created with \code{\link{as.mo}}, see also \code{\link{microorganisms}}} \item{\code{PEN:RIF}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{ab_name}}} }} @@ -21,7 +21,7 @@ example_isolates } \description{ -An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found 4 different hospitals in the Netherlands, between 2001 and 2017. This \code{data.frame} can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}. +A data set containing 2,000 microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}. } \section{Read more on our website!}{ diff --git a/man/mdro.Rd b/man/mdro.Rd index 976875dc..56558457 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -184,21 +184,16 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// } \examples{ +\donttest{ library(dplyr) example_isolates \%>\% mdro() \%>\% freq() -\donttest{ example_isolates \%>\% mutate(EUCAST = eucast_exceptional_phenotypes(.), BRMO = brmo(.), MRGN = mrgn(.)) - -example_isolates \%>\% - rename(PIP = TZP) \%>\% # no piperacillin, so take piperacillin/tazobactam - mrgn() \%>\% # check German guideline - freq() # check frequencies } } diff --git a/man/rsi_translation.Rd b/man/rsi_translation.Rd index 0f97422d..2c558b74 100644 --- a/man/rsi_translation.Rd +++ b/man/rsi_translation.Rd @@ -4,17 +4,17 @@ \name{rsi_translation} \alias{rsi_translation} \title{Data set for RSI interpretation} -\format{A \code{\link{data.frame}} with 11,559 observations and 9 variables: +\format{A \code{\link{data.frame}} with 13,975 observations and 9 variables: \describe{ \item{\code{guideline}}{Name of the guideline} + \item{\code{method}}{Either "MIC" or "DISK"} + \item{\code{site}}{Body site, e.g. "Oral" or "Respiratory"} \item{\code{mo}}{Microbial ID, see \code{\link{as.mo}}} \item{\code{ab}}{Antibiotic ID, see \code{\link{as.ab}}} \item{\code{ref_tbl}}{Info about where the guideline rule can be found} - \item{\code{S_mic}}{Lowest MIC value that leads to "S"} - \item{\code{R_mic}}{Highest MIC value that leads to "R"} - \item{\code{dose_disk}}{Dose of the used disk diffusion method} - \item{\code{S_disk}}{Lowest number of millimeters that leads to "S"} - \item{\code{R_disk}}{Highest number of millimeters that leads to "R"} + \item{\code{disk_dose}}{Dose of the used disk diffusion method} + \item{\code{breakpoint_S}}{Lowest MIC value or highest number of millimeters that leads to "S"} + \item{\code{breakpoint_R}}{Highest MIC value or lowest number of millimeters that leads to "R"} }} \usage{ rsi_translation diff --git a/pkgdown/extra.css b/pkgdown/extra.css index c40042cc..2c97a9df 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -139,6 +139,11 @@ help { font-size: 1.5em; } +/* Beautify manually added 'Last updated' text of NEWS */ +div[id^=last-updated] h2 { + padding-top: 10px; +} + .version.label { display: none; } diff --git a/tests/testthat/test-first_isolate.R b/tests/testthat/test-first_isolate.R index 1829e6ad..4e136d33 100755 --- a/tests/testthat/test-first_isolate.R +++ b/tests/testthat/test-first_isolate.R @@ -99,7 +99,7 @@ test_that("first isolates work", { info = TRUE, icu_exclude = TRUE), na.rm = TRUE), - 1163) + 906) # set 1500 random observations to be of specimen type 'Urine' random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE) diff --git a/vignettes/AMR.Rmd b/vignettes/AMR.Rmd index 74083d5d..774a5eb5 100755 --- a/vignettes/AMR.Rmd +++ b/vignettes/AMR.Rmd @@ -459,7 +459,7 @@ data_1st %>% ## Independence test -The next example uses the included `example_isolates`, which is an anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found in septic patients in 4 different hospitals in the Netherlands, between 2001 and 2017. This `data.frame` can be used to practice AMR analysis. +The next example uses the `example_isolates` data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. We will compare the resistance to fosfomycin (column `FOS`) in hospital A and D. The input for the `fisher.test()` can be retrieved with a transformation like this: diff --git a/vignettes/MDR.Rmd b/vignettes/MDR.Rmd index aa57f0d2..58b75122 100644 --- a/vignettes/MDR.Rmd +++ b/vignettes/MDR.Rmd @@ -21,11 +21,11 @@ knitr::opts_chunk$set( library(AMR) ``` -With the function `mdro()`, you can determine multi-drug resistant organisms (MDRO). +With the function `mdro()`, you can determine which micro-organisms are multi-drug resistant organisms (MDRO). #### Type of input -The `mdro()` takes a data set as input, such as a regular `data.frame`. It automatically determines the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command `?mdro`. +The `mdro()` function takes a data set as input, such as a regular `data.frame`. It tries to automatically determine the right columns for info about your isolates, like the name of the species and all columns with results of antimicrobial agents. See the help page for more info about how to set the right settings for your data with the command `?mdro`. For WHONET data (and most other data), all settings are automatically set correctly. @@ -51,7 +51,9 @@ The function support multiple guidelines. You can select a guideline with the `g #### Examples -The `mdro()` function always returns an ordered `factor`. For example, the output of the default guideline by Magiorakos *et al.* returns a `factor` with levels 'Negative', 'MDR', 'XDR' or 'PDR' in that order. If we test that guideline on the included `example_isolates` data set, we get: +The `mdro()` function always returns an ordered `factor`. For example, the output of the default guideline by Magiorakos *et al.* returns a `factor` with levels 'Negative', 'MDR', 'XDR' or 'PDR' in that order. + +The next example uses the `example_isolates` data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get: ```{r, message = FALSE} library(dplyr) # to support pipes: %>% @@ -62,7 +64,7 @@ example_isolates %>% freq() # show frequency table of the result ``` ```{r, echo = FALSE, results = 'asis', message = FALSE, warning = FALSE} -library(dplyr) # to support pipes: %>% +library(dplyr) example_isolates %>% mdro(info = FALSE) %>% freq() # show frequency table of the result