2020-08-16 21:38:42 +02:00
---
2020-08-17 21:49:58 +02:00
title: "Data sets for download / own use"
2021-03-05 01:31:46 +01:00
date: '`r format(Sys.Date(), "%d %B %Y")`'
2020-08-16 21:38:42 +02:00
output:
rmarkdown::html_vignette:
toc: true
2020-09-03 12:31:48 +02:00
toc_depth: 1
2020-08-16 21:38:42 +02:00
vignette: >
2020-08-17 21:49:58 +02:00
%\VignetteIndexEntry{Data sets for download / own use}
2020-08-16 21:38:42 +02:00
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE, results = 'markup'}
knitr::opts_chunk$set(
warning = FALSE,
collapse = TRUE,
comment = "#",
fig.width = 7.5,
fig.height = 5
)
2020-09-03 20:59:21 +02:00
library(AMR)
library(dplyr)
2022-08-26 14:02:08 +02:00
options(knitr.kable.NA = "")
2020-08-16 21:38:42 +02:00
structure_txt <- function(dataset) {
paste0("A data set with ",
format(nrow(dataset), big.mark = ","), " rows and ",
2021-02-04 16:48:16 +01:00
ncol(dataset), " columns, containing the following column names: \n",
2021-03-11 21:42:30 +01:00
AMR:::vector_or(colnames(dataset), quotes = "*", last_sep = " and ", sort = FALSE), ".")
2020-08-16 21:38:42 +02:00
}
download_txt <- function(filename) {
2020-08-17 21:49:58 +02:00
msg <- paste0("It was last updated on ",
2021-03-11 21:42:30 +01:00
trimws(format(file.mtime(paste0("../data/", filename, ".rda")), "%e %B %Y %H:%M:%S %Z", tz = "UTC")),
2020-10-08 11:16:03 +02:00
". Find more info about the structure of this data set [here](https://msberends.github.io/AMR/reference/", ifelse(filename == "antivirals", "antibiotics", filename), ".html).\n")
2021-10-06 13:23:57 +02:00
github_base <- "https://github.com/msberends/AMR/raw/main/data-raw/"
2020-08-16 21:38:42 +02:00
filename <- paste0("../data-raw/", filename)
txt <- paste0(filename, ".txt")
rds <- paste0(filename, ".rds")
spss <- paste0(filename, ".sav")
2020-08-21 11:40:13 +02:00
stata <- paste0(filename, ".dta")
sas <- paste0(filename, ".sas")
2020-08-16 21:38:42 +02:00
excel <- paste0(filename, ".xlsx")
2020-09-24 00:30:11 +02:00
create_txt <- function(filename, type, software) {
2020-12-17 16:22:25 +01:00
paste0("* Download as [", software, " file](", github_base, filename, ") (", AMR:::formatted_filesize(filename), ") \n")
2020-08-16 21:38:42 +02:00
}
2020-08-29 21:41:46 +02:00
if (any(file.exists(rds),
file.exists(excel),
file.exists(txt),
file.exists(sas),
file.exists(spss),
file.exists(stata))) {
2020-09-24 00:30:11 +02:00
msg <- c(msg, "\n**Direct download links:**\n\n")
2020-08-29 21:41:46 +02:00
}
2020-09-24 00:30:11 +02:00
if (file.exists(rds)) msg <- c(msg, create_txt(rds, "rds", "R"))
if (file.exists(excel)) msg <- c(msg, create_txt(excel, "xlsx", "Excel"))
if (file.exists(txt)) msg <- c(msg, create_txt(txt, "txt", "plain text"))
if (file.exists(sas)) msg <- c(msg, create_txt(sas, "sas", "SAS"))
if (file.exists(spss)) msg <- c(msg, create_txt(spss, "sav", "SPSS"))
if (file.exists(stata)) msg <- c(msg, create_txt(stata, "dta", "Stata"))
2020-08-17 21:49:58 +02:00
paste0(msg, collapse = "")
2020-08-16 21:38:42 +02:00
}
2020-08-29 21:41:46 +02:00
print_df <- function(x, rows = 6) {
2020-08-16 21:38:42 +02:00
x %>%
2020-08-29 21:41:46 +02:00
head(n = rows) %>%
2020-08-16 21:38:42 +02:00
mutate_all(function(x) {
if (is.list(x)) {
sapply(x, function(y) {
if (length(y) > 3) {
paste0(paste(y[1:3], collapse = ", "), ", ...")
2020-12-17 16:22:25 +01:00
} else if (length(y) == 0 || all(is.na(y))) {
2020-08-16 21:38:42 +02:00
""
} else {
paste(y, collapse = ", ")
}
})
} else {
x
}
}) %>%
knitr::kable(align = "c")
}
```
2020-08-21 11:40:13 +02:00
All reference data (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this `AMR` package are reliable, up-to-date and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply tab separated files that are machine-readable and suitable for input in any software program, such as laboratory information systems.
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
On this page, we explain how to download them and how the structure of the data sets look like.
2020-08-17 21:49:58 +02:00
## Microorganisms (currently accepted names)
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
`r structure_txt(microorganisms)`
2020-08-16 21:38:42 +02:00
This data set is in R available as `microorganisms`, after you load the `AMR` package.
2020-08-17 21:49:58 +02:00
`r download_txt("microorganisms")`
### Source
2020-08-16 21:38:42 +02:00
Our full taxonomy of microorganisms is based on the authoritative and comprehensive:
2021-03-11 21:42:30 +01:00
* [Catalogue of Life](http://www.catalogueoflife.org) (included version: `r AMR:::CATALOGUE_OF_LIFE$year`)
* [List of Prokaryotic names with Standing in Nomenclature](https://lpsn.dsmz.de) (LPSN, last updated: `r AMR:::CATALOGUE_OF_LIFE$yearmonth_LPSN`)
* `r AMR:::SNOMED_VERSION$current_source`, retrieved from the [`r AMR:::SNOMED_VERSION$title`](`r AMR:::SNOMED_VERSION$url`), OID `r AMR:::SNOMED_VERSION$current_oid`, version `r AMR:::SNOMED_VERSION$current_version`
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
### Example content
2020-08-16 21:38:42 +02:00
2020-08-17 21:49:58 +02:00
Included (sub)species per taxonomic kingdom:
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
microorganisms %>%
2021-12-14 22:59:27 +01:00
count(kingdom) %>%
mutate(n = format(n, big.mark = ",")) %>%
2020-08-16 21:38:42 +02:00
setNames(c("Kingdom", "Number of (sub)species")) %>%
print_df()
```
2020-08-17 21:49:58 +02:00
Example rows when filtering on genus *Escherichia*:
2020-08-16 21:38:42 +02:00
2020-08-17 21:49:58 +02:00
```{r, echo = FALSE}
microorganisms %>%
filter(genus == "Escherichia") %>%
print_df()
```
2020-08-16 21:38:42 +02:00
2020-08-17 21:49:58 +02:00
## Microorganisms (previously accepted names)
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
`r structure_txt(microorganisms.old)`
**Note:** remember that the 'ref' columns contains the scientific reference to the old taxonomic entries, i.e. of column *'fullname'*. For the scientific reference of the new names, i.e. of column *'fullname_new'*, see the `microorganisms` data set.
2020-08-17 21:49:58 +02:00
This data set is in R available as `microorganisms.old`, after you load the `AMR` package.
2020-08-16 21:38:42 +02:00
2020-08-17 21:49:58 +02:00
`r download_txt("microorganisms.old")`
### Source
This data set contains old, previously accepted taxonomic names. The data sources are the same as the `microorganisms` data set:
2021-03-11 21:42:30 +01:00
* [Catalogue of Life](http://www.catalogueoflife.org) (included version: `r AMR:::CATALOGUE_OF_LIFE$year`)
* [List of Prokaryotic names with Standing in Nomenclature](https://lpsn.dsmz.de) (LPSN, last updated: `r AMR:::CATALOGUE_OF_LIFE$yearmonth_LPSN`)
2020-08-17 21:49:58 +02:00
2020-08-29 21:41:46 +02:00
### Example content
2020-08-17 21:49:58 +02:00
Example rows when filtering on *Escherichia*:
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
2020-08-17 21:49:58 +02:00
microorganisms.old %>%
filter(fullname %like% "^Escherichia") %>%
2020-08-16 21:38:42 +02:00
print_df()
```
2020-08-17 21:49:58 +02:00
2020-08-16 21:38:42 +02:00
## Antibiotic agents
2020-08-29 21:41:46 +02:00
`r structure_txt(antibiotics)`
2020-08-16 21:38:42 +02:00
This data set is in R available as `antibiotics`, after you load the `AMR` package.
2020-08-17 21:49:58 +02:00
`r download_txt("antibiotics")`
### Source
2020-08-16 21:38:42 +02:00
This data set contains all EARS-Net and ATC codes gathered from WHO and WHONET, and all compound IDs from PubChem. It also contains all brand names (synonyms) as found on PubChem and Defined Daily Doses (DDDs) for oral and parenteral administration.
2021-02-04 16:48:16 +01:00
* [ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology](https://www.whocc.no/atc_ddd_index/) (note: this may not be used for commercial purposes, but is freely available from the WHO CC website for personal use)
2020-08-16 21:38:42 +02:00
* [PubChem by the US National Library of Medicine](https://pubchem.ncbi.nlm.nih.gov)
* [WHONET software 2019](https://whonet.org)
2020-08-29 21:41:46 +02:00
### Example content
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
antibiotics %>%
filter(ab %in% colnames(example_isolates)) %>%
print_df()
```
## Antiviral agents
2020-08-29 21:41:46 +02:00
`r structure_txt(antivirals)`
2020-08-16 21:38:42 +02:00
This data set is in R available as `antivirals`, after you load the `AMR` package.
2020-08-17 21:49:58 +02:00
`r download_txt("antivirals")`
### Source
2020-08-16 21:38:42 +02:00
This data set contains all ATC codes gathered from WHO and all compound IDs from PubChem. It also contains all brand names (synonyms) as found on PubChem and Defined Daily Doses (DDDs) for oral and parenteral administration.
2021-02-04 16:48:16 +01:00
* [ATC/DDD index from WHO Collaborating Centre for Drug Statistics Methodology](https://www.whocc.no/atc_ddd_index/) (note: this may not be used for commercial purposes, but is freely available from the WHO CC website for personal use)
2020-08-16 21:38:42 +02:00
* [PubChem by the US National Library of Medicine](https://pubchem.ncbi.nlm.nih.gov)
2020-08-29 21:41:46 +02:00
### Example content
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
antivirals %>%
print_df()
```
2022-05-11 10:26:58 +02:00
## Interpretation from MIC values / disk diameters to R/SI
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
`r structure_txt(rsi_translation)`
2020-08-29 21:41:46 +02:00
2022-05-11 10:26:58 +02:00
This data set is in R available as `rsi_translation`, after you load the `AMR` package.
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
`r download_txt("rsi_translation")`
2020-08-17 21:49:58 +02:00
### Source
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
This data set contains interpretation rules for MIC values and disk diffusion diameters. Included guidelines are CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`) and EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`).
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
### Example content
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
2022-05-11 10:26:58 +02:00
rsi_translation %>%
mutate(mo_name = mo_name(mo, language = NULL), .after = mo) %>%
mutate(ab_name = ab_name(ab, language = NULL), .after = ab) %>%
print_df()
2020-08-16 21:38:42 +02:00
```
2022-05-11 10:26:58 +02:00
## Intrinsic bacterial resistance
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
`r structure_txt(intrinsic_resistant)`
2020-08-29 21:41:46 +02:00
2022-05-11 10:26:58 +02:00
This data set is in R available as `intrinsic_resistant`, after you load the `AMR` package.
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
`r download_txt("intrinsic_resistant")`
2020-08-17 21:49:58 +02:00
### Source
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
This data set contains all defined intrinsic resistance by EUCAST of all bug-drug combinations, and is based on `r AMR:::format_eucast_version_nr("3.3")`.
2020-08-16 21:38:42 +02:00
2020-08-29 21:41:46 +02:00
### Example content
2020-08-16 21:38:42 +02:00
2022-05-11 10:26:58 +02:00
Example rows when filtering on *Enterobacter cloacae*:
2020-08-16 21:38:42 +02:00
```{r, echo = FALSE}
2022-05-11 10:26:58 +02:00
intrinsic_resistant %>%
transmute(microorganism = mo_name(mo),
antibiotic = ab_name(ab)) %>%
filter(microorganism == "Enterobacter cloacae") %>%
arrange(antibiotic) %>%
print_df(rows = Inf)
2020-08-16 21:38:42 +02:00
```
2021-01-18 16:57:56 +01:00
## Dosage guidelines from EUCAST
`r structure_txt(dosage)`
This data set is in R available as `dosage`, after you load the `AMR` package.
`r download_txt("dosage")`
### Source
EUCAST breakpoints used in this package are based on the dosages in this data set.
Currently included dosages in the data set are meant for: `r AMR:::format_eucast_version_nr(unique(dosage$eucast_version))`.
### Example content
```{r, echo = FALSE}
dosage %>%
print_df()
```