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

(v0.9.0.9003) as.mo() speedup for fullnames

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-12-20 15:05:58 +01:00
parent f7eb6e4107
commit 2db2a2458a
21 changed files with 209 additions and 204 deletions

View File

@ -1,30 +1,30 @@
Package: AMR Package: AMR
Version: 0.9.0.9002 Version: 0.9.0.9003
Date: 2019-12-16 Date: 2019-12-20
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),
family = "Berends", given = c("Matthijs", "S."), email = "m.s.berends@umcg.nl", comment = c(ORCID = "0000-0001-7620-1800")), family = "Berends", given = c("Matthijs", "S"), email = "m.s.berends@umcg.nl", comment = c(ORCID = "0000-0001-7620-1800")),
person(role = c("aut", "ctb"), person(role = c("aut", "ctb"),
family = "Luz", given = c("Christian", "F."), email = "c.f.luz@umcg.nl", comment = c(ORCID = "0000-0001-5809-5995")), family = "Luz", given = c("Christian", "F"), email = "c.f.luz@umcg.nl", comment = c(ORCID = "0000-0001-5809-5995")),
person(role = c("aut", "ths"), person(role = c("aut", "ths"),
family = "Friedrich", given = c("Alex", "W."), email = "alex.friedrich@umcg.nl", comment = c(ORCID = "0000-0003-4881-038X")), family = "Friedrich", given = c("Alexander", "W"), email = "alex.friedrich@umcg.nl", comment = c(ORCID = "0000-0003-4881-038X")),
person(role = c("aut", "ths"), person(role = c("aut", "ths"),
family = "Sinha", given = c("Bhanu", "N.", "M."), email = "b.sinha@umcg.nl", comment = c(ORCID = "0000-0003-1634-0010")), family = "Sinha", given = c("Bhanu", "N", "M"), email = "b.sinha@umcg.nl", comment = c(ORCID = "0000-0003-1634-0010")),
person(role = c("aut", "ths"), person(role = c("aut", "ths"),
family = "Albers", given = c("Casper", "J."), email = "c.j.albers@rug.nl", comment = c(ORCID = "0000-0002-9213-6743")), family = "Albers", given = c("Casper", "J"), email = "c.j.albers@rug.nl", comment = c(ORCID = "0000-0002-9213-6743")),
person(role = c("aut", "ths"), person(role = c("aut", "ths"),
family = "Glasner", given = "Corinna", email = "c.glasner@umcg.nl", comment = c(ORCID = "0000-0003-1241-1328")), family = "Glasner", given = "Corinna", email = "c.glasner@umcg.nl", comment = c(ORCID = "0000-0003-1241-1328")),
person(role = "ctb", person(role = "ctb",
family = "Fonville", given = c("Judith", "M."), email = "j.fonville@pamm.nl"), family = "Fonville", given = c("Judith", "M"), email = "j.fonville@pamm.nl"),
person(role = "ctb", person(role = "ctb",
family = "Hassing", given = c("Erwin", "E.", "A."), email = "e.hassing@certe.nl"), family = "Hassing", given = c("Erwin", "E", "A"), email = "e.hassing@certe.nl"),
person(role = "ctb", person(role = "ctb",
family = "Hazenberg", given = c("Eric", "H.", "L.", "C.", "M."), email = "e.hazenberg@jbz.nl"), family = "Hazenberg", given = c("Eric", "H", "L", "C", "M"), email = "e.hazenberg@jbz.nl"),
person(role = "ctb", person(role = "ctb",
family = "Lenglet", given = "Annick", email = "annick.lenglet@amsterdam.msf.org"), family = "Lenglet", given = "Annick", email = "annick.lenglet@amsterdam.msf.org"),
person(role = "ctb", person(role = "ctb",
family = "Meijer", given = c("Bart", "C."), email = "b.meijerg@certe.nl"), family = "Meijer", given = c("Bart", "C"), email = "b.meijerg@certe.nl"),
person(role = "ctb", person(role = "ctb",
family = "Ny", given = "Sofia", email = "sofia.ny@folkhalsomyndigheten.se"), family = "Ny", given = "Sofia", email = "sofia.ny@folkhalsomyndigheten.se"),
person(role = "ctb", person(role = "ctb",

View File

@ -1,7 +1,8 @@
# AMR 0.9.0.9002 # AMR 0.9.0.9003
## <small>Last updated: 16-Dec-2019</small> ## <small>Last updated: 20-Dec-2019</small>
Website updates ### Changes
* Speed improvement for `as.mo()` (and consequently all `mo_*` functions that use `as.mo()` internally)
# AMR 0.9.0 # AMR 0.9.0

32
R/mo.R
View File

@ -25,10 +25,10 @@
#' @param x a character vector or a [`data.frame`] with one or two columns #' @param x a character vector or a [`data.frame`] with one or two columns
#' @param Becker a logical to indicate whether *Staphylococci* should be categorised into coagulase-negative *Staphylococci* ("CoNS") and coagulase-positive *Staphylococci* ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2). Note that this does not include species that were newly named after these publications, like *S. caeli*. #' @param Becker a logical to indicate whether *Staphylococci* should be categorised into coagulase-negative *Staphylococci* ("CoNS") and coagulase-positive *Staphylococci* ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2). Note that this does not include species that were newly named after these publications, like *S. caeli*.
#' #'
#' This excludes *Staphylococcus aureus* at default, use `Becker = "all"` to also categorise *S. aureus* as "CoPS". #' This excludes *Staphylococcus aureus* at default, use `Becker = "all"` to also categorise *S. aureus* as "CoPS".
#' @param Lancefield a logical to indicate whether beta-haemolytic *Streptococci* should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield (3). These *Streptococci* will be categorised in their first group, e.g. *Streptococcus dysgalactiae* will be group C, although officially it was also categorised into groups G and L. #' @param Lancefield a logical to indicate whether beta-haemolytic *Streptococci* should be categorised into Lancefield groups instead of their own species, according to Rebecca C. Lancefield (3). These *Streptococci* will be categorised in their first group, e.g. *Streptococcus dysgalactiae* will be group C, although officially it was also categorised into groups G and L.
#' #'
#' This excludes *Enterococci* at default (who are in group D), use `Lancefield = "all"` to also categorise all *Enterococci* as group D. #' This excludes *Enterococci* at default (who are in group D), use `Lancefield = "all"` to also categorise all *Enterococci* as group D.
#' @param allow_uncertain a number between `0` (or `"none"`) and `3` (or `"all"`), or `TRUE` (= `2`) or `FALSE` (= `0`) to indicate whether the input should be checked for less probable results, please see *Details* #' @param allow_uncertain a number between `0` (or `"none"`) and `3` (or `"all"`), or `TRUE` (= `2`) or `FALSE` (= `0`) to indicate whether the input should be checked for less probable results, please see *Details*
#' @param reference_df a [`data.frame`] to use for extra reference when translating `x` to a valid [`mo`]. See [set_mo_source()] and [get_mo_source()] to automate the usage of your own codes (e.g. used in your analysis or organisation). #' @param reference_df a [`data.frame`] to use for extra reference when translating `x` to a valid [`mo`]. See [set_mo_source()] and [get_mo_source()] to automate the usage of your own codes (e.g. used in your analysis or organisation).
#' @param ... other parameters passed on to functions #' @param ... other parameters passed on to functions
@ -229,18 +229,6 @@ as.mo <- function(x,
# check previously found results # check previously found results
y <- mo_hist y <- mo_hist
} else if (all(tolower(x) %in% microorganismsDT$fullname_lower)
& isFALSE(Becker)
& isFALSE(Lancefield)) {
# we need special treatment for very prevalent full names, they are likely! (case insensitive)
# e.g. as.mo("Staphylococcus aureus")
y <- data.frame(fullname_lower = tolower(x),
stringsAsFactors = FALSE) %>%
left_join(microorganismsDT, by = "fullname_lower") %>%
pull(mo)
# don't save valid fullnames to history (i.e. values that are in microorganisms$fullname)
} else { } else {
# will be checked for mo class in validation and uses exec_as.mo internally if necessary # will be checked for mo class in validation and uses exec_as.mo internally if necessary
y <- mo_validate(x = x, property = "mo", y <- mo_validate(x = x, property = "mo",
@ -249,7 +237,6 @@ as.mo <- function(x,
...) ...)
} }
to_class_mo(y) to_class_mo(y)
} }
@ -283,7 +270,7 @@ exec_as.mo <- function(x,
initial_search = TRUE, initial_search = TRUE,
dyslexia_mode = FALSE, dyslexia_mode = FALSE,
force_mo_history = FALSE, force_mo_history = FALSE,
disable_mo_history = FALSE, disable_mo_history = getOption("AMR_disable_mo_history", FALSE),
debug = FALSE, debug = FALSE,
reference_data_to_use = microorganismsDT) { reference_data_to_use = microorganismsDT) {
@ -433,18 +420,7 @@ exec_as.mo <- function(x,
} else if (all(tolower(x) %in% reference_data_to_use$fullname_lower)) { } else if (all(tolower(x) %in% reference_data_to_use$fullname_lower)) {
# we need special treatment for very prevalent full names, they are likely! # we need special treatment for very prevalent full names, they are likely!
# e.g. as.mo("Staphylococcus aureus") # e.g. as.mo("Staphylococcus aureus")
y <- reference_data_to_use[prevalence == 1][data.table(fullname_lower = tolower(x)), on = "fullname_lower", ..property][[1]] x <- reference_data_to_use[data.table(fullname_lower = tolower(x)), on = "fullname_lower", ..property][[1]]
if (any(is.na(y))) {
y[is.na(y)] <- reference_data_to_use[prevalence == 2][data.table(fullname_lower = tolower(x[is.na(y)])),
on = "fullname_lower",
..property][[1]]
}
if (any(is.na(y))) {
y[is.na(y)] <- reference_data_to_use[prevalence == 3][data.table(fullname_lower = tolower(x[is.na(y)])),
on = "fullname_lower",
..property][[1]]
}
x <- y
} else if (all(toupper(x) %in% AMR::microorganisms.codes$code)) { } else if (all(toupper(x) %in% AMR::microorganisms.codes$code)) {
# commonly used MO codes # commonly used MO codes

View File

@ -15,6 +15,11 @@ data_json <- jsonlite::read_json(url_json)
data <- tibble( data <- tibble(
timestamp_server = as.POSIXct(sapply(data_json, function(x) x$serverTimestamp), origin = "1970-01-01"), timestamp_server = as.POSIXct(sapply(data_json, function(x) x$serverTimestamp), origin = "1970-01-01"),
country = sapply(data_json, function(x) x$country)) country = sapply(data_json, function(x) x$country))
rm(data_json)
# how many?
n_distinct(data$country[data$country != "Unknown"])
# Plot world map ---------------------------------------------------------- # Plot world map ----------------------------------------------------------
@ -28,7 +33,7 @@ world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE)) %>%
included = as.integer(countries_code %in% countries_iso)) %>% included = as.integer(countries_code %in% countries_iso)) %>%
mutate(not_antarctica = as.integer(ID != "Antarctica")) mutate(not_antarctica = as.integer(ID != "Antarctica"))
(ggplot(world1) + countries_plot <- ggplot(world1) +
geom_sf(aes(fill = included, colour = not_antarctica), size = 0.25) + geom_sf(aes(fill = included, colour = not_antarctica), size = 0.25) +
theme_minimal() + theme_minimal() +
theme(legend.position = "none", theme(legend.position = "none",
@ -37,16 +42,37 @@ world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE)) %>%
axis.text = element_blank()) + axis.text = element_blank()) +
scale_fill_gradient(low = "white", high = "#CAD6EA") + scale_fill_gradient(low = "white", high = "#CAD6EA") +
# this makes the border Antarctica turn white (invisible): # this makes the border Antarctica turn white (invisible):
scale_colour_gradient(low = "white", high = "#81899B") + scale_colour_gradient(low = "white", high = "#81899B")
geom_text(aes(x = -170,
y = -70, # main website page
label = stringr::str_wrap(paste0("Accented countries (n = ", ggsave("pkgdown/logos/countries.png",
length(countries_name), "): ", width = 6,
paste(countries_name, collapse = ", ")), height = 3,
225)), units = "in",
hjust = 0, dpi = 100,
size = 4)) %>% plot = countries_plot,
ggsave("pkgdown/logos/countries.png", dpi = 300, plot = ., scale = 1.5) scale = 1)
# when clicked - a high res enlargement
ggsave("pkgdown/logos/countries_large.png",
width = 11,
height = 6,
units = "in",
dpi = 300,
plot =
countries_plot +
labs(title = tools::toTitleCase("Countries where the AMR package for R was downloaded from"),
subtitle = paste0("Between March 2018 - ", format(Sys.Date(), "%B %Y"))) +
theme(plot.title = element_text(size = 16, hjust = 0.5),
plot.subtitle = element_text(size = 12, hjust = 0.5)) +
geom_text(aes(x = -170,
y = -70,
label = stringr::str_wrap(paste0("Countries (n = ",
length(countries_name), "): ",
paste(countries_name, collapse = ", ")),
200)),
hjust = 0,
size = 4),
scale = 1.5)
# Gibberish --------------------------------------------------------------- # Gibberish ---------------------------------------------------------------

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -240,7 +240,7 @@ Content not found. Please use links in the navbar.
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -488,7 +488,7 @@ END OF TERMS AND CONDITIONS
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

