1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:06:12 +01:00

(v0.8.0.9001) guideline text on as.rsi()

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-10-21 14:12:28 +02:00
parent 1b8e2366f7
commit 666126cd5e
11 changed files with 51 additions and 16 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 0.8.0.9000 Version: 0.8.0.9001
Date: 2019-10-16 Date: 2019-10-21
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

View File

@ -1,9 +1,10 @@
# AMR 0.8.0.9000 # AMR 0.8.0.9001
<small>Last updated: 16-Oct-2019</small> <small>Last updated: 21-Oct-2019</small>
### New ### New
### Changes ### Changes
* When running `as.rsi()` over a data set, it will now print the guideline that will be used
# AMR 0.8.0 # AMR 0.8.0

25
R/rsi.R
View File

@ -254,8 +254,28 @@ exec_as.rsi <- function(method, x, mo, ab, guideline) {
class = c("rsi", "ordered", "factor")) 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 #' @rdname as.rsi
#' @importFrom crayon red blue #' @importFrom crayon red blue bold
#' @export #' @export
as.rsi.data.frame <- function(x, col_mo = NULL, guideline = "EUCAST", ...) { as.rsi.data.frame <- function(x, col_mo = NULL, guideline = "EUCAST", ...) {
x <- x x <- x
@ -273,6 +293,9 @@ as.rsi.data.frame <- function(x, col_mo = NULL, guideline = "EUCAST", ...) {
if (is.null(col_mo)) { if (is.null(col_mo)) {
stop("`col_mo` must be set.", call. = FALSE) stop("`col_mo` must be set.", call. = FALSE)
} }
guideline <- get_guideline(guideline)
message(blue("Interpreting using guideline", bold(guideline)))
# transform all MICs # transform all MICs
ab_cols <- colnames(x)[sapply(x, is.mic)] ab_cols <- colnames(x)[sapply(x, is.mic)]

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>

View File

@ -45,7 +45,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>
@ -192,6 +192,10 @@
<a href="#amr-for-r" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px"> <a href="#amr-for-r" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
</h1></div> </h1></div>
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p> <p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
<blockquote>
<p><em>18 October 2019</em><br><strong>METHODS PAPER PREPRINTED</strong><br>
A methods paper about this package has been preprinted at bioRxiv. Please see <a href="https://doi.org/10.1101/810622">here for the publishers page</a> or <a href="https://www.biorxiv.org/content/early/2019/10/18/810622.full.pdf">click here for the PDF</a>.</p>
</blockquote>
<hr> <hr>
<div id="what-is-amr-for-r" class="section level3"> <div id="what-is-amr-for-r" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>
@ -231,11 +231,11 @@
</div> </div>
<div id="amr-0-8-0-9000" class="section level1"> <div id="amr-0-8-0-9001" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-8-0-9000" class="anchor"></a>AMR 0.8.0.9000<small> Unreleased </small> <a href="#amr-0-8-0-9001" class="anchor"></a>AMR 0.8.0.9001<small> Unreleased </small>
</h1> </h1>
<p><small>Last updated: 16-Oct-2019</small></p> <p><small>Last updated: 21-Oct-2019</small></p>
<div id="new" class="section level3"> <div id="new" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3> <a href="#new" class="anchor"></a>New</h3>
@ -243,6 +243,9 @@
<div id="changes" class="section level3"> <div id="changes" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#changes" class="anchor"></a>Changes</h3> <a href="#changes" class="anchor"></a>Changes</h3>
<ul>
<li>When running <code><a href="../reference/as.rsi.html">as.rsi()</a></code> over a data set, it will now print the guideline that will be used</li>
</ul>
</div> </div>
</div> </div>
<div id="amr-0-8-0" class="section level1"> <div id="amr-0-8-0" class="section level1">
@ -1305,7 +1308,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-8-0-9000">0.8.0.9000</a></li> <li><a href="#amr-0-8-0-9001">0.8.0.9001</a></li>
<li><a href="#amr-0-8-0">0.8.0</a></li> <li><a href="#amr-0-8-0">0.8.0</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9000</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9001</span>
</span> </span>
</div> </div>

View File

@ -2,6 +2,10 @@
*(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please [continue reading here to get started](./articles/AMR.html).* *(<help title="Too Long, Didn't Read">TLDR</help> - 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)? ### What is `AMR` (for R)?