Used in over 70 countries
- Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.
diff --git a/DESCRIPTION b/DESCRIPTION index 66fdea47..486001dc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR Version: 0.9.0 -Date: 2019-11-29 +Date: 2019-11-30 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/R/misc.R b/R/misc.R index 37ae8870..2f98c6b1 100755 --- a/R/misc.R +++ b/R/misc.R @@ -117,7 +117,10 @@ search_type_in_df <- function(x, type) { stopifnot_installed_package <- function(package) { # no "utils::installed.packages()" since it requires non-staged install since R 3.6.0 # https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html - get(".packageName", envir = asNamespace(package)) + tryCatch(get(".packageName", envir = asNamespace(package)), + error = function(e) stop("package '", package, "' required but not installed", + ' - try to install it with: install.packages("', package, '")', + call. = FALSE)) return(invisible()) } diff --git a/R/mo_property.R b/R/mo_property.R index 3453a77a..b8c22430 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -21,7 +21,7 @@ #' Property of a microorganism #' -#' Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with [as.mo()], which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples. +#' Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with [as.mo()], which makes it possible to use microbial abbreviations, codes and names as input. Please see *Examples*. #' @param x any (vector of) text that can be coerced to a valid microorganism code with [as.mo()] #' @param property one of the column names of the [microorganisms] data set or `"shortname"` #' @param language language of the returned text, defaults to system language (see [get_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation. @@ -32,7 +32,7 @@ #' - `mo_ref("Chlamydia psittaci")` will return `"Page, 1968"` (with a warning about the renaming) #' - `mo_ref("Chlamydophila psittaci")` will return `"Everett et al., 1999"` (without a warning) #' -#' The Gram stain - [mo_gramstain()] - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram positive - all other bacteria are considered Gram negative. Species outside the kingdom of Bacteria will return a value `NA`. +#' The Gram stain - [mo_gramstain()] - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. #' #' All output will be [translate]d where possible. #' @@ -43,7 +43,7 @@ #' @name mo_property #' @return #' - An [`integer`] in case of [mo_year()] -#' - A [`list`] in case of [mo_taxonomy()] +#' - A [`list`] in case of [mo_taxonomy()] and [mo_info()] #' - A named [`character`] in case of [mo_url()] #' - A [`character`] in all other cases #' @export diff --git a/R/mo_source.R b/R/mo_source.R index 2df96095..8b054964 100644 --- a/R/mo_source.R +++ b/R/mo_source.R @@ -40,12 +40,12 @@ #' #' Imagine this data on a sheet of an Excel file (mo codes were looked up in the `microorganisms` data set). The first column contains the organisation specific codes, the second column contains an MO code from this package: #' ``` -#' | A | B | -#' --|--------------------|-------------| -#' 1 | Organisation XYZ | mo | -#' 2 | lab_mo_ecoli | B_ESCHR_COL | -#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNE | -#' 4 | | | +#' | A | B | +#' --|--------------------|--------------| +#' 1 | Organisation XYZ | mo | +#' 2 | lab_mo_ecoli | B_ESCHR_COLI | +#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN | +#' 4 | | | #' ``` #' #' We save it as `"home/me/ourcodes.xlsx"`. Now we have to set it as a source: @@ -59,7 +59,7 @@ #' And now we can use it in our functions: #' ``` #' as.mo("lab_mo_ecoli") -#' \[1\] B_ESCHR_COLI +#' [1] B_ESCHR_COLI #' #' mo_genus("lab_mo_kpneumoniae") #' [1] "Klebsiella" @@ -69,7 +69,7 @@ #' [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI #' ``` #' -#' If we edit the Excel file to, let's say, this: +#' If we edit the Excel file to, let's say, by adding row 4 like this: #' ``` #' | A | B | #' --|--------------------|--------------| @@ -80,7 +80,7 @@ #' 5 | | | #' ``` #' -#' ...any new usage of an MO function in this package will update your data: +#' ...any new usage of an MO function in this package will update your data file: #' ``` #' as.mo("lab_mo_ecoli") #' # Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'. @@ -90,9 +90,8 @@ #' [1] "Staphylococcus" #' ``` #' -#' To remove the reference completely, just use any of these: +#' To remove the reference data file completely, just use `""` or `NULL` as input for `[set_mo_source()]`: #' ``` -#' set_mo_source("") #' set_mo_source(NULL) #' # Removed mo_source file '~/.mo_source.rds'. #' ``` @@ -126,9 +125,7 @@ set_mo_source <- function(path) { } else if (path %like% "[.]xlsx?$") { # is Excel file (old or new) - if (!"readxl" %in% utils::installed.packages()) { - stop("Install the 'readxl' package first.") - } + stopifnot_installed_package("readxl") df <- readxl::read_excel(path) } else if (path %like% "[.]tsv$") { @@ -219,5 +216,5 @@ mo_source_isvalid <- function(x) { if (!"mo" %in% colnames(x)) { return(FALSE) } - all(x$mo %in% c("", AMR::microorganisms$mo)) + all(x$mo %in% c("", AMR::microorganisms$mo, AMR::microorganisms.translation$mo_old), na.rm = TRUE) } diff --git a/docs/articles/AMR.html b/docs/articles/AMR.html index 553d33c0..c5379fd9 100644 --- a/docs/articles/AMR.html +++ b/docs/articles/AMR.html @@ -187,7 +187,7 @@
AMR.Rmd
Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 29 November 2019.
+Note: values on this page will change with every website update since they are based on randomly created values and the page was written in R Markdown. However, the methodology remains unchanged. This page was generated on 30 November 2019.
So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values M
and F
. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.
The data is already quite clean, but we still need to transform some variables. The bacteria
column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The mutate()
function of the dplyr
package makes this really easy:
data <- data %>%
@@ -422,8 +422,8 @@
# Other rules by this AMR package
# Non-EUCAST: inherit amoxicillin results for unavailable ampicillin (no changes)
# Non-EUCAST: inherit ampicillin results for unavailable amoxicillin (no changes)
-# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,987 values changed)
-# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (122 values changed)
+# Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,960 values changed)
+# Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (144 values changed)
# Non-EUCAST: set piperacillin = R where piperacillin/tazobactam = R (no changes)
# Non-EUCAST: set piperacillin/tazobactam = S where piperacillin = S (no changes)
# Non-EUCAST: set trimethoprim = R where trimethoprim/sulfa = R (no changes)
@@ -448,14 +448,14 @@
# Pasteurella multocida (no changes)
# Staphylococcus (no changes)
# Streptococcus groups A, B, C, G (no changes)
-# Streptococcus pneumoniae (1,064 values changed)
+# Streptococcus pneumoniae (997 values changed)
# Viridans group streptococci (no changes)
#
# EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)
-# Table 01: Intrinsic resistance in Enterobacteriaceae (1,300 values changed)
+# Table 01: Intrinsic resistance in Enterobacteriaceae (1,331 values changed)
# Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)
# Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)
-# Table 04: Intrinsic resistance in Gram-positive bacteria (2,722 values changed)
+# Table 04: Intrinsic resistance in Gram-positive bacteria (2,705 values changed)
# Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)
# Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)
# Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)
@@ -463,15 +463,15 @@
# Table 13: Interpretive rules for quinolones (no changes)
#
# -------------------------------------------------------------------------------
-# EUCAST rules affected 6,539 out of 20,000 rows, making a total of 8,195 edits
+# EUCAST rules affected 6,481 out of 20,000 rows, making a total of 8,137 edits
# => added 0 test results
#
-# => changed 8,195 test results
-# - 125 test results changed from S to I
-# - 4,759 test results changed from S to R
-# - 1,206 test results changed from I to S
-# - 324 test results changed from I to R
-# - 1,781 test results changed from R to S
+# => changed 8,137 test results
+# - 115 test results changed from S to I
+# - 4,732 test results changed from S to R
+# - 1,228 test results changed from I to S
+# - 330 test results changed from I to R
+# - 1,732 test results changed from R to S
# -------------------------------------------------------------------------------
#
# Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.
So only 28.4% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
So only 28.3% is suitable for resistance analysis! We can now filter on it with the filter()
function, also from the dplyr
package:
For future use, the above two syntaxes can be shortened with the filter_first_isolate()
function:
We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient N6, sorted on date:
+We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient E9, sorted on date:
isolate | @@ -526,10 +526,10 @@|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-02-23 | -N6 | +2010-07-16 | +E9 | B_ESCHR_COLI | -R | +S | S | S | S | @@ -537,43 +537,43 @@|||
2 | -2010-04-09 | -N6 | +2010-07-22 | +E9 | B_ESCHR_COLI | S | S | -S | +R | S | FALSE | ||
3 | -2010-04-23 | -N6 | +2010-08-26 | +E9 | B_ESCHR_COLI | R | -R | S | +R | S | FALSE | ||
4 | -2010-05-12 | -N6 | +2010-10-17 | +E9 | B_ESCHR_COLI | -R | S | -R | -R | +S | +S | +S | FALSE |
5 | -2010-06-27 | -N6 | +2010-10-25 | +E9 | B_ESCHR_COLI | -I | +S | S | S | S | @@ -581,10 +581,10 @@|||
6 | -2010-08-09 | -N6 | +2011-02-27 | +E9 | B_ESCHR_COLI | -R | +S | S | S | S | @@ -592,51 +592,51 @@|||
7 | -2010-09-01 | -N6 | +2011-03-15 | +E9 | B_ESCHR_COLI | -I | S | -R | +S | +S | S | FALSE | |
8 | -2010-10-18 | -N6 | +2011-03-19 | +E9 | B_ESCHR_COLI | -S | -S | +R | +R | S | S | FALSE | |
9 | -2011-01-18 | -N6 | +2011-06-20 | +E9 | B_ESCHR_COLI | -R | -I | -R | +S | +S | +S | S | FALSE |
10 | -2011-02-15 | -N6 | +2011-12-03 | +E9 | B_ESCHR_COLI | S | S | S | S | -FALSE | +TRUE |
Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics()
function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.
Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The key_antibiotics()
function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.
If a column exists with a name like ‘key(…)ab’ the first_isolate()
function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:
data <- data %>%
mutate(keyab = key_antibiotics(.)) %>%
@@ -647,7 +647,7 @@
# NOTE: Using column `patient_id` as input for `col_patient_id`.
# NOTE: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.
# [Criterion] Inclusion based on key antibiotics, ignoring I
-# => Found 15,038 first weighted isolates (75.2% of total)
isolate | @@ -664,10 +664,10 @@||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | -2010-02-23 | -N6 | +2010-07-16 | +E9 | B_ESCHR_COLI | -R | +S | S | S | S | @@ -676,58 +676,58 @@||||
2 | -2010-04-09 | -N6 | +2010-07-22 | +E9 | B_ESCHR_COLI | S | S | -S | +R | S | FALSE | TRUE | ||
3 | -2010-04-23 | -N6 | +2010-08-26 | +E9 | B_ESCHR_COLI | R | -R | S | +R | S | FALSE | TRUE | ||
4 | -2010-05-12 | -N6 | +2010-10-17 | +E9 | B_ESCHR_COLI | -R | S | -R | -R | +S | +S | +S | FALSE | TRUE |
5 | -2010-06-27 | -N6 | +2010-10-25 | +E9 | B_ESCHR_COLI | -I | +S | S | S | S | FALSE | -TRUE | +FALSE | |
6 | -2010-08-09 | -N6 | +2011-02-27 | +E9 | B_ESCHR_COLI | -R | +S | S | S | S | @@ -736,23 +736,23 @@||||
7 | -2010-09-01 | -N6 | +2011-03-15 | +E9 | B_ESCHR_COLI | -I | S | -R | +S | +S | S | FALSE | -TRUE | +FALSE |
8 | -2010-10-18 | -N6 | +2011-03-19 | +E9 | B_ESCHR_COLI | -S | -S | +R | +R | S | S | FALSE | @@ -760,35 +760,35 @@||
9 | -2011-01-18 | -N6 | +2011-06-20 | +E9 | B_ESCHR_COLI | -R | -I | -R | +S | +S | +S | S | FALSE | TRUE |
10 | -2011-02-15 | -N6 | +2011-12-03 | +E9 | B_ESCHR_COLI | S | S | S | S | -FALSE | +TRUE | TRUE |
Instead of 1, now 9 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.7% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
+Instead of 2, now 7 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.
As with filter_first_isolate()
, there’s a shortcut for this new algorithm too:
So we end up with 15,038 isolates for analysis.
+So we end up with 15,044 isolates for analysis.
We can remove unneeded columns:
@@ -813,15 +813,47 @@Frequency table
Class: character
-Length: 15,038 (of which NA: 0 = 0%)
+Length: 15,044 (of which NA: 0 = 0%)
Unique: 4
Shortest: 16
Longest: 24
The functions resistance()
and susceptibility()
can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions proportion_S()
, proportion_SI()
, proportion_I()
, proportion_IR()
and proportion_R()
can be used to determine the proportion of a specific antimicrobial outcome.
As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (proportion_R()
, equal to resistance()
) and susceptibility as the proportion of S and I (proportion_SI()
, equal to susceptibility()
). These functions can be used on their own:
Or can be used in conjuction with group_by()
and summarise()
, both from the dplyr
package:
data_1st %>%
group_by(hospital) %>%
@@ -995,19 +995,19 @@ Longest: 24
Hospital A
-0.4688268
+0.4644833
Hospital B
-0.4681135
+0.4626231
Hospital C
-0.4541020
+0.4616060
Hospital D
-0.4743044
+0.4776800
@@ -1025,23 +1025,23 @@ Longest: 24
Hospital A
-0.4688268
-4475
+0.4644833
+4519
Hospital B
-0.4681135
-5253
+0.4626231
+5177
Hospital C
-0.4541020
-2255
+0.4616060
+2279
Hospital D
-0.4743044
-3055
+0.4776800
+3069
@@ -1061,27 +1061,27 @@ Longest: 24
Escherichia
-0.9244023
-0.8946173
-0.9929211
+0.9253970
+0.8955025
+0.9929267
Klebsiella
-0.9174726
-0.8891038
-0.9929078
+0.9298701
+0.9038961
+0.9967532
Staphylococcus
-0.9193941
-0.9248039
-0.9940492
+0.9276493
+0.9133943
+0.9943518
Streptococcus
-0.6070343
+0.6096816
0.0000000
-0.6070343
+0.6096816
diff --git a/docs/articles/AMR_files/figure-html/plot 1-1.png b/docs/articles/AMR_files/figure-html/plot 1-1.png
index ad242a4d..d7bceec2 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 1-1.png and b/docs/articles/AMR_files/figure-html/plot 1-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 3-1.png b/docs/articles/AMR_files/figure-html/plot 3-1.png
index 6d92d711..1f51a21e 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 3-1.png and b/docs/articles/AMR_files/figure-html/plot 3-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 4-1.png b/docs/articles/AMR_files/figure-html/plot 4-1.png
index 6560b52b..50a1c14d 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 4-1.png and b/docs/articles/AMR_files/figure-html/plot 4-1.png differ
diff --git a/docs/articles/AMR_files/figure-html/plot 5-1.png b/docs/articles/AMR_files/figure-html/plot 5-1.png
index 2c2c9b73..e2aca4a6 100644
Binary files a/docs/articles/AMR_files/figure-html/plot 5-1.png and b/docs/articles/AMR_files/figure-html/plot 5-1.png differ
diff --git a/docs/articles/WHONET.html b/docs/articles/WHONET.html
index 7d3ad01e..16d6d3bf 100644
--- a/docs/articles/WHONET.html
+++ b/docs/articles/WHONET.html
@@ -187,7 +187,7 @@
How to work with WHONET data
Matthijs S. Berends
- 29 November 2019
+ 30 November 2019
WHONET.Rmd
diff --git a/docs/countries.png b/docs/countries.png
index df8e944e..f0424ce4 100644
Binary files a/docs/countries.png and b/docs/countries.png differ
diff --git a/docs/extra.css b/docs/extra.css
index 9aa02497..e336ed36 100644
--- a/docs/extra.css
+++ b/docs/extra.css
@@ -44,7 +44,7 @@
.countries_map {
float: left;
padding: 0 10px 10px 0;
- max-width: 25%;
+ max-width: 35%;
}
@media only screen and (max-width: 992px) {
.footer_logo {
diff --git a/docs/index.html b/docs/index.html
index 6f8fc070..82f6284c 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -191,22 +191,22 @@
-(TLDR - to find out how to conduct AMR analysis, please continue reading here to get started.
18 October 2019
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.
-
What is AMR
(for R)?
-AMR
is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.
+(TLDR - to find out how to conduct AMR analysis, please continue reading here to get started.
+AMR
is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. Our aim is to offer a new 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 and all ~550 antibiotic, antimycotic and antiviral drugs by name and code, and knows all about valid RSI and MIC values. It supports any data format, including WHONET/EARS-Net data.
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 & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software (see Copyright).
Used in over 70 countries
- Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.
+ Since its first public release in early 2018, this package has been downloaded over 25,000 times from 75 countries (as of November 2019, CRAN logs). Click the map to enlarge.
@@ -309,7 +309,7 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
WHONET / EARS-Net
-We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an example data set WHONET
with the exact same structure as a WHONET export file. Furthermore, this package also contains a data set antibiotics
with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.
+We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an example data set WHONET
with the exact same structure as a WHONET export file. Furthermore, this package also contains a data set antibiotics with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.
Read our tutorial about how to work with WHONET data here.
@@ -336,8 +336,8 @@ A methods paper about this package has been preprinted at bioRxiv. It was update
Use mdro()
to determine which micro-organisms are multi-drug resistant organisms (MDRO). It supports a variety of international guidelines, such as the MDR-paper by Magiorakos et al. (2012, PMID 21793988), the exceptional phenotype definitions of EUCAST and the WHO guideline on multi-drug resistant TB. It also supports the national guidelines of the Netherlands and Germany.
-The data set microorganisms
contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like mo_genus()
, mo_family()
, mo_gramstain()
or even mo_phylum()
. As they use as.mo()
internally, they also use the same intelligent rules for determination. For example, mo_genus("MRSA")
and mo_genus("S. aureus")
will both return "Staphylococcus"
. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
-The data set antibiotics
contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like ab_name()
, ab_group()
, ab_atc()
and ab_tradenames()
to look up values. The ab_*
functions use as.ab()
internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox")
, ab_name("Floxapen")
and ab_name("J01CF05")
will all return "Flucloxacillin"
. These functions can again be used to add new variables to your data.
+The data set microorganisms contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like mo_genus()
, mo_family()
, mo_gramstain()
or even mo_phylum()
. As they use as.mo()
internally, they also use the same intelligent rules for determination. For example, mo_genus("MRSA")
and mo_genus("S. aureus")
will both return "Staphylococcus"
. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
+The data set antibiotics contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like ab_name()
, ab_group()
, ab_atc()
and ab_tradenames()
to look up values. The ab_*
functions use as.ab()
internally so they support the same intelligent rules to guess the most probable result. For example, ab_name("Fluclox")
, ab_name("Floxapen")
and ab_name("J01CF05")
will all return "Flucloxacillin"
. These functions can again be used to add new variables to your data.
diff --git a/docs/news/index.html b/docs/news/index.html
index 819ec46b..f806f7ac 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -233,7 +233,7 @@
-AMR 0.9.0 Unreleased
+AMR 0.9.0 2019-11-29
diff --git a/docs/reference/mo_property.html b/docs/reference/mo_property.html
index 82f39d28..ddd2008e 100644
--- a/docs/reference/mo_property.html
+++ b/docs/reference/mo_property.html
@@ -51,7 +51,7 @@
-
+
@@ -234,7 +234,7 @@
- Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with as.mo()
, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples.
+ Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with as.mo()
, which makes it possible to use microbial abbreviations, codes and names as input. Please see Examples.
mo_name(x, language = get_locale(), ...)
@@ -311,7 +311,7 @@
An integer
in case of mo_year()
-A list
in case of mo_taxonomy()
+A list
in case of mo_taxonomy()
and mo_info()
A named character
in case of mo_url()
A character
in all other cases
@@ -324,7 +324,7 @@
mo_ref("Chlamydophila psittaci")
will return "Everett et al., 1999"
(without a warning)
-The Gram stain - mo_gramstain()
- will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram positive - all other bacteria are considered Gram negative. Species outside the kingdom of Bacteria will return a value NA
.
+The Gram stain - mo_gramstain()
- will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value NA
.
All output will be translated where possible.
The function mo_url()
will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
Catalogue of Life
diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html
index 6b7cc4c9..9c0f441d 100644
--- a/docs/reference/mo_source.html
+++ b/docs/reference/mo_source.html
@@ -260,12 +260,12 @@ This is the fastest way to have your organisation (or analysis) specific codes p
Reading an Excel file (.xlsx
) with only one row has a size of 8-9 kB. The compressed file used by this package will have a size of 0.1 kB and can be read by get_mo_source()
in only a couple of microseconds (a millionth of a second).
How it works
-Imagine this data on a sheet of an Excel file (mo codes were looked up in the microorganisms
data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:
| A | B |
---|--------------------|-------------|
-1 | Organisation XYZ | mo |
-2 | lab_mo_ecoli | B_ESCHR_COL |
-3 | lab_mo_kpneumoniae | B_KLBSL_PNE |
-4 | | |
+Imagine this data on a sheet of an Excel file (mo codes were looked up in the microorganisms
data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:
| A | B |
+--|--------------------|--------------|
+1 | Organisation XYZ | mo |
+2 | lab_mo_ecoli | B_ESCHR_COLI |
+3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
+4 | | |
We save it as "home/me/ourcodes.xlsx"
. Now we have to set it as a source:
set_mo_source("home/me/ourcodes.xlsx")
@@ -274,7 +274,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
It has now created a file "~/.mo_source.rds"
with the contents of our Excel file, but only the first column with foreign values and the 'mo' column will be kept.
And now we can use it in our functions:
as.mo("lab_mo_ecoli")
-\[1\] B_ESCHR_COLI
+[1] B_ESCHR_COLI
mo_genus("lab_mo_kpneumoniae")
[1] "Klebsiella"
@@ -284,7 +284,7 @@ as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
[1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
-If we edit the Excel file to, let's say, this:
| A | B |
+If we edit the Excel file to, let's say, by adding row 4 like this:
| A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
@@ -293,7 +293,7 @@ as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
5 | | |
-...any new usage of an MO function in this package will update your data:
as.mo("lab_mo_ecoli")
+...any new usage of an MO function in this package will update your data file:
as.mo("lab_mo_ecoli")
# Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'.
[1] B_ESCHR_COLI
@@ -301,8 +301,7 @@ mo_genus("lab_Staph_aureus")
[1] "Staphylococcus"
-To remove the reference completely, just use any of these:
set_mo_source("")
-set_mo_source(NULL)
+To remove the reference data file completely, just use ""
or NULL
as input for [set_mo_source()]
:
set_mo_source(NULL)
# Removed mo_source file '~/.mo_source.rds'.
diff --git a/index.md b/index.md
index 83ff5c74..09c427de 100644
--- a/index.md
+++ b/index.md
@@ -1,16 +1,16 @@
# `AMR` (for R)
-*(TLDR - to find out how to conduct AMR analysis, please [continue reading here to get started](./articles/AMR.html).*
-
> *18 October 2019*
> **METHODS PAPER PREPRINTED**
> A methods paper about this package has been preprinted at bioRxiv. It was updated on 8 November 2019. Please click [here for the publishers page](https://doi.org/10.1101/810622).
-----
-
### What is `AMR` (for R)?
-`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 properties by using evidence-based methods. 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.
+*(TLDR - 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 properties by using evidence-based methods. Our aim is to offer a new 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.
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 & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is [actively maintained](./news) and is free software (see [Copyright](#copyright)).
@@ -18,7 +18,7 @@ We created this package for both routine analysis and academic research (as part
Used in over 70 countries
- Since its first public release in early 2018, this package has been downloaded over 25,000 times from 74 countries (as of November 2019, CRAN logs). Click the map to enlarge.
+ Since its first public release in early 2018, this package has been downloaded over 25,000 times from 75 countries (as of November 2019, CRAN logs). Click the map to enlarge.
#### Partners
@@ -120,7 +120,7 @@ Read more about the data from WHOCC [in our manual](./reference/WHOCC.html).
#### WHONET / EARS-Net
-We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an [example data set `WHONET`](./reference/WHONET.html) with the exact same structure as a WHONET export file. Furthermore, this package also contains a [data set `antibiotics`](./reference/antibiotics.html) with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.
+We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an [example data set `WHONET`](./reference/WHONET.html) with the exact same structure as a WHONET export file. Furthermore, this package also contains a [data set antibiotics](./reference/antibiotics.html) with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.
Read our tutorial about [how to work with WHONET data here](./articles/WHONET.html).
@@ -141,8 +141,8 @@ The `AMR` package basically does four important things:
* Use `first_isolate()` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
* Use `mdro()` to determine which micro-organisms are multi-drug resistant organisms (MDRO). It supports a variety of international guidelines, such as the MDR-paper by Magiorakos *et al.* (2012, [PMID 21793988](https://www.ncbi.nlm.nih.gov/pubmed/?term=21793988)), the exceptional phenotype definitions of EUCAST and the WHO guideline on multi-drug resistant TB. It also supports the national guidelines of the Netherlands and Germany.
- * The [data set `microorganisms`](./reference/microorganisms.html) contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus()`, `mo_family()`, `mo_gramstain()` or even `mo_phylum()`. As they use `as.mo()` internally, they also use the same intelligent rules for determination. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
- * The [data set `antibiotics`](./reference/antibiotics.html) contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like `ab_name()`, `ab_group()`, `ab_atc()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
+ * The [data set microorganisms](./reference/microorganisms.html) contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like `mo_genus()`, `mo_family()`, `mo_gramstain()` or even `mo_phylum()`. As they use `as.mo()` internally, they also use the same intelligent rules for determination. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
+ * The [data set antibiotics](./reference/antibiotics.html) contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like `ab_name()`, `ab_group()`, `ab_atc()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
3. It **analyses the data** with convenient functions that use well-known methods.
diff --git a/man/mo_property.Rd b/man/mo_property.Rd
index 08a5949a..0cc06f71 100644
--- a/man/mo_property.Rd
+++ b/man/mo_property.Rd
@@ -83,13 +83,13 @@ mo_property(x, property = "fullname", language = get_locale(), ...)
\value{
\itemize{
\item An \code{\link{integer}} in case of \code{\link[=mo_year]{mo_year()}}
-\item A \code{\link{list}} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}}
+\item A \code{\link{list}} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}} and \code{\link[=mo_info]{mo_info()}}
\item A named \code{\link{character}} in case of \code{\link[=mo_url]{mo_url()}}
\item A \code{\link{character}} in all other cases
}
}
\description{
-Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with \code{\link[=as.mo]{as.mo()}}, which makes it possible for input of these functions to use microbial abbreviations, codes and names. See Examples.
+Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with \code{\link[=as.mo]{as.mo()}}, which makes it possible to use microbial abbreviations, codes and names as input. Please see \emph{Examples}.
}
\details{
All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{\link[=mo_ref]{mo_ref()}}, \code{\link[=mo_authors]{mo_authors()}} and \code{\link[=mo_year]{mo_year()}}. This leads to the following results:
@@ -99,7 +99,7 @@ All functions will return the most recently known taxonomic property according t
\item \code{mo_ref("Chlamydophila psittaci")} will return \code{"Everett et al., 1999"} (without a warning)
}
-The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram positive - all other bacteria are considered Gram negative. Species outside the kingdom of Bacteria will return a value \code{NA}.
+The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002) who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}.
All output will be \link{translate}d where possible.
diff --git a/man/mo_source.Rd b/man/mo_source.Rd
index 30fc5eff..ddb6c94c 100644
--- a/man/mo_source.Rd
+++ b/man/mo_source.Rd
@@ -28,12 +28,12 @@ The reference file can be a text file seperated with commas (CSV) or tabs or pip
Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The compressed file used by this package will have a size of 0.1 kB and can be read by \code{\link[=get_mo_source]{get_mo_source()}} in only a couple of microseconds (a millionth of a second).
\subsection{How it works}{
-Imagine this data on a sheet of an Excel file (mo codes were looked up in the \code{microorganisms} data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:\preformatted{ | A | B |
---|--------------------|-------------|
-1 | Organisation XYZ | mo |
-2 | lab_mo_ecoli | B_ESCHR_COL |
-3 | lab_mo_kpneumoniae | B_KLBSL_PNE |
-4 | | |
+Imagine this data on a sheet of an Excel file (mo codes were looked up in the \code{microorganisms} data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:\preformatted{ | A | B |
+--|--------------------|--------------|
+1 | Organisation XYZ | mo |
+2 | lab_mo_ecoli | B_ESCHR_COLI |
+3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
+4 | | |
}
We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:\preformatted{set_mo_source("home/me/ourcodes.xlsx")
@@ -43,7 +43,7 @@ We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:
It has now created a file \code{"~/.mo_source.rds"} with the contents of our Excel file, but only the first column with foreign values and the 'mo' column will be kept.
And now we can use it in our functions:\preformatted{as.mo("lab_mo_ecoli")
-\[1\] B_ESCHR_COLI
+[1] B_ESCHR_COLI
mo_genus("lab_mo_kpneumoniae")
[1] "Klebsiella"
@@ -53,7 +53,7 @@ as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
[1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
}
-If we edit the Excel file to, let's say, this:\preformatted{ | A | B |
+If we edit the Excel file to, let's say, by adding row 4 like this:\preformatted{ | A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
@@ -62,7 +62,7 @@ If we edit the Excel file to, let's say, this:\preformatted{ | A
5 | | |
}
-...any new usage of an MO function in this package will update your data:\preformatted{as.mo("lab_mo_ecoli")
+...any new usage of an MO function in this package will update your data file:\preformatted{as.mo("lab_mo_ecoli")
# Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'.
[1] B_ESCHR_COLI
@@ -70,8 +70,7 @@ mo_genus("lab_Staph_aureus")
[1] "Staphylococcus"
}
-To remove the reference completely, just use any of these:\preformatted{set_mo_source("")
-set_mo_source(NULL)
+To remove the reference data file completely, just use \code{""} or \code{NULL} as input for \verb{[set_mo_source()]}:\preformatted{set_mo_source(NULL)
# Removed mo_source file '~/.mo_source.rds'.
}
}
diff --git a/pkgdown/extra.css b/pkgdown/extra.css
index 9aa02497..e336ed36 100644
--- a/pkgdown/extra.css
+++ b/pkgdown/extra.css
@@ -44,7 +44,7 @@
.countries_map {
float: left;
padding: 0 10px 10px 0;
- max-width: 25%;
+ max-width: 35%;
}
@media only screen and (max-width: 992px) {
.footer_logo {
diff --git a/pkgdown/logos/countries.png b/pkgdown/logos/countries.png
index df8e944e..f0424ce4 100644
Binary files a/pkgdown/logos/countries.png and b/pkgdown/logos/countries.png differ