View File

@ -41,7 +41,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.9.0</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -187,7 +187,7 @@
<h1>Benchmarks</h1> <h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">11 December 2019</h4> <h4 class="date">20 December 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div> <div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -196,12 +196,13 @@
<p><small>Source: <a href="https://gitlab.com/msberends/AMR/blob/master/vignettes/benchmarks.Rmd" class="uri">https://gitlab.com/msberends/AMR/blob/master/vignettes/benchmarks.Rmd</a></small></p>
<p>One of the most important features of this package is the complete microbial taxonomic database, supplied by the <a href="http://catalogueoflife.org">Catalogue of Life</a>. We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.</p> <p>One of the most important features of this package is the complete microbial taxonomic database, supplied by the <a href="http://catalogueoflife.org">Catalogue of Life</a>. We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.</p>
<p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function. Its function <code><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark()</a></code> runs different input expressions independently of each other and measures their time-to-result.</p> <p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function. Its function <code><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark()</a></code> runs different input expressions independently of each other and measures their time-to-result.</p>
<p>FALSE</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(microbenchmark)</a> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(microbenchmark)</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</a></code></pre></div> <a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</a></code></pre></div>
<p>In the next test, we try to coerce different input values for <em>Staphylococcus aureus</em>. The actual result is the same every time: it returns its microorganism code <code>B_STPHY_AURS</code> (<em>B</em> stands for <em>Bacteria</em>, the taxonomic kingdom).</p> <p>In the next test, we try to coerce different input values into the microbial code of <em>Staphylococcus aureus</em>. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.</p>
<p>The actual result is the same every time: it returns its microorganism code B_STPHY_AURS (<em>B</em> stands for <em>Bacteria</em>, the taxonomic kingdom).</p>
<p>But the calculation time differs a lot:</p> <p>But the calculation time differs a lot:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">S.aureus &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(</a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">S.aureus &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(</a>
<a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"sau"</span>), <span class="co"># WHONET code</span></a> <a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"sau"</span>), <span class="co"># WHONET code</span></a>
@ -221,49 +222,49 @@
<a class="sourceLine" id="cb2-16" data-line-number="16"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb2-16" data-line-number="16"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-17" data-line-number="17"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-18" data-line-number="18"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 11 11 15 11 14 33 10</span></a> <a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 9.2 9.4 9.7 9.6 10.0 11 10</span></a>
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 34 38 47 43 58 65 10</span></a> <a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 32.0 34.0 43.0 37.0 58.0 66 10</span></a>
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 34 37 45 39 59 65 10</span></a> <a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 34.0 34.0 40.0 35.0 36.0 65 10</span></a>
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 10 12 30 12 37 120 10</span></a> <a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 9.2 9.3 12.0 9.8 11.0 33 10</span></a>
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 11 11 20 12 34 45 10</span></a> <a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 9.1 9.5 12.0 9.6 9.9 35 10</span></a>
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 26 27 34 30 34 54 10</span></a> <a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 24.0 25.0 34.0 28.0 48.0 55 10</span></a>
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 26 27 44 28 28 160 10</span></a> <a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 24.0 24.0 32.0 26.0 32.0 55 10</span></a>
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 32 34 37 35 41 44 10</span></a> <a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 4.6 4.7 9.7 4.8 5.5 30 10</span></a>
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 640 690 710 700 720 810 10</span></a> <a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 620.0 630.0 670.0 650.0 680.0 840 10</span></a>
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 340 370 390 380 400 470 10</span></a> <a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 320.0 330.0 370.0 350.0 410.0 470 10</span></a>
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 11 11 14 12 12 35 10</span></a> <a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 9.2 9.8 17.0 10.0 32.0 37 10</span></a>
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 22 23 33 26 46 51 10</span></a> <a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 19.0 19.0 23.0 20.0 23.0 49 10</span></a>
<a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 20 22 25 24 26 43 10</span></a> <a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 19.0 20.0 26.0 22.0 25.0 46 10</span></a>
<a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 20 25 37 36 49 55 10</span></a></code></pre></div> <a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 18.0 19.0 23.0 20.0 24.0 43 10</span></a></code></pre></div>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-5-1.png" width="562.5"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-5-1.png" width="562.5"></p>
<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>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>Methanosarcina semesiae</em> (<code>B_MTHNSR_SEMS</code>), a bug probably never found before in humans:</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>Methanosarcina semesiae</em> (<code>B_MTHNSR_SEMS</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" data-line-number="1">M.semesiae &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"metsem"</span>),</a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">M.semesiae &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"metsem"</span>),</a>
<a class="sourceLine" id="cb3-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"METSEM"</span>),</a> <a class="sourceLine" id="cb3-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"METSEM"</span>),</a>
<a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a> <a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a>
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a> <a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a>
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Methanosarcina semesiae"</span>),</a> <a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Methanosarcina semesiae"</span>),</a>
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(M.semesiae, <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="cb3-7" data-line-number="7"><span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(M.semesiae, <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="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq max</span></a> <a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq</span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("metsem") 1455.00 1534.00 1589.00 1546.00 1642.0 1856.0</span></a> <a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("metsem") 1424.000 1452.000 1483.00 1489.000 1518.00</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("METSEM") 1504.00 1560.00 1570.00 1568.00 1581.0 1668.0</span></a> <a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("METSEM") 1342.000 1434.000 1477.00 1491.000 1522.00</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("M. semesiae") 2262.00 2295.00 2338.00 2321.00 2361.0 2536.0</span></a> <a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("M. semesiae") 2104.000 2163.000 2180.00 2196.000 2202.00</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("M. semesiae") 2243.00 2261.00 2304.00 2302.00 2334.0 2397.0</span></a> <a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("M. semesiae") 2111.000 2148.000 2168.00 2170.000 2183.00</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Methanosarcina semesiae") 33.36 35.01 43.82 39.71 47.8 68.4</span></a> <a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Methanosarcina semesiae") 5.309 5.483 13.19 5.854 28.63</span></a>
<a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># neval</span></a> <a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># max neval</span></a>
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># 10</span></a> <a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># 1554.00 10</span></a>
<a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># 10</span></a> <a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># 1584.00 10</span></a>
<a class="sourceLine" id="cb3-18" data-line-number="18"><span class="co"># 10</span></a> <a class="sourceLine" id="cb3-18" data-line-number="18"><span class="co"># 2214.00 10</span></a>
<a class="sourceLine" id="cb3-19" data-line-number="19"><span class="co"># 10</span></a> <a class="sourceLine" id="cb3-19" data-line-number="19"><span class="co"># 2208.00 10</span></a>
<a class="sourceLine" id="cb3-20" data-line-number="20"><span class="co"># 10</span></a></code></pre></div> <a class="sourceLine" id="cb3-20" data-line-number="20"><span class="co"># 32.07 10</span></a></code></pre></div>
<p>That takes 14.9 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>Methanosarcina semesiae</em>) are almost fast - these are the most probable input from most data sets.</p> <p>That takes 15.5 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>Methanosarcina semesiae</em>) are always very fast and only take some thousands of seconds to coerce - they 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>Methanosarcina semesiae</em> (which is uncommon):</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>Methanosarcina semesiae</em> (which is uncommon):</p>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-9-1.png" width="562.5"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-8-1.png" width="900"></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>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 below figure, this effect was disabled to show the difference with the boxplot above:</p>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-11-1.png" width="562.5"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-9-1.png" width="900"></p>
<p>The highest outliers are the first times. All next determinations were done in only thousands of seconds.</p> <p>The highest outliers are the first times. All next determinations were done in only thousands of seconds.</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> <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"> <div id="repetitive-results" class="section level3">
@ -296,8 +297,8 @@
<a class="sourceLine" id="cb4-24" data-line-number="24"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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="cb4-24" data-line-number="24"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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="cb4-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb4-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb4-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb4-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb4-27" data-line-number="27"><span class="co"># mo_name(x) 647 669 689 685 701 770 10</span></a></code></pre></div> <a class="sourceLine" id="cb4-27" data-line-number="27"><span class="co"># mo_name(x) 620 645 659 660 672 700 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.69 seconds (685 ms). You only lose time on your unique input values.</p> <p>So transforming 500,000 values (!!) of 50 unique values only takes 0.66 seconds (660 ms). You only lose time on your unique input values.</p>
</div> </div>
<div id="precalculated-results" class="section level3"> <div id="precalculated-results" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
@ -309,11 +310,11 @@
<a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-5" data-line-number="5"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># A 6.440 6.560 11.00 7.210 8.75 44.10 10</span></a> <a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># A 6.360 6.400 6.770 6.500 6.720 8.590 10</span></a>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># B 25.400 25.700 31.40 27.900 34.90 53.80 10</span></a> <a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># B 24.800 25.100 32.500 28.400 30.400 54.200 10</span></a>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># C 0.816 0.878 1.05 0.991 1.24 1.37 10</span></a></code></pre></div> <a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># C 0.704 0.747 0.777 0.785 0.814 0.817 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.001 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p> <p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesnt 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="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">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> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">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="cb6-2" data-line-number="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> <a class="sourceLine" id="cb6-2" data-line-number="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>
<a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a> <a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
@ -326,14 +327,14 @@
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-10" data-line-number="10"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb6-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb6-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-13" data-line-number="13"><span class="co"># A 0.461 0.485 0.613 0.608 0.739 0.775 10</span></a> <a class="sourceLine" id="cb6-13" data-line-number="13"><span class="co"># A 0.450 0.453 0.471 0.467 0.491 0.497 10</span></a>
<a class="sourceLine" id="cb6-14" data-line-number="14"><span class="co"># B 0.505 0.521 0.641 0.552 0.594 1.120 10</span></a> <a class="sourceLine" id="cb6-14" data-line-number="14"><span class="co"># B 0.492 0.500 0.508 0.507 0.508 0.549 10</span></a>
<a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co"># C 0.759 0.846 1.040 0.870 1.270 1.680 10</span></a> <a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co"># C 0.725 0.770 0.793 0.799 0.819 0.849 10</span></a>
<a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co"># D 0.495 0.502 0.536 0.505 0.532 0.667 10</span></a> <a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co"># D 0.492 0.494 0.505 0.501 0.510 0.549 10</span></a>
<a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co"># E 0.459 0.470 0.549 0.478 0.510 0.830 10</span></a> <a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co"># E 0.450 0.460 0.466 0.462 0.466 0.507 10</span></a>
<a class="sourceLine" id="cb6-18" data-line-number="18"><span class="co"># F 0.457 0.460 0.545 0.469 0.615 0.788 10</span></a> <a class="sourceLine" id="cb6-18" data-line-number="18"><span class="co"># F 0.441 0.450 0.459 0.458 0.467 0.491 10</span></a>
<a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co"># G 0.455 0.474 0.572 0.516 0.694 0.830 10</span></a> <a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co"># G 0.444 0.450 0.463 0.464 0.470 0.492 10</span></a>
<a class="sourceLine" id="cb6-20" data-line-number="20"><span class="co"># H 0.457 0.466 0.551 0.472 0.545 1.030 10</span></a></code></pre></div> <a class="sourceLine" id="cb6-20" data-line-number="20"><span class="co"># H 0.448 0.458 0.481 0.459 0.463 0.658 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> <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>
<div id="results-in-other-languages" class="section level3"> <div id="results-in-other-languages" class="section level3">
@ -360,13 +361,13 @@
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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="cb7-18" data-line-number="18"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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="cb7-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a> <a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a> <a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-21" data-line-number="21"><span class="co"># en 20.61 21.92 22.93 22.53 24.17 26.26 10</span></a> <a class="sourceLine" id="cb7-21" data-line-number="21"><span class="co"># en 20.20 20.36 25.81 20.55 26.48 44.15 10</span></a>
<a class="sourceLine" id="cb7-22" data-line-number="22"><span class="co"># de 22.19 22.61 28.83 23.28 28.22 51.89 10</span></a> <a class="sourceLine" id="cb7-22" data-line-number="22"><span class="co"># de 21.79 21.97 29.74 22.27 45.35 49.38 10</span></a>
<a class="sourceLine" id="cb7-23" data-line-number="23"><span class="co"># nl 27.45 28.26 29.07 29.34 29.78 30.03 10</span></a> <a class="sourceLine" id="cb7-23" data-line-number="23"><span class="co"># nl 27.24 27.39 28.69 27.85 28.68 35.16 10</span></a>
<a class="sourceLine" id="cb7-24" data-line-number="24"><span class="co"># es 22.05 23.69 30.82 28.10 30.51 51.22 10</span></a> <a class="sourceLine" id="cb7-24" data-line-number="24"><span class="co"># es 21.48 21.51 27.65 21.97 22.85 55.52 10</span></a>
<a class="sourceLine" id="cb7-25" data-line-number="25"><span class="co"># it 23.00 24.39 31.27 27.07 33.34 49.78 10</span></a> <a class="sourceLine" id="cb7-25" data-line-number="25"><span class="co"># it 21.92 21.95 24.77 22.11 22.63 47.75 10</span></a>
<a class="sourceLine" id="cb7-26" data-line-number="26"><span class="co"># fr 22.13 23.03 26.94 23.83 25.55 52.39 10</span></a> <a class="sourceLine" id="cb7-26" data-line-number="26"><span class="co"># fr 21.46 21.55 25.53 22.59 23.05 50.67 10</span></a>
<a class="sourceLine" id="cb7-27" data-line-number="27"><span class="co"># pt 22.43 24.94 33.02 28.38 45.69 49.11 10</span></a></code></pre></div> <a class="sourceLine" id="cb7-27" data-line-number="27"><span class="co"># pt 21.44 21.79 24.62 21.88 23.07 46.35 10</span></a></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p> <p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div> </div>
</div> </div>
@ -380,7 +381,7 @@
<footer><div class="copyright"> <footer><div class="copyright">
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 75 KiB

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -250,7 +250,7 @@
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -232,23 +232,23 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>
<p><strong><a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a></strong>. Author, maintainer. <a href='https://orcid.org/0000-0001-7620-1800' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a> <p><strong>Matthijs S Berends</strong>. Author, maintainer. <a href='https://orcid.org/0000-0001-7620-1800' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a>
</p> </p>
</li> </li>
<li> <li>
<p><strong><a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a></strong>. Author, contributor. <a href='https://orcid.org/0000-0001-5809-5995' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a> <p><strong>Christian F Luz</strong>. Author, contributor. <a href='https://orcid.org/0000-0001-5809-5995' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a>
</p> </p>
</li> </li>
<li> <li>
<p><strong><a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a></strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0003-4881-038X' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a> <p><strong>Alexander W Friedrich</strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0003-4881-038X' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a>
</p> </p>
</li> </li>
<li> <li>
<p><strong><a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a></strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0003-1634-0010' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a> <p><strong>Bhanu N M Sinha</strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0003-1634-0010' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a>
</p> </p>
</li> </li>
<li> <li>
<p><strong><a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a></strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0002-9213-6743' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a> <p><strong>Casper J Albers</strong>. Author, thesis advisor. <a href='https://orcid.org/0000-0002-9213-6743' target='orcid.widget'><img src='https://members.orcid.org/sites/default/files/vector_iD_icon.svg' class='orcid' alt='ORCID'></a>
</p> </p>
</li> </li>
<li> <li>
@ -256,15 +256,15 @@
</p> </p>
</li> </li>
<li> <li>
<p><strong>Judith M. Fonville</strong>. Contributor. <p><strong>Judith M Fonville</strong>. Contributor.
</p> </p>
</li> </li>
<li> <li>
<p><strong>Erwin E. A. Hassing</strong>. Contributor. <p><strong>Erwin E A Hassing</strong>. Contributor.
</p> </p>
</li> </li>
<li> <li>
<p><strong>Eric H. L. C. M. Hazenberg</strong>. Contributor. <p><strong>Eric H L C M Hazenberg</strong>. Contributor.
</p> </p>
</li> </li>
<li> <li>
@ -272,7 +272,7 @@
</p> </p>
</li> </li>
<li> <li>
<p><strong>Bart C. Meijer</strong>. Contributor. <p><strong>Bart C Meijer</strong>. Contributor.
</p> </p>
</li> </li>
<li> <li>
@ -293,7 +293,7 @@
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 67 KiB

