mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 18:46:11 +01:00
cfta streptococci
This commit is contained in:
parent
30b559827c
commit
cffb7787d8
@ -51,7 +51,7 @@ before_script:
|
||||
|
||||
R-release:
|
||||
stage: build
|
||||
allow_failure: true
|
||||
allow_failure: false
|
||||
script:
|
||||
- Rscript -e 'sessionInfo()'
|
||||
# install missing and outdated packages
|
||||
|
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 0.6.1.9002
|
||||
Date: 2019-04-06
|
||||
Date: 2019-04-09
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(
|
||||
|
@ -71,7 +71,6 @@ export(atc_umcg)
|
||||
export(availability)
|
||||
export(brmo)
|
||||
export(catalogue_of_life_version)
|
||||
export(clean_mo_history)
|
||||
export(count_I)
|
||||
export(count_IR)
|
||||
export(count_R)
|
||||
@ -293,4 +292,3 @@ importFrom(stats,sd)
|
||||
importFrom(utils,browseURL)
|
||||
importFrom(utils,browseVignettes)
|
||||
importFrom(utils,installed.packages)
|
||||
importFrom(utils,menu)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -6,6 +6,8 @@
|
||||
* 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
|
||||
* Frequency tables of microbial IDs speed improvement
|
||||
* Removed all hardcoded EUCAST rules and replaced them with a new reference file: `./inst/eucast/eucast.tsv`.
|
||||
* 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+.
|
||||
|
||||
#### Other
|
||||
* Prevented [staged install](https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html) in R 3.6.0 and later by adding `StagedInstall: false` to the DESCRIPTION file
|
||||
|
18
R/age.R
18
R/age.R
@ -72,9 +72,9 @@ age <- function(x, reference = Sys.Date()) {
|
||||
#' \item{A character:}
|
||||
#' \itemize{
|
||||
#' \item{\code{"children"}, equivalent of: \code{c(0, 1, 2, 4, 6, 13, 18)}. This will split on 0, 1, 2-3, 4-5, 6-12, 13-17 and 18+.}
|
||||
#' \item{\code{"elderly"} or \code{"seniors"}, equivalent of: \code{c(65, 75, 85, 95)}. This will split on 0-64, 65-74, 75-84, 85-94 and 95+.}
|
||||
#' \item{\code{"fives"}, equivalent of: \code{1:24 * 5}. This will split on 0-4, 5-9, 10-14, 15-19 and so forth, until 120.}
|
||||
#' \item{\code{"tens"}, equivalent of: \code{1:12 * 10}. This will split on 0-9, 10-19, 20-29 and so forth, until 120.}
|
||||
#' \item{\code{"elderly"} or \code{"seniors"}, equivalent of: \code{c(65, 75, 85)}. This will split on 0-64, 65-74, 75-84, 85+.}
|
||||
#' \item{\code{"fives"}, equivalent of: \code{1:20 * 5}. This will split on 0-4, 5-9, 10-14, ..., 90-94, 95-99, 100+.}
|
||||
#' \item{\code{"tens"}, equivalent of: \code{1:10 * 10}. This will split on 0-9, 10-19, 20-29, ... 80-89, 90-99, 100+.}
|
||||
#' }
|
||||
#' }
|
||||
#' @keywords age_group age
|
||||
@ -92,11 +92,11 @@ age <- function(x, reference = Sys.Date()) {
|
||||
#' age_groups(ages, c(20, 50))
|
||||
#'
|
||||
#' # split into groups of ten years
|
||||
#' age_groups(ages, 1:12 * 10)
|
||||
#' age_groups(ages, 1:10 * 10)
|
||||
#' age_groups(ages, split_at = "tens")
|
||||
#'
|
||||
#' # split into groups of five years
|
||||
#' age_groups(ages, 1:24 * 5)
|
||||
#' age_groups(ages, 1:20 * 5)
|
||||
#' age_groups(ages, split_at = "fives")
|
||||
#'
|
||||
#' # split specifically for children
|
||||
@ -117,14 +117,14 @@ age <- function(x, reference = Sys.Date()) {
|
||||
age_groups <- function(x, split_at = c(12, 25, 55, 75)) {
|
||||
if (is.character(split_at)) {
|
||||
split_at <- split_at[1L]
|
||||
if (split_at %like% "^child") {
|
||||
if (split_at %like% "^(child|kid)") {
|
||||
split_at <- c(0, 1, 2, 4, 6, 13, 18)
|
||||
} else if (split_at %like% "^(elder|senior)") {
|
||||
split_at <- c(65, 75, 85, 95)
|
||||
split_at <- c(65, 75, 85)
|
||||
} else if (split_at %like% "^five") {
|
||||
split_at <- 1:24 * 5
|
||||
split_at <- 1:20 * 5
|
||||
} else if (split_at %like% "^ten") {
|
||||
split_at <- 1:12 * 10
|
||||
split_at <- 1:10 * 10
|
||||
}
|
||||
}
|
||||
split_at <- as.integer(split_at)
|
||||
|
178
R/mo_history.R
178
R/mo_history.R
@ -25,50 +25,50 @@ set_mo_history <- function(x, mo, uncertainty_level, force = FALSE) {
|
||||
# disable function
|
||||
return(base::invisible())
|
||||
|
||||
if (base::interactive() | force == TRUE) {
|
||||
mo_hist <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
df <- data.frame(x, mo, stringsAsFactors = FALSE) %>%
|
||||
distinct(x, .keep_all = TRUE) %>%
|
||||
filter(!is.na(x) & !is.na(mo))
|
||||
if (nrow(df) == 0) {
|
||||
return(base::invisible())
|
||||
}
|
||||
x <- toupper(df$x)
|
||||
mo <- df$mo
|
||||
for (i in 1:length(x)) {
|
||||
# save package version too, as both the as.mo() algorithm and the reference data set may change
|
||||
if (NROW(mo_hist[base::which(mo_hist$x == x[i] &
|
||||
mo_hist$uncertainty_level >= uncertainty_level &
|
||||
mo_hist$package_v == utils::packageVersion("AMR")),]) == 0) {
|
||||
tryCatch(
|
||||
assign(x = "mo_history",
|
||||
value = rbind(mo_hist,
|
||||
data.frame(
|
||||
x = x[i],
|
||||
mo = mo[i],
|
||||
uncertainty_level = uncertainty_level,
|
||||
package_v = base::as.character(utils::packageVersion("AMR")),
|
||||
stringsAsFactors = FALSE)),
|
||||
envir = asNamespace("AMR")),
|
||||
error = function(e) invisible())
|
||||
}
|
||||
}
|
||||
}
|
||||
return(base::invisible())
|
||||
# if (base::interactive() | force == TRUE) {
|
||||
# mo_hist <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
# df <- data.frame(x, mo, stringsAsFactors = FALSE) %>%
|
||||
# distinct(x, .keep_all = TRUE) %>%
|
||||
# filter(!is.na(x) & !is.na(mo))
|
||||
# if (nrow(df) == 0) {
|
||||
# return(base::invisible())
|
||||
# }
|
||||
# x <- toupper(df$x)
|
||||
# mo <- df$mo
|
||||
# for (i in 1:length(x)) {
|
||||
# # save package version too, as both the as.mo() algorithm and the reference data set may change
|
||||
# if (NROW(mo_hist[base::which(mo_hist$x == x[i] &
|
||||
# mo_hist$uncertainty_level >= uncertainty_level &
|
||||
# mo_hist$package_v == utils::packageVersion("AMR")),]) == 0) {
|
||||
# tryCatch(
|
||||
# assign(x = "mo_history",
|
||||
# value = rbind(mo_hist,
|
||||
# data.frame(
|
||||
# x = x[i],
|
||||
# mo = mo[i],
|
||||
# uncertainty_level = uncertainty_level,
|
||||
# package_v = base::as.character(utils::packageVersion("AMR")),
|
||||
# stringsAsFactors = FALSE)),
|
||||
# envir = asNamespace("AMR")),
|
||||
# error = function(e) invisible())
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# return(base::invisible())
|
||||
}
|
||||
|
||||
get_mo_history <- function(x, uncertainty_level, force = FALSE) {
|
||||
# disable function
|
||||
return(NA)
|
||||
|
||||
history <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
if (base::is.null(history)) {
|
||||
NA
|
||||
} else {
|
||||
data.frame(x = toupper(x), stringsAsFactors = FALSE) %>%
|
||||
left_join(history, by = "x") %>%
|
||||
pull(mo)
|
||||
}
|
||||
# history <- read_mo_history(uncertainty_level = uncertainty_level, force = force)
|
||||
# if (base::is.null(history)) {
|
||||
# NA
|
||||
# } else {
|
||||
# data.frame(x = toupper(x), stringsAsFactors = FALSE) %>%
|
||||
# left_join(history, by = "x") %>%
|
||||
# pull(mo)
|
||||
# }
|
||||
}
|
||||
|
||||
#' @importFrom dplyr %>% filter distinct
|
||||
@ -76,59 +76,59 @@ read_mo_history <- function(uncertainty_level = 2, force = FALSE, unfiltered = F
|
||||
# disable function
|
||||
return(NULL)
|
||||
|
||||
if ((!base::interactive() & force == FALSE)) {
|
||||
return(NULL)
|
||||
}
|
||||
uncertainty_level_param <- uncertainty_level
|
||||
|
||||
history <- tryCatch(get("mo_history", envir = asNamespace("AMR")),
|
||||
error = function(e) NULL)
|
||||
if (is.null(history)) {
|
||||
return(NULL)
|
||||
}
|
||||
# Below: filter on current package version.
|
||||
# Even current fullnames may be replaced by new taxonomic names, so new versions of
|
||||
# the Catalogue of Life must not lead to data corruption.
|
||||
|
||||
if (unfiltered == FALSE) {
|
||||
history <- history %>%
|
||||
filter(package_v == as.character(utils::packageVersion("AMR")),
|
||||
# only take unknowns if uncertainty_level_param is higher
|
||||
((mo == "UNKNOWN" & uncertainty_level_param == uncertainty_level) |
|
||||
(mo != "UNKNOWN" & uncertainty_level_param >= uncertainty_level))) %>%
|
||||
arrange(desc(uncertainty_level)) %>%
|
||||
distinct(x, mo, .keep_all = TRUE)
|
||||
}
|
||||
|
||||
if (nrow(history) == 0) {
|
||||
NULL
|
||||
} else {
|
||||
history
|
||||
}
|
||||
# if ((!base::interactive() & force == FALSE)) {
|
||||
# return(NULL)
|
||||
# }
|
||||
# uncertainty_level_param <- uncertainty_level
|
||||
#
|
||||
# history <- tryCatch(get("mo_history", envir = asNamespace("AMR")),
|
||||
# error = function(e) NULL)
|
||||
# if (is.null(history)) {
|
||||
# return(NULL)
|
||||
# }
|
||||
# # Below: filter on current package version.
|
||||
# # Even current fullnames may be replaced by new taxonomic names, so new versions of
|
||||
# # the Catalogue of Life must not lead to data corruption.
|
||||
#
|
||||
# if (unfiltered == FALSE) {
|
||||
# history <- history %>%
|
||||
# filter(package_v == as.character(utils::packageVersion("AMR")),
|
||||
# # only take unknowns if uncertainty_level_param is higher
|
||||
# ((mo == "UNKNOWN" & uncertainty_level_param == uncertainty_level) |
|
||||
# (mo != "UNKNOWN" & uncertainty_level_param >= uncertainty_level))) %>%
|
||||
# arrange(desc(uncertainty_level)) %>%
|
||||
# distinct(x, mo, .keep_all = TRUE)
|
||||
# }
|
||||
#
|
||||
# if (nrow(history) == 0) {
|
||||
# NULL
|
||||
# } else {
|
||||
# history
|
||||
# }
|
||||
}
|
||||
|
||||
#' @rdname as.mo
|
||||
#' @importFrom crayon red
|
||||
#' @importFrom utils menu
|
||||
#' @export
|
||||
# @rdname as.mo
|
||||
# @importFrom crayon red
|
||||
# @importFrom utils menu
|
||||
# @export
|
||||
clean_mo_history <- function(...) {
|
||||
if (!is.null(read_mo_history())) {
|
||||
if (interactive() & !isTRUE(list(...)$force)) {
|
||||
q <- menu(title = paste("This will remove all",
|
||||
format(nrow(read_mo_history(999, unfiltered = TRUE)), big.mark = ","),
|
||||
"microbial IDs determined previously in this session. Are you sure?"),
|
||||
choices = c("Yes", "No"),
|
||||
graphics = FALSE)
|
||||
if (q != 1) {
|
||||
return(invisible())
|
||||
}
|
||||
}
|
||||
tryCatch(
|
||||
assign(x = "mo_history",
|
||||
value = NULL,
|
||||
envir = asNamespace("AMR")),
|
||||
error = function(e) invisible())
|
||||
cat(red("History removed."))
|
||||
}
|
||||
# if (!is.null(read_mo_history())) {
|
||||
# if (interactive() & !isTRUE(list(...)$force)) {
|
||||
# q <- menu(title = paste("This will remove all",
|
||||
# format(nrow(read_mo_history(999, unfiltered = TRUE)), big.mark = ","),
|
||||
# "microbial IDs determined previously in this session. Are you sure?"),
|
||||
# choices = c("Yes", "No"),
|
||||
# graphics = FALSE)
|
||||
# if (q != 1) {
|
||||
# return(invisible())
|
||||
# }
|
||||
# }
|
||||
# tryCatch(
|
||||
# assign(x = "mo_history",
|
||||
# value = NULL,
|
||||
# envir = asNamespace("AMR")),
|
||||
# error = function(e) invisible())
|
||||
# cat(red("History removed."))
|
||||
# }
|
||||
}
|
||||
|
||||
|
@ -247,10 +247,13 @@ mo_phylum <- function(x, language = get_locale(), ...) {
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_kingdom <- function(x, language = get_locale(), ...) {
|
||||
if (all(x %in% AMR::microorganisms$kingdom)) {
|
||||
return(x)
|
||||
}
|
||||
x <- as.mo(x, language = "en", ...)
|
||||
kngdm <- mo_validate(x = x, property = "kingdom", ...)
|
||||
if (language != "en") {
|
||||
unknowns <- as.mo(x, ...) == "UNKOWN"
|
||||
kngdm[unknowns] <- mo_translate(kngdm[unknowns], language = language)
|
||||
kngdm[x == "UNKNOWN"] <- mo_translate(kngdm[x == "UNKNOWN"], language = language)
|
||||
}
|
||||
kngdm
|
||||
}
|
||||
@ -264,7 +267,6 @@ mo_type <- function(x, language = get_locale(), ...) {
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_gramstain <- function(x, language = get_locale(), ...) {
|
||||
x.bak <- x
|
||||
x.mo <- as.mo(x, language = "en", ...)
|
||||
x.phylum <- mo_phylum(x.mo, language = "en")
|
||||
x[x.phylum %in% c("Actinobacteria",
|
||||
|
@ -192,7 +192,7 @@
|
||||
<h1>Benchmarks</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">05 April 2019</h4>
|
||||
<h4 class="date">09 April 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>benchmarks.Rmd</code></div>
|
||||
@ -217,14 +217,14 @@
|
||||
<a class="sourceLine" id="cb2-8" title="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
|
||||
<a class="sourceLine" id="cb2-9" title="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb2-10" title="10"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 18.0 18.0 27 18.0 20.0 62 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 48.0 48.0 61 49.0 91.0 92 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 18.0 18.0 18 18.0 18.0 19 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 18.0 18.0 18 18.0 18.0 20 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 29.0 29.0 29 29.0 29.0 29 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28.0 29.0 48 29.0 73.0 130 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 8.1 8.1 13 8.2 8.6 52 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 18 18.0 27 18.0 18.0 65 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 48 48.0 56 48.0 48.0 130 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 18 18.0 24 18.0 18.0 76 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 18 18.0 27 18.0 19.0 63 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 28 28.0 33 28.0 29.0 72 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28 29.0 38 29.0 31.0 76 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 8 8.1 12 8.1 8.2 52 10</span></a></code></pre></div>
|
||||
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
|
||||
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">T.islandicus <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
|
||||
@ -236,11 +236,11 @@
|
||||
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb3-8" title="8"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-9" title="9"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 460 460 480 470 510 510 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 460 470 490 490 510 540 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 73 73 84 73 77 130 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 73 73 88 75 120 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 73 73 80 73 74 130 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 460 480 490 500 510 510 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 460 460 490 470 510 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 72 73 88 75 110 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 73 73 87 74 100 140 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 72 73 90 75 120 130 10</span></a></code></pre></div>
|
||||
<p>That takes 8 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
|
||||
@ -256,10 +256,7 @@
|
||||
<a class="sourceLine" id="cb4-11" title="11"> <span class="dt">xlab =</span> <span class="st">""</span>, <span class="dt">ylab =</span> <span class="st">"Time in seconds"</span>, <span class="dt">ylim =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">0</span>, <span class="fl">0.5</span>),</a>
|
||||
<a class="sourceLine" id="cb4-12" title="12"> <span class="dt">main =</span> <span class="st">"Benchmarks per prevalence"</span>)</a></code></pre></div>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
|
||||
<p>In reality, the <code><a href="../reference/as.mo.html">as.mo()</a></code> functions <strong>learns from its own output to speed up determinations for next times</strong>. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use <code><a href="../reference/as.mo.html">as.mo()</a></code> yourself:</p>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="720"></p>
|
||||
<p>The highest outliers are the first times. All next determinations were done in only thousands of seconds. For now, learning only works per session. If R is closed or terminated, the algorithms reset. This will probably be resolved in a next version.</p>
|
||||
<p>Still, uncommon microorganisms take a lot more time than common microorganisms, especially the first time. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||
<p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
|
||||
<div id="repetitive-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#repetitive-results" class="anchor"></a>Repetitive results</h3>
|
||||
@ -290,8 +287,8 @@
|
||||
<a class="sourceLine" id="cb5-24" title="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb5-25" title="25"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 689 730 762 752 778 938 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.75 seconds (751 ms). You only lose time on your unique input values.</p>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 774 777 811 783 829 947 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.78 seconds (783 ms). You only lose time on your unique input values.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -304,9 +301,9 @@
|
||||
<a class="sourceLine" id="cb6-5" title="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb6-6" title="6"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 12.200 12.300 12.500 12.400 12.600 13.40 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.800 26.300 26.800 26.600 26.900 28.50 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 0.477 0.724 0.779 0.825 0.848 1.07 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 12.000 12.100 12.500 12.400 12.800 13.20 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.800 26.200 26.900 26.600 27.800 28.00 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 0.476 0.691 0.758 0.812 0.848 1.03 10</span></a></code></pre></div>
|
||||
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">run_it <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb7-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
|
||||
@ -320,14 +317,14 @@
|
||||
<a class="sourceLine" id="cb7-10" title="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb7-11" title="11"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-12" title="12"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.376 0.386 0.436 0.436 0.479 0.516 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.467 0.501 0.561 0.567 0.599 0.700 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 0.503 0.782 0.850 0.918 0.971 1.040 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.403 0.471 0.488 0.491 0.525 0.588 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.343 0.429 0.456 0.445 0.485 0.638 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.380 0.403 0.447 0.453 0.491 0.520 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.385 0.421 0.458 0.447 0.487 0.575 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.396 0.455 0.484 0.491 0.515 0.549 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.364 0.403 0.452 0.455 0.496 0.575 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.478 0.533 0.566 0.565 0.594 0.645 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 0.512 0.726 0.851 0.893 1.010 1.150 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.409 0.460 0.490 0.507 0.530 0.544 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.375 0.380 0.454 0.476 0.488 0.524 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.395 0.411 0.463 0.442 0.522 0.587 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.381 0.404 0.454 0.451 0.495 0.546 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.232 0.268 0.304 0.297 0.336 0.391 10</span></a></code></pre></div>
|
||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -354,13 +351,13 @@
|
||||
<a class="sourceLine" id="cb8-18" title="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
|
||||
<a class="sourceLine" id="cb8-19" title="19"><span class="co">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.96 19.05 19.17 19.10 19.28 19.50 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 31.11 31.58 40.75 32.11 33.36 75.57 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 31.18 31.55 39.10 31.77 32.52 75.92 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 30.76 31.46 40.46 31.62 33.07 75.85 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 31.02 31.41 36.06 31.67 31.95 76.19 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 31.02 31.66 36.36 31.84 32.46 76.22 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 31.13 31.58 31.78 31.65 31.74 33.00 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.37 19.07 19.98 19.22 19.41 27.24 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 30.58 31.06 35.93 31.42 31.54 77.27 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 31.01 31.33 37.73 31.41 31.59 93.52 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 31.38 31.45 36.30 31.81 32.53 76.12 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 30.98 31.40 36.99 31.58 32.30 84.46 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 31.19 31.21 35.82 31.45 31.62 75.52 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 31.02 31.36 40.85 32.22 33.84 76.22 10</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
@ -243,9 +243,19 @@
|
||||
<ul>
|
||||
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>
|
||||
</li>
|
||||
<li>Added more old taxonomic names to the <code>microorganisms.old</code> data set, which leads to better results finding when using the <code><a href="../reference/as.mo.html">as.mo()</a></code> function</li>
|
||||
<li>Added ~5,000 more old taxonomic names to the <code>microorganisms.old</code> data set, which leads to better results finding when using the <code><a href="../reference/as.mo.html">as.mo()</a></code> function</li>
|
||||
<li>Frequency tables of microbial IDs speed improvement</li>
|
||||
<li>Removed all hardcoded EUCAST rules and replaced them with a new reference file: <code>./inst/eucast/eucast.tsv</code>.</li>
|
||||
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
|
||||
</li>
|
||||
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>Prevented <a href="https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html">staged install</a> in R 3.6.0 and later by adding <code>StagedInstall: false</code> to the DESCRIPTION file</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -401,7 +411,7 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
|
||||
Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a></code> could lead to very unreliable results.</li>
|
||||
<li>Implemented the latest publication of Becker <em>et al.</em> (2019), for categorising coagulase-negative <em>Staphylococci</em>
|
||||
</li>
|
||||
<li>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code><a href="../reference/as.mo.html">clean_mo_history()</a></code> to delete this file, which resets the algorithms.</li>
|
||||
<li>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code>clean_mo_history()</code> to delete this file, which resets the algorithms.</li>
|
||||
<li>
|
||||
<p>Incoercible results will now be considered ‘unknown’, MO code <code>UNKNOWN</code>. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
|
||||
@ -488,9 +498,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
<li>if using different lengths of pattern and x in <code>%like%</code>, it will now return the call</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other" class="section level4">
|
||||
<div id="other-1" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other" class="anchor"></a>Other</h4>
|
||||
<a href="#other-1" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>Updated licence text to emphasise GPL 2.0 and that this is an R package.</li>
|
||||
</ul>
|
||||
@ -613,9 +623,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
<li><p>Percentages will now will rounded more logically (e.g. in <code>freq</code> function)</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other-1" class="section level4">
|
||||
<div id="other-2" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other-1" class="anchor"></a>Other</h4>
|
||||
<a href="#other-2" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>New dependency on package <code>crayon</code>, to support formatted text in the console</li>
|
||||
<li>Dependency <code>tidyr</code> is now mandatory (went to <code>Import</code> field) since <code>portion_df</code> and <code>count_df</code> rely on it</li>
|
||||
@ -750,9 +760,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other-2" class="section level4">
|
||||
<div id="other-3" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other-2" class="anchor"></a>Other</h4>
|
||||
<a href="#other-3" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>More unit tests to ensure better integrity of functions</li>
|
||||
</ul>
|
||||
@ -879,9 +889,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
<li>Other small fixes</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other-3" class="section level4">
|
||||
<div id="other-4" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other-3" class="anchor"></a>Other</h4>
|
||||
<a href="#other-4" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>Added integration tests (check if everything works as expected) for all releases of R 3.1 and higher
|
||||
<ul>
|
||||
@ -941,9 +951,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
<li>Functions <code>as.rsi</code> and <code>as.mic</code> now add the package name and version as attributes</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="other-4" class="section level4">
|
||||
<div id="other-5" class="section level4">
|
||||
<h4 class="hasAnchor">
|
||||
<a href="#other-4" class="anchor"></a>Other</h4>
|
||||
<a href="#other-5" class="anchor"></a>Other</h4>
|
||||
<ul>
|
||||
<li>Expanded <code>README.md</code> with more examples</li>
|
||||
<li>Added <a href="https://orcid.org">ORCID</a> of authors to DESCRIPTION file</li>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -267,9 +267,9 @@
|
||||
The default is to split on young children (0-11), youth (12-24), young adults (26-54), middle-aged adults (55-74) and elderly (75+).</p></li>
|
||||
<li><p>A character:</p><ul>
|
||||
<li><p><code>"children"</code>, equivalent of: <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(0, 1, 2, 4, 6, 13, 18)</a></code>. This will split on 0, 1, 2-3, 4-5, 6-12, 13-17 and 18+.</p></li>
|
||||
<li><p><code>"elderly"</code> or <code>"seniors"</code>, equivalent of: <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(65, 75, 85, 95)</a></code>. This will split on 0-64, 65-74, 75-84, 85-94 and 95+.</p></li>
|
||||
<li><p><code>"fives"</code>, equivalent of: <code>1:24 * 5</code>. This will split on 0-4, 5-9, 10-14, 15-19 and so forth, until 120.</p></li>
|
||||
<li><p><code>"tens"</code>, equivalent of: <code>1:12 * 10</code>. This will split on 0-9, 10-19, 20-29 and so forth, until 120.</p></li>
|
||||
<li><p><code>"elderly"</code> or <code>"seniors"</code>, equivalent of: <code><a href='https://www.rdocumentation.org/packages/base/topics/c'>c(65, 75, 85)</a></code>. This will split on 0-64, 65-74, 75-84, 85+.</p></li>
|
||||
<li><p><code>"fives"</code>, equivalent of: <code>1:20 * 5</code>. This will split on 0-4, 5-9, 10-14, ..., 90-94, 95-99, 100+.</p></li>
|
||||
<li><p><code>"tens"</code>, equivalent of: <code>1:10 * 10</code>. This will split on 0-9, 10-19, 20-29, ... 80-89, 90-99, 100+.</p></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
@ -294,11 +294,11 @@
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>20</span>, <span class='fl'>50</span>))
|
||||
|
||||
<span class='co'># split into groups of ten years</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>12</span> * <span class='fl'>10</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>10</span> * <span class='fl'>10</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='kw'>split_at</span> <span class='kw'>=</span> <span class='st'>"tens"</span>)
|
||||
|
||||
<span class='co'># split into groups of five years</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>24</span> * <span class='fl'>5</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>20</span> * <span class='fl'>5</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='kw'>split_at</span> <span class='kw'>=</span> <span class='st'>"fives"</span>)
|
||||
|
||||
<span class='co'># split specifically for children</span>
|
||||
|
@ -250,9 +250,7 @@
|
||||
|
||||
<span class='fu'>mo_uncertainties</span>()
|
||||
|
||||
<span class='fu'>mo_renamed</span>()
|
||||
|
||||
<span class='fu'>clean_mo_history</span>(<span class='no'>...</span>)</pre>
|
||||
<span class='fu'>mo_renamed</span>()</pre>
|
||||
|
||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||
<table class="ref-arguments">
|
||||
@ -310,10 +308,6 @@ A microbial ID from this package (class: <code>mo</code>) typically looks like t
|
||||
<p>Values that cannot be coered will be considered 'unknown' and will get the MO code <code>UNKNOWN</code>.</p>
|
||||
<p>Use the <code><a href='mo_property.html'>mo_property</a>_*</code> functions to get properties based on the returned code, see Examples.</p>
|
||||
<p>The algorithm uses data from the Catalogue of Life (see below) and from one other source (see <code><a href='microorganisms.html'>?microorganisms</a></code>).</p>
|
||||
<p><strong>Self-learning algoritm</strong> <br />
|
||||
The <code>as.mo()</code> function gains experience from previously determined microbial IDs and learns from it. This drastically improves both speed and reliability. Use <code>clean_mo_history()</code> to reset the algorithms. Only experience from your current <code>AMR</code> package version is used. This is done because in the future the taxonomic tree (which is included in this package) may change for any organism and it consequently has to rebuild its knowledge.</p>
|
||||
<p>Usually, any guess after the first try runs 80-95% faster than the first try.</p>
|
||||
<p>For now, learning only works per session. If R is closed or terminated, the algorithms reset. This will probably be resolved in a next version.</p>
|
||||
<p><strong>Intelligent rules</strong> <br />
|
||||
This function uses intelligent rules to help getting fast and logical results. It tries to find matches in this order:</p><ul>
|
||||
<li><p>Valid MO codes and full names: it first searches in already valid MO code and known genus/species combinations</p></li>
|
||||
@ -365,7 +359,7 @@ The intelligent rules takes into account microbial prevalence of pathogens in hu
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
@ -246,7 +246,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p>Click here for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="included-taxa"><a class="anchor" href="#included-taxa"></a>Included taxa</h2>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -256,7 +256,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code>catalogue_of_life_version()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
@ -293,7 +293,7 @@
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="as.mo.html">as.mo()</a></code> <code><a href="as.mo.html">is.mo()</a></code> <code><a href="as.mo.html">mo_failures()</a></code> <code><a href="as.mo.html">mo_uncertainties()</a></code> <code><a href="as.mo.html">mo_renamed()</a></code> <code><a href="as.mo.html">clean_mo_history()</a></code> </p>
|
||||
<p><code><a href="as.mo.html">as.mo()</a></code> <code><a href="as.mo.html">is.mo()</a></code> <code><a href="as.mo.html">mo_failures()</a></code> <code><a href="as.mo.html">mo_uncertainties()</a></code> <code><a href="as.mo.html">mo_renamed()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Transform to microorganism ID</p></td>
|
||||
</tr><tr>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -254,7 +254,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -288,7 +288,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
@ -260,7 +260,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -334,7 +334,7 @@
|
||||
|
||||
|
||||
<p><img src='figures/logo_col.png' height=40px style=margin-bottom:5px /> <br />
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~60,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
This package contains the complete taxonomic tree of almost all microorganisms (~65,000 species) from the authoritative and comprehensive Catalogue of Life (<a href='http://www.catalogueoflife.org'>http://www.catalogueoflife.org</a>). The Catalogue of Life is the most comprehensive and authoritative global index of species currently available.</p>
|
||||
<p><a href='catalogue_of_life.html'>Click here</a> for more information about the included taxa. The Catalogue of Life releases updates annually; check which version was included in this package with <code><a href='catalogue_of_life_version.html'>catalogue_of_life_version</a>()</code>.</p>
|
||||
|
||||
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
|
||||
|
@ -147,7 +147,7 @@ genus_species is Staphylococcus hominis cfta R Table 04: Intrinsic resistance
|
||||
genus_species is Staphylococcus haemolyticus cfta R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus_species is Staphylococcus intermedius cfta R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus_species is Staphylococcus pseudintermedius cfta R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus is Streptococcus fusi, aminoglycosides R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus is Streptococcus fusi, cfta, aminoglycosides R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus_species is Enterococcus faecalis fusi, cfta, cephalosporins_without_cfta, aminoglycosides, macrolides, clin, qida, trim, trsu R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus_species is Enterococcus gallinarum fusi, cfta, cephalosporins_without_cfta, aminoglycosides, macrolides, clin, qida, vanc, trim, trsu R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
genus_species is Enterococcus casseliflavus fusi, cfta, cephalosporins_without_cfta, aminoglycosides, macrolides, clin, qida, vanc, trim, trsu R Table 04: Intrinsic resistance in Gram-positive bacteria Expert Rules
|
||||
|
|
@ -25,9 +25,9 @@ To split ages, the input can be:
|
||||
\item{A character:}
|
||||
\itemize{
|
||||
\item{\code{"children"}, equivalent of: \code{c(0, 1, 2, 4, 6, 13, 18)}. This will split on 0, 1, 2-3, 4-5, 6-12, 13-17 and 18+.}
|
||||
\item{\code{"elderly"} or \code{"seniors"}, equivalent of: \code{c(65, 75, 85, 95)}. This will split on 0-64, 65-74, 75-84, 85-94 and 95+.}
|
||||
\item{\code{"fives"}, equivalent of: \code{1:24 * 5}. This will split on 0-4, 5-9, 10-14, 15-19 and so forth, until 120.}
|
||||
\item{\code{"tens"}, equivalent of: \code{1:12 * 10}. This will split on 0-9, 10-19, 20-29 and so forth, until 120.}
|
||||
\item{\code{"elderly"} or \code{"seniors"}, equivalent of: \code{c(65, 75, 85)}. This will split on 0-64, 65-74, 75-84, 85+.}
|
||||
\item{\code{"fives"}, equivalent of: \code{1:20 * 5}. This will split on 0-4, 5-9, 10-14, ..., 90-94, 95-99, 100+.}
|
||||
\item{\code{"tens"}, equivalent of: \code{1:10 * 10}. This will split on 0-9, 10-19, 20-29, ... 80-89, 90-99, 100+.}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,11 +46,11 @@ age_groups(ages, 50)
|
||||
age_groups(ages, c(20, 50))
|
||||
|
||||
# split into groups of ten years
|
||||
age_groups(ages, 1:12 * 10)
|
||||
age_groups(ages, 1:10 * 10)
|
||||
age_groups(ages, split_at = "tens")
|
||||
|
||||
# split into groups of five years
|
||||
age_groups(ages, 1:24 * 5)
|
||||
age_groups(ages, 1:20 * 5)
|
||||
age_groups(ages, split_at = "fives")
|
||||
|
||||
# split specifically for children
|
||||
|
@ -1,5 +1,5 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/mo.R, R/mo_history.R
|
||||
% Please edit documentation in R/mo.R
|
||||
\name{as.mo}
|
||||
\alias{as.mo}
|
||||
\alias{mo}
|
||||
@ -7,7 +7,6 @@
|
||||
\alias{mo_failures}
|
||||
\alias{mo_uncertainties}
|
||||
\alias{mo_renamed}
|
||||
\alias{clean_mo_history}
|
||||
\title{Transform to microorganism ID}
|
||||
\usage{
|
||||
as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
|
||||
@ -20,8 +19,6 @@ mo_failures()
|
||||
mo_uncertainties()
|
||||
|
||||
mo_renamed()
|
||||
|
||||
clean_mo_history(...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a character vector or a \code{data.frame} with one or two columns}
|
||||
|
Loading…
Reference in New Issue
Block a user