From 666126cd5edeea868dd4706c5b4cfdf0fd8f8824 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Mon, 21 Oct 2019 14:12:28 +0200 Subject: [PATCH] (v0.8.0.9001) guideline text on as.rsi() --- DESCRIPTION | 4 ++-- NEWS.md | 5 +++-- R/rsi.R | 25 ++++++++++++++++++++++++- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 6 +++++- docs/news/index.html | 13 ++++++++----- docs/reference/index.html | 2 +- index.md | 4 ++++ 11 files changed, 51 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9aa19876..73cbbb97 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.8.0.9000 -Date: 2019-10-16 +Version: 0.8.0.9001 +Date: 2019-10-21 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 172eae0d..8877fa55 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ -# AMR 0.8.0.9000 -Last updated: 16-Oct-2019 +# AMR 0.8.0.9001 +Last updated: 21-Oct-2019 ### New ### Changes +* When running `as.rsi()` over a data set, it will now print the guideline that will be used # AMR 0.8.0 diff --git a/R/rsi.R b/R/rsi.R index 73f814b8..39a5e93c 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -254,8 +254,28 @@ exec_as.rsi <- function(method, x, mo, ab, guideline) { class = c("rsi", "ordered", "factor")) } +get_guideline <- function(guideline) { + guideline_param <- toupper(guideline) + if (guideline_param %in% c("CLSI", "EUCAST")) { + guideline_param <- AMR::rsi_translation %>% + filter(guideline %like% guideline_param) %>% + pull(guideline) %>% + sort() %>% + rev() %>% + .[1] + } + + if (!guideline_param %in% AMR::rsi_translation$guideline) { + stop(paste0("invalid guideline: '", guideline, + "'.\nValid guidelines are: ", paste0("'", rev(sort(unique(AMR::rsi_translation$guideline))), "'", collapse = ", ")), + call. = FALSE) + } + + guideline_param +} + #' @rdname as.rsi -#' @importFrom crayon red blue +#' @importFrom crayon red blue bold #' @export as.rsi.data.frame <- function(x, col_mo = NULL, guideline = "EUCAST", ...) { x <- x @@ -273,6 +293,9 @@ as.rsi.data.frame <- function(x, col_mo = NULL, guideline = "EUCAST", ...) { if (is.null(col_mo)) { stop("`col_mo` must be set.", call. = FALSE) } + + guideline <- get_guideline(guideline) + message(blue("Interpreting using guideline", bold(guideline))) # transform all MICs ab_cols <- colnames(x)[sapply(x, is.mic)] diff --git a/docs/404.html b/docs/404.html index 5d5331de..0148bcdc 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 2cef744e..064bddde 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001 diff --git a/docs/articles/index.html b/docs/articles/index.html index 676662c1..232a8fb8 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001 diff --git a/docs/authors.html b/docs/authors.html index 177d3ba1..2173df4b 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001 diff --git a/docs/index.html b/docs/index.html index c3c2d404..51208a52 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001 @@ -192,6 +192,10 @@ AMR (for R)

(TLDR - to find out how to conduct AMR analysis, please continue reading here to get started.

+
+

18 October 2019
METHODS PAPER PREPRINTED
+A methods paper about this package has been preprinted at bioRxiv. Please see here for the publishers page or click here for the PDF.

+

diff --git a/docs/news/index.html b/docs/news/index.html index fa69d25f..c26358b1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.8.0.9000 + 0.8.0.9001

@@ -231,11 +231,11 @@ -
+

-AMR 0.8.0.9000 Unreleased +AMR 0.8.0.9001 Unreleased

-

Last updated: 16-Oct-2019

+

Last updated: 21-Oct-2019

New

@@ -243,6 +243,9 @@

Changes

+
    +
  • When running as.rsi() over a data set, it will now print the guideline that will be used
  • +
@@ -1305,7 +1308,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents

diff --git a/index.md b/index.md index 082371c7..26ceeec1 100644 --- a/index.md +++ b/index.md @@ -2,6 +2,10 @@ *(TLDR - to find out how to conduct AMR analysis, please [continue reading here to get started](./articles/AMR.html).* +> *18 October 2019* +> **METHODS PAPER PREPRINTED** +> A methods paper about this package has been preprinted at bioRxiv. Please see [here for the publishers page](https://doi.org/10.1101/810622) or [click here for the PDF](https://www.biorxiv.org/content/early/2019/10/18/810622.full.pdf). + ---- ### What is `AMR` (for R)?