BIN
docs/countries_large.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -193,20 +193,20 @@
</h1></div> </h1></div>
<blockquote> <blockquote>
<p><em>18 October 2019</em><br><strong>METHODS PAPER PREPRINTED</strong><br> <p><em>18 October 2019</em><br><strong>METHODS PAPER PREPRINTED</strong><br>
A methods paper about this package has been preprinted at bioRxiv. It was updated on 8 November 2019. Please click <a href="https://doi.org/10.1101/810622">here for the publishers page</a>.</p> A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/810622). It was <strong>updated on 18 December 2019</strong> and in parallel sent to a journal. Please click <a href="https://doi.org/10.1101/810622">here for the paper on bioRxivs publishers page</a>.</p>
</blockquote> </blockquote>
<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">
<a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3> <a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3>
<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>
<p><code>AMR</code> is a free and open-source <a href="https://www.r-project.org">R package</a> to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. <strong>Our aim is to supply a standard</strong> for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p> <p><code>AMR</code> is a free and open-source <a href="https://www.r-project.org">R package</a> to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. <strong>Our aim is to provide a standard</strong> for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p> <p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p> <p>We created this package for both routine analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
<div class="main-content"> <div class="main-content">
<p> <p>
<a href="./countries.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a>
<strong>Used in over 70 countries</strong><br> <strong>Used in almost 80 countries</strong><br>
Since its first public release in early 2018, this package has been downloaded over 25,000 times from 78 countries <small>(as of December 2019, <a href="https://cran-logs.rstudio.com" target="_blank">CRAN logs</a>)</small>. Click the map to enlarge.</p> Since its first public release in early 2018, this package has been downloaded over 25,000 times from 79 countries <small>(as of December 2019, <a href="https://cran-logs.rstudio.com" target="_blank">CRAN logs</a>)</small>. Click the map to enlarge.</p>
<br><br> <br><br>
</div> </div>
<div id="partners" class="section level4"> <div id="partners" class="section level4">
@ -296,7 +296,7 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
<div id="microbial-taxonomic-reference-data" class="section level4"> <div id="microbial-taxonomic-reference-data" class="section level4">
<h4 class="hasAnchor"> <h4 class="hasAnchor">
<a href="#microbial-taxonomic-reference-data" class="anchor"></a>Microbial (taxonomic) reference data</h4> <a href="#microbial-taxonomic-reference-data" class="anchor"></a>Microbial (taxonomic) reference data</h4>
<p>This package contains the complete taxonomic tree of almost all 70,000 microorganisms from the authoritative and comprehensive Catalogue of Life (CoL, <a href="http://www.catalogueoflife.org">www.catalogueoflife.org</a>). With <code><a href="reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code> can be checked which version of the CoL is included in this package.</p> <p>This package contains the complete taxonomic tree of almost all ~70,000 microorganisms from the authoritative and comprehensive Catalogue of Life (CoL, <a href="http://www.catalogueoflife.org">www.catalogueoflife.org</a>). With <code><a href="reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code> can be checked which version of the CoL is included in this package.</p>
<p>Read more about which data from the Catalogue of Life <a href="./reference/catalogue_of_life.html">in our manual</a>.</p> <p>Read more about which data from the Catalogue of Life <a href="./reference/catalogue_of_life.html">in our manual</a>.</p>
</div> </div>
<div id="antimicrobial-reference-data" class="section level4"> <div id="antimicrobial-reference-data" class="section level4">
@ -413,16 +413,11 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
<div class="developers"> <div class="developers">
<h2>Developers</h2> <h2>Developers</h2>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li> <li>Matthijs S Berends <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0001-7620-1800" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a> <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0001-7620-1800" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li> <li>Christian F Luz <br><small class="roles"> Author, contributor </small> <a href="https://orcid.org/0000-0001-5809-5995" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li> <li>Alexander W Friedrich <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-4881-038X" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a> <br><small class="roles"> Author, contributor </small> <a href="https://orcid.org/0000-0001-5809-5995" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li> <li>Bhanu N M Sinha <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1634-0010" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li> <li>Casper J Albers <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0002-9213-6743" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-4881-038X" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li>
<a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1634-0010" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li>
<a href="https://www.rug.nl/staff/c.j.albers/">Casper J. Albers</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0002-9213-6743" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li> <li>
<a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1241-1328" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li> <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a> <br><small class="roles"> Author, thesis advisor </small> <a href="https://orcid.org/0000-0003-1241-1328" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID"></a> </li>
<li><a href="authors.html">All authors...</a></li> <li><a href="authors.html">All authors...</a></li>
@ -434,7 +429,7 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
<footer><div class="copyright"> <footer><div class="copyright">
<p>Developed by <a href="https://www.rug.nl/staff/m.s.berends/">Matthijs S. Berends</a>, <a href="https://www.rug.nl/staff/c.f.luz/">Christian F. Luz</a>, <a href="https://www.rug.nl/staff/a.w.friedrich/">Alex W. Friedrich</a>, <a href="https://www.rug.nl/staff/b.sinha/">Bhanu N. M. Sinha</a>, <a href="https://www.rug.nl/staff/c.j.albers/">Casper J. Albers</a>, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href="https://www.rug.nl/staff/c.glasner/">Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -231,15 +231,21 @@
</div> </div>
<div id="amr-0-9-0-9002" class="section level1"> <div id="amr-0-9-0-9003" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-9-0-9002" class="anchor"></a>AMR 0.9.0.9002<small> Unreleased </small> <a href="#amr-0-9-0-9003" class="anchor"></a>AMR 0.9.0.9003<small> Unreleased </small>
</h1> </h1>
<div id="last-updated-16-dec-2019" class="section level2"> <div id="last-updated-20-dec-2019" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-16-dec-2019" class="anchor"></a><small>Last updated: 16-Dec-2019</small> <a href="#last-updated-20-dec-2019" class="anchor"></a><small>Last updated: 20-Dec-2019</small>
</h2> </h2>
<p>Website updates</p> <div id="changes" class="section level3">
<h3 class="hasAnchor">
<a href="#changes" class="anchor"></a>Changes</h3>
<ul>
<li>Speed improvement for <code><a href="../reference/as.mo.html">as.mo()</a></code> (and consequently all <code>mo_*</code> functions that use <code><a href="../reference/as.mo.html">as.mo()</a></code> internally)</li>
</ul>
</div>
</div> </div>
</div> </div>
<div id="amr-0-9-0" class="section level1"> <div id="amr-0-9-0" class="section level1">
@ -284,9 +290,9 @@
<li><p>Data set <code>antivirals</code>, containing all entries from the ATC J05 group with their DDDs for oral and parenteral treatment</p></li> <li><p>Data set <code>antivirals</code>, containing all entries from the ATC J05 group with their DDDs for oral and parenteral treatment</p></li>
</ul> </ul>
</div> </div>
<div id="changes" class="section level3"> <div id="changes-1" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#changes" class="anchor"></a>Changes</h3> <a href="#changes-1" class="anchor"></a>Changes</h3>
<ul> <ul>
<li>Improvements to algorithm in <code><a href="../reference/as.mo.html">as.mo()</a></code>: <li>Improvements to algorithm in <code><a href="../reference/as.mo.html">as.mo()</a></code>:
<ul> <ul>
@ -1401,7 +1407,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-9-0-9002">0.9.0.9002</a></li> <li><a href="#amr-0-9-0-9003">0.9.0.9003</a></li>
<li><a href="#amr-0-9-0">0.9.0</a></li> <li><a href="#amr-0-9-0">0.9.0</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>
@ -1423,7 +1429,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

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.9.0.9002</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9003</span>
</span> </span>
</div> </div>
@ -585,7 +585,7 @@
<footer> <footer>
<div class="copyright"> <div class="copyright">
<p>Developed by <a href='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <a href='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <a href='https://www.rug.nl/staff/a.w.friedrich/'>Alex W. Friedrich</a>, <a href='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <a href='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p> <p>Developed by Matthijs S Berends, Christian F Luz, Alexander W Friedrich, Bhanu N M Sinha, Casper J Albers, <a href='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>
</div> </div>
<div class="pkgdown"> <div class="pkgdown">

