(v0.7.1.9076) mo codes
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 0.7.1.9075
|
||||
Date: 2019-09-18
|
||||
Version: 0.7.1.9076
|
||||
Date: 2019-09-20
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
|
17
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 0.7.1.9075
|
||||
<small>Last updated: 18-Sep-2019</small>
|
||||
# AMR 0.7.1.9076
|
||||
<small>Last updated: 20-Sep-2019</small>
|
||||
|
||||
### Breaking
|
||||
* Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`:
|
||||
@ -19,7 +19,7 @@
|
||||
x <- as.mo("E. coli")
|
||||
x[1] <- "testvalue"
|
||||
#> Warning message:
|
||||
#> invalid microbial code, NA generated
|
||||
#> invalid microorganism code, NA generated
|
||||
```
|
||||
This is important, because a value like `"testvalue"` could never be understood by e.g. `mo_name()`, although the class would suggest a valid microbial code.
|
||||
* Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)), since creating frequency tables actually does not fit the scope of this package. The `freq()` function still works, since it is re-exported from the `clean` package (which will be installed automatically upon updating this `AMR` package).
|
||||
@ -29,12 +29,13 @@
|
||||
```r
|
||||
x <- bug_drug_combinations(example_isolates)
|
||||
x
|
||||
# NOTE: Using column `mo` as input for `col_mo`.
|
||||
#> ab mo S I R total
|
||||
#> 1 AMC B_ESCHR_COL 332 74 61 467
|
||||
#> 2 AMC B_KLBSL_PNE 49 3 6 58
|
||||
#> 3 AMC B_PROTS_MIR 28 7 1 36
|
||||
#> 4 AMC B_PSDMN_AER 0 0 30 30
|
||||
#> 5 AMC B_STPHY_AUR 234 0 1 235
|
||||
#> 1 AMC B_ESCHR_COLI 332 74 61 467
|
||||
#> 2 AMC B_KLBSL_PNMN 49 3 6 58
|
||||
#> 3 AMC B_PROTS_MRBL 28 7 1 36
|
||||
#> 4 AMC B_PSDMN_AERG 0 0 30 30
|
||||
#> 5 AMC B_STPHY_AURS 234 0 1 235
|
||||
```
|
||||
You can format this to a printable format, ready for reporting or exporting to e.g. Excel with the base R `format()` function:
|
||||
```r
|
||||
|
6
R/data.R
@ -55,7 +55,7 @@
|
||||
#'
|
||||
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A \code{\link{data.frame}} with 69,460 observations and 16 variables:
|
||||
#' @format A \code{\link{data.frame}} with 69,454 observations and 16 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{mo}}{ID of microorganism as used by this package}
|
||||
#' \item{\code{col_id}}{Catalogue of Life ID}
|
||||
@ -73,7 +73,7 @@
|
||||
#' \item{2 entries of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
|
||||
#' \item{3 entries of \emph{Trichomonas} (\emph{Trichomonas vaginalis}, and its family and genus)}
|
||||
#' \item{5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)}
|
||||
#' \item{22,654 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) overwriting records from the Catalogue of Life, since the DSMZ contain the latest taxonomic information based on recent publications}
|
||||
#' \item{9,460 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) since the DSMZ contain the latest taxonomic information based on recent publications}
|
||||
#' }
|
||||
#' @section About the records from DSMZ (see source):
|
||||
#' Names of prokaryotes are defined as being validly published by the International Code of Nomenclature of Bacteria. Validly published are all names which are included in the Approved Lists of Bacterial Names and the names subsequently published in the International Journal of Systematic Bacteriology (IJSB) and, from January 2000, in the International Journal of Systematic and Evolutionary Microbiology (IJSEM) as original articles or in the validation lists.
|
||||
@ -90,7 +90,7 @@ catalogue_of_life <- list(
|
||||
year = 2018,
|
||||
version = "Catalogue of Life: {year} Annual Checklist",
|
||||
url_CoL = "http://www.catalogueoflife.org/annual-checklist/{year}/",
|
||||
url_DSMZ = "https://www.dsmz.de/microorganisms/pnu/bacterial_nomenclature_info_mm.php",
|
||||
url_DSMZ = "https://www.dsmz.de/services/online-tools/prokaryotic-nomenclature-up-to-date/prokaryotic-nomenclature-up-to-date/genus-search",
|
||||
yearmonth_DSMZ = "August 2019"
|
||||
)
|
||||
|
||||
|
9
R/mo.R
@ -1067,6 +1067,8 @@ exec_as.mo <- function(x,
|
||||
# MISCELLANEOUS ----
|
||||
|
||||
# look for old taxonomic names ----
|
||||
# wait until prevalence == 2 to run the old taxonomic results on both prevalence == 1 and prevalence == 2
|
||||
if (nrow(data_to_check) == nrow(microorganismsDT[prevalence == 2])) {
|
||||
found <- microorganisms.oldDT[fullname_lower == tolower(a.x_backup)
|
||||
| fullname_lower %like_case% d.x_withspaces_start_end,]
|
||||
if (NROW(found) > 0) {
|
||||
@ -1090,6 +1092,7 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
return(x[i])
|
||||
}
|
||||
}
|
||||
|
||||
# check for uncertain results ----
|
||||
uncertain_fn <- function(a.x_backup,
|
||||
@ -1851,7 +1854,7 @@ as.data.frame.mo <- function(x, ...) {
|
||||
"[<-.mo" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
class_integrity_check(y, "microbial code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
class_integrity_check(y, "microorganism code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
}
|
||||
#' @exportMethod [[<-.mo
|
||||
#' @export
|
||||
@ -1859,7 +1862,7 @@ as.data.frame.mo <- function(x, ...) {
|
||||
"[[<-.mo" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
class_integrity_check(y, "microbial code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
class_integrity_check(y, "microorganism code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
}
|
||||
#' @exportMethod c.mo
|
||||
#' @export
|
||||
@ -1867,7 +1870,7 @@ as.data.frame.mo <- function(x, ...) {
|
||||
c.mo <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
class_integrity_check(y, "microbial code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
class_integrity_check(y, "microorganism code", c(as.character(AMR::microorganisms$mo), as.character(microorganisms.translation$mo_old)))
|
||||
}
|
||||
|
||||
#' @rdname as.mo
|
||||
|
@ -355,6 +355,7 @@ mo_info <- function(x, language = get_locale(), ...) {
|
||||
#' @export
|
||||
mo_url <- function(x, open = FALSE, ...) {
|
||||
mo <- AMR::as.mo(x = x, ... = ...)
|
||||
mo_names <- AMR::mo_name(mo)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
|
||||
df <- data.frame(mo, stringsAsFactors = FALSE) %>%
|
||||
@ -362,12 +363,12 @@ mo_url <- function(x, open = FALSE, ...) {
|
||||
mutate(url = case_when(source == "CoL" ~
|
||||
paste0(gsub("{year}", catalogue_of_life$year, catalogue_of_life$url_CoL, fixed = TRUE), "details/species/id/", species_id),
|
||||
source == "DSMZ" ~
|
||||
paste0(catalogue_of_life$url_DSMZ, "?bnu_no=", species_id, "#", species_id),
|
||||
paste0(catalogue_of_life$url_DSMZ, "/", unlist(lapply(strsplit(mo_names, ""), function(x) x[1]))),
|
||||
TRUE ~
|
||||
NA_character_))
|
||||
|
||||
u <- df$url
|
||||
names(u) <- AMR::mo_name(mo)
|
||||
names(u) <- mo_names
|
||||
if (open == TRUE) {
|
||||
if (length(u) > 1) {
|
||||
warning("only the first URL will be opened, as `browseURL()` only suports one string.")
|
||||
|
BIN
R/sysdata.rda
@ -91,6 +91,32 @@ rm(data_col)
|
||||
rm(data_dsmz)
|
||||
rm(ref_taxonomy)
|
||||
|
||||
mo_found_in_NL <- c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma",
|
||||
"Angiostrongylus", "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus",
|
||||
"Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", "Beauveria",
|
||||
"Bilophilia", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Candida", "Capillaria",
|
||||
"Capnocytophaga", "Catabacter", "Cdc", "Chaetomium", "Chilomastix", "Chryseobacterium",
|
||||
"Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus",
|
||||
"Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium",
|
||||
"Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria", "Dracunculus", "Echinococcus",
|
||||
"Echinostoma", "Elisabethkingia", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala",
|
||||
"Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium",
|
||||
"Giardia", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces",
|
||||
"Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia",
|
||||
"Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", "Malassezia",
|
||||
"Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas",
|
||||
"Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", "Nanophetus", "Nattrassia",
|
||||
"Necator", "Nectria", "Novospingobium", "Ochroconis", "Oesophagostomum", "Oidiodendron", "Onchocerca",
|
||||
"Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus", "Phlebotomus",
|
||||
"Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella",
|
||||
"Pseudallescheria", "Pseudoterranova", "Pulex", "Retortamonas", "Rhizomucor", "Rhizopus",
|
||||
"Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", "Schistosoma",
|
||||
"Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys",
|
||||
"Stenotrophomononas", "Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia",
|
||||
"Ternidens", "Torulopsis", "Toxocara", "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma",
|
||||
"Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium",
|
||||
"Trombicula", "Trypanosoma", "Tunga", "Ureaplasma", "Wuchereria")
|
||||
|
||||
MOs <- data_total %>%
|
||||
filter(
|
||||
(
|
||||
@ -102,23 +128,7 @@ MOs <- data_total %>%
|
||||
& !order %in% c("Eurotiales", "Microascales", "Mucorales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales"))
|
||||
)
|
||||
# or the genus has to be one of the genera we found in our hospitals last decades (Northern Netherlands, 2002-2018)
|
||||
| genus %in% c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus",
|
||||
"Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aureobacterium", "Aureobasidium", "Balantidum", "Basidiobolus",
|
||||
"Beauveria", "Bilophilia", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Capillaria", "Catabacter", "Cdc", "Chaetomium",
|
||||
"Chilomastix", "Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus", "Contracaecum",
|
||||
"Cordylobia", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium", "Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria",
|
||||
"Dracunculus", "Echinococcus", "Echinostoma", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala", "Exserohilum", "Fasciola",
|
||||
"Fasciolopsis", "Fonsecaea", "Fusarium", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces", "Hysterothylacium",
|
||||
"Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia", "Leptomyxida", "Leptosphaeria", "Loa", "Lucilia",
|
||||
"Lumbricus", "Malassezia", "Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas", "Mortierella",
|
||||
"Mucor", "Multiceps", "Mycocentrospora", "Nanophetus", "Nattrassia", "Necator", "Nectria", "Novospingobium", "Ochroconis",
|
||||
"Oesophagostomum", "Oidiodendron", "Onchocerca", "Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus",
|
||||
"Phlebotomus", "Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Pseudallescheria", "Pseudoterranova",
|
||||
"Pulex", "Retortamonas", "Rhizomucor", "Rhizopus", "Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes",
|
||||
"Schistosoma", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys", "Stenotrophomononas",
|
||||
"Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia", "Ternidens", "Torulopsis", "Toxocara", "Trichinella",
|
||||
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium", "Trombicula",
|
||||
"Trypanosoma", "Tunga", "Wuchereria")
|
||||
| genus %in% mo_found_in_NL
|
||||
# or the taxonomic entry is old - the species was renamed
|
||||
| !is.na(col_id_new)
|
||||
) %>%
|
||||
@ -209,11 +219,6 @@ MOs.old <- MOs %>%
|
||||
distinct(fullname, .keep_all = TRUE) %>%
|
||||
arrange(col_id)
|
||||
|
||||
MO.bak <- MOs
|
||||
MOold.bak <- MOs.old
|
||||
MOs <- MO.bak
|
||||
MOs.old <- MOold.bak
|
||||
|
||||
MOs <- MOs %>%
|
||||
filter(is.na(col_id_new) | source == "DSMZ") %>%
|
||||
transmute(col_id,
|
||||
@ -241,12 +246,6 @@ MOs <- MOs %>%
|
||||
arrange(desc(source)) %>%
|
||||
distinct(kingdom, fullname, .keep_all = TRUE)
|
||||
|
||||
# # Filter out the DSMZ records that were renamed and are now in MOs.old
|
||||
# MOs <- MOs %>%
|
||||
# filter(!(source == "DSMZ" & fullname %in% MOs.old$fullname)) %>%
|
||||
# distinct(kingdom, fullname, .keep_all = TRUE) %>%
|
||||
# filter(fullname != "")
|
||||
|
||||
# remove all genera that have no species - they are irrelevant for microbiology and almost all from the kingdom of Animalia
|
||||
to_remove <- MOs %>%
|
||||
filter(!kingdom %in% c("Bacteria", "Protozoa")) %>%
|
||||
@ -259,15 +258,19 @@ to_remove <- MOs %>%
|
||||
MOs <- MOs %>% filter(!(paste(kingdom, genus) %in% to_remove))
|
||||
rm(to_remove)
|
||||
|
||||
# add CoL ID from MOs.bak, for the cases where DSMZ took preference
|
||||
# add CoL's col_id, source and ref from MOs.bak, for the cases where DSMZ took preference
|
||||
MOs <- MOs %>%
|
||||
mutate(kingdom_fullname = paste(kingdom, fullname)) %>%
|
||||
select(-col_id) %>%
|
||||
left_join(MO.bak %>%
|
||||
filter(is.na(col_id_new), !is.na(col_id)) %>%
|
||||
transmute(col_id, kingdom_fullname = trimws(paste(kingdom, genus, species, subspecies))),
|
||||
by = "kingdom_fullname") %>%
|
||||
select(col_id, everything(), -kingdom_fullname)
|
||||
transmute(col_id, species_id, source, ref, kingdom_fullname = trimws(paste(kingdom, genus, species, subspecies))),
|
||||
by = "kingdom_fullname",
|
||||
suffix = c("_dsmz", "_col")) %>%
|
||||
mutate(col_id = col_id_col,
|
||||
species_id = ifelse(!is.na(species_id_col), gsub(".*/(.*)$", "\\1", species_id_col), species_id_dsmz),
|
||||
source = ifelse(!is.na(species_id_col), source_col, source_dsmz),
|
||||
ref = ifelse(!is.na(species_id_col) & ref_col != "", ref_col, ref_dsmz)) %>%
|
||||
select(-matches("(_col|_dsmz|kingdom_fullname)"))
|
||||
|
||||
|
||||
MOs.old <- MOs.old %>%
|
||||
@ -279,7 +282,9 @@ MOs.old <- MOs.old %>%
|
||||
select(col_id = col_id.x, col_id_new, fullname, ref = ref.x)
|
||||
|
||||
# remove the records that are in MOs.old
|
||||
sum(MOs.old$fullname %in% MOs$fullname)
|
||||
MOs <- MOs %>% filter(!fullname %in% MOs.old$fullname)
|
||||
sum(MOs.old$fullname %in% MOs$fullname)
|
||||
|
||||
# what characters are in the fullnames?
|
||||
table(sort(unlist(strsplit(x = paste(MOs$fullname, collapse = ""), split = ""))))
|
||||
@ -293,28 +298,13 @@ MOs <- MOs %>%
|
||||
class == "Gammaproteobacteria"
|
||||
| genus %in% c("Enterococcus", "Staphylococcus", "Streptococcus")
|
||||
~ 1,
|
||||
phylum %in% c("Proteobacteria",
|
||||
kingdom %in% c("Archaea", "Bacteria", "Chromista", "Fungi")
|
||||
& (phylum %in% c("Proteobacteria",
|
||||
"Firmicutes",
|
||||
"Actinobacteria",
|
||||
"Sarcomastigophora")
|
||||
| genus %in% c("Aspergillus",
|
||||
"Bacteroides",
|
||||
"Candida",
|
||||
"Capnocytophaga",
|
||||
"Chryseobacterium",
|
||||
"Cryptococcus",
|
||||
"Elisabethkingia",
|
||||
"Flavobacterium",
|
||||
"Fusobacterium",
|
||||
"Giardia",
|
||||
"Leptotrichia",
|
||||
"Mycoplasma",
|
||||
"Prevotella",
|
||||
"Rhodotorula",
|
||||
"Treponema",
|
||||
"Trichophyton",
|
||||
"Ureaplasma")
|
||||
| rank %in% c("kingdom", "phylum", "class", "order", "family")
|
||||
| genus %in% mo_found_in_NL
|
||||
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
|
||||
~ 2,
|
||||
TRUE ~ 3
|
||||
))
|
||||
@ -322,7 +312,7 @@ MOs <- MOs %>%
|
||||
# Add abbreviations so we can easily know which ones are which ones.
|
||||
# These will become valid and unique microbial IDs for the AMR package.
|
||||
MOs <- MOs %>%
|
||||
arrange(prevalence, fullname) %>%
|
||||
arrange(prevalence, genus, species, subspecies) %>%
|
||||
group_by(kingdom) %>%
|
||||
mutate(abbr_other = case_when(
|
||||
rank == "family" ~ paste0("[FAM]_",
|
||||
@ -354,22 +344,21 @@ MOs <- MOs %>%
|
||||
)) %>%
|
||||
# abbreviations may be same for genera between kingdoms,
|
||||
# because each abbreviation starts with the the first character(s) of the kingdom
|
||||
mutate(abbr_genus = abbreviate(genus,
|
||||
mutate(abbr_genus = abbreviate(gsub("^ae", "\u00E6\u00E6", genus, ignore.case = TRUE), # keep a starting Latin ae
|
||||
minlength = 5,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides",
|
||||
strict = FALSE)) %>%
|
||||
method = "both.sides")) %>%
|
||||
ungroup() %>%
|
||||
group_by(genus) %>%
|
||||
# species abbreviations may be the same between genera
|
||||
# because the genus abbreviation is part of the abbreviation
|
||||
mutate(abbr_species = abbreviate(species,
|
||||
mutate(abbr_species = abbreviate(gsub("^ae", "\u00E6\u00E6", species),
|
||||
minlength = 4,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides")) %>%
|
||||
ungroup() %>%
|
||||
group_by(genus, species) %>%
|
||||
mutate(abbr_subspecies = abbreviate(subspecies,
|
||||
mutate(abbr_subspecies = abbreviate(gsub("^ae", "\u00E6\u00E6", subspecies),
|
||||
minlength = 4,
|
||||
use.classes = TRUE,
|
||||
method = "both.sides")) %>%
|
||||
@ -385,7 +374,8 @@ MOs <- MOs %>%
|
||||
abbr_subspecies,
|
||||
sep = "_"),
|
||||
abbr_other),
|
||||
sep = "_")))) %>%
|
||||
sep = "_"))),
|
||||
mo = gsub("(\u00C6|\u00E6)+", "AE", mo)) %>%
|
||||
mutate(mo = ifelse(duplicated(.$mo),
|
||||
# these one or two must be unique too
|
||||
paste0(mo, "1"),
|
||||
@ -643,7 +633,8 @@ MOs <- MOs %>%
|
||||
MOs <- MOs %>%
|
||||
group_by(kingdom) %>%
|
||||
distinct(fullname, .keep_all = TRUE) %>%
|
||||
ungroup()
|
||||
ungroup() %>%
|
||||
filter(fullname != "")
|
||||
|
||||
# everything distinct?
|
||||
sum(duplicated(MOs$mo))
|
||||
@ -693,10 +684,11 @@ MOs$col_id <- as.integer(MOs$col_id)
|
||||
MOs.old$col_id <- as.integer(MOs.old$col_id)
|
||||
MOs.old$col_id_new <- as.integer(MOs.old$col_id_new)
|
||||
|
||||
# save
|
||||
# SAVE
|
||||
### for other server
|
||||
saveRDS(MOs, "microorganisms.rds")
|
||||
saveRDS(MOs.old, "microorganisms.old.rds")
|
||||
saveRDS(microorganisms.codes, "microorganisms.codes.rds")
|
||||
### for same server
|
||||
microorganisms <- MOs
|
||||
microorganisms.old <- MOs.old
|
||||
@ -708,9 +700,14 @@ class(microorganisms.translation$mo_new) <- "mo"
|
||||
usethis::use_data(microorganisms, overwrite = TRUE, version = 2)
|
||||
usethis::use_data(microorganisms.old, overwrite = TRUE, version = 2)
|
||||
usethis::use_data(microorganisms.codes, overwrite = TRUE, version = 2)
|
||||
saveRDS(AMR::microorganisms.translation, file = "microorganisms.translation.rds", version = 2) # this one will be covered in data-raw/internals.R
|
||||
saveRDS(microorganisms.translation, file = "data-raw/microorganisms.translation.rds", version = 2) # this one will be covered in data-raw/internals.R
|
||||
rm(microorganisms)
|
||||
rm(microorganisms.old)
|
||||
rm(microorganisms.codes)
|
||||
rm(microorganisms.translation)
|
||||
# and update the year and dimensions in R/data.R
|
||||
devtools::load_all(".")
|
||||
|
||||
# TO DO AFTER THIS
|
||||
# * Update the year and dim()s in R/data.R
|
||||
# * Rerun data-raw/reproduction_of_rsi_translation.R
|
||||
# * Run unit tests
|
||||
|
@ -654,4 +654,8 @@ usethis::use_data(microorganisms, overwrite = TRUE, version = 2)
|
||||
usethis::use_data(microorganisms.old, overwrite = TRUE, version = 2)
|
||||
rm(microorganisms)
|
||||
rm(microorganisms.old)
|
||||
# and update the year in R/data.R
|
||||
|
||||
# TO DO AFTER THIS
|
||||
# * Update the year and dim()s in R/data.R
|
||||
# * Rerun data-raw/reproduction_of_rsi_translation.R
|
||||
# * Run unit tests
|
||||
|
@ -52,3 +52,4 @@ rsi_translation <- tbl_mic %>%
|
||||
# save to package
|
||||
usethis::use_data(rsi_translation, overwrite = TRUE)
|
||||
rm(rsi_translation)
|
||||
devtools::load_all(".")
|
||||
|
BIN
data/microorganisms.rda
Executable file → Normal file
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9067</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
<h1>How to conduct AMR analysis</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">28 August 2019</h4>
|
||||
<h4 class="date">20 September 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>AMR.Rmd</code></div>
|
||||
@ -194,7 +194,7 @@
|
||||
|
||||
|
||||
|
||||
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 28 August 2019.</p>
|
||||
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 20 September 2019.</p>
|
||||
<div id="introduction" class="section level1">
|
||||
<h1 class="hasAnchor">
|
||||
<a href="#introduction" class="anchor"></a>Introduction</h1>
|
||||
@ -210,21 +210,21 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2019-08-28</td>
|
||||
<td align="center">2019-09-20</td>
|
||||
<td align="center">abcd</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2019-08-28</td>
|
||||
<td align="center">2019-09-20</td>
|
||||
<td align="center">abcd</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2019-08-28</td>
|
||||
<td align="center">2019-09-20</td>
|
||||
<td align="center">efgh</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
@ -300,8 +300,7 @@
|
||||
<a class="sourceLine" id="cb7-12" data-line-number="12"> <span class="dt">CIP =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dt">size =</span> sample_size, <span class="dt">replace =</span> <span class="ot">TRUE</span>,</a>
|
||||
<a class="sourceLine" id="cb7-13" data-line-number="13"> <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.80</span>, <span class="fl">0.00</span>, <span class="fl">0.20</span>)),</a>
|
||||
<a class="sourceLine" id="cb7-14" data-line-number="14"> <span class="dt">GEN =</span> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(ab_interpretations, <span class="dt">size =</span> sample_size, <span class="dt">replace =</span> <span class="ot">TRUE</span>,</a>
|
||||
<a class="sourceLine" id="cb7-15" data-line-number="15"> <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.92</span>, <span class="fl">0.00</span>, <span class="fl">0.08</span>))</a>
|
||||
<a class="sourceLine" id="cb7-16" data-line-number="16"> )</a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-15" data-line-number="15"> <span class="dt">prob =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="fl">0.92</span>, <span class="fl">0.00</span>, <span class="fl">0.08</span>)))</a></code></pre></div>
|
||||
<p>Using the <code><a href="https://dplyr.tidyverse.org/reference/join.html">left_join()</a></code> function from the <code>dplyr</code> package, we can ‘map’ the gender to the patient ID using the <code>patients_table</code> object we created earlier:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/join.html">left_join</a></span>(patients_table)</a></code></pre></div>
|
||||
<p>The resulting data set contains 20,000 blood culture isolates. With the <code><a href="https://www.rdocumentation.org/packages/utils/topics/head">head()</a></code> function we can preview the first 6 values of this data set:</p>
|
||||
@ -320,67 +319,67 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2017-06-03</td>
|
||||
<td align="center">E4</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2015-02-25</td>
|
||||
<td align="center">J4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2014-08-28</td>
|
||||
<td align="center">F7</td>
|
||||
<td align="center">2011-05-18</td>
|
||||
<td align="center">O8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2011-12-16</td>
|
||||
<td align="center">U7</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2015-02-09</td>
|
||||
<td align="center">C8</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<tr class="even">
|
||||
<td align="center">2011-03-28</td>
|
||||
<td align="center">Q8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2014-11-26</td>
|
||||
<td align="center">Y5</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<tr class="odd">
|
||||
<td align="center">2015-12-27</td>
|
||||
<td align="center">W2</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Klebsiella pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2014-05-30</td>
|
||||
<td align="center">X6</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2015-07-30</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2016-11-03</td>
|
||||
<td align="center">O8</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
@ -406,8 +405,8 @@
|
||||
#
|
||||
# Item Count Percent Cum. Count Cum. Percent
|
||||
# --- ----- ------- -------- ----------- -------------
|
||||
# 1 M 10,360 51.8% 10,360 51.8%
|
||||
# 2 F 9,640 48.2% 20,000 100.0%</code></pre>
|
||||
# 1 M 10,330 51.6% 10,330 51.6%
|
||||
# 2 F 9,670 48.4% 20,000 100.0%</code></pre>
|
||||
<p>So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.</p>
|
||||
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> 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 <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">data <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||
@ -437,14 +436,14 @@
|
||||
<a class="sourceLine" id="cb15-18" data-line-number="18"><span class="co"># Pasteurella multocida (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-19" data-line-number="19"><span class="co"># Staphylococcus (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-20" data-line-number="20"><span class="co"># Streptococcus groups A, B, C, G (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-21" data-line-number="21"><span class="co"># Streptococcus pneumoniae (1,477 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-21" data-line-number="21"><span class="co"># Streptococcus pneumoniae (1,405 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-22" data-line-number="22"><span class="co"># Viridans group streptococci (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-23" data-line-number="23"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb15-24" data-line-number="24"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
|
||||
<a class="sourceLine" id="cb15-25" data-line-number="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,306 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-25" data-line-number="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,290 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-26" data-line-number="26"><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-27" data-line-number="27"><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-28" data-line-number="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,760 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-28" data-line-number="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,639 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-29" data-line-number="29"><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-30" data-line-number="30"><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-31" data-line-number="31"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)</span></a>
|
||||
@ -452,24 +451,24 @@
|
||||
<a class="sourceLine" id="cb15-33" data-line-number="33"><span class="co"># Table 13: Interpretive rules for quinolones (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-34" data-line-number="34"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb15-35" data-line-number="35"><span class="co"># Other rules</span></a>
|
||||
<a class="sourceLine" id="cb15-36" data-line-number="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,250 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-37" data-line-number="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (100 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-36" data-line-number="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,299 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-37" data-line-number="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (101 values changed)</span></a>
|
||||
<a class="sourceLine" id="cb15-38" data-line-number="38"><span class="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-39" data-line-number="39"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-40" data-line-number="40"><span class="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-41" data-line-number="41"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
|
||||
<a class="sourceLine" id="cb15-42" data-line-number="42"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb15-43" data-line-number="43"><span class="co"># --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb15-44" data-line-number="44"><span class="co"># EUCAST rules affected 6,548 out of 20,000 rows, making a total of 7,893 edits</span></a>
|
||||
<a class="sourceLine" id="cb15-44" data-line-number="44"><span class="co"># EUCAST rules affected 6,427 out of 20,000 rows, making a total of 7,734 edits</span></a>
|
||||
<a class="sourceLine" id="cb15-45" data-line-number="45"><span class="co"># => added 0 test results</span></a>
|
||||
<a class="sourceLine" id="cb15-46" data-line-number="46"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb15-47" data-line-number="47"><span class="co"># => changed 7,893 test results</span></a>
|
||||
<a class="sourceLine" id="cb15-48" data-line-number="48"><span class="co"># - 102 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb15-49" data-line-number="49"><span class="co"># - 4,732 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb15-50" data-line-number="50"><span class="co"># - 1,108 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb15-51" data-line-number="51"><span class="co"># - 328 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb15-52" data-line-number="52"><span class="co"># - 1,603 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb15-53" data-line-number="53"><span class="co"># - 20 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb15-47" data-line-number="47"><span class="co"># => changed 7,734 test results</span></a>
|
||||
<a class="sourceLine" id="cb15-48" data-line-number="48"><span class="co"># - 99 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb15-49" data-line-number="49"><span class="co"># - 4,591 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb15-50" data-line-number="50"><span class="co"># - 1,111 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb15-51" data-line-number="51"><span class="co"># - 289 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb15-52" data-line-number="52"><span class="co"># - 1,622 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb15-53" data-line-number="53"><span class="co"># - 22 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb15-54" data-line-number="54"><span class="co"># --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb15-55" data-line-number="55"><span class="co"># </span></a>
|
||||
<a class="sourceLine" id="cb15-56" data-line-number="56"><span class="co"># Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.</span></a></code></pre></div>
|
||||
@ -497,8 +496,8 @@
|
||||
<a class="sourceLine" id="cb17-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
|
||||
<a class="sourceLine" id="cb17-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
|
||||
<a class="sourceLine" id="cb17-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||
<a class="sourceLine" id="cb17-6" data-line-number="6"><span class="co"># => Found 5,693 first isolates (28.5% of total)</span></a></code></pre></div>
|
||||
<p>So only is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
|
||||
<a class="sourceLine" id="cb17-6" data-line-number="6"><span class="co"># => Found 5,635 first isolates (28.2% of total)</span></a></code></pre></div>
|
||||
<p>So only 28.2% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
|
||||
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
|
||||
@ -508,7 +507,7 @@
|
||||
<div id="first-weighted-isolates" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
|
||||
<p>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 Q3, sorted on date:</p>
|
||||
<p>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 O6, sorted on date:</p>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">isolate</th>
|
||||
@ -524,32 +523,32 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2010-01-29</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-03-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">2010-04-29</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-04-30</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2010-08-31</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -557,10 +556,10 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-07-02</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2010-09-18</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -568,21 +567,21 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-10-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-03-23</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-11-26</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2011-03-24</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -590,9 +589,9 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">7</td>
|
||||
<td align="center">2011-01-09</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-07-19</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -601,20 +600,20 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2011-02-01</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2011-03-20</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-15</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -623,9 +622,9 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-22</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -645,7 +644,7 @@
|
||||
<a class="sourceLine" id="cb20-7" data-line-number="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
|
||||
<a class="sourceLine" id="cb20-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
|
||||
<a class="sourceLine" id="cb20-9" data-line-number="9"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
|
||||
<a class="sourceLine" id="cb20-10" data-line-number="10"><span class="co"># => Found 15,134 first weighted isolates (75.7% of total)</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb20-10" data-line-number="10"><span class="co"># => Found 15,041 first weighted isolates (75.2% of total)</span></a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">isolate</th>
|
||||
@ -662,34 +661,34 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2010-01-29</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-03-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">2010-04-29</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-04-30</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2010-08-31</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -698,10 +697,10 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-07-02</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2010-09-18</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -710,57 +709,57 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-10-10</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-03-23</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-11-26</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">2011-03-24</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">7</td>
|
||||
<td align="center">2011-01-09</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-07-19</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2011-02-01</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2011-03-20</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-15</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -770,9 +769,9 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2011-08-04</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-08-22</td>
|
||||
<td align="center">O6</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -782,11 +781,11 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Instead of 2, now 8 isolates are flagged. In total, of all isolates are marked ‘first weighted’ - more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
|
||||
<p>Instead of 2, now 6 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 47% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
|
||||
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1">data_1st <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
|
||||
<p>So we end up with 15,134 isolates for analysis.</p>
|
||||
<p>So we end up with 15,041 isolates for analysis.</p>
|
||||
<p>We can remove unneeded columns:</p>
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="1">data_1st <-<span class="st"> </span>data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb22-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
|
||||
@ -812,58 +811,58 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>1</td>
|
||||
<td align="center">2017-06-03</td>
|
||||
<td align="center">E4</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">2011-05-18</td>
|
||||
<td align="center">O8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STPHY_AURS</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram-negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram-positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">aureus</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>2</td>
|
||||
<td align="center">2015-02-25</td>
|
||||
<td align="center">J4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_STRPT_PNE</td>
|
||||
<td align="center">2011-03-28</td>
|
||||
<td align="center">Q8</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STRPT_PNMN</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram-positive</td>
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>4</td>
|
||||
<td align="center">2011-12-16</td>
|
||||
<td align="center">U7</td>
|
||||
<td>3</td>
|
||||
<td align="center">2015-12-27</td>
|
||||
<td align="center">W2</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">B_KLBSL_PNMN</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram-positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">aureus</td>
|
||||
<td align="center">Gram-negative</td>
|
||||
<td align="center">Klebsiella</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>6</td>
|
||||
<td align="center">2014-11-26</td>
|
||||
<td align="center">Y5</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td>5</td>
|
||||
<td align="center">2015-07-30</td>
|
||||
<td align="center">Q3</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -875,30 +874,14 @@
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>7</td>
|
||||
<td align="center">2010-08-09</td>
|
||||
<td align="center">C5</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td>6</td>
|
||||
<td align="center">2016-11-03</td>
|
||||
<td align="center">O8</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_STPHY_AURS</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram-negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>8</td>
|
||||
<td align="center">2011-07-24</td>
|
||||
<td align="center">W6</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STPHY_AUR</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
<td align="center">Gram-positive</td>
|
||||
@ -906,6 +889,22 @@
|
||||
<td align="center">aureus</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>7</td>
|
||||
<td align="center">2013-04-03</td>
|
||||
<td align="center">F8</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_ESCHR_COLI</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
<td align="center">Gram-negative</td>
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Time for the analysis!</p>
|
||||
@ -925,7 +924,7 @@
|
||||
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq</a></span>(genus, species)</a></code></pre></div>
|
||||
<p><strong>Frequency table</strong></p>
|
||||
<p>Class: character<br>
|
||||
Length: 15,134 (of which NA: 0 = 0.00%)<br>
|
||||
Length: 15,041 (of which NA: 0 = 0.00%)<br>
|
||||
Unique: 4</p>
|
||||
<p>Shortest: 16<br>
|
||||
Longest: 24</p>
|
||||
@ -942,33 +941,33 @@ Longest: 24</p>
|
||||
<tr class="odd">
|
||||
<td align="left">1</td>
|
||||
<td align="left">Escherichia coli</td>
|
||||
<td align="right">7,330</td>
|
||||
<td align="right">48.4%</td>
|
||||
<td align="right">7,330</td>
|
||||
<td align="right">48.4%</td>
|
||||
<td align="right">7,491</td>
|
||||
<td align="right">49.8%</td>
|
||||
<td align="right">7,491</td>
|
||||
<td align="right">49.8%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Staphylococcus aureus</td>
|
||||
<td align="right">3,816</td>
|
||||
<td align="right">25.2%</td>
|
||||
<td align="right">11,146</td>
|
||||
<td align="right">73.6%</td>
|
||||
<td align="right">3,732</td>
|
||||
<td align="right">24.8%</td>
|
||||
<td align="right">11,223</td>
|
||||
<td align="right">74.6%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">Streptococcus pneumoniae</td>
|
||||
<td align="right">2,386</td>
|
||||
<td align="right">15.8%</td>
|
||||
<td align="right">13,532</td>
|
||||
<td align="right">2,223</td>
|
||||
<td align="right">14.8%</td>
|
||||
<td align="right">13,446</td>
|
||||
<td align="right">89.4%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Klebsiella pneumoniae</td>
|
||||
<td align="right">1,602</td>
|
||||
<td align="right">1,595</td>
|
||||
<td align="right">10.6%</td>
|
||||
<td align="right">15,134</td>
|
||||
<td align="right">15,041</td>
|
||||
<td align="right">100.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -979,7 +978,7 @@ Longest: 24</p>
|
||||
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
|
||||
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (<code><a href="../reference/portion.html">portion_R()</a></code>) and susceptibility as the portion of S and I (<code><a href="../reference/portion.html">portion_SI()</a></code>). These functions can be used on their own:</p>
|
||||
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX)</a>
|
||||
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="co"># [1] 0.4649795</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="co"># [1] 0.4677216</span></a></code></pre></div>
|
||||
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
|
||||
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" data-line-number="1">data_1st <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
@ -992,19 +991,19 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4684865</td>
|
||||
<td align="center">0.4646398</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4595616</td>
|
||||
<td align="center">0.4578497</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4685616</td>
|
||||
<td align="center">0.4776586</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4664897</td>
|
||||
<td align="center">0.4822200</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1022,23 +1021,23 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">0.4684865</td>
|
||||
<td align="center">4506</td>
|
||||
<td align="center">0.4646398</td>
|
||||
<td align="center">4539</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4595616</td>
|
||||
<td align="center">5292</td>
|
||||
<td align="center">0.4578497</td>
|
||||
<td align="center">5255</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4685616</td>
|
||||
<td align="center">2322</td>
|
||||
<td align="center">0.4776586</td>
|
||||
<td align="center">2238</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4664897</td>
|
||||
<td align="center">3014</td>
|
||||
<td align="center">0.4822200</td>
|
||||
<td align="center">3009</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1058,27 +1057,27 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">0.9289222</td>
|
||||
<td align="center">0.8896317</td>
|
||||
<td align="center">0.9924966</td>
|
||||
<td align="center">0.9236417</td>
|
||||
<td align="center">0.8994794</td>
|
||||
<td align="center">0.9942598</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Klebsiella</td>
|
||||
<td align="center">0.8021223</td>
|
||||
<td align="center">0.9082397</td>
|
||||
<td align="center">0.9812734</td>
|
||||
<td align="center">0.8206897</td>
|
||||
<td align="center">0.9028213</td>
|
||||
<td align="center">0.9868339</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">0.9263627</td>
|
||||
<td align="center">0.9129979</td>
|
||||
<td align="center">0.9900419</td>
|
||||
<td align="center">0.9228296</td>
|
||||
<td align="center">0.9265809</td>
|
||||
<td align="center">0.9951768</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">0.6240570</td>
|
||||
<td align="center">0.6171840</td>
|
||||
<td align="center">0.0000000</td>
|
||||
<td align="center">0.6240570</td>
|
||||
<td align="center">0.6171840</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
@ -40,7 +40,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
<h1>Benchmarks</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">18 September 2019</h4>
|
||||
<h4 class="date">20 September 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>benchmarks.Rmd</code></div>
|
||||
@ -219,36 +219,36 @@
|
||||
<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://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb2-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</span></a>
|
||||
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 8.5 8.9 12.0 9.1 9.7</span></a>
|
||||
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 31.0 32.0 48.0 34.0 55.0</span></a>
|
||||
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 31.0 31.0 35.0 32.0 33.0</span></a>
|
||||
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 8.6 8.8 12.0 9.0 9.3</span></a>
|
||||
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 8.6 8.9 9.0 9.0 9.1</span></a>
|
||||
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 23.0 23.0 26.0 24.0 24.0</span></a>
|
||||
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 23.0 23.0 31.0 24.0 44.0</span></a>
|
||||
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 27.0 28.0 29.0 29.0 29.0</span></a>
|
||||
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 550.0 560.0 590.0 580.0 590.0</span></a>
|
||||
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 270.0 290.0 340.0 300.0 330.0</span></a>
|
||||
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 8.7 8.8 9.1 9.1 9.4</span></a>
|
||||
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 18.0 19.0 20.0 19.0 20.0</span></a>
|
||||
<a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 19.0 19.0 23.0 19.0 22.0</span></a>
|
||||
<a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 18.0 18.0 37.0 30.0 42.0</span></a>
|
||||
<a class="sourceLine" id="cb2-34" data-line-number="34"><span class="co"># max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-35" data-line-number="35"><span class="co"># 31.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-36" data-line-number="36"><span class="co"># 120.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-37" data-line-number="37"><span class="co"># 59.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-38" data-line-number="38"><span class="co"># 34.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-39" data-line-number="39"><span class="co"># 9.2 10</span></a>
|
||||
<a class="sourceLine" id="cb2-40" data-line-number="40"><span class="co"># 49.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-41" data-line-number="41"><span class="co"># 53.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-42" data-line-number="42"><span class="co"># 30.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-43" data-line-number="43"><span class="co"># 670.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-44" data-line-number="44"><span class="co"># 620.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-45" data-line-number="45"><span class="co"># 9.5 10</span></a>
|
||||
<a class="sourceLine" id="cb2-46" data-line-number="46"><span class="co"># 28.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-47" data-line-number="47"><span class="co"># 45.0 10</span></a>
|
||||
<a class="sourceLine" id="cb2-48" data-line-number="48"><span class="co"># 110.0 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq max</span></a>
|
||||
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 8.4 8.8 23.0 8.8 30.0 100</span></a>
|
||||
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 31.0 31.0 42.0 35.0 54.0 60</span></a>
|
||||
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 31.0 32.0 39.0 33.0 53.0 56</span></a>
|
||||
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 8.5 8.9 11.0 9.0 9.2 33</span></a>
|
||||
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 8.6 8.8 9.4 9.3 9.4 11</span></a>
|
||||
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 23.0 24.0 28.0 26.0 28.0 51</span></a>
|
||||
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 23.0 24.0 29.0 25.0 25.0 51</span></a>
|
||||
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 28.0 29.0 30.0 29.0 30.0 32</span></a>
|
||||
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 600.0 620.0 640.0 620.0 640.0 800</span></a>
|
||||
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 320.0 340.0 370.0 350.0 400.0 450</span></a>
|
||||
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 8.7 8.7 11.0 9.2 9.9 31</span></a>
|
||||
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 19.0 19.0 20.0 19.0 20.0 23</span></a>
|
||||
<a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 19.0 19.0 25.0 20.0 28.0 44</span></a>
|
||||
<a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 18.0 19.0 47.0 31.0 48.0 190</span></a>
|
||||
<a class="sourceLine" id="cb2-34" data-line-number="34"><span class="co"># neval</span></a>
|
||||
<a class="sourceLine" id="cb2-35" data-line-number="35"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-36" data-line-number="36"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-37" data-line-number="37"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-38" data-line-number="38"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-39" data-line-number="39"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-40" data-line-number="40"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-41" data-line-number="41"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-42" data-line-number="42"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-43" data-line-number="43"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-44" data-line-number="44"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-45" data-line-number="45"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-46" data-line-number="46"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-47" data-line-number="47"><span class="co"># 10</span></a>
|
||||
<a class="sourceLine" id="cb2-48" data-line-number="48"><span class="co"># 10</span></a></code></pre></div>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-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>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISLN</code>), a bug probably never found before in humans:</p>
|
||||
@ -258,93 +258,25 @@
|
||||
<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">"T. islandicus"</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">"Thermus islandicus"</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="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-9" data-line-number="9"></a>
|
||||
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-12" data-line-number="12"></a>
|
||||
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-15" data-line-number="15"></a>
|
||||
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-18" data-line-number="18"></a>
|
||||
<a class="sourceLine" id="cb3-19" data-line-number="19"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-20" data-line-number="20"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-21" data-line-number="21"></a>
|
||||
<a class="sourceLine" id="cb3-22" data-line-number="22"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-23" data-line-number="23"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-24" data-line-number="24"></a>
|
||||
<a class="sourceLine" id="cb3-25" data-line-number="25"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-26" data-line-number="26"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-27" data-line-number="27"></a>
|
||||
<a class="sourceLine" id="cb3-28" data-line-number="28"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-29" data-line-number="29"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-30" data-line-number="30"></a>
|
||||
<a class="sourceLine" id="cb3-31" data-line-number="31"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-32" data-line-number="32"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-33" data-line-number="33"></a>
|
||||
<a class="sourceLine" id="cb3-34" data-line-number="34"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-35" data-line-number="35"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-36" data-line-number="36"></a>
|
||||
<a class="sourceLine" id="cb3-37" data-line-number="37"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-38" data-line-number="38"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-39" data-line-number="39"></a>
|
||||
<a class="sourceLine" id="cb3-40" data-line-number="40"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-41" data-line-number="41"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-42" data-line-number="42"></a>
|
||||
<a class="sourceLine" id="cb3-43" data-line-number="43"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-44" data-line-number="44"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-45" data-line-number="45"></a>
|
||||
<a class="sourceLine" id="cb3-46" data-line-number="46"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-47" data-line-number="47"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-48" data-line-number="48"></a>
|
||||
<a class="sourceLine" id="cb3-49" data-line-number="49"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-50" data-line-number="50"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-51" data-line-number="51"></a>
|
||||
<a class="sourceLine" id="cb3-52" data-line-number="52"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-53" data-line-number="53"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-54" data-line-number="54"></a>
|
||||
<a class="sourceLine" id="cb3-55" data-line-number="55"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-56" data-line-number="56"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-57" data-line-number="57"></a>
|
||||
<a class="sourceLine" id="cb3-58" data-line-number="58"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-59" data-line-number="59"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-60" data-line-number="60"></a>
|
||||
<a class="sourceLine" id="cb3-61" data-line-number="61"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-62" data-line-number="62"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-63" data-line-number="63"></a>
|
||||
<a class="sourceLine" id="cb3-64" data-line-number="64"><span class="co"># Warning: </span></a>
|
||||
<a class="sourceLine" id="cb3-65" data-line-number="65"><span class="co"># Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</span></a>
|
||||
<a class="sourceLine" id="cb3-66" data-line-number="66"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb3-67" data-line-number="67"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-68" data-line-number="68"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-69" data-line-number="69"><span class="co"># as.mo("theisl") 1300 1400 1400 1400 1500 1600 10</span></a>
|
||||
<a class="sourceLine" id="cb3-70" data-line-number="70"><span class="co"># as.mo("THEISL") 1400 1400 1400 1400 1500 1600 10</span></a>
|
||||
<a class="sourceLine" id="cb3-71" data-line-number="71"><span class="co"># as.mo("T. islandicus") 370 400 410 410 420 450 10</span></a>
|
||||
<a class="sourceLine" id="cb3-72" data-line-number="72"><span class="co"># as.mo("T. islandicus") 360 370 400 380 410 490 10</span></a>
|
||||
<a class="sourceLine" id="cb3-73" data-line-number="73"><span class="co"># as.mo("Thermus islandicus") 28 30 35 32 35 59 10</span></a></code></pre></div>
|
||||
<p>That takes 8.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>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
|
||||
<a class="sourceLine" id="cb3-8" 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 neval</span></a>
|
||||
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 1300 1500 1500 1500 1500 1600 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 1400 1500 1500 1500 1500 1600 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 410 410 430 410 450 500 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 410 420 430 420 440 440 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 30 30 31 31 32 35 10</span></a></code></pre></div>
|
||||
<p>That takes 8.2 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
|
||||
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is uncommon):</p>
|
||||
<pre><code># Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
|
||||
@ -356,15 +288,18 @@
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.
|
||||
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</code></pre>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="562.5"></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>
|
||||
<pre><code># NOTE: results are saved to /Users/msberends/Library/R/3.6/library/AMR/mo_history/mo_history.csv.
|
||||
# NOTE: Prevotella ruminicola brevis (Shah et al., 1990) was renamed Prevotella brevis (Avgustin et al., 2016) [B_PRVTL_BRVS]
|
||||
# Warning:
|
||||
# Result of one value was guessed with uncertainty. Use mo_uncertainties() to review it.</code></pre>
|
||||
<p><img src="benchmarks_files/figure-html/unnamed-chunk-7-1.png" width="562.5"></p>
|
||||
@ -400,8 +335,8 @@
|
||||
<a class="sourceLine" id="cb6-24" data-line-number="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb6-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-27" data-line-number="27"><span class="co"># mo_name(x) 610 644 669 665 684 748 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.66 seconds (664 ms). You only lose time on your unique input values.</p>
|
||||
<a class="sourceLine" id="cb6-27" data-line-number="27"><span class="co"># mo_name(x) 604 632 655 644 660 764 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.64 seconds (644 ms). You only lose time on your unique input values.</p>
|
||||
</div>
|
||||
<div id="precalculated-results" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
@ -414,9 +349,9 @@
|
||||
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb7-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># A 6.150 6.260 6.400 6.390 6.520 6.710 10</span></a>
|
||||
<a class="sourceLine" id="cb7-9" data-line-number="9"><span class="co"># B 22.200 22.500 26.400 22.700 24.800 53.100 10</span></a>
|
||||
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co"># C 0.645 0.774 0.801 0.803 0.812 0.911 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># A 6.190 6.270 6.560 6.290 7.160 7.280 10</span></a>
|
||||
<a class="sourceLine" id="cb7-9" data-line-number="9"><span class="co"># B 22.600 23.100 26.700 23.400 24.300 51.600 10</span></a>
|
||||
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co"># C 0.704 0.765 0.827 0.829 0.906 0.913 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.0008 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">run_it <-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
|
||||
<a class="sourceLine" id="cb8-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>
|
||||
@ -430,14 +365,14 @@
|
||||
<a class="sourceLine" id="cb8-10" data-line-number="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
|
||||
<a class="sourceLine" id="cb8-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-13" data-line-number="13"><span class="co"># A 0.467 0.471 0.509 0.492 0.512 0.680 10</span></a>
|
||||
<a class="sourceLine" id="cb8-14" data-line-number="14"><span class="co"># B 0.628 0.634 0.664 0.646 0.685 0.748 10</span></a>
|
||||
<a class="sourceLine" id="cb8-15" data-line-number="15"><span class="co"># C 0.712 0.723 0.771 0.755 0.797 0.906 10</span></a>
|
||||
<a class="sourceLine" id="cb8-16" data-line-number="16"><span class="co"># D 0.444 0.455 0.475 0.464 0.501 0.518 10</span></a>
|
||||
<a class="sourceLine" id="cb8-17" data-line-number="17"><span class="co"># E 0.452 0.453 0.468 0.457 0.487 0.510 10</span></a>
|
||||
<a class="sourceLine" id="cb8-18" data-line-number="18"><span class="co"># F 0.439 0.450 0.462 0.459 0.470 0.501 10</span></a>
|
||||
<a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co"># G 0.450 0.460 0.476 0.480 0.492 0.496 10</span></a>
|
||||
<a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co"># H 0.443 0.455 0.461 0.456 0.466 0.495 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb8-13" data-line-number="13"><span class="co"># A 0.456 0.476 0.484 0.483 0.488 0.516 10</span></a>
|
||||
<a class="sourceLine" id="cb8-14" data-line-number="14"><span class="co"># B 0.613 0.620 0.639 0.628 0.642 0.723 10</span></a>
|
||||
<a class="sourceLine" id="cb8-15" data-line-number="15"><span class="co"># C 0.675 0.700 0.763 0.796 0.807 0.816 10</span></a>
|
||||
<a class="sourceLine" id="cb8-16" data-line-number="16"><span class="co"># D 0.443 0.454 0.466 0.467 0.477 0.497 10</span></a>
|
||||
<a class="sourceLine" id="cb8-17" data-line-number="17"><span class="co"># E 0.453 0.459 0.465 0.464 0.472 0.483 10</span></a>
|
||||
<a class="sourceLine" id="cb8-18" data-line-number="18"><span class="co"># F 0.433 0.447 0.464 0.463 0.484 0.498 10</span></a>
|
||||
<a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co"># G 0.453 0.460 0.469 0.464 0.478 0.502 10</span></a>
|
||||
<a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co"># H 0.433 0.451 0.477 0.459 0.470 0.662 10</span></a></code></pre></div>
|
||||
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
|
||||
</div>
|
||||
<div id="results-in-other-languages" class="section level3">
|
||||
@ -464,13 +399,13 @@
|
||||
<a class="sourceLine" id="cb9-18" data-line-number="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
|
||||
<a class="sourceLine" id="cb9-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb9-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb9-21" data-line-number="21"><span class="co"># en 18.19 18.35 18.84 18.65 18.99 20.91 10</span></a>
|
||||
<a class="sourceLine" id="cb9-22" data-line-number="22"><span class="co"># de 19.31 19.71 20.39 20.29 20.92 21.83 10</span></a>
|
||||
<a class="sourceLine" id="cb9-23" data-line-number="23"><span class="co"># nl 24.43 24.92 25.51 25.37 25.65 27.97 10</span></a>
|
||||
<a class="sourceLine" id="cb9-24" data-line-number="24"><span class="co"># es 19.22 19.53 20.06 19.82 20.47 21.81 10</span></a>
|
||||
<a class="sourceLine" id="cb9-25" data-line-number="25"><span class="co"># it 19.36 20.03 24.77 20.26 20.96 45.31 10</span></a>
|
||||
<a class="sourceLine" id="cb9-26" data-line-number="26"><span class="co"># fr 19.11 19.30 19.71 19.72 20.11 20.37 10</span></a>
|
||||
<a class="sourceLine" id="cb9-27" data-line-number="27"><span class="co"># pt 19.40 19.90 27.80 21.38 41.88 45.37 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb9-21" data-line-number="21"><span class="co"># en 18.18 18.24 18.54 18.44 18.58 19.41 10</span></a>
|
||||
<a class="sourceLine" id="cb9-22" data-line-number="22"><span class="co"># de 19.52 19.79 20.03 19.90 20.15 20.95 10</span></a>
|
||||
<a class="sourceLine" id="cb9-23" data-line-number="23"><span class="co"># nl 24.54 24.94 26.29 25.70 26.35 31.90 10</span></a>
|
||||
<a class="sourceLine" id="cb9-24" data-line-number="24"><span class="co"># es 19.52 19.69 22.29 19.86 20.27 44.03 10</span></a>
|
||||
<a class="sourceLine" id="cb9-25" data-line-number="25"><span class="co"># it 19.52 19.57 22.05 19.74 20.46 41.43 10</span></a>
|
||||
<a class="sourceLine" id="cb9-26" data-line-number="26"><span class="co"># fr 19.61 19.67 22.28 20.04 20.30 42.90 10</span></a>
|
||||
<a class="sourceLine" id="cb9-27" data-line-number="27"><span class="co"># pt 19.51 19.79 25.16 20.01 20.73 49.48 10</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -225,11 +225,11 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="amr-0-7-1-9075" class="section level1">
|
||||
<div id="amr-0-7-1-9076" class="section level1">
|
||||
<h1 class="page-header">
|
||||
<a href="#amr-0-7-1-9075" class="anchor"></a>AMR 0.7.1.9075<small> Unreleased </small>
|
||||
<a href="#amr-0-7-1-9076" class="anchor"></a>AMR 0.7.1.9076<small> Unreleased </small>
|
||||
</h1>
|
||||
<p><small>Last updated: 18-Sep-2019</small></p>
|
||||
<p><small>Last updated: 20-Sep-2019</small></p>
|
||||
<div id="breaking" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
<a href="#breaking" class="anchor"></a>Breaking</h3>
|
||||
@ -250,7 +250,7 @@ For WHONET users, this means that all records/isolates with organism code <code>
|
||||
<a class="sourceLine" id="cb2-8" data-line-number="8">x <-<span class="st"> </span><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
|
||||
<a class="sourceLine" id="cb2-9" data-line-number="9">x[<span class="dv">1</span>] <-<span class="st"> "testvalue"</span></a>
|
||||
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co">#> Warning message:</span></a>
|
||||
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co">#> invalid microbial code, NA generated</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co">#> invalid microorganism code, NA generated</span></a></code></pre></div>
|
||||
This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</li>
|
||||
<li><p>Function <code><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq()</a></code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq()</a></code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</p></li>
|
||||
</ul>
|
||||
@ -263,12 +263,13 @@ This is important, because a value like <code>"testvalue"</code> could never be
|
||||
<p>Function <code><a href="../reference/bug_drug_combinations.html">bug_drug_combinations()</a></code> to quickly get a <code>data.frame</code> with the antimicrobial resistance of any bug-drug combination in a data set:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">x <-<span class="st"> </span><span class="kw"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(example_isolates)</a>
|
||||
<a class="sourceLine" id="cb3-2" data-line-number="2">x</a>
|
||||
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co">#> ab mo S I R total</span></a>
|
||||
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co">#> 1 AMC B_ESCHR_COL 332 74 61 467</span></a>
|
||||
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="co">#> 2 AMC B_KLBSL_PNE 49 3 6 58</span></a>
|
||||
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co">#> 3 AMC B_PROTS_MIR 28 7 1 36</span></a>
|
||||
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co">#> 4 AMC B_PSDMN_AER 0 0 30 30</span></a>
|
||||
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co">#> 5 AMC B_STPHY_AUR 234 0 1 235</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
|
||||
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co">#> ab mo S I R total</span></a>
|
||||
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="co">#> 1 AMC B_ESCHR_COLI 332 74 61 467</span></a>
|
||||
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co">#> 2 AMC B_KLBSL_PNMN 49 3 6 58</span></a>
|
||||
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co">#> 3 AMC B_PROTS_MRBL 28 7 1 36</span></a>
|
||||
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co">#> 4 AMC B_PSDMN_AERG 0 0 30 30</span></a>
|
||||
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co">#> 5 AMC B_STPHY_AURS 234 0 1 235</span></a></code></pre></div>
|
||||
<p>You can format this to a printable format, ready for reporting or exporting to e.g. Excel with the base R <code><a href="https://www.rdocumentation.org/packages/base/topics/format">format()</a></code> function:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/format">format</a></span>(x, <span class="dt">combine_IR =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
|
||||
</li>
|
||||
@ -1266,7 +1267,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
||||
<div id="tocnav">
|
||||
<h2>Contents</h2>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#amr-0-7-1-9075">0.7.1.9075</a></li>
|
||||
<li><a href="#amr-0-7-1-9076">0.7.1.9076</a></li>
|
||||
<li><a href="#amr-0-7-1">0.7.1</a></li>
|
||||
<li><a href="#amr-0-7-0">0.7.0</a></li>
|
||||
<li><a href="#amr-0-6-1">0.6.1</a></li>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9073</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -238,7 +238,7 @@
|
||||
|
||||
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
|
||||
|
||||
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 69,460 observations and 16 variables:</p><dl class='dl-horizontal'>
|
||||
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 69,454 observations and 16 variables:</p><dl class='dl-horizontal'>
|
||||
<dt><code>mo</code></dt><dd><p>ID of microorganism as used by this package</p></dd>
|
||||
<dt><code>col_id</code></dt><dd><p>Catalogue of Life ID</p></dd>
|
||||
<dt><code>fullname</code></dt><dd><p>Full name, like <code>"Escherichia coli"</code></p></dd>
|
||||
@ -262,7 +262,7 @@
|
||||
<li><p>2 entries of <em>Staphylococcus</em> (coagulase-negative [CoNS] and coagulase-positive [CoPS])</p></li>
|
||||
<li><p>3 entries of <em>Trichomonas</em> (<em>Trichomonas vaginalis</em>, and its family and genus)</p></li>
|
||||
<li><p>5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)</p></li>
|
||||
<li><p>22,654 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) overwriting records from the Catalogue of Life, since the DSMZ contain the latest taxonomic information based on recent publications</p></li>
|
||||
<li><p>9,460 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) since the DSMZ contain the latest taxonomic information based on recent publications</p></li>
|
||||
</ul>
|
||||
|
||||
<h2 class="hasAnchor" id="about-the-records-from-dsmz-see-source-"><a class="anchor" href="#about-the-records-from-dsmz-see-source-"></a>About the records from DSMZ (see source)</h2>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9075</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9076</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -1 +1 @@
|
||||
"x","mo","uncertainty_level","package_version"
|
||||
"","x","mo","uncertainty_level","package_v"
|
||||
|
|
@ -4,7 +4,7 @@
|
||||
\name{microorganisms}
|
||||
\alias{microorganisms}
|
||||
\title{Data set with ~70,000 microorganisms}
|
||||
\format{A \code{\link{data.frame}} with 69,460 observations and 16 variables:
|
||||
\format{A \code{\link{data.frame}} with 69,454 observations and 16 variables:
|
||||
\describe{
|
||||
\item{\code{mo}}{ID of microorganism as used by this package}
|
||||
\item{\code{col_id}}{Catalogue of Life ID}
|
||||
@ -34,7 +34,7 @@ Manually added were:
|
||||
\item{2 entries of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
|
||||
\item{3 entries of \emph{Trichomonas} (\emph{Trichomonas vaginalis}, and its family and genus)}
|
||||
\item{5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)}
|
||||
\item{22,654 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) overwriting records from the Catalogue of Life, since the DSMZ contain the latest taxonomic information based on recent publications}
|
||||
\item{9,460 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) since the DSMZ contain the latest taxonomic information based on recent publications}
|
||||
}
|
||||
}
|
||||
\section{About the records from DSMZ (see source)}{
|
||||
|
@ -30,6 +30,9 @@ test_that("data sets are valid", {
|
||||
|
||||
# check cross table reference
|
||||
expect_true(all(microorganisms.codes$mo %in% microorganisms$mo))
|
||||
expect_true(all(example_isolates$mo %in% microorganisms$mo))
|
||||
expect_true(all(microorganisms.translation$mo_new %in% microorganisms$mo))
|
||||
expect_true(all(rsi_translation$mo %in% microorganisms$mo))
|
||||
expect_false(any(is.na(microorganisms.codes$code)))
|
||||
expect_false(any(is.na(microorganisms.codes$mo)))
|
||||
|
||||
@ -40,6 +43,7 @@ test_that("data sets are valid", {
|
||||
datasets <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item"]
|
||||
for (i in 1:length(datasets)) {
|
||||
dataset <- get(datasets[i], envir = asNamespace("AMR"))
|
||||
#print(paste("testing data set", datasets[i]))
|
||||
expect_identical(dataset_UTF8_to_ASCII(dataset), dataset)
|
||||
}
|
||||
})
|
||||
|
@ -121,8 +121,7 @@ data <- data.frame(date = sample(dates, size = sample_size, replace = TRUE),
|
||||
CIP = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||
prob = c(0.80, 0.00, 0.20)),
|
||||
GEN = sample(ab_interpretations, size = sample_size, replace = TRUE,
|
||||
prob = c(0.92, 0.00, 0.08))
|
||||
)
|
||||
prob = c(0.92, 0.00, 0.08)))
|
||||
```
|
||||
|
||||
Using the `left_join()` function from the `dplyr` package, we can 'map' the gender to the patient ID using the `patients_table` object we created earlier:
|
||||
|
@ -95,7 +95,7 @@ In the table above, all measurements are shown in milliseconds (thousands of sec
|
||||
|
||||
To achieve this speed, the `as.mo` 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 *Thermus islandicus* (`B_THERMS_ISLN`), a bug probably never found before in humans:
|
||||
|
||||
```{r}
|
||||
```{r, warning=FALSE}
|
||||
T.islandicus <- microbenchmark(as.mo("theisl"),
|
||||
as.mo("THEISL"),
|
||||
as.mo("T. islandicus"),
|
||||
|