mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 13:21:50 +02:00
(v0.9.0.9004) website fix
This commit is contained in:
@ -28,6 +28,18 @@ knitr::opts_chunk$set(
|
||||
|
||||
# Introduction
|
||||
|
||||
Conducting antimicrobial resistance analysis unfortunately requires in-depth knowledge from different scientific fields, which makes it hard to do right. At least, it requires:
|
||||
|
||||
* Good questions (always start with these!)
|
||||
* A thorough understanding of both (clinical) epidemiology and (clinical) microbiology, to understand the clinical and epidemiological relevance of results and their pharmaceutical implications
|
||||
* Experience with data analysis with microbiological tests and their results (MIC/RSI values)
|
||||
* Availability of the biological taxonomy of microorganisms
|
||||
* Available (inter-)national guidelines and methods to apply them
|
||||
|
||||
Of course, we cannot instantly provide you with knowledge and experience. But with this `AMR` pacakge, we aimed at providing (1) tools to simplify antimicrobial resistance data cleaning/analysis, (2) methods to easily incorporate international guidelines and (3) scientifically reliable reference data. The `AMR` package enables standardised and reproducible antimicrobial resistance analyses, including the application of evidence-based rules, determination of first isolates, translation of various codes for microorganisms and antimicrobial agents, determination of (multi-drug) resistant microorganisms, and calculation of antimicrobial resistance, prevalence and future trends.
|
||||
|
||||
# Preparation
|
||||
|
||||
For this tutorial, we will create fake demonstration data to work with.
|
||||
|
||||
You can skip to [Cleaning the data](#cleaning-the-data) if you already have your own data ready. If you start your analysis, try to make the structure of your data generally look like this:
|
||||
|
@ -29,8 +29,6 @@ One of the most important features of this package is the complete microbial tax
|
||||
|
||||
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}
|
||||
library(dplyr)
|
||||
library(ggplot2)
|
||||
@ -67,7 +65,7 @@ library(AMR)
|
||||
|
||||
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).
|
||||
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:
|
||||
|
||||
@ -134,7 +132,9 @@ boxplot(microbenchmark(
|
||||
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:
|
||||
The highest outliers are the first times. All next determinations were done in only thousands of seconds, because the `as.mo()` function **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()
|
||||
@ -154,8 +154,6 @@ boxplot(microbenchmark(
|
||||
options(AMR_disable_mo_history = FALSE)
|
||||
```
|
||||
|
||||
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**.
|
||||
|
||||
### Repetitive results
|
||||
@ -183,7 +181,7 @@ n_distinct(x)
|
||||
|
||||
# now let's see:
|
||||
run_it <- microbenchmark(mo_name(x),
|
||||
times = 10)
|
||||
times = 100)
|
||||
print(run_it, unit = "ms", signif = 3)
|
||||
```
|
||||
|
||||
@ -245,7 +243,7 @@ run_it <- microbenchmark(en = mo_name("CoNS", language = "en"),
|
||||
it = mo_name("CoNS", language = "it"),
|
||||
fr = mo_name("CoNS", language = "fr"),
|
||||
pt = mo_name("CoNS", language = "pt"),
|
||||
times = 10)
|
||||
times = 100)
|
||||
print(run_it, unit = "ms", signif = 4)
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user