diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b150183..865d8be9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,13 +20,13 @@ # ==================================================================== # # to do a full CRAN check with R-Hub: -# chck <- rhub::check(devtools::build(), platform = c('debian-clang-devel', 'debian-gcc-devel', 'fedora-clang-devel', 'fedora-gcc-devel', 'windows-x86_64-devel', 'debian-gcc-patched', 'solaris-x86-patched', 'debian-gcc-release', 'windows-x86_64-release', 'macos-elcapitan-release', 'windows-x86_64-oldrel')) +# chck <- rhub::check(devtools::build(), platform = rhub::platforms()[!is.na(rhub::platforms()$`cran-name`), 'name']) stages: - check - lint - - coverage - website + - coverage image: rocker/r-base @@ -35,7 +35,7 @@ before_script: # install dependencies for packages - apt-get install -y wget locales libxml2-dev libssl-dev libcurl4-openssl-dev zlib1g-dev > /dev/null # recent pandoc - - wget --quiet https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb + - wget --quiet https://github.com/jgm/pandoc/releases/download/2.9.2.1/pandoc-2.9.2.1-1-amd64.deb - dpkg -i pandoc*.deb - rm pandoc*.deb # set R system language @@ -74,7 +74,7 @@ R-release: - '*.Rcheck/*' expire_in: '1 month' cache: - key: r350 + key: release_4_0 paths: - installed_deps/ @@ -100,7 +100,7 @@ R-devel: - '*.Rcheck/*' expire_in: '1 month' cache: - key: r360 + key: devel_4_1 paths: - installed_deps/ @@ -109,7 +109,7 @@ lintr: allow_failure: true when: on_success cache: - key: r350 + key: release_4_0 paths: - installed_deps/ policy: pull # no uploading after run @@ -120,12 +120,23 @@ lintr: # check all syntax with lintr - Rscript -e 'lintr::lint_package()' +pages: + stage: website + when: always + only: + - master + script: + - mv docs public + artifacts: + paths: + - public + codecovr: stage: coverage allow_failure: true when: on_success cache: - key: r350 + key: release_4_0 paths: - installed_deps/ policy: pull # no uploading after run @@ -138,14 +149,3 @@ codecovr: # Sys.setenv(NOT_CRAN = 'true'), because otherwise skip_on_cran() will be applied on Covr too, resulting in extremely low coverage percentages - Rscript -e "Sys.setenv(NOT_CRAN = 'true'); cc <- covr::package_coverage(line_exclusions = list('R/atc_online.R', 'R/mo_history.R', 'R/mo_source.R', 'R/resistance_predict.R')); covr::codecov(coverage = cc, token = '$codecov'); cat('Code coverage:', covr::percent_coverage(cc))" coverage: '/Code coverage: \d+\.\d+/' - -pages: - stage: website - when: always - only: - - master - script: - - mv docs public - artifacts: - paths: - - public diff --git a/DESCRIPTION b/DESCRIPTION index d1a8740a..4dbc26f6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.1.0 -Date: 2020-04-15 +Version: 1.1.0.9000 +Date: 2020-04-29 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NAMESPACE b/NAMESPACE index c44fab9e..16f0244e 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -66,11 +66,20 @@ S3method(skewness,matrix) S3method(summary,mic) S3method(summary,mo) S3method(summary,rsi) +S3method(vec_cast,character.ab) S3method(vec_cast,character.mo) -S3method(vec_cast,mo) -S3method(vec_cast,mo.character) -S3method(vec_cast,mo.mo) -S3method(vec_ptype2,mo) +S3method(vec_cast.ab,ab) +S3method(vec_cast.ab,character) +S3method(vec_cast.ab,default) +S3method(vec_cast.mo,character) +S3method(vec_cast.mo,default) +S3method(vec_cast.mo,mo) +S3method(vec_ptype2.ab,character) +S3method(vec_ptype2.ab,default) +S3method(vec_ptype2.character,ab) +S3method(vec_ptype2.character,mo) +S3method(vec_ptype2.mo,character) +S3method(vec_ptype2.mo,default) S3method(vec_ptype_abbr,ab) S3method(vec_ptype_abbr,disk) S3method(vec_ptype_abbr,mic) @@ -222,6 +231,10 @@ export(set_mo_source) export(skewness) export(susceptibility) export(theme_rsi) +export(vec_cast.ab) +export(vec_cast.mo) +export(vec_ptype2.ab) +export(vec_ptype2.mo) exportMethods("[.ab") exportMethods("[.disk") exportMethods("[.mic") @@ -282,6 +295,18 @@ exportMethods(skewness.matrix) exportMethods(summary.mic) exportMethods(summary.mo) exportMethods(summary.rsi) +exportMethods(vec_cast.character.ab) +exportMethods(vec_cast.character.mo) +exportMethods(vec_ptype_abbr.ab) +exportMethods(vec_ptype_abbr.disk) +exportMethods(vec_ptype_abbr.mic) +exportMethods(vec_ptype_abbr.mo) +exportMethods(vec_ptype_abbr.rsi) +exportMethods(vec_ptype_full.ab) +exportMethods(vec_ptype_full.disk) +exportMethods(vec_ptype_full.mic) +exportMethods(vec_ptype_full.mo) +exportMethods(vec_ptype_full.rsi) importFrom(R6,R6Class) importFrom(cleaner,freq) importFrom(cleaner,freq.default) @@ -372,6 +397,6 @@ importFrom(utils,adist) importFrom(utils,browseURL) importFrom(utils,menu) importFrom(vctrs,vec_cast) -importFrom(vctrs,vec_ptype2) +importFrom(vctrs,vec_ptype2.character) importFrom(vctrs,vec_ptype_abbr) importFrom(vctrs,vec_ptype_full) diff --git a/NEWS.md b/NEWS.md index 4a3a83cc..5d88146f 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,12 @@ -# AMR 1.1.0 +# AMR 1.1.0.9000 +## Last updated: 29-Apr-2020 +### Changed +* Small fix for some text input that could not be coerced as valid MIC values +* Better support for the tidyverse. The tidyverse now heavily relies on the `vctrs` package for data transformation and data joining. In newer versions of e.g. the `dplyr` package, a function like `bind_rows()` would not preserve the right class for microorganisms (class `mo`) and antibiotics (class `ab`). This is fixed in this version. +* Fixed interpretation of generic CLSI interpretation rules (thanks to Anthony Underwood) + +# AMR 1.1.0 ### New * Support for easy principal component analysis for AMR, using the new `pca()` function diff --git a/R/ab.R b/R/ab.R index b010a3ce..0e5de7f9 100755 --- a/R/ab.R +++ b/R/ab.R @@ -405,18 +405,6 @@ c.ab <- function(x, ...) { class_integrity_check(y, "antimicrobial code", antibiotics$ab) } -#' @importFrom vctrs vec_ptype_abbr -#' @export -vec_ptype_abbr.ab <- function(x, ...) { - "ab" -} - -#' @importFrom vctrs vec_ptype_full -#' @export -vec_ptype_full.ab <- function(x, ...) { - "ab" -} - #' @importFrom pillar pillar_shaft #' @export pillar_shaft.ab <- function(x, ...) { diff --git a/R/data.R b/R/data.R index 880c47f2..ddd0f041 100755 --- a/R/data.R +++ b/R/data.R @@ -59,7 +59,7 @@ #' * #' * #' -#' Files in R format (which data structure) can be found here: +#' Files in R format (with preserved data structure) can be found here: #' #' * #' * @@ -105,7 +105,7 @@ #' #' * #' -#' The file in R format (which data structure) can be found here: +#' The file in R format (with preserved data structure) can be found here: #' #' * #' @section About the records from DSMZ (see source): diff --git a/R/disk.R b/R/disk.R index 0bb5e463..aac7303a 100644 --- a/R/disk.R +++ b/R/disk.R @@ -127,18 +127,6 @@ pillar_shaft.disk <- function(x, ...) { pillar::new_pillar_shaft_simple(out, align = "right", min_width = 3) } -#' @importFrom vctrs vec_ptype_abbr -#' @export -vec_ptype_abbr.disk <- function(x, ...) { - "disk" -} - -#' @importFrom vctrs vec_ptype_full -#' @export -vec_ptype_full.disk <- function(x, ...) { - "disk" -} - #' @exportMethod [.disk #' @export #' @noRd diff --git a/R/mic.R b/R/mic.R index 37864df5..df325aae 100755 --- a/R/mic.R +++ b/R/mic.R @@ -75,7 +75,7 @@ as.mic <- function(x, na.rm = FALSE) { x <- gsub("=>", ">=", x, fixed = TRUE) # starting dots must start with 0 x <- gsub("^[.]+", "0.", x) - # <=0.2560.512 should be 0.512 + # values like "<=0.2560.512" should be 0.512 x <- gsub(".*[.].*[.]", "0.", x) # remove ending .0 x <- gsub("[.]+0$", "", x) @@ -90,11 +90,13 @@ as.mic <- function(x, na.rm = FALSE) { x <- gsub("(.*[.])0+$", "\\10", x) # remove ending .0 again x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"]) + # never end with dot + x <- gsub("[.]$", "", x) # force to be character x <- as.character(x) # trim it x <- trimws(x) - + ## previously unempty values now empty - should return a warning later on x[x.bak != "" & x == ""] <- "invalid" @@ -235,18 +237,6 @@ barplot.mic <- function(height, axis(2, seq(0, max(table(droplevels.factor(height))))) } -#' @importFrom vctrs vec_ptype_abbr -#' @export -vec_ptype_abbr.mic <- function(x, ...) { - "mic" -} - -#' @importFrom vctrs vec_ptype_full -#' @export -vec_ptype_full.mic <- function(x, ...) { - "mic" -} - #' @importFrom pillar pillar_shaft #' @export pillar_shaft.mic <- function(x, ...) { diff --git a/R/mo.R b/R/mo.R index 5d5b8309..5ee7bc05 100755 --- a/R/mo.R +++ b/R/mo.R @@ -1671,48 +1671,6 @@ print.mo <- function(x, ...) { print.default(x, quote = FALSE) } -#' @importFrom vctrs vec_ptype_abbr -#' @export -vec_ptype_abbr.mo <- function(x, ...) { - "mo" -} - -#' @importFrom vctrs vec_ptype_full -#' @export -vec_ptype_full.mo <- function(x, ...) { - "mo" -} - -#' @importFrom vctrs vec_ptype2 -#' @export -vec_ptype2.mo <- function(x, y, ...) { - vctrs::vec_ptype2(x = as.character(x), y = as.character(y), ...) -} - -#' @importFrom vctrs vec_cast -#' @export -vec_cast.mo <- function(x, to, ...) { - as.mo(vctrs::vec_cast(x = as.character(x), to = as.character(to), ...)) -} - -#' @importFrom vctrs vec_cast -#' @export -vec_cast.mo.mo <- function(x, to, ...) { - as.mo(vctrs::vec_cast(x = as.character(x), to = as.character(to), ...)) -} - -#' @importFrom vctrs vec_cast -#' @export -vec_cast.mo.character <- function(x, to, ...) { - vctrs::vec_cast(x = as.character(x), to = as.character(to), ...) -} - -#' @importFrom vctrs vec_cast -#' @export -vec_cast.character.mo <- function(x, to, ...) { - as.mo(vctrs::vec_cast(x = as.character(x), to = as.character(to), ...)) -} - #' @importFrom pillar pillar_shaft #' @export pillar_shaft.mo <- function(x, ...) { diff --git a/R/mo_property.R b/R/mo_property.R index c18724c7..1e4f29f1 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -32,6 +32,8 @@ #' - `mo_ref("Chlamydia psittaci")` will return `"Page, 1968"` (with a warning about the renaming) #' - `mo_ref("Chlamydophila psittaci")` will return `"Everett et al., 1999"` (without a warning) #' +#' The short name - [mo_shortname()] - almost always returns the first character of the genus and the full species, like *"E. coli"*. Exceptions are abbreviations of staphylococci and beta-haemolytic streptococci, like *"CoNS"* (Coagulase-Negative Staphylococci) and *"GBS"* (Group B Streptococci). +#' #' The Gram stain - [mo_gramstain()] - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. #' #' All output will be [translate]d where possible. diff --git a/R/rsi.R b/R/rsi.R index 4d317f94..1715b6ca 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -423,7 +423,7 @@ exec_as.rsi <- function(method, x, mo, ab, guideline, uti) { mo_order <- as.mo(mo_order(mo)) mo_becker <- as.mo(mo, Becker = TRUE) mo_lancefield <- as.mo(mo, Lancefield = TRUE) - mo_other <- as.mo("other") + mo_other <- as.mo(rep("UNKNOWN", length(mo))) guideline_coerced <- get_guideline(guideline) if (guideline_coerced != guideline) { @@ -659,18 +659,6 @@ barplot.rsi <- function(height, } } -#' @importFrom vctrs vec_ptype_abbr -#' @export -vec_ptype_abbr.rsi <- function(x, ...) { - "rsi" -} - -#' @importFrom vctrs vec_ptype_full -#' @export -vec_ptype_full.rsi <- function(x, ...) { - "rsi" -} - #' @importFrom pillar pillar_shaft #' @importFrom crayon bgGreen bgYellow bgRed black white #' @export diff --git a/R/sysdata.rda b/R/sysdata.rda index 28106cb9..3f958c2f 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/R/vctrs.R b/R/vctrs.R new file mode 100644 index 00000000..607a98e5 --- /dev/null +++ b/R/vctrs.R @@ -0,0 +1,235 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Analysis # +# # +# SOURCE # +# https://gitlab.com/msberends/AMR # +# # +# LICENCE # +# (c) 2018-2020 Berends MS, Luz CF et al. # +# # +# 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. # +# # +# We created this package for both routine data analysis and academic # +# research and it 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. # +# ==================================================================== # + +#' `vctrs` methods +#' +#' These methods are needed to support methods used by the tidyverse, like joining and transforming data, with new classes that come with this package. +#' @inheritSection lifecycle Stable lifecycle +#' @inheritSection AMR Read more on our website! +#' @keywords internal +#' @name AMR-vctrs +NULL + + +# Class mo ---------------------------------------------------------------- + + +#' @exportMethod vec_ptype_abbr.mo +#' @importFrom vctrs vec_ptype_abbr +#' @export +vec_ptype_abbr.mo <- function(x, ...) { + "mo" +} + +#' @exportMethod vec_ptype_full.mo +#' @importFrom vctrs vec_ptype_full +#' @export +vec_ptype_full.mo <- function(x, ...) { + "mo" +} + +#' @rdname AMR-vctrs +#' @export +vec_ptype2.mo <- function(x, y, ...) { + UseMethod("vec_ptype2.mo", y) +} + +#' @method vec_ptype2.mo default +#' @export +vec_ptype2.mo.default <- function(x, y, ..., x_arg = "x", y_arg = "y") { + vctrs::vec_default_ptype2(x, y, x_arg = x_arg, y_arg = y_arg) +} + +#' @method vec_ptype2.mo character +#' @export +vec_ptype2.mo.character <- function(x, y, ...) { + x +} + +#' @method vec_ptype2.character mo +#' @importFrom vctrs vec_ptype2.character +#' @export +vec_ptype2.character.mo <- function(x, y, ...) { + y +} + +#' @rdname AMR-vctrs +#' @export +vec_cast.mo <- function(x, to, ...) { + UseMethod("vec_cast.mo") +} + +#' @method vec_cast.mo mo +#' @export +vec_cast.mo.mo <- function(x, to, ...) { + as.mo(x) +} + +#' @method vec_cast.mo character +#' @export +vec_cast.mo.character <- function(x, to, ...) { + as.mo(x) +} + +#' @method vec_cast.mo default +#' @export +vec_cast.mo.default <- function(x, to, ...) { + vec_default_cast(x, to) +} + +# @method vec_cast.character mo +#' @exportMethod vec_cast.character.mo +#' @importFrom vctrs vec_cast +#' @export +vec_cast.character.mo <- function(x, to, ...) { + # purrr::map_chr(x, stringr::str_c, collapse = " ") + unclass(x) +} + + +# Class ab ---------------------------------------------------------------- + + +#' @exportMethod vec_ptype_abbr.ab +#' @importFrom vctrs vec_ptype_abbr +#' @export +vec_ptype_abbr.ab <- function(x, ...) { + "ab" +} + +#' @exportMethod vec_ptype_full.ab +#' @importFrom vctrs vec_ptype_full +#' @export +vec_ptype_full.ab <- function(x, ...) { + "ab" +} + +#' @rdname AMR-vctrs +#' @export +vec_ptype2.ab <- function(x, y, ...) { + UseMethod("vec_ptype2.ab", y) +} + +#' @method vec_ptype2.ab default +#' @export +vec_ptype2.ab.default <- function(x, y, ..., x_arg = "x", y_arg = "y") { + vctrs::vec_default_ptype2(x, y, x_arg = x_arg, y_arg = y_arg) +} + +#' @method vec_ptype2.ab character +#' @export +vec_ptype2.ab.character <- function(x, y, ...) { + x +} + +#' @method vec_ptype2.character ab +#' @importFrom vctrs vec_ptype2.character +#' @export +vec_ptype2.character.ab <- function(x, y, ...) { + y +} + +#' @rdname AMR-vctrs +#' @export +vec_cast.ab <- function(x, to, ...) { + UseMethod("vec_cast.ab") +} + +#' @method vec_cast.ab ab +#' @export +vec_cast.ab.ab <- function(x, to, ...) { + as.ab(x) +} + +#' @method vec_cast.ab character +#' @export +vec_cast.ab.character <- function(x, to, ...) { + as.ab(x) +} + +#' @method vec_cast.ab default +#' @export +vec_cast.ab.default <- function(x, to, ...) { + vec_default_cast(x, to) +} + +# @method vec_cast.character ab +#' @exportMethod vec_cast.character.ab +#' @importFrom vctrs vec_cast +#' @export +vec_cast.character.ab <- function(x, to, ...) { + # purrr::map_chr(x, stringr::str_c, collapse = " ") + unclass(x) +} + + +# Class disk -------------------------------------------------------------- + + +#' @exportMethod vec_ptype_abbr.disk +#' @importFrom vctrs vec_ptype_abbr +#' @export +vec_ptype_abbr.disk <- function(x, ...) { + "disk" +} + +#' @exportMethod vec_ptype_full.disk +#' @importFrom vctrs vec_ptype_full +#' @export +vec_ptype_full.disk <- function(x, ...) { + "disk" +} + + +# Class rsi -------------------------------------------------------------- + + +#' @exportMethod vec_ptype_abbr.rsi +#' @importFrom vctrs vec_ptype_abbr +#' @export +vec_ptype_abbr.rsi <- function(x, ...) { + "rsi" +} + +#' @exportMethod vec_ptype_full.rsi +#' @importFrom vctrs vec_ptype_full +#' @export +vec_ptype_full.rsi <- function(x, ...) { + "rsi" +} + + +# Class mic -------------------------------------------------------------- + + +#' @exportMethod vec_ptype_abbr.mic +#' @importFrom vctrs vec_ptype_abbr +#' @export +vec_ptype_abbr.mic <- function(x, ...) { + "mic" +} + +#' @exportMethod vec_ptype_full.mic +#' @importFrom vctrs vec_ptype_full +#' @export +vec_ptype_full.mic <- function(x, ...) { + "mic" +} diff --git a/_pkgdown.yml b/_pkgdown.yml index ceb72343..eec943c5 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -165,6 +165,7 @@ reference: - "`extended-functions`" - "`like`" - "`reexports`" + - "`AMR-vctrs`" - title: Deprecated functions desc: > These functions are deprecated, meaning that they will still diff --git a/docs/404.html b/docs/404.html index c4ecb7f2..97a8f6b7 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000 @@ -248,7 +248,7 @@ Content not found. Please use links in the navbar.
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 46baee58..380088a9 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000 @@ -496,7 +496,7 @@ END OF TERMS AND CONDITIONS
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/articles/index.html b/docs/articles/index.html index 698a9119..b04168bc 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000 @@ -261,7 +261,7 @@
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/authors.html b/docs/authors.html index c35a9d85..a0400fcc 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000 @@ -310,7 +310,7 @@
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/index.html b/docs/index.html index 8185d105..03064061 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000 @@ -186,9 +186,9 @@
-
+

