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)
(
+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.
Last updated: 16-Oct-2019
+Last updated: 21-Oct-2019
as.rsi()
over a data set, it will now print the guideline that will be usedas.mo(..., allow_uncertain = 3)
Contents