View File

@ -2,13 +2,13 @@
> *18 October 2019* > *18 October 2019*
> **METHODS PAPER PREPRINTED** > **METHODS PAPER PREPRINTED**
> A methods paper about this package has been preprinted at bioRxiv. It was updated on 8 November 2019. Please click [here for the publishers page](https://doi.org/10.1101/810622). > A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/810622). It was **updated on 18 December 2019** and in parallel sent to a journal. Please click [here for the paper on bioRxiv's publishers page](https://doi.org/10.1101/810622).
### What is `AMR` (for R)? ### What is `AMR` (for R)?
*(<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).*
`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to supply a standard** for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. `AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data. After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.
@ -16,9 +16,9 @@ We created this package for both routine analysis and academic research (as part
<div class="main-content"> <div class="main-content">
<p> <p>
<a href="./countries.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a>
<strong>Used in over 70 countries</strong><br> <strong>Used in almost 80 countries</strong><br>
Since its first public release in early 2018, this package has been downloaded over 25,000 times from 78 countries <small>(as of December 2019, <a href="https://cran-logs.rstudio.com" target="_blank">CRAN logs</a>)</small>. Click the map to enlarge.</p><br><br> Since its first public release in early 2018, this package has been downloaded over 25,000 times from 79 countries <small>(as of December 2019, <a href="https://cran-logs.rstudio.com" target="_blank">CRAN logs</a>)</small>. Click the map to enlarge.</p><br><br>
</div> </div>
#### Partners #### Partners
@ -106,7 +106,7 @@ To find out how to conduct AMR analysis, please [continue reading here to get st
#### Microbial (taxonomic) reference data #### Microbial (taxonomic) reference data
This package contains the complete taxonomic tree of almost all 70,000 microorganisms from the authoritative and comprehensive Catalogue of Life (CoL, [www.catalogueoflife.org](http://www.catalogueoflife.org)). With `catalogue_of_life_version()` can be checked which version of the CoL is included in this package. This package contains the complete taxonomic tree of almost all ~70,000 microorganisms from the authoritative and comprehensive Catalogue of Life (CoL, [www.catalogueoflife.org](http://www.catalogueoflife.org)). With `catalogue_of_life_version()` can be checked which version of the CoL is included in this package.
Read more about which data from the Catalogue of Life [in our manual](./reference/catalogue_of_life.html). Read more about which data from the Catalogue of Life [in our manual](./reference/catalogue_of_life.html).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -22,14 +22,15 @@ knitr::opts_chunk$set(
fig.height = 4.5, fig.height = 4.5,
dpi = 75 dpi = 75
) )
options(AMR_disable_mo_history = FALSE)
``` ```
<small>Source: https://gitlab.com/msberends/AMR/blob/master/vignettes/benchmarks.Rmd</small>
One of the most important features of this package is the complete microbial taxonomic database, supplied by the [Catalogue of Life](http://catalogueoflife.org). We created a function `as.mo()` that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life. One of the most important features of this package is the complete microbial taxonomic database, supplied by the [Catalogue of Life](http://catalogueoflife.org). We created a function `as.mo()` that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.
Using the `microbenchmark` package, we can review the calculation performance of this function. Its function `microbenchmark()` runs different input expressions independently of each other and measures their time-to-result. Using the `microbenchmark` package, we can review the calculation performance of this function. Its function `microbenchmark()` runs different input expressions independently of each other and measures their time-to-result.
`r interactive()`
```{r, message = FALSE, echo = FALSE} ```{r, message = FALSE, echo = FALSE}
library(dplyr) library(dplyr)
library(ggplot2) library(ggplot2)
@ -64,7 +65,9 @@ library(microbenchmark)
library(AMR) library(AMR)
``` ```
In the next test, we try to 'coerce' different input values for *Staphylococcus aureus*. The actual result is the same every time: it returns its microorganism code `B_STPHY_AURS` (*B* stands for *Bacteria*, the taxonomic kingdom). In the next test, we try to 'coerce' different input values into the microbial code of *Staphylococcus aureus*. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.
The actual result is the same every time: it returns its microorganism code `r as.character(as.mo("Staphylococcus aureus"))` (*B* stands for *Bacteria*, the taxonomic kingdom).
But the calculation time differs a lot: But the calculation time differs a lot:
@ -103,43 +106,20 @@ clear_mo_history()
``` ```
```{r, warning=FALSE} ```{r, warning=FALSE}
M.semesiae <- microbenchmark(as.mo("metsem"), M.semesiae <- microbenchmark(as.mo("metsem"),
as.mo("METSEM"), as.mo("METSEM"),
as.mo("M. semesiae"), as.mo("M. semesiae"),
as.mo("M. semesiae"), as.mo("M. semesiae"),
as.mo("Methanosarcina semesiae"), as.mo("Methanosarcina semesiae"),
times = 10) times = 10)
print(M.semesiae, unit = "ms", signif = 4) print(M.semesiae, unit = "ms", signif = 4)
``` ```
That takes `r round(mean(M.semesiae$time, na.rm = TRUE) / mean(S.aureus$time, na.rm = TRUE), 1)` 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 *Methanosarcina semesiae*) are almost fast - these are the most probable input from most data sets. That takes `r round(mean(M.semesiae$time, na.rm = TRUE) / mean(S.aureus$time, na.rm = TRUE), 1)` 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 *Methanosarcina semesiae*) are always very fast and only take some thousands of seconds to coerce - they are the most probable input from most data sets.
In the figure below, we compare *Escherichia coli* (which is very common) with *Prevotella brevis* (which is moderately common) and with *Methanosarcina semesiae* (which is uncommon): In the figure below, we compare *Escherichia coli* (which is very common) with *Prevotella brevis* (which is moderately common) and with *Methanosarcina semesiae* (which is uncommon):
```{r, echo = FALSE} ```{r, echo = FALSE, fig.width=12}
clear_mo_history() clear_mo_history()
```
```{r, echo = FALSE}
par(mar = c(5, 16, 4, 2))
boxplot(microbenchmark(
'as.mo("Methanosarcina semesiae")' = as.mo("Methanosarcina semesiae"),
'as.mo("Prevotella brevis")' = as.mo("Prevotella brevis"),
'as.mo("Escherichia coli")' = as.mo("Escherichia coli"),
'as.mo("M. semesiae")' = as.mo("M. semesiae"),
'as.mo("P. brevis")' = as.mo("P. brevis"),
'as.mo("E. coli")' = as.mo("E. coli"),
times = 10),
horizontal = TRUE, las = 1, unit = "s", log = TRUE,
xlab = "", ylab = "Time in seconds (log)",
main = "Benchmarks per prevalence")
```
In reality, the `as.mo()` functions **learns from its own output to speed up determinations for next times**. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use `as.mo()` yourself:
```{r, echo = FALSE}
clear_mo_history()
```
```{r, echo = FALSE}
par(mar = c(5, 16, 4, 2)) par(mar = c(5, 16, 4, 2))
boxplot(microbenchmark( boxplot(microbenchmark(
'as.mo("Methanosarcina semesiae")' = as.mo("Methanosarcina semesiae", force_mo_history = TRUE), 'as.mo("Methanosarcina semesiae")' = as.mo("Methanosarcina semesiae", force_mo_history = TRUE),
@ -154,6 +134,26 @@ boxplot(microbenchmark(
main = "Benchmarks per prevalence") main = "Benchmarks per prevalence")
``` ```
In reality, the `as.mo()` functions **learns from its own output to speed up determinations for next times**. In below figure, this effect was disabled to show the difference with the boxplot above:
```{r, echo = FALSE, fig.width=12}
clear_mo_history()
options(AMR_disable_mo_history = TRUE)
par(mar = c(5, 16, 4, 2))
boxplot(microbenchmark(
'as.mo("Methanosarcina semesiae")' = as.mo("Methanosarcina semesiae"),
'as.mo("Prevotella brevis")' = as.mo("Prevotella brevis"),
'as.mo("Escherichia coli")' = as.mo("Escherichia coli"),
'as.mo("M. semesiae")' = as.mo("M. semesiae"),
'as.mo("P. brevis")' = as.mo("P. brevis"),
'as.mo("E. coli")' = as.mo("E. coli"),
times = 10),
horizontal = TRUE, las = 1, unit = "s", log = TRUE,
xlab = "", ylab = "Time in seconds (log)",
main = "Benchmarks per prevalence")
options(AMR_disable_mo_history = FALSE)
```
The highest outliers are the first times. All next determinations were done in only thousands of seconds. The highest outliers are the first times. All next determinations were done in only thousands of seconds.
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: **repetitive results** and **already precalculated results**. 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: **repetitive results** and **already precalculated results**.