18 October 2019
METHODS PAPER PREPRINTED
@@ -293,9 +293,9 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/

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.

-
+

-WHONET / EARS-Net

+WHONET / EARS-Net

We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an example data set WHONET with the exact same structure as a WHONET export file. Furthermore, this package also contains a data set antibiotics with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.

Read our tutorial about how to work with WHONET data here.

@@ -433,7 +433,7 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/
-

Site built with pkgdown 1.5.0.

+

Site built with pkgdown 1.5.1.

diff --git a/docs/news/index.html b/docs/news/index.html index 1d764251..6c2f95cb 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
@@ -229,9 +229,28 @@ Source: NEWS.md
-
+
+

+AMR 1.1.0.9000 Unreleased +

+
+

+Last updated: 29-Apr-2020 +

+
+

+Changed

+
    +
  • Small fix for some text input that could not be coerced as valid MIC values
  • +
  • Better support for the tidyverse. The tidyverse now heavily relies on the vctrs package for data transformation and data joining. In newer versions of e.g. the dplyr package, a function like bind_rows() would not preserve the right class for microorganisms (class mo) and antibiotics (class ab). This is fixed in this version.
  • +
  • Fixed interpretation of generic CLSI interpretation rules (thanks to Anthony Underwood)
  • +
+
+
+
+

-AMR 1.1.0 Unreleased +AMR 1.1.0 2020-04-15

@@ -241,9 +260,9 @@
  • Plotting biplots for principal component analysis using the new ggplot_pca() function
  • -
    +

    -Changed

    +Changed
    • Improvements for the algorithm used by as.mo() (and consequently all mo_* functions, that use as.mo() internally):
        @@ -271,15 +290,15 @@
    -
    +

    -AMR 1.0.1 2020-02-23 +AMR 1.0.1 2020-02-23

    -
    +

    -Changed

    +Changed
      -
    • Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline

    • +
    • Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline
    • Interpretation from MIC values (and disk zones) to R/SI can now be used with mutate_at() of the dplyr package:

      yourdata %>%
      @@ -288,15 +307,15 @@
       yourdata %>%
         mutate_at(vars(antibiotic1:antibiotic25), as.rsi, mo = .$mybacteria)
    • -
    • Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole

    • -
    • Added uti (as abbreviation of urinary tract infections) as parameter to as.rsi(), so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs

    • +
    • Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole
    • +
    • Added uti (as abbreviation of urinary tract infections) as parameter to as.rsi(), so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs
    • Info printing in functions eucast_rules(), first_isolate(), mdro() and resistance_predict() will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)

    -
    +

    -AMR 1.0.0 2020-02-17 +AMR 1.0.0 2020-02-17

    This software is now out of beta and considered stable. Nonetheless, this package will be developed continually.

    @@ -353,7 +372,7 @@
  • Changes to the antibiotics data set (thanks to Peter Dutey):
  • @@ -369,9 +388,9 @@
    -
    +

    -AMR 0.9.0 2019-11-29 +AMR 0.9.0 2019-11-29

    @@ -402,8 +421,7 @@ amox_clav = resistance(AMC)) %>% filter(!is.na(amoxicillin) | !is.na(amox_clav))

    -
  • -

    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).

    +
  • 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
    • @@ -418,8 +436,8 @@
      • Improvements to algorithm in as.mo():
          -
        • Now allows “ou” where “au” should have been used and vice versa

        • -
        • More intelligent way of coping with some consonants like “l” and “r”

        • +
        • Now allows “ou” where “au” should have been used and vice versa
        • +
        • More intelligent way of coping with some consonants like “l” and “r”
        • Added a score (a certainty percentage) to mo_uncertainties(), that is calculated using the Levenshtein distance:

          as.mo(c("Stafylococcus aureus",
          @@ -469,9 +487,9 @@
           
  • -
    +

    -AMR 0.8.0 2019-10-15 +AMR 0.8.0 2019-10-15

    @@ -480,8 +498,7 @@
  • Determination of first isolates now excludes all ‘unknown’ microorganisms at default, i.e. microbial code "UNKNOWN". They can be included with the new parameter include_unknown:

    first_isolate(..., include_unknown = TRUE)
    -

    For WHONET users, this means that all records/isolates with organism code "con" (contamination) will be excluded at default, since as.mo("con") = "UNKNOWN". The function always shows a note with the number of ‘unknown’ microorganisms that were included or excluded.

    -
  • +For WHONET users, this means that all records/isolates with organism code "con" (contamination) will be excluded at default, since as.mo("con") = "UNKNOWN". The function always shows a note with the number of ‘unknown’ microorganisms that were included or excluded.
  • For code consistency, classes ab and mo will now be preserved in any subsetting or assignment. For the sake of data integrity, this means that invalid assignments will now result in NA:

    # how it works in base R:
    @@ -495,9 +512,8 @@
     x[1] <- "testvalue"
     #> Warning message:
     #> invalid microorganism code, NA generated
    -

    This is important, because a value like "testvalue" could never be understood by e.g. mo_name(), although the class would suggest a valid microbial code.

    -
  • -
  • Function freq() has moved to a new package, clean (CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq() function still works, since it is re-exported from the clean package (which will be installed automatically upon updating this AMR package).

  • +This is important, because a value like "testvalue" could never be understood by e.g. mo_name(), although the class would suggest a valid microbial code. +
  • Function freq() has moved to a new package, clean (CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq() function still works, since it is re-exported from the clean package (which will be installed automatically upon updating this AMR package).
  • Renamed data set septic_patients to example_isolates

  • @@ -540,16 +556,15 @@ # -------- -------- ---------- ----------- ---------- ----------- # S or I S or I X X X X # R S or I X X X X -# S or I X X - - +# <NA> S or I X X - - # S or I R X X X X # R R - X - X -# R - - - - -# S or I X X - - -# R - - - - -# - - - - -# --------------------------------------------------------------------
    -

    Since this is a major change, usage of the old also_single_tested will throw an informative error that it has been replaced by only_all_tested.

    - +# <NA> R - - - - +# S or I <NA> X X - - +# R <NA> - - - - +# <NA> <NA> - - - - +# --------------------------------------------------------------------
    +Since this is a major change, usage of the old also_single_tested will throw an informative error that it has been replaced by only_all_tested.
  • tibble printing support for classes rsi, mic, disk, ab mo. When using tibbles containing antimicrobial columns, values S will print in green, values I will print in yellow and values R will print in red. Microbial IDs (class mo) will emphasise on the genus and species, not on the kingdom.

    # (run this on your own console, as this page does not support colour printing)
    @@ -560,9 +575,9 @@
     
  • -
    +

    -Changed

    +Changed
    • Many algorithm improvements for as.mo() (of which some led to additions to the microorganisms data set). Many thanks to all contributors that helped improving the algorithms.
        @@ -586,7 +601,7 @@
      • Added more informative errors and warnings
      • Printed info now distinguishes between added and changes values
      • -
      • Using Verbose mode (i.e. eucast_rules(..., verbose = TRUE)) returns more informative and readable output
      • +
      • Using Verbose mode (i.e. eucast_rules(..., verbose = TRUE)) returns more informative and readable output
      • Using factors as input now adds missing factors levels when the function changes antibiotic results
    • @@ -623,9 +638,9 @@
    -
    +

    -AMR 0.7.1 2019-06-23 +AMR 0.7.1 2019-06-23

    @@ -665,13 +680,13 @@ mo_gramstain("EHEC") # "Gram-negative"

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

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

  • -
    +

    -Changed

    +Changed
    • Column names of output count_df() and portion_df() are now lowercase
    • Fixed bug in translation of microorganism names
    • @@ -691,7 +706,7 @@
    • Fixed bug where not all old taxonomic names would be printed, when using a vector as input for as.mo()
    • Manually added Trichomonas vaginalis from the kingdom of Protozoa, which is missing from the Catalogue of Life
    • -
    • Small improvements to plot() and barplot() for MIC and RSI classes
    • +
    • Small improvements to plot() and barplot() for MIC and RSI classes
    • Allow Catalogue of Life IDs to be coerced by as.mo()
    @@ -704,9 +719,9 @@
    -
    +

    -AMR 0.7.0 2019-06-03 +AMR 0.7.0 2019-06-03

    @@ -718,51 +733,48 @@
  • Added guidelines of the WHO to determine multi-drug resistance (MDR) for TB (mdr_tb()) and added a new vignette about MDR. Read this tutorial here on our website.
  • -
    +

    -Changed

    +Changed
      -
    • Fixed a critical bug in first_isolate() where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.

    • -
    • Fixed a bug in eucast_rules() where antibiotics from WHONET software would not be recognised

    • -
    • -

      Completely reworked the antibiotics data set:

      +
    • Fixed a critical bug in first_isolate() where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.
    • +
    • Fixed a bug in eucast_rules() where antibiotics from WHONET software would not be recognised
    • +
    • Completely reworked the antibiotics data set:
        -
      • -

        All entries now have 3 different identifiers:

        +
      • All entries now have 3 different identifiers:
        • Column ab contains a human readable EARS-Net code, used by ECDC and WHO/WHONET - this is the primary identifier used in this package
        • Column atc contains the ATC code, used by WHO/WHOCC
        • Column cid contains the CID code (Compound ID), used by PubChem
      • -
      • Based on the Compound ID, almost 5,000 official brand names have been added from many different countries

      • -
      • All references to antibiotics in our package now use EARS-Net codes, like AMX for amoxicillin

      • -
      • Functions atc_certe, ab_umcg and atc_trivial_nl have been removed

      • -
      • All atc_* functions are superceded by ab_* functions

      • +
      • Based on the Compound ID, almost 5,000 official brand names have been added from many different countries
      • +
      • All references to antibiotics in our package now use EARS-Net codes, like AMX for amoxicillin
      • +
      • Functions atc_certe, ab_umcg and atc_trivial_nl have been removed
      • +
      • All atc_* functions are superceded by ab_* functions
      • All output will be translated by using an included translation file which can be viewed here.

        -

        Please create an issue in one of our repositories if you want additions in this file.

        -
      • +Please create an issue in one of our repositories if you want additions in this file.
    • -
    • -

      Improvements to plotting AMR results with ggplot_rsi():

      +
    • Improvements to plotting AMR results with ggplot_rsi():
      • New parameter colours to set the bar colours
      • New parameters title, subtitle, caption, x.title and y.title to set titles and axis descriptions
    • -
    • Improved intelligence of looking up antibiotic columns in a data set using guess_ab_col()

    • -
    • Added ~5,000 more old taxonomic names to the microorganisms.old data set, which leads to better results finding when using the as.mo() function

    • -
    • This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like portion_df() and count_df() this means that their new parameter combine_SI is TRUE at default. Our plotting function ggplot_rsi() also reflects this change since it uses count_df() internally.

    • -
    • The age() function gained a new parameter exact to determine ages with decimals

    • -
    • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi()

    • -
    • -

      Frequency tables (freq()):

      +
    • Improved intelligence of looking up antibiotic columns in a data set using guess_ab_col() +
    • +
    • Added ~5,000 more old taxonomic names to the microorganisms.old data set, which leads to better results finding when using the as.mo() function
    • +
    • This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like portion_df() and count_df() this means that their new parameter combine_SI is TRUE at default. Our plotting function ggplot_rsi() also reflects this change since it uses count_df() internally.
    • +
    • The age() function gained a new parameter exact to determine ages with decimals
    • +
    • Removed deprecated functions guess_mo(), guess_atc(), EUCAST_rules(), interpretive_reading(), rsi() +
    • +
    • Frequency tables (freq()):
        -
      • speed improvement for microbial IDs

      • -
      • fixed factor level names for R Markdown

      • -
      • when all values are unique it now shows a message instead of a warning

      • +
      • speed improvement for microbial IDs
      • +
      • fixed factor level names for R Markdown
      • +
      • when all values are unique it now shows a message instead of a warning
      • support for boxplots:

        septic_patients %>%
        @@ -778,17 +790,20 @@
         
      • Removed all hardcoded EUCAST rules and replaced them with a new reference file which can be viewed here.

        -

        Please create an issue in one of our repositories if you want changes in this file.

        +Please create an issue in one of our repositories if you want changes in this file.
      • +
      • Added ceftazidim intrinsic resistance to Streptococci
      • -
      • Added ceftazidim intrinsic resistance to Streptococci

      • -
      • Changed default settings for age_groups(), to let groups of fives and tens end with 100+ instead of 120+

      • -
      • Fix for freq() for when all values are NA

      • -
      • Fix for first_isolate() for when dates are missing

      • -
      • Improved speed of guess_ab_col()

      • -
      • Function as.mo() now gently interprets any number of whitespace characters (like tabs) as one space

      • -
      • Function as.mo() now returns UNKNOWN for "con" (WHONET ID of ‘contamination’) and returns NA for "xxx"(WHONET ID of ‘no growth’)

      • -
      • Small algorithm fix for as.mo()

      • -
      • Removed viruses from data set microorganisms.codes and cleaned it up

      • +
      • Changed default settings for age_groups(), to let groups of fives and tens end with 100+ instead of 120+
      • +
      • Fix for freq() for when all values are NA +
      • +
      • Fix for first_isolate() for when dates are missing
      • +
      • Improved speed of guess_ab_col() +
      • +
      • Function as.mo() now gently interprets any number of whitespace characters (like tabs) as one space
      • +
      • Function as.mo() now returns UNKNOWN for "con" (WHONET ID of ‘contamination’) and returns NA for "xxx"(WHONET ID of ‘no growth’)
      • +
      • Small algorithm fix for as.mo() +
      • +
      • Removed viruses from data set microorganisms.codes and cleaned it up
      • Fix for mo_shortname() where species would not be determined correctly

    @@ -801,13 +816,13 @@
    -
    +

    -AMR 0.6.1 2019-03-29 +AMR 0.6.1 2019-03-29

    -
    +

    -Changed

    +Changed
    • Fixed a critical bug when using eucast_rules() with verbose = TRUE
    • @@ -815,9 +830,9 @@
    -
    +

    -AMR 0.6.0 2019-03-27 +AMR 0.6.0 2019-03-27

    New website!

    We’ve got a new website: https://msberends.gitlab.io/AMR (built with the great pkgdown)

    @@ -829,25 +844,23 @@

    New

      -
    • BREAKING: removed deprecated functions, parameters and references to ‘bactid’. Use as.mo() to identify an MO code.

    • -

      Catalogue of Life as a new taxonomic source for data about microorganisms, which also contains all ITIS data we used previously. The microorganisms data set now contains:

      +BREAKING: removed deprecated functions, parameters and references to ‘bactid’. Use as.mo() to identify an MO code.
    • +
    • Catalogue of Life as a new taxonomic source for data about microorganisms, which also contains all ITIS data we used previously. The microorganisms data set now contains:
        -
      • All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa

      • -
      • All ~3,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales and Schizosaccharomycetales (covering at least like all species of Aspergillus, Candida, Pneumocystis, Saccharomyces and Trichophyton)

      • -
      • All ~2,000 (sub)species from ~100 other relevant genera, from the kingdoms of Animalia and Plantae (like Strongyloides and Taenia)

      • -
      • All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed

      • +
      • All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa
      • +
      • All ~3,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales and Schizosaccharomycetales (covering at least like all species of Aspergillus, Candida, Pneumocystis, Saccharomyces and Trichophyton)
      • +
      • All ~2,000 (sub)species from ~100 other relevant genera, from the kingdoms of Animalia and Plantae (like Strongyloides and Taenia)
      • +
      • All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed
      • The responsible author(s) and year of scientific publication

        -

        This data is updated annually - check the included version with the new function catalogue_of_life_version().

        -
      • -
      • Due to this change, some mo codes changed (e.g. Streptococcus changed from B_STRPTC to B_STRPT). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.

      • -
      • New function mo_rank() for the taxonomic rank (genus, species, infraspecies, etc.)

      • -
      • New function mo_url() to get the direct URL of a species from the Catalogue of Life

      • +This data is updated annually - check the included version with the new function catalogue_of_life_version(). +
      • Due to this change, some mo codes changed (e.g. Streptococcus changed from B_STRPTC to B_STRPT). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
      • +
      • New function mo_rank() for the taxonomic rank (genus, species, infraspecies, etc.)
      • +
      • New function mo_url() to get the direct URL of a species from the Catalogue of Life
    • -
    • -

      Support for data from WHONET and EARS-Net (European Antimicrobial Resistance Surveillance Network):

      +
    • Support for data from WHONET and EARS-Net (European Antimicrobial Resistance Surveillance Network):
      • Exported files from WHONET can be read and used in this package. For functions like first_isolate() and eucast_rules(), all parameters will be filled in automatically.
      • This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the antibiotics data set now contains a column ears_net.
      • @@ -882,20 +895,19 @@ ab_certe -> atc_certe() ab_umcg -> atc_umcg() ab_tradenames -> atc_tradenames()
    -

    These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.

    - -
  • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions

  • -
  • Support for the upcoming dplyr version 0.8.0

  • -
  • New function guess_ab_col() to find an antibiotic column in a table

  • -
  • New function mo_failures() to review values that could not be coerced to a valid MO code, using as.mo(). This latter function will now only show a maximum of 10 uncoerced values and will refer to mo_failures().

  • -
  • New function mo_uncertainties() to review values that could be coerced to a valid MO code using as.mo(), but with uncertainty.

  • -
  • New function mo_renamed() to get a list of all returned values from as.mo() that have had taxonomic renaming

  • -
  • New function age() to calculate the (patients) age in years

  • -
  • New function age_groups() to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.

  • +These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus. +
  • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions
  • +
  • Support for the upcoming dplyr version 0.8.0
  • +
  • New function guess_ab_col() to find an antibiotic column in a table
  • +
  • New function mo_failures() to review values that could not be coerced to a valid MO code, using as.mo(). This latter function will now only show a maximum of 10 uncoerced values and will refer to mo_failures().
  • +
  • New function mo_uncertainties() to review values that could be coerced to a valid MO code using as.mo(), but with uncertainty.
  • +
  • New function mo_renamed() to get a list of all returned values from as.mo() that have had taxonomic renaming
  • +
  • New function age() to calculate the (patients) age in years
  • +
  • New function age_groups() to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
  • -

    New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

    +

    New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

    x <- resistance_predict(septic_patients, col_ab = "amox")
    -plot(x)
    +plot(x)
     ggplot_rsi_predict(x)
  • @@ -909,13 +921,14 @@ filter(only_firsts == TRUE) %>% select(-only_firsts)
  • -
  • New function availability() to check the number of available (non-empty) results in a data.frame

  • +
  • New function availability() to check the number of available (non-empty) results in a data.frame +
  • New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the G-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.

  • -
    +

    -Changed

    +Changed
    • Function eucast_rules():
        @@ -952,10 +965,10 @@ # also equal: as.mo(..., allow_uncertain = FALSE) as.mo(..., allow_uncertain = 0)
    -

    Using as.mo(..., allow_uncertain = 3) could lead to very unreliable results.

    +Using as.mo(..., allow_uncertain = 3) could lead to very unreliable results. +
  • Implemented the latest publication of Becker et al. (2019), for categorising coagulase-negative Staphylococci
  • -
  • Implemented the latest publication of Becker et al. (2019), for categorising coagulase-negative Staphylococci

  • -
  • All microbial IDs that found are now saved to a local file ~/.Rhistory_mo. Use the new function clean_mo_history() to delete this file, which resets the algorithms.

  • +
  • All microbial IDs that found are now saved to a local file ~/.Rhistory_mo. Use the new function clean_mo_history() to delete this file, which resets the algorithms.
  • Incoercible results will now be considered ‘unknown’, MO code UNKNOWN. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:

    mo_genus("qwerty", language = "es")
    @@ -963,16 +976,17 @@
     # one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.
     #> [1] "(género desconocido)"
  • -
  • Fix for vector containing only empty values

  • -
  • Finds better results when input is in other languages

  • -
  • Better handling for subspecies

  • -
  • Better handling for Salmonellae, especially the ‘city like’ serovars like Salmonella London

  • -
  • Understanding of highly virulent E. coli strains like EIEC, EPEC and STEC

  • -
  • There will be looked for uncertain results at default - these results will be returned with an informative warning

  • -
  • Manual (help page) now contains more info about the algorithms

  • -
  • Progress bar will be shown when it takes more than 3 seconds to get results

  • -
  • Support for formatted console text

  • -
  • Console will return the percentage of uncoercable input

  • +
  • Fix for vector containing only empty values
  • +
  • Finds better results when input is in other languages
  • +
  • Better handling for subspecies
  • +
  • Better handling for Salmonellae, especially the ‘city like’ serovars like Salmonella London +
  • +
  • Understanding of highly virulent E. coli strains like EIEC, EPEC and STEC
  • +
  • There will be looked for uncertain results at default - these results will be returned with an informative warning
  • +
  • Manual (help page) now contains more info about the algorithms
  • +
  • Progress bar will be shown when it takes more than 3 seconds to get results
  • +
  • Support for formatted console text
  • +
  • Console will return the percentage of uncoercable input
  • Function first_isolate(): @@ -1020,15 +1034,17 @@ group_by(gender) %>% freq(mo_genus(mo))
  • -
  • Header info is now available as a list, with the header function

  • -
  • The parameter header is now set to TRUE at default, even for markdown

  • -
  • Added header info for class mo to show unique count of families, genera and species

  • -
  • Now honours the decimal.mark setting, which just like format defaults to getOption("OutDec")

  • -
  • The new big.mark parameter will at default be "," when decimal.mark = "." and "." otherwise

  • -
  • Fix for header text where all observations are NA

  • -
  • New parameter droplevels to exclude empty factor levels when input is a factor

  • -
  • Factor levels will be in header when present in input data (maximum of 5)

  • -
  • Fix for using select() on frequency tables

  • +
  • Header info is now available as a list, with the header function
  • +
  • The parameter header is now set to TRUE at default, even for markdown
  • +
  • Added header info for class mo to show unique count of families, genera and species
  • +
  • Now honours the decimal.mark setting, which just like format defaults to getOption("OutDec") +
  • +
  • The new big.mark parameter will at default be "," when decimal.mark = "." and "." otherwise
  • +
  • Fix for header text where all observations are NA +
  • +
  • New parameter droplevels to exclude empty factor levels when input is a factor
  • +
  • Factor levels will be in header when present in input data (maximum of 5)
  • +
  • Fix for using select() on frequency tables
  • Function scale_y_percent() now contains the limits parameter
  • @@ -1047,9 +1063,9 @@
    -
    +

    -AMR 0.5.0 2018-11-30 +AMR 0.5.0 2018-11-30

    @@ -1065,14 +1081,15 @@
  • Functions mo_authors and mo_year to get specific values about the scientific reference of a taxonomic entry
  • -
    +

    -Changed

    +Changed
      -
    • Functions MDRO, BRMO, MRGN and EUCAST_exceptional_phenotypes were renamed to mdro, brmo, mrgn and eucast_exceptional_phenotypes

    • -
    • EUCAST_rules was renamed to eucast_rules, the old function still exists as a deprecated function

    • +
    • Functions MDRO, BRMO, MRGN and EUCAST_exceptional_phenotypes were renamed to mdro, brmo, mrgn and eucast_exceptional_phenotypes +
    • -

      Big changes to the eucast_rules function:

      +EUCAST_rules was renamed to eucast_rules, the old function still exists as a deprecated function
    • +
    • Big changes to the eucast_rules function:
      • Now also applies rules from the EUCAST ‘Breakpoint tables for bacteria’, version 8.1, 2018, http://www.eucast.org/clinical_breakpoints/ (see Source of the function)
      • New parameter rules to specify which rules should be applied (expert rules, breakpoints, others or all)
      • @@ -1084,9 +1101,10 @@
      • Small fixes to EUCAST clinical breakpoint rules
    • -
    • Added column kingdom to the microorganisms data set, and function mo_kingdom to look up values

    • -
    • Tremendous speed improvement for as.mo (and subsequently all mo_* functions), as empty values wil be ignored a priori

    • -
    • Fewer than 3 characters as input for as.mo will return NA

    • +
    • Added column kingdom to the microorganisms data set, and function mo_kingdom to look up values
    • +
    • Tremendous speed improvement for as.mo (and subsequently all mo_* functions), as empty values wil be ignored a priori +
    • +
    • Fewer than 3 characters as input for as.mo will return NA
    • Function as.mo (and all mo_* wrappers) now supports genus abbreviations with “species” attached

      as.mo("E. species")        # B_ESCHR
      @@ -1094,13 +1112,14 @@
       as.mo("S. spp")            # B_STPHY
       mo_fullname("S. species")  # "Staphylococcus species"
    • -
    • Added parameter combine_IR (TRUE/FALSE) to functions portion_df and count_df, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)

    • -
    • Fix for portion_*(..., as_percent = TRUE) when minimal number of isolates would not be met

    • -
    • Added parameter also_single_tested for portion_* and count_* functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see ?portion

    • -
    • Using portion_* functions now throws a warning when total available isolate is below parameter minimum

    • -
    • Functions as.mo, as.rsi, as.mic, as.atc and freq will not set package name as attribute anymore

    • -
    • -

      Frequency tables - freq():

      +
    • Added parameter combine_IR (TRUE/FALSE) to functions portion_df and count_df, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)
    • +
    • Fix for portion_*(..., as_percent = TRUE) when minimal number of isolates would not be met
    • +
    • Added parameter also_single_tested for portion_* and count_* functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see ?portion +
    • +
    • Using portion_* functions now throws a warning when total available isolate is below parameter minimum +
    • +
    • Functions as.mo, as.rsi, as.mic, as.atc and freq will not set package name as attribute anymore
    • +
    • Frequency tables - freq():
      • Support for grouping variables, test with:

        @@ -1114,25 +1133,29 @@ freq(hospital_id) %>% select(-count, -cum_count) # only get item, percent, cum_percent
    -
  • Check for hms::is.hms

  • -
  • Now prints in markdown at default in non-interactive sessions

  • -
  • No longer adds the factor level column and sorts factors on count again

  • -
  • Support for class difftime

  • -
  • New parameter na, to choose which character to print for empty values

  • -
  • New parameter header to turn the header info off (default when markdown = TRUE)

  • -
  • New parameter title to manually setbthe title of the frequency table

  • +
  • Check for hms::is.hms +
  • +
  • Now prints in markdown at default in non-interactive sessions
  • +
  • No longer adds the factor level column and sorts factors on count again
  • +
  • Support for class difftime +
  • +
  • New parameter na, to choose which character to print for empty values
  • +
  • New parameter header to turn the header info off (default when markdown = TRUE)
  • +
  • New parameter title to manually setbthe title of the frequency table
  • -
  • first_isolate now tries to find columns to use as input when parameters are left blank

  • -
  • Improvements for MDRO algorithm (function mdro)

  • -
  • Data set septic_patients is now a data.frame, not a tibble anymore

  • -
  • Removed diacritics from all authors (columns microorganisms$ref and microorganisms.old$ref) to comply with CRAN policy to only allow ASCII characters

  • -
  • Fix for mo_property not working properly

  • -
  • Fix for eucast_rules where some Streptococci would become ceftazidime R in EUCAST rule 4.5

  • -
  • Support for named vectors of class mo, useful for top_freq()

  • -
  • ggplot_rsi and scale_y_percent have breaks parameter

  • -

    AI improvements for as.mo:

    +first_isolate now tries to find columns to use as input when parameters are left blank
  • +
  • Improvements for MDRO algorithm (function mdro)
  • +
  • Data set septic_patients is now a data.frame, not a tibble anymore
  • +
  • Removed diacritics from all authors (columns microorganisms$ref and microorganisms.old$ref) to comply with CRAN policy to only allow ASCII characters
  • +
  • Fix for mo_property not working properly
  • +
  • Fix for eucast_rules where some Streptococci would become ceftazidime R in EUCAST rule 4.5
  • +
  • Support for named vectors of class mo, useful for top_freq() +
  • +
  • +ggplot_rsi and scale_y_percent have breaks parameter
  • +
  • AI improvements for as.mo:
    • "CRS" -> Stenotrophomonas maltophilia @@ -1148,11 +1171,12 @@
  • -
  • Fix for join functions

  • -
  • Speed improvement for is.rsi.eligible, now 15-20 times faster

  • -
  • In g.test, when sum(x) is below 1000 or any of the expected values is below 5, Fisher’s Exact Test will be suggested

  • -
  • ab_name will try to fall back on as.atc when no results are found

  • -
  • Removed the addin to view data sets

  • +
  • Fix for join functions
  • +
  • Speed improvement for is.rsi.eligible, now 15-20 times faster
  • +
  • In g.test, when sum(x) is below 1000 or any of the expected values is below 5, Fisher’s Exact Test will be suggested
  • +
  • +ab_name will try to fall back on as.atc when no results are found
  • +
  • Removed the addin to view data sets
  • Percentages will now will rounded more logically (e.g. in freq function)

  • @@ -1166,17 +1190,16 @@
    -
    +

    -AMR 0.4.0 2018-10-01 +AMR 0.4.0 2018-10-01

    New

      -
    • The data set microorganisms now contains all microbial taxonomic data from ITIS (kingdoms Bacteria, Fungi and Protozoa), the Integrated Taxonomy Information System, available via https://itis.gov. The data set now contains more than 18,000 microorganisms with all known bacteria, fungi and protozoa according ITIS with genus, species, subspecies, family, order, class, phylum and subkingdom. The new data set microorganisms.old contains all previously known taxonomic names from those kingdoms.

    • -
    • -

      New functions based on the existing function mo_property:

      +
    • The data set microorganisms now contains all microbial taxonomic data from ITIS (kingdoms Bacteria, Fungi and Protozoa), the Integrated Taxonomy Information System, available via https://itis.gov. The data set now contains more than 18,000 microorganisms with all known bacteria, fungi and protozoa according ITIS with genus, species, subspecies, family, order, class, phylum and subkingdom. The new data set microorganisms.old contains all previously known taxonomic names from those kingdoms.
    • +
    • New functions based on the existing function mo_property:
      • Taxonomic names: mo_phylum, mo_class, mo_order, mo_family, mo_genus, mo_species, mo_subspecies
      • @@ -1201,13 +1224,13 @@ # Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010) # [1] "Gram negative"
    -
  • -

    Functions count_R, count_IR, count_I, count_SI and count_S to selectively count resistant or susceptible isolates

    +
  • Functions count_R, count_IR, count_I, count_SI and count_S to selectively count resistant or susceptible isolates
    • Extra function count_df (which works like portion_df) to get all counts of S, I and R of a data set with antibiotic columns, with support for grouped variables
  • -
  • Function is.rsi.eligible to check for columns that have valid antimicrobial results, but do not have the rsi class yet. Transform the columns of your raw data with: data %>% mutate_if(is.rsi.eligible, as.rsi)

  • +
  • Function is.rsi.eligible to check for columns that have valid antimicrobial results, but do not have the rsi class yet. Transform the columns of your raw data with: data %>% mutate_if(is.rsi.eligible, as.rsi) +
  • Functions as.mo and is.mo as replacements for as.bactid and is.bactid (since the microoganisms data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The as.mo function determines microbial IDs using intelligent rules:

    as.mo("E. coli")
    @@ -1223,9 +1246,8 @@
     #         min       median         max  neval
     #  0.01817717  0.01843957  0.03878077    100
  • -
  • Added parameter reference_df for as.mo, so users can supply their own microbial IDs, name or codes as a reference table

  • -
  • -

    Renamed all previous references to bactid to mo, like:

    +
  • Added parameter reference_df for as.mo, so users can supply their own microbial IDs, name or codes as a reference table
  • +
  • Renamed all previous references to bactid to mo, like:
    • Column names inputs of EUCAST_rules, first_isolate and key_antibiotics
    • @@ -1234,19 +1256,20 @@
    • All old syntaxes will still work with this version, but will throw warnings
  • -
  • Function labels_rsi_count to print datalabels on a RSI ggplot2 model

  • +
  • Function labels_rsi_count to print datalabels on a RSI ggplot2 model
  • Functions as.atc and is.atc to transform/look up antibiotic ATC codes as defined by the WHO. The existing function guess_atc is now an alias of as.atc.

  • -
  • Function ab_property and its aliases: ab_name, ab_tradenames, ab_certe, ab_umcg and ab_trivial_nl

  • -
  • Introduction to AMR as a vignette

  • -
  • Removed clipboard functions as it violated the CRAN policy

  • +
  • Function ab_property and its aliases: ab_name, ab_tradenames, ab_certe, ab_umcg and ab_trivial_nl +
  • +
  • Introduction to AMR as a vignette
  • +
  • Removed clipboard functions as it violated the CRAN policy
  • Renamed septic_patients$sex to septic_patients$gender

  • -
    +

    -Changed

    +Changed
      -
    • Added three antimicrobial agents to the antibiotics data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)

    • +
    • Added three antimicrobial agents to the antibiotics data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)
    • Added 163 trade names to the antibiotics data set, it now contains 298 different trade names in total, e.g.:

      ab_official("Bactroban")
      @@ -1256,12 +1279,13 @@
       ab_atc(c("Bactroban", "Amoxil", "Zithromax", "Floxapen"))
       # [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"
    • -
    • For first_isolate, rows will be ignored when there’s no species available

    • -
    • Function ratio is now deprecated and will be removed in a future release, as it is not really the scope of this package

    • -
    • Fix for as.mic for values ending in zeroes after a real number

    • -
    • Small fix where B. fragilis would not be found in the microorganisms.umcg data set

    • -
    • Added prevalence column to the microorganisms data set

    • -
    • Added parameters minimum and as_percent to portion_df

    • +
    • For first_isolate, rows will be ignored when there’s no species available
    • +
    • Function ratio is now deprecated and will be removed in a future release, as it is not really the scope of this package
    • +
    • Fix for as.mic for values ending in zeroes after a real number
    • +
    • Small fix where B. fragilis would not be found in the microorganisms.umcg data set
    • +
    • Added prevalence column to the microorganisms data set
    • +
    • Added parameters minimum and as_percent to portion_df +
    • Support for quasiquotation in the functions series count_* and portions_*, and n_rsi. This allows to check for more than 2 vectors or columns.

      septic_patients %>% select(amox, cipr) %>% count_IR()
      @@ -1272,14 +1296,16 @@
       septic_patients %>% portion_S(amcl, gent)
       septic_patients %>% portion_S(amcl, gent, pita)
    • -
    • Edited ggplot_rsi and geom_rsi so they can cope with count_df. The new fun parameter has value portion_df at default, but can be set to count_df.

    • -
    • Fix for ggplot_rsi when the ggplot2 package was not loaded

    • -
    • Added datalabels function labels_rsi_count to ggplot_rsi

    • -
    • Added possibility to set any parameter to geom_rsi (and ggplot_rsi) so you can set your own preferences

    • -
    • Fix for joins, where predefined suffices would not be honoured

    • -
    • Added parameter quote to the freq function

    • -
    • Added generic function diff for frequency tables

    • -
    • Added longest en shortest character length in the frequency table (freq) header of class character

    • +
    • Edited ggplot_rsi and geom_rsi so they can cope with count_df. The new fun parameter has value portion_df at default, but can be set to count_df.
    • +
    • Fix for ggplot_rsi when the ggplot2 package was not loaded
    • +
    • Added datalabels function labels_rsi_count to ggplot_rsi +
    • +
    • Added possibility to set any parameter to geom_rsi (and ggplot_rsi) so you can set your own preferences
    • +
    • Fix for joins, where predefined suffices would not be honoured
    • +
    • Added parameter quote to the freq function
    • +
    • Added generic function diff for frequency tables
    • +
    • Added longest en shortest character length in the frequency table (freq) header of class character +
    • Support for types (classes) list and matrix for freq

      my_matrix = with(septic_patients, matrix(c(age, gender), ncol = 2))
      @@ -1299,9 +1325,9 @@
       
    -
    +

    -AMR 0.3.0 2018-08-14 +AMR 0.3.0 2018-08-14

    @@ -1376,9 +1402,9 @@

    -
    +

    -Changed

    +Changed
    • Improvements for forecasting with resistance_predict and added more examples
    • More antibiotics added as parameters for EUCAST rules
    • @@ -1406,7 +1432,7 @@
    -
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • +
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • Classes rsi and mic do not add the attribute package.version anymore
  • Added "groups" option for atc_property(..., property). It will return a vector of the ATC hierarchy as defined by the WHO. The new function atc_groups is a convenient wrapper around this.
  • Build-in host check for atc_property as it requires the host set by url to be responsive
  • @@ -1436,9 +1462,9 @@
    -
    +

    -AMR 0.2.0 2018-05-03 +AMR 0.2.0 2018-05-03

    @@ -1462,9 +1488,9 @@
  • New print format for tibbles and data.tables
  • -
    +

    -Changed

    +Changed
    • Fixed rsi class for vectors that contain only invalid antimicrobial interpretations
    • Renamed dataset ablist to antibiotics @@ -1494,9 +1520,9 @@
    -
    +

    -AMR 0.1.1 2018-03-14 +AMR 0.1.1 2018-03-14

    • @@ -1507,9 +1533,9 @@
    • Added barplots for rsi and mic classes
    -
    +

    -AMR 0.1.0 2018-02-22 +AMR 0.1.0 2018-02-22

    • First submission to CRAN.
    • @@ -1532,7 +1558,7 @@
    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 783a957c..9c0f82fc 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,5 @@ -pandoc: 2.7.3 -pkgdown: 1.5.0 +pandoc: 2.3.1 +pkgdown: 1.5.1 pkgdown_sha: ~ articles: AMR: AMR.html @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-04-15T12:29Z +last_built: 2020-04-29T11:27Z urls: reference: https://msberends.gitlab.io/AMR/reference article: https://msberends.gitlab.io/AMR/articles diff --git a/docs/reference/AMR-vctrs.html b/docs/reference/AMR-vctrs.html new file mode 100644 index 00000000..f2a73e8a --- /dev/null +++ b/docs/reference/AMR-vctrs.html @@ -0,0 +1,287 @@ + + + + + + + + +<code>vctrs</code> methods — AMR-vctrs • AMR (for R) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    These methods are needed to support methods used by the tidyverse, like joining and transforming data, with new classes that come with this package.

    +
    + +
    vec_ptype2.mo(x, y, ...)
    +
    +vec_cast.mo(x, to, ...)
    +
    +vec_ptype2.ab(x, y, ...)
    +
    +vec_cast.ab(x, to, ...)
    + + +

    Stable lifecycle

    + + + +


    +The lifecycle of this function is stable. In a stable function, we are largely happy with the unlying code, and major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; we will avoid removing arguments or changing the meaning of existing arguments.

    +

    If the unlying code needs breaking changes, they will occur gradually. To begin with, the function or argument will be deprecated; it will continue to work but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.

    +

    Read more on our website!

    + + + +

    On our website https://msberends.gitlab.io/AMR you can find a comprehensive 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.

    + +
    + +
    + + + +
    + + + + + + + + diff --git a/docs/reference/antibiotics.html b/docs/reference/antibiotics.html index 40027955..dc5fc397 100644 --- a/docs/reference/antibiotics.html +++ b/docs/reference/antibiotics.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
    @@ -295,7 +295,7 @@
  • https://gitlab.com/msberends/AMR/raw/master/data-raw/antivirals.txt

  • -

    Files in R format (which data structure) can be found here:

    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/first_isolate.html b/docs/reference/first_isolate.html index 09e5ef67..075b4fe4 100644 --- a/docs/reference/first_isolate.html +++ b/docs/reference/first_isolate.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
    @@ -465,7 +465,7 @@ The lifecycle of this function is stable
    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/index.html b/docs/reference/index.html index b10210be..bdc6fc95 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
    @@ -601,6 +601,12 @@

    reexports

    Objects exported from other packages

    + + + +

    vec_ptype2.mo() vec_cast.mo() vec_ptype2.ab() vec_cast.ab()

    + +

    vctrs methods

    @@ -639,7 +645,7 @@
    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index 1cadbf32..140bbcfe 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
    @@ -275,7 +275,7 @@
  • https://gitlab.com/msberends/AMR/raw/master/data-raw/microorganisms.txt

  • -

    The file in R format (which data structure) can be found here:

    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html index 3fb120fe..26fff214 100644 --- a/docs/reference/mo_property.html +++ b/docs/reference/mo_property.html @@ -82,7 +82,7 @@ AMR (for R) - 1.1.0 + 1.1.0.9000
    @@ -325,6 +325,7 @@
  • mo_ref("Chlamydophila psittaci") will return "Everett et al., 1999" (without a warning)

  • +

    The short name - mo_shortname() - almost always returns the first character of the genus and the species, like "E. coli". Exceptions are abbreviations of staphylococci and beta-haemolytic streptococci, like "CoNS" (Coagulase-Negative Staphylococci) and "GBS" (Group B Streptococci).

    The Gram stain - mo_gramstain() - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value NA.

    All output will be translated where possible.

    The function mo_url() will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.

    @@ -454,7 +455,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
    -

    Site built with pkgdown 1.5.0.

    +

    Site built with pkgdown 1.5.1.

    diff --git a/docs/sitemap.xml b/docs/sitemap.xml index acde0f71..f065ffbe 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -6,6 +6,9 @@ https://msberends.gitlab.io/AMR/reference/AMR-deprecated.html + + https://msberends.gitlab.io/AMR/reference/AMR-vctrs.html + https://msberends.gitlab.io/AMR/reference/AMR.html diff --git a/git_premaster.sh b/git_premaster.sh index fbd3de3a..c2ac3e6d 100755 --- a/git_premaster.sh +++ b/git_premaster.sh @@ -63,24 +63,28 @@ if [ -z "$3" ]; then # no version number set, so get latest tags to create it git pull --tags --quiet current_tag=`git describe --tags --abbrev=0 | sed 's/v//'` - current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'` + +# current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'` if [ -z "current_tag" ]; then echo "FATAL - could not determine current tag" exit 1 fi + current_tag_dots=`echo $current_tag | grep -o "[.]" | wc -l` + if (( "$current_tag_dots" < 3 )); then + # contains two dots, so version number is like "1.0.0", commit nr is 0 + current_commit=0 + echo "---------------" + echo "Mind NEWS.md! Assuming sequence number 9000." + echo "---------------" + else + current_commit=`git describe --tags | sed 's/.*[.]//'` + fi if [ -z "current_commit" ]; then echo "FATAL - could not determine last commit index number" exit 1 fi # combine tag (e.g. 0.1.0) and commit number (like 40) increased by 9000 to indicate beta version new_version="$current_tag.$((current_commit + 9000))" # results in 0.1.0.9040 - if [ -z "$new_version" ]; then - new_version="$current_tag.9000" - echo - echo "** COULD NOT CREATE NEW VERSION NUMBER! **" - echo "Are there some unpushed changes in a new tag? Then mind NEWS.md. Assuming sequence number 9000." - echo - fi # add date to 2nd line of NEWS.md when no version number was set sed -i -- "2s/.*/## \Last updated: $(date '+%d-%b-%Y')\<\/small\>/" NEWS.md else @@ -100,6 +104,7 @@ echo echo "• First 2 lines of NEWS.md:" head -2 NEWS.md echo +echo "R library location:" $(Rscript -e "cat(.libPaths()[1])") echo "•••••••••••••••••••••••••••••••••" echo "• Reloading/documenting package •" echo "•••••••••••••••••••••••••••••••••" diff --git a/man/AMR-vctrs.Rd b/man/AMR-vctrs.Rd new file mode 100644 index 00000000..15f8416f --- /dev/null +++ b/man/AMR-vctrs.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/vctrs.R +\name{AMR-vctrs} +\alias{AMR-vctrs} +\alias{vec_ptype2.mo} +\alias{vec_cast.mo} +\alias{vec_ptype2.ab} +\alias{vec_cast.ab} +\title{\code{vctrs} methods} +\usage{ +vec_ptype2.mo(x, y, ...) + +vec_cast.mo(x, to, ...) + +vec_ptype2.ab(x, y, ...) + +vec_cast.ab(x, to, ...) +} +\description{ +These methods are needed to support methods used by the tidyverse, like joining and transforming data, with new classes that come with this package. +} +\section{Stable lifecycle}{ + +\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr} +The \link[AMR:lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, we are largely happy with the unlying code, and major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; we will avoid removing arguments or changing the meaning of existing arguments. + +If the unlying code needs breaking changes, they will occur gradually. To begin with, the function or argument will be deprecated; it will continue to work but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error. +} + +\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 comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}. +} + +\keyword{internal} diff --git a/man/antibiotics.Rd b/man/antibiotics.Rd index ced389a6..cd8bd401 100644 --- a/man/antibiotics.Rd +++ b/man/antibiotics.Rd @@ -68,7 +68,7 @@ These data sets are available as 'flat files' for use even without R - you can f \item \url{https://gitlab.com/msberends/AMR/raw/master/data-raw/antivirals.txt} } -Files in R format (which data structure) can be found here: +Files in R format (with preserved data structure) can be found here: \itemize{ \item \url{https://gitlab.com/msberends/AMR/raw/master/data/antibiotics.rda} \item \url{https://gitlab.com/msberends/AMR/raw/master/data/antivirals.rda} diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd index 432bea58..800b7deb 100755 --- a/man/microorganisms.Rd +++ b/man/microorganisms.Rd @@ -48,7 +48,7 @@ This data set is available as 'flat file' for use even without R - you can find \item \url{https://gitlab.com/msberends/AMR/raw/master/data-raw/microorganisms.txt} } -The file in R format (which data structure) can be found here: +The file in R format (with preserved data structure) can be found here: \itemize{ \item \url{https://gitlab.com/msberends/AMR/raw/master/data/microorganisms.rda} } diff --git a/man/mo_property.Rd b/man/mo_property.Rd index 236c67f1..4af6ad6f 100644 --- a/man/mo_property.Rd +++ b/man/mo_property.Rd @@ -103,6 +103,8 @@ All functions will return the most recently known taxonomic property according t \item \code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning) } +The short name - \code{\link[=mo_shortname]{mo_shortname()}} - almost always returns the first character of the genus and the full species, like \emph{"E. coli"}. Exceptions are abbreviations of staphylococci and beta-haemolytic streptococci, like \emph{"CoNS"} (Coagulase-Negative Staphylococci) and \emph{"GBS"} (Group B Streptococci). + The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}. All output will be \link{translate}d where possible. diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 5d5ca8b5..8f8af659 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -37,7 +37,7 @@ test_that("EUCAST rules work", { expect_error(eucast_rules(data.frame(a = "test"))) expect_error(eucast_rules(data.frame(mo = "test"), rules = "invalid rules set")) - expect_warning(eucast_rules(data.frame(mo = "Escherichia coli", vancomycin = "S"))) + expect_warning(eucast_rules(data.frame(mo = "Escherichia coli", vancomycin = "S", stringsAsFactors = TRUE))) expect_identical(colnames(example_isolates), colnames(suppressWarnings(eucast_rules(example_isolates)))) diff --git a/tests/testthat/test-mo.R b/tests/testthat/test-mo.R index 3a284dbb..9bdf8c7f 100644 --- a/tests/testthat/test-mo.R +++ b/tests/testthat/test-mo.R @@ -287,4 +287,11 @@ test_that("as.mo works", { expect_warning(x[1] <- "invalid code") expect_warning(x[[1]] <- "invalid code") expect_warning(c(x[1], "test")) + + # joining on mo class + expect_identical(class(bind_rows(example_isolates, + example_isolates, + example_isolates)$mo), + "mo") + })