41 Commits
Author SHA1 Message Date
dr. M.S. (Matthijs) Berends af74e1d4f2 (v2.1.1.9041) antibiotics update 2024-06-08 17:35:25 +02:00
dr. M.S. (Matthijs) Berends e2acc513a5 (v2.1.1.9040) try to put version number in commit msg 2024-06-07 12:07:07 +02:00
dr. M.S. (Matthijs) Berends 0bda9e9997 try to add version to commit msg 2024-06-04 20:21:12 +02:00
dr. M.S. (Matthijs) Berends c5981cdeb3 fix unit test 2024-06-04 20:17:54 +02:00
dr. M.S. (Matthijs) Berends 7c1b564648 fix SIR interpretation for uti 2024-05-31 21:24:35 +02:00
dr. M.S. (Matthijs) Berends 60c6c21e45 fix SIR interpretation 2024-05-31 09:50:54 +02:00
dr. M.S. (Matthijs) Berends ba4dc20cf3 autoplot fix 2024-05-30 16:39:59 +02:00
dr. M.S. (Matthijs) Berends d4490c7f25 fix sorting of MICs, MIC autoplot titles 2024-05-30 15:50:17 +02:00
dr. M.S. (Matthijs) Berends c3ce1b551d rename limit_mic_range() to rescale_mic() 2024-05-24 15:07:41 +02:00
dr. M.S. (Matthijs) Berends d214f74e25 allow column name for ab in as.sir() 2024-05-20 21:29:13 +02:00
dr. M.S. (Matthijs) Berends fc269e667d unit test fix 2024-05-20 18:58:35 +02:00
dr. M.S. (Matthijs) Berends 08a27922a8 new SDD and N for as.sir() 2024-05-20 15:27:04 +02:00
dr. M.S. (Matthijs) Berends b68f47d985 improved algorithm of as.ab() 2024-05-12 16:24:44 +02:00
dr. M.S. (Matthijs) Berends 1bce7ed3d3 fix git hooks 2024-04-24 11:58:16 +02:00
dr. M.S. (Matthijs) Berends 7f18e66c4e unit test fix 2024-04-24 11:42:43 +02:00
dr. M.S. (Matthijs) Berends 3e5c7d45c6 update intro logo 2024-04-24 09:58:24 +02:00
dr. M.S. (Matthijs) Berends 25089e811e correct for high-level abx 2024-04-24 09:50:32 +02:00
dr. M.S. (Matthijs) Berends 0d8a91db49 rename pre-commit hook to pre-commit checks (no-check) 2024-04-23 10:55:48 +02:00
dr. M.S. (Matthijs) Berends 04df6dfcf5 fix website nav header (no-check) 2024-04-23 10:33:26 +02:00
dr. M.S. (Matthijs) Berends 35f095cceb fixes #148 2024-04-23 09:34:05 +02:00
dr. M.S. (Matthijs) Berends 2899b3c840 new mo_group_members() 2024-04-19 10:18:21 +02:00
dr. M.S. (Matthijs) Berends 7e7bc9d56e Merge branch 'main' of https://github.com/msberends/AMR 2024-04-08 09:58:54 +02:00
dr. M.S. (Matthijs) Berends d2c5e4b749 update website colours 2024-04-08 09:55:21 +02:00
Matthijs Berends 42a23e89a8 Update DESCRIPTION 2024-04-08 00:52:25 +02:00
dr. M.S. (Matthijs) Berends 94e9a4d99b update MIC implementation 2024-04-07 20:22:59 +02:00
dr. M.S. (Matthijs) Berends 0039cb05d6 update MIC comparisons 2024-04-05 16:44:43 +02:00
dr. M.S. (Matthijs) Berends 4170def0ec unit test 2024-03-09 16:46:59 +01:00
dr. M.S. (Matthijs) Berends bc4f8515e2 new Norwegian link 2024-03-03 23:24:57 +01:00
dr. M.S. (Matthijs) Berends f2d245b0cb update navbar colours 2024-03-03 19:07:09 +01:00
dr. M.S. (Matthijs) Berends 46634bfcaa navbar colour 2024-02-25 16:48:04 +01:00
Matthijs Berends 8b43fed94d Update _pkgdown.yml 2024-02-25 14:40:19 +01:00
dr. M.S. (Matthijs) Berends 8d077149fa new logo 2024-02-25 14:20:43 +01:00
dr. M.S. (Matthijs) Berends b303662ec6 fix veterinary for R<4 2024-02-24 19:26:35 +01:00
dr. M.S. (Matthijs) Berends 35963ca3dc vctrs fix 2024-02-24 18:51:37 +01:00
dr. M.S. (Matthijs) Berends 4aa5413641 fix unit test 2024-02-24 18:14:50 +01:00
dr. M.S. (Matthijs) Berends 7be4dabbc0 support veterinary MIC/disk translation 2024-02-24 15:16:52 +01:00
Emil Rossing 74ea6c8c60 Added support for 'html' in italicize_taxonomy() (#134) 2024-02-13 13:47:07 +01:00
dr. M.S. (Matthijs) Berends 83e92fd88c docu fix 2023-12-04 08:19:02 +01:00
dr. M.S. (Matthijs) Berends 7059568581 fix scale functions 2023-12-03 16:51:54 +01:00
dr. M.S. (Matthijs) Berends c7461766ce Remove RSI from package, add extra MIC scale functions 2023-12-03 11:34:48 +01:00
dr. M.S. (Matthijs) Berends 6f417d0ef2 add scale_x_mic() 2023-12-03 01:06:00 +01:00
157 changed files with 42296 additions and 47509 deletions
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# ==================================================================== #
# TITLE: #
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
# SOURCE CODE: #
# https://github.com/msberends/AMR #
# #
# PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
# Data. Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 #
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#######################################
# This script runs on commit-msg hook #
#######################################
# Path to the commit message file
COMMIT_MSG_FILE=$1
# Read the current commit message
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
# check the commit message, cancel commit if needed
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then
exit 0
fi
# Path to the DESCRIPTION file
DESCRIPTION_FILE="DESCRIPTION"
# Read the version number from the DESCRIPTION file
if [ -f "$DESCRIPTION_FILE" ]; then
currentversion=$(grep "^Version:" "$DESCRIPTION_FILE" | awk '{print $2}')
else
echo "Error: DESCRIPTION file not found. Unable to prepend version number."
exit 1
fi
# Prepend the version number to the commit message
echo "(v${currentversion}) ${COMMIT_MSG}" > "$COMMIT_MSG_FILE"
+23 -3
View File
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# ==================================================================== #
# TITLE: #
@@ -29,12 +29,32 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
echo "Running pre-commit hook..."
########################################
# This script runs before every commit #
########################################
# try to fetch the commit message from the standard location
COMMIT_MSG_PATH=".git/COMMIT_EDITMSG"
if [ -f "$COMMIT_MSG_PATH" ]; then
COMMIT_MSG=$(cat "$COMMIT_MSG_PATH")
else
echo "Commit message file not found."
exit 1
fi
# check the commit message, cancel commit if needed
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then
echo "Not running pre-commit checks:"
echo "Commit message contains '(no-check)', '(no-checks)', or '(no-verify)."
echo ""
exit 0
fi
echo "Running pre-commit checks..."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if command -v Rscript > /dev/null; then
if [ "$(Rscript -e 'cat(all(c('"'pkgload'"', '"'devtools'"', '"'dplyr'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
Rscript -e "source('data-raw/_pre_commit_hook.R')"
Rscript -e "source('data-raw/_pre_commit_checks.R')"
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
echo "- Adding changed files in ./data-raw and ./man to this commit"
git add data-raw/*
+1
View File
@@ -49,6 +49,7 @@ jobs:
# Test all old versions of R >= 3.0, we support them all!
# For these old versions, dependencies and vignettes will not be checked.
# For recent R versions, see check-recent.yaml (r-lib and tidyverse support the latest 5 major R releases).
- {os: ubuntu-latest, r: '3.6', allowfail: false}
# - {os: windows-latest, r: '3.5', allowfail: true} # always fails, horrible with UTF-8
- {os: ubuntu-latest, r: '3.4', allowfail: false}
- {os: ubuntu-latest, r: '3.3', allowfail: false}
+5 -5
View File
@@ -58,15 +58,15 @@ jobs:
- {os: ubuntu-latest, r: 'devel', allowfail: false}
# current 'release' version, check all major OSes:
- {os: macOS-latest, r: '4.3', allowfail: false}
- {os: windows-latest, r: '4.3', allowfail: false}
- {os: ubuntu-latest, r: '4.3', allowfail: false}
- {os: macOS-latest, r: 'release', allowfail: false}
- {os: windows-latest, r: 'release', allowfail: false}
- {os: ubuntu-latest, r: 'release', allowfail: false}
# older versions (see also check-old.yaml for even older versions):
- {os: ubuntu-latest, r: '4.3', allowfail: false}
- {os: ubuntu-latest, r: '4.2', allowfail: false}
- {os: ubuntu-latest, r: '4.1', allowfail: false}
- {os: ubuntu-latest, r: '4.0', allowfail: false}
- {os: ubuntu-latest, r: '3.6', allowfail: false} # when a new R releases, this one has to move to check-old.yaml
- {os: ubuntu-latest, r: '4.0', allowfail: false} # when a new R releases, this one has to move to check-old.yaml
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+15 -12
View File
@@ -1,13 +1,12 @@
Package: AMR
Version: 2.1.1
Date: 2023-10-20
Version: 2.1.1.9041
Date: 2024-06-08
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by
using evidence-based methods, as described in <doi:10.18637/jss.v104.i03>.
Authors@R: c(
person(family = "Berends", c("Matthijs", "S."), role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7620-1800"), email = "m.s.berends@umcg.nl"),
person(family = "Luz", c("Christian", "F."), role = c("aut", "ctb"), comment = c(ORCID = "0000-0001-5809-5995")),
person(family = "Souverein", c("Dennis"), role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-0455-0336")),
person(family = "Hassing", c("Erwin", "E.", "A."), role = c("aut", "ctb")),
person(family = "Albers", c("Casper", "J."), role = "ths", comment = c(ORCID = "0000-0002-9213-6743")),
@@ -18,36 +17,40 @@ Authors@R: c(
person(family = "Hazenberg", c("Eric", "H.", "L.", "C.", "M."), role = "ctb"),
person(family = "Knight", c("Gwen"), role = "ctb", comment = c(ORCID = "0000-0002-7263-9896")),
person(family = "Lenglet", c("Annick"), role = "ctb", comment = c(ORCID = "0000-0003-2013-8405")),
person(family = "Luz", c("Christian", "F."), role = c("ctb"), comment = c(ORCID = "0000-0001-5809-5995")),
person(family = "Meijer", c("Bart", "C."), role = "ctb"),
person(family = "Mykhailenko", c("Dmytro"), role = "ctb"),
person(family = "Mymrikov", c("Anton"), role = "ctb"),
person(family = "Norgan", c("Andrew", "P."), role = "ctb", comment = c(ORCID = "0000-0002-2955-2066")),
person(family = "Ny", c("Sofia"), role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
person(family = "Saab", c("Matthew"), role = "ctb"),
person(family = "Salm", c("Jonas"), role = "ctb"),
person(family = "Sanchez", c("Javier"), role = "ctb", comment = c(ORCID = "0000-0003-2605-8094")),
person(family = "Schade", c("Rogier", "P."), role = "ctb"),
person(family = "Sinha", c("Bhanu", "N.", "M."), role = "ths", comment = c(ORCID = "0000-0003-1634-0010")),
person(family = "Stull", c("Jason"), role = "ctb", comment = c(ORCID = "0000-0002-9028-8153")),
person(family = "Underwood", c("Anthony"), role = "ctb", comment = c(ORCID = "0000-0002-8547-4277")),
person(family = "Williams", c("Anita"), role = "ctb", comment = c(ORCID = "0000-0002-5295-8451")))
Depends: R (>= 3.0.0)
Enhances:
cleaner,
ggplot2,
janitor,
skimr,
tibble,
tidyselect,
tsibble
Suggests:
cleaner,
cli,
curl,
data.table,
dplyr,
ggplot2,
janitor,
knitr,
progress,
readxl,
rmarkdown,
rvest,
skimr,
tibble,
tidyselect,
tinytest,
tsibble,
vctrs,
xml2
VignetteBuilder: knitr,rmarkdown
URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR
@@ -55,5 +58,5 @@ BugReports: https://github.com/msberends/AMR/issues
License: GPL-2 | file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
+11 -29
View File
@@ -13,7 +13,6 @@ S3method("[<-",av)
S3method("[<-",disk)
S3method("[<-",mic)
S3method("[<-",mo)
S3method("[<-",rsi)
S3method("[<-",sir)
S3method("[[",ab)
S3method("[[",av)
@@ -25,7 +24,6 @@ S3method("[[<-",av)
S3method("[[<-",disk)
S3method("[[<-",mic)
S3method("[[<-",mo)
S3method("[[<-",rsi)
S3method("[[<-",sir)
S3method("|",ab_selector)
S3method(Complex,mic)
@@ -38,24 +36,22 @@ S3method(any,ab_selector)
S3method(any,ab_selector_any_all)
S3method(as.data.frame,ab)
S3method(as.data.frame,av)
S3method(as.data.frame,mic)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.list,custom_eucast_rules)
S3method(as.list,custom_mdro_guideline)
S3method(as.list,mic)
S3method(as.matrix,mic)
S3method(as.numeric,mic)
S3method(as.rsi,data.frame)
S3method(as.rsi,default)
S3method(as.rsi,disk)
S3method(as.rsi,mic)
S3method(as.sir,data.frame)
S3method(as.sir,default)
S3method(as.sir,disk)
S3method(as.sir,mic)
S3method(as.vector,mic)
S3method(barplot,antibiogram)
S3method(barplot,disk)
S3method(barplot,mic)
S3method(barplot,rsi)
S3method(barplot,sir)
S3method(c,ab)
S3method(c,ab_selector)
@@ -65,11 +61,9 @@ S3method(c,custom_mdro_guideline)
S3method(c,disk)
S3method(c,mic)
S3method(c,mo)
S3method(c,rsi)
S3method(c,sir)
S3method(close,progress_bar)
S3method(droplevels,mic)
S3method(droplevels,rsi)
S3method(droplevels,sir)
S3method(format,bug_drug_combinations)
S3method(hist,mic)
@@ -87,7 +81,6 @@ S3method(plot,antibiogram)
S3method(plot,disk)
S3method(plot,mic)
S3method(plot,resistance_predict)
S3method(plot,rsi)
S3method(plot,sir)
S3method(print,ab)
S3method(print,av)
@@ -100,7 +93,6 @@ S3method(print,mo)
S3method(print,mo_renamed)
S3method(print,mo_uncertainties)
S3method(print,pca)
S3method(print,rsi)
S3method(print,sir)
S3method(quantile,mic)
S3method(rep,ab)
@@ -108,7 +100,6 @@ S3method(rep,av)
S3method(rep,disk)
S3method(rep,mic)
S3method(rep,mo)
S3method(rep,rsi)
S3method(rep,sir)
S3method(skewness,data.frame)
S3method(skewness,default)
@@ -117,14 +108,12 @@ S3method(sort,mic)
S3method(summary,mic)
S3method(summary,mo)
S3method(summary,pca)
S3method(summary,rsi)
S3method(summary,sir)
S3method(unique,ab)
S3method(unique,av)
S3method(unique,disk)
S3method(unique,mic)
S3method(unique,mo)
S3method(unique,rsi)
S3method(unique,sir)
export("%like%")
export("%like_case%")
@@ -132,7 +121,6 @@ export("%unlike%")
export("%unlike_case%")
export(NA_disk_)
export(NA_mic_)
export(NA_rsi_)
export(NA_sir_)
export(ab_atc)
export(ab_atc_group1)
@@ -171,7 +159,6 @@ export(as.av)
export(as.disk)
export(as.mic)
export(as.mo)
export(as.rsi)
export(as.sir)
export(atc_online_ddd)
export(atc_online_ddd_units)
@@ -217,21 +204,17 @@ export(custom_mdro_guideline)
export(eucast_dosage)
export(eucast_exceptional_phenotypes)
export(eucast_rules)
export(facet_rsi)
export(facet_sir)
export(filter_first_isolate)
export(first_isolate)
export(fluoroquinolones)
export(full_join_microorganisms)
export(g.test)
export(geom_rsi)
export(geom_sir)
export(get_AMR_locale)
export(get_episode)
export(get_mo_source)
export(ggplot_pca)
export(ggplot_rsi)
export(ggplot_rsi_predict)
export(ggplot_sir)
export(ggplot_sir_predict)
export(glycopeptides)
@@ -242,8 +225,6 @@ export(is.av)
export(is.disk)
export(is.mic)
export(is.mo)
export(is.rsi)
export(is.rsi.eligible)
export(is.sir)
export(is_new_episode)
export(is_sir_eligible)
@@ -251,7 +232,6 @@ export(italicise_taxonomy)
export(italicize_taxonomy)
export(key_antimicrobials)
export(kurtosis)
export(labels_rsi_count)
export(labels_sir_count)
export(left_join_microorganisms)
export(like)
@@ -273,6 +253,7 @@ export(mo_fullname)
export(mo_gbif)
export(mo_genus)
export(mo_gramstain)
export(mo_group_members)
export(mo_info)
export(mo_is_anaerobic)
export(mo_is_gram_negative)
@@ -304,8 +285,8 @@ export(mo_uncertainties)
export(mo_url)
export(mo_year)
export(mrgn)
export(n_rsi)
export(n_sir)
export(nitrofurans)
export(not_intrinsic_resistant)
export(oxazolidinones)
export(pca)
@@ -320,16 +301,18 @@ export(proportion_df)
export(quinolones)
export(random_disk)
export(random_mic)
export(random_rsi)
export(random_sir)
export(rescale_mic)
export(reset_AMR_locale)
export(resistance)
export(resistance_predict)
export(rifamycins)
export(right_join_microorganisms)
export(rsi_df)
export(rsi_predict)
export(scale_rsi_colours)
export(scale_colour_mic)
export(scale_fill_mic)
export(scale_sir_colours)
export(scale_x_mic)
export(scale_y_mic)
export(scale_y_percent)
export(semi_join_microorganisms)
export(set_AMR_locale)
@@ -343,7 +326,6 @@ export(skewness)
export(streptogramins)
export(susceptibility)
export(tetracyclines)
export(theme_rsi)
export(theme_sir)
export(translate_AMR)
export(trimethoprims)
+48 -2
View File
@@ -1,3 +1,49 @@
# AMR 2.1.1.9041
*(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support!)*
#### A New Milestone: One Health Support (= Human + Veterinary + Environmental)
This package now supports not only tools for AMR data analysis in clinical settings, but also for veterinary and environmental microbiology. This was made possible through a collaboration with the [University of Prince Edward Island](https://www.upei.ca/avc), Canada. To celebrate this great improvement of the package, we also updated the package logo to reflect this change.
## Breaking
* Removed all functions and references that used the deprecated `rsi` class, which were all replaced with their `sir` equivalents over a year ago
## New
* One Health implementation
* Function `as.sir()` now has extensive support for animal breakpoints from CLSI. Use `breakpoint_type = "animal"` and set the `host` argument to a variable that contains animal species names.
* The `clinical_breakpoints` data set contains all these breakpoints, and can be downloaded on our [download page](https://msberends.github.io/AMR/articles/datasets.html).
* The `antibiotics` data set contains all veterinary antibiotics, such as pradofloxacin and enrofloxacin. All WHOCC codes for veterinary use have been added as well.
* `ab_atc()` now supports ATC codes of veterinary antibiotics (that all start with "Q")
* `ab_url()` now supports retrieving the WHOCC url of their ATCvet pages
* `as.sir()` now returns additional factor levels "N" for non-interpretable and "SDD" for susceptible dose-dependent. Users can now set their own criteria (using regular expressions) as to what should be considered S, I, R, SDD, and N.
* The function group `scale_*_mic()`, namely: `scale_x_mic()`, `scale_y_mic()`, `scale_colour_mic()` and `scale_fill_mic()`. They are advanced ggplot2 extensions to allow easy plotting of MIC values. They allow for manual range definition and plotting missing intermediate log2 levels.
* Function `rescale_mic()`, which allows to rescale MIC values to a manually set range. This is the powerhouse behind the `scale_*_mic()` functions, but it can be used by users directly to e.g. compare equality in MIC distributions by rescaling them to the same range first.
* Function `mo_group_members()` to retrieve the member microorganisms of a microorganism group. For example, `mo_group_members("Strep group C")` returns a vector of all microorganisms that are in that group.
## Changed
* For SIR interpretation, it is now possible to use column names for argument `ab`, `mo`, and `uti`: `as.sir(..., ab = "column1", mo = "column2", uti = "column3")`. This greatly improves the flexibility for users.
* Extended the antibiotic selectors with `nitrofurans()` and `rifamycins()`
* Added "clindamycin inducible screening" as `CLI1` to the `antibiotics` data set. Since clindamycin is a lincosamide, the antibiotic selector `lincosamides()` now contains the argument `only_treatable = TRUE` (similar to other antibiotic selectors that contain non-treatable drugs)
* For MICs:
* Added as valid levels: 4096, 6 powers of 0.0625, and 5 powers of 192 (192, 384, 576, 768, 960)
* Added new argument `keep_operators` to `as.mic()`. This can be `"all"` (default), `"none"`, or `"edges"`. This argument is also available in the new `rescale_mic()` and `scale_*_mic()` functions.
* Comparisons of MIC values are now more strict. For example, `>32` is higher than (and never equal to) `32`. Thus, `as.mic(">32") == as.mic(32)` now returns `FALSE`, and `as.mic(">32") > as.mic(32)` now returns `TRUE`.
* Sorting of MIC values (using `sort()`) was fixed in the same manner; `<0.001` now gets sorted before `0.001`, and `>0.001` gets sorted after `0.001`.
* Updated `italicise_taxonomy()` to support HTML output
* `custom_eucast_rules()` now supports multiple antibiotics and antibiotic groups to be affected by a single rule
* `mo_info()` now contains an extra element `group_members`, with the contents of the new `mo_group_members()` function
* Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`.
* Updated all ATC codes from WHOCC
* Updated all antibiotic DDDs from WHOCC
* Fix for using a manual value for `mo_transform` in `antibiogram()`
* Fix for mapping 'high level' antibiotics in `as.ab()` (amphotericin B-high, gentamicin-high, kanamycin-high, streptomycin-high, tobramycin-high)
* Improved overall algorithm of `as.ab()` for better performance and accuracy
* When using antibiotic selectors such as `aminoglycosides()` that exclude non-treatable drugs like gentamicin-high, the function now always returns a warning that these can be included using `only_treatable = FALSE`
## Other
* Added Jordan Stull, Matthew Saab, and Javier Sanchez as contributors, to thank them for their valuable input
# AMR 2.1.1
* Fix for selecting first isolates using the phenotype-based method
@@ -132,7 +178,7 @@ The new function `add_custom_antimicrobials()` allows users to add custom antimi
The `antibiotics` data set was greatly updated:
* The following 20 antibiotics have been added (also includes the [new J01RA ATC group](https://www.whocc.no/atc_ddd_index/?code=J01RA&showdescription=no)): azithromycin/fluconazole/secnidazole (AFC), cefepime/amikacin (CFA), cefixime/ornidazole (CEO), ceftriaxone/beta-lactamase inhibitor (CEB), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), furazidin (FUR), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), lascufloxacin (LSC), levofloxacin/ornidazole (LEO), nemonoxacin (NEM), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin/ornidazole (OOR), oteseconazole (OTE), rifampicin/ethambutol/isoniazid (REI), sarecycline (SRC), tetracycline/oleandomycin (TOL), and thioacetazone (TAT)
* The following 20 antibiotics have been added (also includes the [new J01RA ATC group](https://atcddd.fhi.no/atc_ddd_index/?code=J01RA&showdescription=no)): azithromycin/fluconazole/secnidazole (AFC), cefepime/amikacin (CFA), cefixime/ornidazole (CEO), ceftriaxone/beta-lactamase inhibitor (CEB), ciprofloxacin/metronidazole (CIM), ciprofloxacin/ornidazole (CIO), ciprofloxacin/tinidazole (CIT), furazidin (FUR), isoniazid/sulfamethoxazole/trimethoprim/pyridoxine (IST), lascufloxacin (LSC), levofloxacin/ornidazole (LEO), nemonoxacin (NEM), norfloxacin/metronidazole (NME), norfloxacin/tinidazole (NTI), ofloxacin/ornidazole (OOR), oteseconazole (OTE), rifampicin/ethambutol/isoniazid (REI), sarecycline (SRC), tetracycline/oleandomycin (TOL), and thioacetazone (TAT)
* Added some missing ATC codes
* Updated DDDs and PubChem Compound IDs
* Updated some antibiotic name spelling, now used by WHOCC (such as cephalexin -> cefalexin, and phenethicillin -> pheneticillin)
@@ -145,7 +191,7 @@ Also, we added support for using antibiotic selectors in scoped `dplyr` verbs (w
We now added extensive support for antiviral agents! For the first time, the `AMR` package has extensive support for antiviral drugs and to work with their names, codes and other data in any way.
* The `antivirals` data set has been extended with 18 new drugs (also from the [new J05AJ ATC group](https://www.whocc.no/atc_ddd_index/?code=J05AJ&showdescription=no)) and now also contains antiviral identifiers and LOINC codes
* The `antivirals` data set has been extended with 18 new drugs (also from the [new J05AJ ATC group](https://atcddd.fhi.no/atc_ddd_index/?code=J05AJ&showdescription=no)) and now also contains antiviral identifiers and LOINC codes
* A new data type `av` (*antivirals*) has been added, which is functionally similar to `ab` for antibiotics
* Functions `as.av()`, `av_name()`, `av_atc()`, `av_synonyms()`, `av_from_text()` have all been added as siblings to their `ab_*()` equivalents
+5 -3
View File
@@ -28,7 +28,7 @@
# ==================================================================== #
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and clinical_breakpoints
# (sourcing "data-raw/_pre_commit_hook.R" will process the TSV file)
# (sourcing "data-raw/_pre_commit_checks.R" will process the TSV file)
EUCAST_VERSION_BREAKPOINTS <- list(
# "13.0" = list(
# version_txt = "v13.0",
@@ -86,8 +86,8 @@ EUCAST_VERSION_EXPERT_RULES <- list(
TAXONOMY_VERSION <- list(
GBIF = list(
accessed_date = as.Date("2022-12-11"),
citation = "GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \\doi{10.15468/39omei}.",
accessed_date = as.Date("2024-01-08"),
citation = "GBIF Secretariat (2023). GBIF Backbone Taxonomy. Checklist dataset \\doi{10.15468/39omei}.",
url = "https://www.gbif.org"
),
LPSN = list(
@@ -146,6 +146,8 @@ globalVariables(c(
"group",
"guideline",
"hjust",
"host_index",
"host_match",
"input",
"intrinsic_resistant",
"isolates",
+39 -13
View File
@@ -237,7 +237,7 @@ addin_insert_like <- function() {
}
}
search_type_in_df <- function(x, type, info = TRUE) {
search_type_in_df <- function(x, type, info = TRUE, add_col_prefix = TRUE) {
meet_criteria(x, allow_class = "data.frame")
meet_criteria(type, allow_class = "character", has_length = 1)
@@ -280,7 +280,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
if (!inherits(pm_pull(x, found), c("Date", "POSIXct"))) {
stop(
font_red(paste0(
"Found column '", font_bold(found), "' to be used as input for `col_", type,
"Found column '", font_bold(found), "' to be used as input for `", ifelse(add_col_prefix, "col_", ""), type,
"`, but this column contains no valid dates. Transform its values to valid dates first."
)),
call. = FALSE
@@ -311,6 +311,14 @@ search_type_in_df <- function(x, type, info = TRUE) {
found <- sort(colnames(x)[colnames_formatted %like_case% "^(specimen)"])
}
}
# -- host (animals)
if (type == "host") {
if (any(colnames_formatted %like_case% "^(host|animal)")) {
found <- sort(colnames(x)[colnames_formatted %like_case% "^(host|animal)"])
} else if (any(colnames_formatted %like_case% "((^|[^A-Za-z])host($|[^A-Za-z])|animal)")) {
found <- sort(colnames(x)[colnames_formatted %like_case% "((^|[^A-Za-z])host($|[^A-Za-z])|animal)"])
}
}
# -- UTI (urinary tract infection)
if (type == "uti") {
if (any(colnames_formatted == "uti")) {
@@ -321,7 +329,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
if (!is.null(found)) {
# this column should contain logicals
if (!is.logical(x[, found, drop = TRUE])) {
message_("Column '", font_bold(found), "' found as input for `col_", type,
message_("Column '", font_bold(found), "' found as input for `", ifelse(add_col_prefix, "col_", ""), type,
"`, but this column does not contain 'logical' values (TRUE/FALSE) and was ignored.",
add_fn = font_red
)
@@ -334,9 +342,9 @@ search_type_in_df <- function(x, type, info = TRUE) {
if (!is.null(found) && isTRUE(info)) {
if (message_not_thrown_before("search_in_type", type)) {
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
msg <- paste0("Using column '", font_bold(found), "' as input for `", ifelse(add_col_prefix, "col_", ""), type, "`.")
if (type %in% c("keyantibiotics", "keyantimicrobials", "specimen")) {
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
msg <- paste(msg, "Use", font_bold(paste0(ifelse(add_col_prefix, "col_", ""), type), "= FALSE"), "to prevent this.")
}
message_(msg)
}
@@ -456,7 +464,8 @@ word_wrap <- function(...,
ops <- "([,./><\\]\\[])"
msg <- gsub(paste0(ops, " ", ops), "\\1\\2", msg, perl = TRUE)
# we need to correct for already applied style, that adds text like "\033[31m\"
msg_stripped <- font_stripstyle(msg)
msg_stripped <- gsub("(.*)?\\033\\]8;;.*\\a(.*?)\\033\\]8;;\\a(.*)", "\\1\\2\\3", msg, perl = TRUE) # for font_url()
msg_stripped <- font_stripstyle(msg_stripped)
# where are the spaces now?
msg_stripped_wrapped <- paste0(
strwrap(msg_stripped,
@@ -680,7 +689,7 @@ create_eucast_ab_documentation <- function() {
ab <- character()
for (val in x) {
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) {
# antibiotic group names, as defined in data-raw/_pre_commit_hook.R, such as `CARBAPENEMS`
# antibiotic group names, as defined in data-raw/_pre_commit_checks.R, such as `CARBAPENEMS`
val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
} else if (val %in% AMR_env$AB_lookup$ab) {
# separate drugs, such as `AMX`
@@ -734,6 +743,10 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
# class 'sir' should be sorted like this
v <- c("S", "I", "R")
}
if (identical(v, c("I", "N", "R", "S", "SDD"))) {
# class 'sir' should be sorted like this
v <- c("S", "SDD", "I", "R", "N")
}
# oxford comma
if (last_sep %in% c(" or ", " and ") && length(v) > 2) {
last_sep <- paste0(",", last_sep)
@@ -826,7 +839,7 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
return(invisible())
}
if (!is.null(allow_class)) {
if (!is.null(allow_class) && !(suppressWarnings(all(is.na(object))) && allow_NA == TRUE)) {
stop_ifnot(inherits(object, allow_class), "argument `", obj_name,
"` must be ", format_class(allow_class, plural = isTRUE(has_length > 1)),
", i.e. not be ", format_class(class(object), plural = isTRUE(has_length > 1)),
@@ -862,12 +875,20 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
object <- tolower(object)
is_in <- tolower(is_in)
}
stop_ifnot(all(object %in% is_in, na.rm = TRUE), "argument `", obj_name, "` ",
is_in.bak <- is_in
if ("logical" %in% allow_class) {
is_in <- is_in[!is_in %in% c("TRUE", "FALSE")]
}
or_values <- vector_or(is_in, quotes = !isTRUE(any(c("numeric", "integer") %in% allow_class)))
if ("logical" %in% allow_class) {
or_values <- paste0(or_values, ", or TRUE or FALSE")
}
stop_ifnot(all(object %in% is_in.bak, na.rm = TRUE), "argument `", obj_name, "` ",
ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
"must be either ",
"must only contain values "
),
vector_or(is_in, quotes = !isTRUE(any(c("double", "numeric", "integer") %in% allow_class))),
or_values,
ifelse(allow_NA == TRUE, ", or NA", ""),
call = call_depth
)
@@ -1028,10 +1049,15 @@ get_current_column <- function() {
if (tryCatch(!is.null(env$i), error = function(e) FALSE)) {
if (!is.null(env$tibble_vars)) {
# for mutate_if()
# TODO remove later, was part of older dplyr versions (at least not in dplyr 1.1.4)
env$tibble_vars[env$i]
} else {
# for mutate(across())
df <- tryCatch(get_current_data(NA, 0), error = function(e) NULL)
if (!is.null(env$data) && is.data.frame(env$data)) {
df <- env$data
} else {
df <- tryCatch(get_current_data(NA, 0), error = function(e) NULL)
}
if (is.data.frame(df)) {
colnames(df)[env$i]
} else {
@@ -1551,7 +1577,7 @@ readRDS_AMR <- function(file, refhook = NULL) {
match <- function(x, table, ...) {
if (!is.null(AMR_env$chmatch) && inherits(x, "character") && inherits(table, "character")) {
# data.table::chmatch() is much faster than base::match() for character
AMR_env$chmatch(x, table, ...)
tryCatch(AMR_env$chmatch(x, table, ...), error = function(e) base::match(x, table, ...))
} else {
base::match(x, table, ...)
}
@@ -1559,7 +1585,7 @@ match <- function(x, table, ...) {
`%in%` <- function(x, table) {
if (!is.null(AMR_env$chin) && inherits(x, "character") && inherits(table, "character")) {
# data.table::`%chin%`() is much faster than base::`%in%`() for character
AMR_env$chin(x, table)
tryCatch(AMR_env$chin(x, table), error = function(e) base::`%in%`(x, table))
} else {
base::`%in%`(x, table)
}
+11 -11
View File
@@ -31,19 +31,19 @@
#'
#' This is an overview of all the package-specific [options()] you can set in the `AMR` package.
#' @section Options:
#' * `AMR_custom_ab` \cr Allows to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
#' * `AMR_custom_mo` \cr Allows to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
#' * `AMR_eucastrules` \cr Used for setting the default types of rules for [eucast_rules()] function, must be one or more of: `"breakpoints"`, `"expert"`, `"other"`, `"custom"`, `"all"`, and defaults to `c("breakpoints", "expert")`.
#' * `AMR_guideline` \cr Used for setting the default guideline for interpreting MIC values and disk diffusion diameters with [as.sir()]. Can be only the guideline name (e.g., `"CLSI"`) or the name with a year (e.g. `"CLSI 2019"`). The default to the latest implemented EUCAST guideline, currently \code{"`r clinical_breakpoints$guideline[1]`"}. Supported guideline are currently EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`).
#' * `AMR_breakpoint_type` \cr A [character] to use in [as.sir()], to indicate which breakpoint type to use. This must be either `r vector_or(clinical_breakpoints$type)`.
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
#' * `AMR_custom_ab` \cr A file location to an RDS file, to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()].
#' * `AMR_custom_mo` \cr A file location to an RDS file, to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()].
#' * `AMR_eucastrules` \cr A [character] to set the default types of rules for [eucast_rules()] function, must be one or more of: `"breakpoints"`, `"expert"`, `"other"`, `"custom"`, `"all"`, and defaults to `c("breakpoints", "expert")`.
#' * `AMR_guideline` \cr A [character] to set the default guideline for interpreting MIC values and disk diffusion diameters with [as.sir()]. Can be only the guideline name (e.g., `"CLSI"`) or the name with a year (e.g. `"CLSI 2019"`). The default to the latest implemented EUCAST guideline, currently \code{"`r clinical_breakpoints$guideline[1]`"}. Supported guideline are currently EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`).
#' * `AMR_ignore_pattern` \cr A [regular expression][base::regex] to ignore (i.e., make `NA`) any match given in [as.mo()] and all [`mo_*`][mo_property()] functions.
#' * `AMR_include_PKPD` \cr A [logical] to use in [as.sir()], to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is `TRUE`.
#' * `AMR_ecoff` \cr A [logical] use in [as.sir()], to indicate that ECOFF (Epidemiological Cut-Off) values must be used - the default is `FALSE`.
#' * `AMR_include_screening` \cr A [logical] to use in [as.sir()], to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`.
#' * `AMR_keep_synonyms` \cr A [logical] to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to indicate if old, previously valid taxonomic names must be preserved and not be corrected to currently accepted names. The default is `FALSE`.
#' * `AMR_cleaning_regex` \cr A [regular expression][base::regex] (case-insensitive) to use in [as.mo()] and all [`mo_*`][mo_property()] functions, to clean the user input. The default is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar".
#' * `AMR_locale` \cr A language to use for the `AMR` package, can be one of these supported language names or ISO-639-1 codes: `r vector_or(paste0(sapply(LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]), " (" , LANGUAGES_SUPPORTED, ")"), quotes = FALSE, sort = FALSE)`. The default is the current system language (if supported).
#' * `AMR_locale` \cr A [character] to set the language for the `AMR` package, can be one of these supported language names or ISO-639-1 codes: `r vector_or(paste0(sapply(LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]), " (" , LANGUAGES_SUPPORTED, ")"), quotes = FALSE, sort = FALSE)`. The default is the current system language (if supported, English otherwise).
#' * `AMR_mo_source` \cr A file location for a manual code list to be used in [as.mo()] and all [`mo_*`][mo_property()] functions. This is explained in [set_mo_source()].
#'
#'
#' @section Saving Settings Between Sessions:
#' Settings in \R are not saved globally and are thus lost when \R is exited. You can save your options to your own `.Rprofile` file, which is a user-specific file. You can edit it using:
#'
@@ -51,18 +51,18 @@
#' utils::file.edit("~/.Rprofile")
#' ```
#'
#' In this file, you can set options such as:
#' In this file, you can set options such as...
#'
#' ```r
#' options(AMR_locale = "pt")
#' options(AMR_include_PKPD = TRUE)
#' ```
#'
#' to add Portuguese language support of antibiotics, and allow PK/PD rules when interpreting MIC values with [as.sir()].
#' ...to add Portuguese language support of antibiotics, and allow PK/PD rules when interpreting MIC values with [as.sir()].
#'
#' ### Share Options Within Team
#'
#' For a more global approach, e.g. within a data team, save an options file to a remote file location, such as a shared network drive. This would work in this way:
#' For a more global approach, e.g. within a (data) team, save an options file to a remote file location, such as a shared network drive, and have each user read in this file automatically at start-up. This would work in this way:
#'
#' 1. Save a plain text file to e.g. "X:/team_folder/R_options.R" and fill it with preferred settings.
#'
+46 -37
View File
@@ -51,7 +51,7 @@
#'
#' You can add your own manual codes to be considered by [as.ab()] and all [`ab_*`][ab_property()] functions, see [add_custom_antimicrobials()].
#' @section Source:
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://atcddd.fhi.no/atc_ddd_index/}
#'
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
#' @aliases ab
@@ -107,7 +107,10 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
))
}
initial_search <- is.null(list(...)$initial_search)
loop_time <- list(...)$loop_time
if (is.null(loop_time)) {
loop_time <- 1
}
already_regex <- isTRUE(list(...)$already_regex)
fast_mode <- isTRUE(list(...)$fast_mode)
@@ -117,8 +120,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# remove diacritics
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
x <- gsub('"', "", x, fixed = TRUE)
x <- gsub("(specimen|specimen date|specimen_date|spec_date|gender|^dates?$)", "", x, ignore.case = TRUE, perl = TRUE)
# penicillin is a special case: we call it so, but then mean benzylpenicillin
x <- gsub("(specimen|specimen date|specimen_date|spec_date|gender|^dates?$|animal|host($|[a-z]))", "", x, ignore.case = TRUE, perl = TRUE)
# penicillin is a special case: we call it so, but then most often mean benzylpenicillin
x[x %like_case% "^PENICILLIN" & x %unlike_case% "[ /+-]"] <- "benzylpenicillin"
x_bak_clean <- x
if (already_regex == FALSE) {
@@ -131,16 +134,21 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown_ATCs <- character(0)
note_if_more_than_one_found <- function(found, index, from_text) {
if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) {
abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE)
if (loop_time == 1 && isTRUE(length(from_text) > 1)) {
abnames <- ab_name(from_text, tolower = TRUE, loop_time = loop_time + 1)
if (ab_name(found[1L], language = NULL) %like% "(clavulanic acid|(avi|tazo|mono|vabor)bactam)") {
abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam", "tazobactam", "vaborbactam", "monobactam")]
}
if (length(abnames) > 1) {
message_(
"More than one result was found for item ", index, ": ",
vector_and(abnames, quotes = FALSE)
)
if (toupper(paste(abnames, collapse = " ")) %in% AMR_env$AB_lookup$generalised_name) {
# if the found values combined is a valid AB, return that
found <- AMR_env$AB_lookup$ab[match(toupper(paste(abnames, collapse = " ")), AMR_env$AB_lookup$generalised_name)][1]
} else {
message_(
"More than one result was found for item ", index, ": ",
vector_and(abnames, quotes = FALSE)
)
}
}
}
found[1L]
@@ -174,13 +182,13 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[is.na(x)] <- NA
already_known[is.na(x)] <- FALSE
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
if (loop_time == 1 && sum(already_known) < length(x)) {
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
on.exit(close(progress))
}
for (i in which(!already_known)) {
if (isTRUE(initial_search)) {
if (loop_time == 1) {
progress$tick()
}
@@ -202,7 +210,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
}
if (fast_mode == FALSE && flag_multiple_results == TRUE && x[i] %like% "[ ]") {
from_text <- tryCatch(suppressWarnings(ab_from_text(x[i], initial_search = FALSE, translate_ab = FALSE)[[1]]),
from_text <- tryCatch(suppressWarnings(ab_from_text(x[i], loop_time = loop_time + 1, translate_ab = FALSE)[[1]]),
error = function(e) character(0)
)
} else {
@@ -314,13 +322,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
}
# INITIAL SEARCH - More uncertain results ----
if (isTRUE(initial_search) && fast_mode == FALSE) {
# only run on first try
if (loop_time <= 2 && fast_mode == FALSE) {
# only run on first and second try
# try by removing all spaces
if (x[i] %like% " ") {
found <- suppressWarnings(as.ab(gsub(" +", "", x[i], perl = TRUE), initial_search = FALSE))
found <- suppressWarnings(as.ab(gsub(" +", "", x[i], perl = TRUE), loop_time = loop_time + 2))
if (length(found) > 0 && !is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -329,7 +336,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# try by removing all spaces and numbers
if (x[i] %like% " " || x[i] %like% "[0-9]") {
found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i], perl = TRUE), initial_search = FALSE))
found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i], perl = TRUE), loop_time = loop_time + 2))
if (length(found) > 0 && !is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -355,7 +362,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
)[[1]],
collapse = "/"
)
x_translated_guess <- suppressWarnings(as.ab(x_translated, initial_search = FALSE))
x_translated_guess <- suppressWarnings(as.ab(x_translated, loop_time = loop_time + 2))
if (!is.na(x_translated_guess)) {
x_new[i] <- x_translated_guess
next
@@ -367,7 +374,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
strsplit(x_translated, "[^A-Z0-9 ]"),
function(y) {
for (i in seq_len(length(y))) {
y_name <- suppressWarnings(ab_name(y[i], language = NULL, initial_search = FALSE))
y_name <- suppressWarnings(ab_name(y[i], language = NULL, loop_time = loop_time + 2))
y[i] <- ifelse(!is.na(y_name),
y_name,
y[i]
@@ -378,7 +385,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
)[[1]],
collapse = "/"
)
x_translated_guess <- suppressWarnings(as.ab(x_translated, initial_search = FALSE))
x_translated_guess <- suppressWarnings(as.ab(x_translated, loop_time = loop_time + 2))
if (!is.na(x_translated_guess)) {
x_new[i] <- x_translated_guess
next
@@ -386,7 +393,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# try by removing all trailing capitals
if (x[i] %like_case% "[a-z]+[A-Z]+$") {
found <- suppressWarnings(as.ab(gsub("[A-Z]+$", "", x[i], perl = TRUE), initial_search = FALSE))
found <- suppressWarnings(as.ab(gsub("[A-Z]+$", "", x[i], perl = TRUE), loop_time = loop_time + 2))
if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -394,7 +401,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
}
# keep only letters
found <- suppressWarnings(as.ab(gsub("[^A-Z]", "", x[i], perl = TRUE), initial_search = FALSE))
found <- suppressWarnings(as.ab(gsub("[^A-Z]", "", x[i], perl = TRUE), loop_time = loop_time + 2))
if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -405,7 +412,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
if (flag_multiple_results == TRUE) {
found <- from_text[1L]
} else {
found <- tryCatch(suppressWarnings(ab_from_text(x[i], initial_search = FALSE, translate_ab = FALSE)[[1]][1L]),
found <- tryCatch(suppressWarnings(ab_from_text(x[i], loop_time = loop_time + 2, translate_ab = FALSE)[[1]][1L]),
error = function(e) NA_character_
)
}
@@ -415,12 +422,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
}
# first 5 except for cephalosporins, then first 7 (those cephalosporins all start quite the same!)
found <- suppressWarnings(as.ab(substr(x[i], 1, 5), initial_search = FALSE))
if (!is.na(found) && ab_group(found, initial_search = FALSE) %unlike% "cephalosporins") {
found <- suppressWarnings(as.ab(substr(x[i], 1, 5), loop_time = loop_time + 2))
if (!is.na(found) && ab_group(found, loop_time = loop_time + 1) %unlike% "cephalosporins") {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
}
found <- suppressWarnings(as.ab(substr(x[i], 1, 7), initial_search = FALSE))
found <- suppressWarnings(as.ab(substr(x[i], 1, 7), loop_time = loop_time + 2))
if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -428,7 +435,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# make all consonants facultative
search_str <- gsub("([BCDFGHJKLMNPQRSTVWXZ])", "\\1*", x[i], perl = TRUE)
found <- suppressWarnings(as.ab(search_str, initial_search = FALSE, already_regex = TRUE))
found <- suppressWarnings(as.ab(search_str, loop_time = loop_time + 2, already_regex = TRUE))
# keep at least 4 normal characters
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 4) {
found <- NA
@@ -440,7 +447,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# make all vowels facultative
search_str <- gsub("([AEIOUY])", "\\1*", x[i], perl = TRUE)
found <- suppressWarnings(as.ab(search_str, initial_search = FALSE, already_regex = TRUE))
found <- suppressWarnings(as.ab(search_str, loop_time = loop_time + 2, already_regex = TRUE))
# keep at least 5 normal characters
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 5) {
found <- NA
@@ -456,7 +463,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_spelling <- gsub("I+", "[AEIOU]+", x_spelling, fixed = TRUE)
x_spelling <- gsub("O+", "[AEIOU]+", x_spelling, fixed = TRUE)
x_spelling <- gsub("U+", "[AEIOU]+", x_spelling, fixed = TRUE)
found <- suppressWarnings(as.ab(x_spelling, initial_search = FALSE, already_regex = TRUE))
found <- suppressWarnings(as.ab(x_spelling, loop_time = loop_time + 2, already_regex = TRUE))
if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next
@@ -473,7 +480,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# ending part:
substr(x[i], j + 2, nchar(x[i]))
)
found <- suppressWarnings(as.ab(x_switched, initial_search = FALSE))
found <- suppressWarnings(as.ab(x_switched, loop_time = loop_time + 1))
if (!is.na(found)) {
break
}
@@ -482,18 +489,18 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[i] <- found[1L]
next
}
} # end of initial_search = TRUE
} # end of loop_time <= 2
# not found
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
}
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
if (loop_time == 1 && sum(already_known) < length(x)) {
close(progress)
}
# save to package env to save time for next time
if (isTRUE(initial_search)) {
if (loop_time == 1) {
AMR_env$ab_previously_coerced <- AMR_env$ab_previously_coerced[which(!AMR_env$ab_previously_coerced$x %in% x), , drop = FALSE]
AMR_env$ab_previously_coerced <- unique(rbind_AMR(
AMR_env$ab_previously_coerced,
@@ -645,12 +652,14 @@ generalise_antibiotic_name <- function(x) {
x <- gsub("_(MIC|RSI|SIR|DIS[CK])$", "", x, perl = TRUE)
# remove disk concentrations, like LVX_NM -> LVX
x <- gsub("_[A-Z]{2}[0-9_.]{0,3}$", "", x, perl = TRUE)
# remove part between brackets if that's followed by another string
x <- gsub("(.*)+ [(].*[)]", "\\1", x)
# keep only max 1 space
x <- trimws2(gsub(" +", " ", x, perl = TRUE))
# non-character, space or number should be a slash
x <- gsub("[^A-Z0-9 -]", "/", x, perl = TRUE)
x <- gsub("[^A-Z0-9 -)(]", "/", x, perl = TRUE)
# correct for 'high level' antibiotics
x <- gsub("([^A-Z0-9/ -]+)?(HIGH(.?LE?VE?L)?|[^A-Z0-9/]H[^A-Z0-9]?L)([^A-Z0-9 -]+)?", "-HIGH", x, perl = TRUE)
# remove part between brackets if that's followed by another string
x <- gsub("(.*)+ [(].*[)]", "\\1", x)
# spaces around non-characters must be removed: amox + clav -> amox/clav
x <- gsub("(.*[A-Z0-9]) ([^A-Z0-9].*)", "\\1\\2", x, perl = TRUE)
x <- gsub("(.*[^A-Z0-9]) ([A-Z0-9].*)", "\\1\\2", x, perl = TRUE)
+4
View File
@@ -129,6 +129,10 @@ ab_from_text <- function(text,
text_split_all <- text_split_all[nchar(text_split_all) >= 4 & grepl("[a-z]+", text_split_all)]
result <- lapply(text_split_all, function(text_split) {
progress$tick()
text_split <- text_split[text_split %like% "[A-Z]" & text_split %unlike% "[0-9]"]
if (length(text_split) == 0) {
return(as.ab(NA_character_))
}
suppressWarnings(
as.ab(text_split, ...)
)
+6 -3
View File
@@ -245,7 +245,7 @@ ab_ddd <- function(x, administration = "oral", ...) {
warning_(
"in `ab_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/"
"atcddd.fhi.no/ddd/list_of_ddds_combined_products/"
)
}
out
@@ -265,7 +265,7 @@ ab_ddd_units <- function(x, administration = "oral", ...) {
warning_(
"in `ab_ddd_units()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/"
"atcddd.fhi.no/ddd/list_of_ddds_combined_products/"
)
}
out
@@ -310,7 +310,10 @@ ab_url <- function(x, open = FALSE, ...) {
ab <- as.ab(x = x, ...)
atcs <- ab_atc(ab, only_first = TRUE)
u <- paste0("https://www.whocc.no/atc_ddd_index/?code=", atcs, "&showdescription=no")
u <- character(length(atcs))
# veterinary codes
u[atcs %like% "^Q"] <- paste0("https://atcddd.fhi.no/atcvet/atcvet_index/?code=", atcs[atcs %like% "^Q"], "&showdescription=no")
u[atcs %unlike% "^Q"] <- paste0("https://atcddd.fhi.no/atc_ddd_index//?code=", atcs[atcs %unlike% "^Q"], "&showdescription=no")
u[is.na(atcs)] <- NA_character_
names(u) <- ab_name(ab)
+34 -128
View File
@@ -226,10 +226,6 @@ ab_class <- function(ab_class,
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec(NULL, only_sir_columns = only_sir_columns, ab_class_args = ab_class, only_treatable = only_treatable)
}
@@ -242,10 +238,6 @@ ab_selector <- function(filter,
...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
# but it only takes a couple of milliseconds
@@ -277,10 +269,6 @@ ab_selector <- function(filter,
aminoglycosides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("aminoglycosides", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
}
@@ -288,10 +276,6 @@ aminoglycosides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...
#' @export
aminopenicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("aminopenicillins", only_sir_columns = only_sir_columns)
}
@@ -299,10 +283,6 @@ aminopenicillins <- function(only_sir_columns = FALSE, ...) {
#' @export
antifungals <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("antifungals", only_sir_columns = only_sir_columns)
}
@@ -310,10 +290,6 @@ antifungals <- function(only_sir_columns = FALSE, ...) {
#' @export
antimycobacterials <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("antimycobacterials", only_sir_columns = only_sir_columns)
}
@@ -322,10 +298,6 @@ antimycobacterials <- function(only_sir_columns = FALSE, ...) {
betalactams <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("betalactams", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
}
@@ -334,10 +306,6 @@ betalactams <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
carbapenems <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("carbapenems", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
}
@@ -345,10 +313,6 @@ carbapenems <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
#' @export
cephalosporins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins", only_sir_columns = only_sir_columns)
}
@@ -356,10 +320,6 @@ cephalosporins <- function(only_sir_columns = FALSE, ...) {
#' @export
cephalosporins_1st <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins_1st", only_sir_columns = only_sir_columns)
}
@@ -367,10 +327,6 @@ cephalosporins_1st <- function(only_sir_columns = FALSE, ...) {
#' @export
cephalosporins_2nd <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins_2nd", only_sir_columns = only_sir_columns)
}
@@ -378,10 +334,6 @@ cephalosporins_2nd <- function(only_sir_columns = FALSE, ...) {
#' @export
cephalosporins_3rd <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins_3rd", only_sir_columns = only_sir_columns)
}
@@ -389,10 +341,6 @@ cephalosporins_3rd <- function(only_sir_columns = FALSE, ...) {
#' @export
cephalosporins_4th <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins_4th", only_sir_columns = only_sir_columns)
}
@@ -400,10 +348,6 @@ cephalosporins_4th <- function(only_sir_columns = FALSE, ...) {
#' @export
cephalosporins_5th <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("cephalosporins_5th", only_sir_columns = only_sir_columns)
}
@@ -411,10 +355,6 @@ cephalosporins_5th <- function(only_sir_columns = FALSE, ...) {
#' @export
fluoroquinolones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("fluoroquinolones", only_sir_columns = only_sir_columns)
}
@@ -422,32 +362,21 @@ fluoroquinolones <- function(only_sir_columns = FALSE, ...) {
#' @export
glycopeptides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("glycopeptides", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
lincosamides <- function(only_sir_columns = FALSE, ...) {
lincosamides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("lincosamides", only_sir_columns = only_sir_columns)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
ab_select_exec("lincosamides", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
#' @export
lipoglycopeptides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("lipoglycopeptides", only_sir_columns = only_sir_columns)
}
@@ -455,21 +384,20 @@ lipoglycopeptides <- function(only_sir_columns = FALSE, ...) {
#' @export
macrolides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("macrolides", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
nitrofurans <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
ab_select_exec("nitrofurans", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
oxazolidinones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("oxazolidinones", only_sir_columns = only_sir_columns)
}
@@ -477,10 +405,6 @@ oxazolidinones <- function(only_sir_columns = FALSE, ...) {
#' @export
penicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("penicillins", only_sir_columns = only_sir_columns)
}
@@ -489,43 +413,34 @@ penicillins <- function(only_sir_columns = FALSE, ...) {
polymyxins <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("polymyxins", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
}
#' @rdname antibiotic_class_selectors
#' @export
streptogramins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("streptogramins", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
quinolones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("quinolones", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
rifamycins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
ab_select_exec("rifamycins", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
streptogramins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
ab_select_exec("streptogramins", only_sir_columns = only_sir_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
tetracyclines <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("tetracyclines", only_sir_columns = only_sir_columns)
}
@@ -533,10 +448,6 @@ tetracyclines <- function(only_sir_columns = FALSE, ...) {
#' @export
trimethoprims <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("trimethoprims", only_sir_columns = only_sir_columns)
}
@@ -544,10 +455,6 @@ trimethoprims <- function(only_sir_columns = FALSE, ...) {
#' @export
ureidopenicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("ureidopenicillins", only_sir_columns = only_sir_columns)
}
@@ -649,10 +556,10 @@ not_intrinsic_resistant <- function(only_sir_columns = FALSE, col_mo = NULL, ver
),
error = function(e) stop_("in not_intrinsic_resistant(): ", e$message, call = FALSE)
)
agents <- ab_in_data[ab_in_data %in% names(vars_df_R[which(vars_df_R)])]
if (length(agents) > 0 &&
message_not_thrown_before("not_intrinsic_resistant", sort(agents))) {
message_not_thrown_before("not_intrinsic_resistant", sort(agents))) {
agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'")
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
need_name <- generalise_antibiotic_name(agents) != generalise_antibiotic_name(agents_names)
@@ -663,7 +570,7 @@ not_intrinsic_resistant <- function(only_sir_columns = FALSE, col_mo = NULL, ver
vector_and(agents_formatted, quotes = FALSE, sort = FALSE)
)
}
vars_df_R <- names(vars_df_R)[which(!vars_df_R)]
# find columns that are abx, but also intrinsic R
out <- unname(intersect(ab_in_data, vars_df_R))
@@ -687,9 +594,9 @@ ab_select_exec <- function(function_name,
# untreatable drugs
if (only_treatable == TRUE) {
untreatable <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
untreatable <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$name %like% "-high|EDTA|polysorbate|macromethod|screening|nacubactam"), "ab", drop = TRUE]
if (any(untreatable %in% names(ab_in_data))) {
if (message_not_thrown_before(function_name, "ab_class", "untreatable", entire_session = TRUE)) {
if (message_not_thrown_before(function_name, "ab_class", "untreatable")) {
warning_(
"in `", function_name, "()`: some drugs were ignored since they cannot be used for treating patients: ",
vector_and(
@@ -699,8 +606,7 @@ ab_select_exec <- function(function_name,
),
quotes = FALSE,
sort = TRUE
), ". They can be included using `", function_name, "(only_treatable = FALSE)`. ",
"This warning will be shown once per session."
), ". They can be included using `", function_name, "(only_treatable = FALSE)`."
)
}
ab_in_data <- ab_in_data[!names(ab_in_data) %in% untreatable]
@@ -719,7 +625,7 @@ ab_select_exec <- function(function_name,
} else if (isTRUE(function_name == "antimycobacterials")) {
abx <- AMR_env$AB_lookup$ab[which(AMR_env$AB_lookup$group == "Antimycobacterials")]
} else {
# their upper case equivalent are vectors with class 'ab', created in data-raw/_pre_commit_hook.R
# their upper case equivalent are vectors with class 'ab', created in data-raw/_pre_commit_checks.R
# carbapenems() gets its codes from AMR:::AB_CARBAPENEMS
abx <- get(paste0("AB_", toupper(function_name)), envir = asNamespace("AMR"))
# manually added codes from add_custom_antimicrobials() must also be supported
@@ -784,10 +690,10 @@ c.ab_selector <- function(...) {
all_any_ab_selector <- function(type, ..., na.rm = TRUE) {
cols_ab <- c(...)
result <- cols_ab[toupper(cols_ab) %in% c("S", "I", "R")]
result <- cols_ab[toupper(cols_ab) %in% c("S", "SDD", "I", "R", "N")]
if (length(result) == 0) {
message_("Filtering ", type, " of columns ", vector_and(font_bold(cols_ab, collapse = NULL), quotes = "'"), ' to contain value "S", "I" or "R"')
result <- c("S", "I", "R")
result <- c("S", "SDD", "I", "R", "N")
}
cols_ab <- cols_ab[!cols_ab %in% result]
df <- get_current_data(arg_name = NA, call = -3)
@@ -896,7 +802,7 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
}
}
# this is `!=`, so turn around the values
sir <- c("S", "I", "R")
sir <- c("S", "SDD", "I", "R", "N")
e2 <- sir[sir != e2]
structure(all_any_ab_selector(type = type, e1, e2),
class = c("ab_selector_any_all", "logical")
+3 -3
View File
@@ -294,7 +294,7 @@ antibiogram <- function(x,
} else if (mo_transform == "name") {
x$`.mo` <- mo_name(x$`.mo`, language = language)
} else {
x$`.mo` <- mo_property(x$`.mo`, language = language)
x$`.mo` <- mo_property(x$`.mo`, property = mo_transform, language = language)
}
x$`.mo`[is.na(x$`.mo`)] <- "(??)"
@@ -348,11 +348,11 @@ antibiogram <- function(x,
} else {
# determine whether this new column should contain S, I, R, or NA
if (isTRUE(combine_SI)) {
S_values <- c("S", "I")
S_values <- c("S", "SDD", "I")
} else {
S_values <- "S"
}
other_values <- setdiff(c("S", "I", "R"), S_values)
other_values <- setdiff(c("S", "SDD", "I", "R", "N"), S_values)
x_transposed <- as.list(as.data.frame(t(x[, abx, drop = FALSE]), stringsAsFactors = FALSE))
if (isTRUE(only_all_tested)) {
x[new_colname] <- as.sir(vapply(FUN.VALUE = character(1), x_transposed, function(x) ifelse(anyNA(x), NA_character_, ifelse(any(x %in% S_values), "S", "R")), USE.NAMES = FALSE))
+12 -8
View File
@@ -64,7 +64,7 @@
#' **N.B. This function requires an internet connection and only works if the following packages are installed: `curl`, `rvest`, `xml2`.**
#' @export
#' @rdname atc_online
#' @source <https://www.whocc.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/>
#' @source <https://atcddd.fhi.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/>
#' @examples
#' \donttest{
#' if (requireNamespace("curl") && requireNamespace("rvest") && requireNamespace("xml2")) {
@@ -81,9 +81,9 @@
atc_online_property <- function(atc_code,
property,
administration = "O",
url = "https://www.whocc.no/atc_ddd_index/?code=%s&showdescription=no",
url_vet = "https://www.whocc.no/atcvet/atcvet_index/?code=%s&showdescription=no") {
meet_criteria(atc_code, allow_class = "character")
url = "https://atcddd.fhi.no/atc_ddd_index/?code=%s&showdescription=no",
url_vet = "https://atcddd.fhi.no/atcvet/atcvet_index/?code=%s&showdescription=no") {
meet_criteria(atc_code, allow_class = "character", allow_NA = TRUE)
meet_criteria(property, allow_class = "character", has_length = 1, is_in = c("ATC", "Name", "DDD", "U", "unit", "Adm.R", "Note", "groups"), ignore.case = TRUE)
meet_criteria(administration, allow_class = "character", has_length = 1)
meet_criteria(url, allow_class = "character", has_length = 1, looks_like = "https?://")
@@ -128,6 +128,10 @@ atc_online_property <- function(atc_code,
for (i in seq_len(length(atc_code))) {
progress$tick()
if (is.na(atc_code[i])) {
next
}
if (atc_code[i] %like% "^Q") {
# veterinary drugs, ATC_vet codes start with a "Q"
@@ -176,7 +180,7 @@ atc_online_property <- function(atc_code,
colnames(out) <- gsub("^atc.*", "atc", tolower(colnames(out)))
if (length(out) == 0) {
warning_("in `atc_online_property()`: ATC not found: ", atc_code[i], ". Please check ", atc_url, ".")
message_("in `atc_online_property()`: no properties found for ATC ", atc_code[i], ". Please check ", font_url(atc_url, "this WHOCC webpage"), ".")
returnvalue[i] <- NA
next
}
@@ -209,20 +213,20 @@ atc_online_property <- function(atc_code,
#' @rdname atc_online
#' @export
atc_online_groups <- function(atc_code, ...) {
meet_criteria(atc_code, allow_class = "character")
meet_criteria(atc_code, allow_class = "character", allow_NA = TRUE)
atc_online_property(atc_code = atc_code, property = "groups", ...)
}
#' @rdname atc_online
#' @export
atc_online_ddd <- function(atc_code, ...) {
meet_criteria(atc_code, allow_class = "character")
meet_criteria(atc_code, allow_class = "character", allow_NA = TRUE)
atc_online_property(atc_code = atc_code, property = "ddd", ...)
}
#' @rdname atc_online
#' @export
atc_online_ddd_units <- function(atc_code, ...) {
meet_criteria(atc_code, allow_class = "character")
meet_criteria(atc_code, allow_class = "character", allow_NA = TRUE)
atc_online_property(atc_code = atc_code, property = "unit", ...)
}
+1 -1
View File
@@ -49,7 +49,7 @@
#'
#' Note: the [as.av()] and [`av_*`][av_property()] functions may use very long regular expression to match brand names of antimicrobial drugs. This may fail on some systems.
#' @section Source:
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://atcddd.fhi.no/atc_ddd_index/}
#'
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
#' @aliases av
+3 -3
View File
@@ -164,7 +164,7 @@ av_ddd <- function(x, administration = "oral", ...) {
warning_(
"in `av_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/"
"atcddd.fhi.no/ddd/list_of_ddds_combined_products/"
)
}
out
@@ -184,7 +184,7 @@ av_ddd_units <- function(x, administration = "oral", ...) {
warning_(
"in `av_ddd_units()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
"Please refer to the WHOCC website:\n",
"www.whocc.no/ddd/list_of_ddds_combined_products/"
"atcddd.fhi.no/ddd/list_of_ddds_combined_products/"
)
}
out
@@ -227,7 +227,7 @@ av_url <- function(x, open = FALSE, ...) {
av <- as.av(x = x, ...)
atcs <- av_atc(av, only_first = TRUE)
u <- paste0("https://www.whocc.no/atc_ddd_index/?code=", atcs, "&showdescription=no")
u <- paste0("https://atcddd.fhi.no/atc_ddd_index/?code=", atcs, "&showdescription=no")
u[is.na(atcs)] <- NA_character_
names(u) <- av_name(av)
+14 -6
View File
@@ -42,7 +42,7 @@
#' @details The function [format()] calculates the resistance per bug-drug combination and returns a table ready for reporting/publishing. Use `combine_SI = TRUE` (default) to test R vs. S+I and `combine_SI = FALSE` to test R+I vs. S. This table can also directly be used in R Markdown / Quarto without the need for e.g. [knitr::kable()].
#' @export
#' @rdname bug_drug_combinations
#' @return The function [bug_drug_combinations()] returns a [data.frame] with columns "mo", "ab", "S", "I", "R" and "total".
#' @return The function [bug_drug_combinations()] returns a [data.frame] with columns "mo", "ab", "S", "SDD", "I", "R", and "total".
#' @examples
#' # example_isolates is a data set available in the AMR package.
#' # run ?example_isolates for more info.
@@ -105,8 +105,10 @@ bug_drug_combinations <- function(x,
mo = character(0),
ab = character(0),
S = integer(0),
SDD = integer(0),
I = integer(0),
R = integer(0),
N = integer(0),
total = integer(0),
stringsAsFactors = FALSE
)
@@ -121,17 +123,19 @@ bug_drug_combinations <- function(x,
x_mo_filter <- x[which(x[, col_mo, drop = TRUE] == unique_mo[i]), names(which(vapply(FUN.VALUE = logical(1), x, is.sir))), drop = FALSE]
# turn and merge everything
pivot <- lapply(x_mo_filter, function(x) {
m <- as.matrix(table(x))
data.frame(S = m["S", ], I = m["I", ], R = m["R", ], stringsAsFactors = FALSE)
m <- as.matrix(table(as.sir(x)))
data.frame(S = m["S", ], SDD = m["SDD", ], I = m["I", ], R = m["R", ], N = m["N", ], stringsAsFactors = FALSE)
})
merged <- do.call(rbind_AMR, pivot)
out_group <- data.frame(
mo = rep(unique_mo[i], NROW(merged)),
ab = rownames(merged),
S = merged$S,
SDD = merged$SDD,
I = merged$I,
R = merged$R,
total = merged$S + merged$I + merged$R,
N = merged$N,
total = merged$S + merged$SDD + merged$I + merged$R + merged$N,
stringsAsFactors = FALSE
)
if (data_has_groups) {
@@ -203,12 +207,16 @@ format.bug_drug_combinations <- function(x,
mo = gsub("(.*)%%(.*)", "\\1", names(idx)),
ab = gsub("(.*)%%(.*)", "\\2", names(idx)),
S = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$S[i], na.rm = TRUE)),
SDD = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$SDD[i], na.rm = TRUE)),
I = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$I[i], na.rm = TRUE)),
R = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$R[i], na.rm = TRUE)),
N = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$R[i], na.rm = TRUE)),
total = vapply(FUN.VALUE = double(1), idx, function(i) {
sum(x$S[i], na.rm = TRUE) +
sum(x$SDD[i], na.rm = TRUE) +
sum(x$I[i], na.rm = TRUE) +
sum(x$R[i], na.rm = TRUE)
sum(x$R[i], na.rm = TRUE) +
sum(x$N[i], na.rm = TRUE)
}),
stringsAsFactors = FALSE
)
@@ -223,7 +231,7 @@ format.bug_drug_combinations <- function(x,
if (combine_SI == TRUE) {
x$isolates <- x$R
} else {
x$isolates <- x$R + x$I
x$isolates <- x$R + x$I + x$SDD
}
give_ab_name <- function(ab, format, language) {
+64 -58
View File
@@ -135,62 +135,7 @@ count_resistant <- function(..., only_all_tested = FALSE) {
count_susceptible <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "I"),
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_R <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "R",
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_IR <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_IR", entire_session = TRUE)) {
message_("Using `count_IR()` is discouraged; use `count_resistant()` instead to not consider \"I\" being resistant. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("I", "R"),
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_I <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "I",
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_SI <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "I"),
ab_result = c("S", "SDD", "I"),
only_all_tested = only_all_tested,
only_count = TRUE
),
@@ -202,7 +147,7 @@ count_SI <- function(..., only_all_tested = FALSE) {
#' @export
count_S <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_S", entire_session = TRUE)) {
message_("Using `count_S()` is discouraged; use `count_susceptible()` instead to also consider \"I\" being susceptible. This note will be shown once for this session.", as_note = FALSE)
message_("Using `count_S()` is discouraged; use `count_susceptible()` instead to also consider \"I\" and \"SDD\" being susceptible. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
@@ -214,12 +159,73 @@ count_S <- function(..., only_all_tested = FALSE) {
)
}
#' @rdname count
#' @export
count_SI <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_SI", entire_session = TRUE)) {
message_("Note that `count_SI()` will also count dose-dependent susceptibility, 'SDD'. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("S", "SDD", "I"),
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_I <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_I", entire_session = TRUE)) {
message_("Note that `count_I()` will also count dose-dependent susceptibility, 'SDD'. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("I", "SDD"),
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_IR <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_IR", entire_session = TRUE)) {
message_("Using `count_IR()` is discouraged; use `count_resistant()` instead to not consider \"I\" and \"SDD\" being resistant. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("I", "SDD", "R"),
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_R <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "R",
only_all_tested = only_all_tested,
only_count = TRUE
),
error = function(e) stop_(gsub("in sir_calc(): ", "", e$message, fixed = TRUE), call = -5)
)
}
#' @rdname count
#' @export
count_all <- function(..., only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "I", "R"),
ab_result = c("S", "SDD", "I", "R", "N"),
only_all_tested = only_all_tested,
only_count = TRUE
),
+1 -1
View File
@@ -96,7 +96,7 @@
#'
#'
#' # Add Co-fluampicil, which is one of the many J01CR50 codes, see
#' # https://www.whocc.no/ddd/list_of_ddds_combined_products/
#' # https://atcddd.fhi.no/ddd/list_of_ddds_combined_products/
#' add_custom_antimicrobials(
#' data.frame(
#' ab = "COFLU",
+46 -23
View File
@@ -30,7 +30,7 @@
#' Define Custom EUCAST Rules
#'
#' Define custom EUCAST rules for your organisation or specific analysis and use the output of this function in [eucast_rules()].
#' @param ... rules in [formula][base::tilde] notation, see *Examples*
#' @param ... rules in [formula][base::tilde] notation, see below for instructions, and in *Examples*
#' @details
#' Some organisations have their own adoption of EUCAST rules. This function can be used to define custom EUCAST rules to be used in the [eucast_rules()] function.
#' @section How it works:
@@ -89,11 +89,24 @@
#' #> 2 Klebsiella pneumoniae R R S
#' ```
#'
#' ### Usage of antibiotic group names
#' ### Usage of multiple antibiotics and antibiotic group names
#'
#' You can define antibiotic groups instead of single antibiotics for the rule consequence, which is the part *after* the tilde (~). In the examples above, the antibiotic group `aminopenicillins` includes both ampicillin and amoxicillin.
#'
#' Rules can also be applied to multiple antibiotics and antibiotic groups simultaneously. Use the `c()` function to combine multiple antibiotics. For instance, the following example sets all aminopenicillins and ureidopenicillins to "R" if column TZP (piperacillin/tazobactam) is "R":
#'
#' ```r
#' x <- custom_eucast_rules(TZP == "R" ~ c(aminopenicillins, ureidopenicillins) == "R")
#' x
#' #> A set of custom EUCAST rules:
#' #>
#' #> 1. If TZP is "R" then set to "R":
#' #> amoxicillin (AMX), ampicillin (AMP), azlocillin (AZL), mezlocillin (MEZ), piperacillin (PIP), piperacillin/tazobactam (TZP)
#' ```
#'
#' It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part *after* the tilde. In above examples, the antibiotic group `aminopenicillins` is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the drugs that will be matched when running the rule.
#' These `r length(DEFINED_AB_GROUPS)` antibiotic groups are allowed in the rules (case-insensitive) and can be used in any combination:
#'
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("\"", tolower(gsub("^AB_", "", x)), "\"\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0(tolower(gsub("^AB_", "", x)), "\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
#' @returns A [list] containing the custom rules
#' @export
#' @examples
@@ -156,24 +169,34 @@ custom_eucast_rules <- function(...) {
"the result of rule ", i, " (the part after the `~`) must contain `==`, such as in `... ~ ampicillin == \"R\"`, see `?custom_eucast_rules`"
)
result_group <- as.character(result)[[2]]
if (paste0("AB_", toupper(result_group), "S") %in% DEFINED_AB_GROUPS) {
# support for e.g. 'aminopenicillin' if user meant 'aminopenicillins'
result_group <- paste0(result_group, "s")
result_group<- as.character(str2lang(result_group))
result_group <- result_group[result_group != "c"]
result_group_agents <- character(0)
for (j in seq_len(length(result_group))) {
if (paste0("AB_", toupper(result_group[j]), "S") %in% DEFINED_AB_GROUPS) {
# support for e.g. 'aminopenicillin' if user meant 'aminopenicillins'
result_group[j] <- paste0(result_group[j], "s")
}
if (paste0("AB_", toupper(result_group[j])) %in% DEFINED_AB_GROUPS) {
result_group_agents <- c(result_group_agents,
eval(parse(text = paste0("AB_", toupper(result_group[j]))), envir = asNamespace("AMR")))
} else {
out_group <- tryCatch(
suppressWarnings(as.ab(result_group[j],
fast_mode = TRUE,
flag_multiple_results = FALSE
)),
error = function(e) NA_character_
)
if (!all(is.na(out_group))) {
result_group_agents <- c(result_group_agents, out_group)
}
}
}
if (paste0("AB_", toupper(result_group)) %in% DEFINED_AB_GROUPS) {
result_group <- eval(parse(text = paste0("AB_", toupper(result_group))), envir = asNamespace("AMR"))
} else {
result_group <- tryCatch(
suppressWarnings(as.ab(result_group,
fast_mode = TRUE,
flag_multiple_results = FALSE
)),
error = function(e) NA_character_
)
}
result_group_agents <- result_group_agents[!is.na(result_group_agents)]
stop_if(
any(is.na(result_group)),
length(result_group_agents) == 0,
"this result of rule ", i, " could not be translated to a single antimicrobial drug/group: \"",
as.character(result)[[2]], "\".\n\nThe input can be a name or code of an antimicrobial drug, or be one of: ",
vector_or(tolower(gsub("AB_", "", DEFINED_AB_GROUPS)), quotes = FALSE), "."
@@ -181,12 +204,12 @@ custom_eucast_rules <- function(...) {
result_value <- as.character(result)[[3]]
result_value[result_value == "NA"] <- NA
stop_ifnot(
result_value %in% c("S", "I", "R", NA),
"the resulting value of rule ", i, " must be either \"S\", \"I\", \"R\" or NA"
result_value %in% c("S", "SDD", "I", "R", "N", NA),
"the resulting value of rule ", i, " must be either \"S\", \"SDD\", \"I\", \"R\", \"N\" or NA"
)
result_value <- as.sir(result_value)
out[[i]]$result_group <- result_group
out[[i]]$result_group <- result_group_agents
out[[i]]$result_value <- result_value
}
+11 -4
View File
@@ -67,7 +67,7 @@
#' Like all data sets in this package, these data sets are publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit [our website for the download links](https://msberends.github.io/AMR/articles/datasets.html). The actual files are of course available on [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw).
#' @source
#'
#' * World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): <https://www.whocc.no/atc_ddd_index/>
#' * World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): <https://atcddd.fhi.no/atc_ddd_index/>
#'
#' * `r TAXONOMY_VERSION$LOINC$citation` Accessed from <`r TAXONOMY_VERSION$LOINC$url`> on `r documentation_date(TAXONOMY_VERSION$LOINC$accessed_date)`.
#'
@@ -100,7 +100,7 @@
#' - `gbif_parent`\cr GBIF identifier of the parent taxon
#' - `gbif_renamed_to`\cr GBIF identifier of the currently valid taxon
#' - `source`\cr Either `r vector_or(microorganisms$source)` (see *Source*)
#' - `prevalence`\cr Prevalence of the microorganism according to Bartlett *et al.* (2022, \doi{10.1099/mic.0.001269}), see [mo_matching_score()] for the full explanation
#' - `prevalence`\cr Prevalence of the microorganism based on Bartlett *et al.* (2022, \doi{10.1099/mic.0.001269}), see [mo_matching_score()] for the full explanation
#' - `snomed`\cr Systematized Nomenclature of Medicine (SNOMED) code of the microorganism, version of `r documentation_date(TAXONOMY_VERSION$SNOMED$accessed_date)` (see *Source*). Use [mo_snomed()] to retrieve it quickly, see [mo_property()].
#' @details
#' Please note that entries are only based on the List of Prokaryotic names with Standing in Nomenclature (LPSN) and the Global Biodiversity Information Facility (GBIF) (see below). Since these sources incorporate entries based on (recent) publications in the International Journal of Systematic and Evolutionary Microbiology (IJSEM), it can happen that the year of publication is sometimes later than one might expect.
@@ -262,10 +262,17 @@
#' Data Set with Clinical Breakpoints for SIR Interpretation
#'
#' Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. Currently implemented guidelines are EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`). Use [as.sir()] to transform MICs or disks measurements to SIR values.
#' @description Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. This dataset contain breakpoints for humans, `r length(unique(clinical_breakpoints$host[!clinical_breakpoints$host %in% clinical_breakpoints$type]))` different animal groups, and ECOFFs.
#'
#' Currently available breakpoint guidelines for **clinical microbiology** are EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`.
#'
#' Currently available breakpoint guidelines for **veterinary microbiology** are EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`.
#'
#' Use [as.sir()] to transform MICs or disks measurements to SIR values.
#' @format A [tibble][tibble::tibble] with `r format(nrow(clinical_breakpoints), big.mark = " ")` observations and `r ncol(clinical_breakpoints)` variables:
#' - `guideline`\cr Name of the guideline
#' - `type`\cr Breakpoint type, either `r vector_or(clinical_breakpoints$type)`
#' - `host`\cr Host of infectious agent. This is mostly useful for veterinary breakpoints and is either `r vector_or(clinical_breakpoints$host)`
#' - `method`\cr Testing method, either `r vector_or(clinical_breakpoints$method)`
#' - `site`\cr Body site for which the breakpoint must be applied, e.g. "Oral" or "Respiratory"
#' - `mo`\cr Microbial ID, see [as.mo()]
@@ -291,7 +298,7 @@
#' ### Download
#' Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit [our website for the download links](https://msberends.github.io/AMR/articles/datasets.html). The actual files are of course available on [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw). They allow for machine reading EUCAST and CLSI guidelines, which is almost impossible with the MS Excel and PDF files distributed by EUCAST and CLSI, though initiatives have started to overcome these burdens.
#'
#' **NOTE:** this `AMR` package (and the WHONET software as well) contains internal methods to apply the guidelines, which is rather complex. For example, some breakpoints must be applied on certain species groups (which are in case of this package available through the [microorganisms.groups] data set). It is important that this is considered when using the breakpoints for own use.
#' **NOTE:** this `AMR` package (and the WHONET software as well) contains rather complex internal methods to apply the guidelines. For example, some breakpoints must be applied on certain species groups (which are in case of this package available through the [microorganisms.groups] data set). It is important that this is considered when using the breakpoints for own use.
#' @seealso [intrinsic_resistant]
#' @examples
#' clinical_breakpoints
-5
View File
@@ -165,11 +165,6 @@ pillar_shaft.disk <- function(x, ...) {
create_pillar_column(out, align = "right", width = 2)
}
# will be exported using s3_register() in R/zzz.R
type_sum.disk <- function(x, ...) {
"disk"
}
#' @method print disk
#' @export
#' @noRd
+3 -3
View File
@@ -103,7 +103,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
#' @section Antibiotics:
#' To define antibiotics column names, leave as it is to determine it automatically with [guess_ab_col()] or input a text (case-insensitive), or use `NULL` to skip a column (e.g. `TIC = NULL` to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
#'
#' The following antibiotics are eligible for the functions [eucast_rules()] and [mdro()]. These are shown below in the format 'name (`antimicrobial ID`, [ATC code](https://www.whocc.no/atc/structure_and_principles/))', sorted alphabetically:
#' The following antibiotics are eligible for the functions [eucast_rules()] and [mdro()]. These are shown below in the format 'name (`antimicrobial ID`, [ATC code](https://atcddd.fhi.no/atc/structure_and_principles/))', sorted alphabetically:
#'
#' `r create_eucast_ab_documentation()`
#' @aliases EUCAST
@@ -184,7 +184,6 @@ eucast_rules <- function(x,
meet_criteria(ampc_cephalosporin_resistance, allow_class = c("logical", "character", "sir"), has_length = 1, allow_NA = TRUE, allow_NULL = TRUE)
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE)
if ("only_rsi_columns" %in% names(list(...))) only_sir_columns <- list(...)$only_rsi_columns
add_MO_lookup_to_AMR_env()
@@ -591,7 +590,7 @@ eucast_rules <- function(x,
# this allows: eucast_rules(x, eucast_rules_df = AMR:::EUCAST_RULES_DF %>% filter(is.na(have_these_values)))
eucast_rules_df <- list(...)$eucast_rules_df
} else {
# otherwise internal data file, created in data-raw/_pre_commit_hook.R
# otherwise internal data file, created in data-raw/_pre_commit_checks.R
eucast_rules_df <- EUCAST_RULES_DF
}
@@ -890,6 +889,7 @@ eucast_rules <- function(x,
),
type = "ansi"
))
cat("\n")
warned <- FALSE
}
run_changes <- edit_sir(
+57
View File
@@ -0,0 +1,57 @@
# ==================================================================== #
# TITLE: #
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
# SOURCE CODE: #
# https://github.com/msberends/AMR #
# #
# PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
# Data. Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 #
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#' Export Data Set as NCBI BioSample Antibiogram
#'
#'
#' @param x a data set
#' @param filename a character string specifying the file name
#' @param type a character string specifying the type of data set, either "pathogen MIC" or "beta-lactamase MIC", see <https://www.ncbi.nlm.nih.gov/biosample/docs/>
#' @param save_as_xlsx
export_biosample <- function(x,
filename = paste0("biosample_", format(Sys.time(), "%Y-%m-%d-%H%M%S"), ".xlsx"),
type = "pathogen MIC",
columns = where(is.mic),
save_as_xlsx = TRUE) {
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
meet_criteria(filename, allow_class = "character", has_length = 1)
meet_criteria(type, allow_class = "character", has_length = 1, is_in = c("pathogen MIC", "beta-lactamase MIC"))
meet_criteria(save_as_xlsx, allow_class = "logical", has_length = 1)
out <- x %pm>%
pm_select(columns)
stop_if(NROW(out) == 0, "No columns found.")
if (isTRUE(save_as_xlsx)) {
export <- import_fn("write.xlsx", pkg = "openxlsx", error_on_fail = TRUE)
export(out, file = filename, overwrite = TRUE, asTable = FALSE)
} else {
out
}
}
+1 -5
View File
@@ -227,10 +227,6 @@ first_isolate <- function(x = NULL,
meet_criteria(points_threshold, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
meet_criteria(info, allow_class = "logical", has_length = 1)
meet_criteria(include_unknown, allow_class = "logical", has_length = 1)
if ("include_untested_rsi" %in% names(list(...))) {
deprecation_warning("include_untested_rsi", "include_untested_sir", is_function = FALSE)
include_untested_sir <- list(...)$include_untested_rsi
}
meet_criteria(include_untested_sir, allow_class = "logical", has_length = 1)
# remove data.table, grouping from tibbles, etc.
@@ -240,7 +236,7 @@ first_isolate <- function(x = NULL,
FUN.VALUE = logical(1),
X = x,
# check only first 10,000 rows
FUN = function(x) any(as.character(x[1:10000]) %in% c("S", "I", "R"), na.rm = TRUE),
FUN = function(x) any(as.character(x[1:10000]) %in% c("S", "SDD", "I", "R", "N"), na.rm = TRUE),
USE.NAMES = FALSE
))
if (method == "phenotype-based" && !any_col_contains_sir) {
+6 -4
View File
@@ -85,16 +85,18 @@
#' summary(pca_result)
#'
#' # old base R plotting method:
#' biplot(pca_result)
#' biplot(pca_result, main = "Base R biplot")
#'
#' # new ggplot2 plotting method using this package:
#' if (require("ggplot2")) {
#' ggplot_pca(pca_result)
#'
#' ggplot_pca(pca_result) +
#' labs(title = "ggplot2 biplot")
#' }
#' if (require("ggplot2")) {
#' # still extendible with any ggplot2 function
#' ggplot_pca(pca_result) +
#' scale_colour_viridis_d() +
#' labs(title = "Title here")
#' labs(title = "ggplot2 biplot")
#' }
#' }
#' }
+1 -1
View File
@@ -335,7 +335,7 @@ get_ab_from_namespace <- function(x, cols_ab) {
x_new <- character()
for (val in x) {
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) {
# antibiotic group names, as defined in data-raw/_pre_commit_hook.R, such as `AB_CARBAPENEMS`
# antibiotic group names, as defined in data-raw/_pre_commit_checks.R, such as `AB_CARBAPENEMS`
val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
} else if (val %in% AMR_env$AB_lookup$ab) {
# separate drugs, such as `AMX`
+8 -5
View File
@@ -31,11 +31,11 @@
#'
#' According to the binomial nomenclature, the lowest four taxonomic levels (family, genus, species, subspecies) should be printed in italics. This function finds taxonomic names within strings and makes them italic.
#' @param string a [character] (vector)
#' @param type type of conversion of the taxonomic names, either "markdown" or "ansi", see *Details*
#' @param type type of conversion of the taxonomic names, either "markdown", "html" or "ansi", see *Details*
#' @details
#' This function finds the taxonomic names and makes them italic based on the [microorganisms] data set.
#'
#' The taxonomic names can be italicised using markdown (the default) by adding `*` before and after the taxonomic names, or using ANSI colours by adding `\033[3m` before and `\033[23m` after the taxonomic names. If multiple ANSI colours are not available, no conversion will occur.
#' The taxonomic names can be italicised using markdown (the default) by adding `*` before and after the taxonomic names, or `<i>` and `</i>` when using html. When using 'ansi', ANSI colours will be added using `\033[3m` before and `\033[23m` after the taxonomic names. If multiple ANSI colours are not available, no conversion will occur.
#'
#' This function also supports abbreviation of the genus if it is followed by a species, such as "E. coli" and "K. pneumoniae ozaenae".
#' @export
@@ -44,18 +44,21 @@
#' italicise_taxonomy("An overview of S. aureus isolates")
#'
#' cat(italicise_taxonomy("An overview of S. aureus isolates", type = "ansi"))
italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
italicise_taxonomy <- function(string, type = c("markdown", "ansi", "html")) {
if (missing(type)) {
type <- "markdown"
}
meet_criteria(string, allow_class = "character")
meet_criteria(type, allow_class = "character", has_length = 1, is_in = c("markdown", "ansi"))
meet_criteria(type, allow_class = "character", has_length = 1, is_in = c("markdown", "ansi", "html"))
add_MO_lookup_to_AMR_env()
if (type == "markdown") {
before <- "*"
after <- "*"
} else if (type == "html") {
before <- "<i>"
after <- "</i>"
} else if (type == "ansi") {
if (!has_colour() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) {
return(string)
@@ -134,7 +137,7 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
#' @rdname italicise_taxonomy
#' @export
italicize_taxonomy <- function(string, type = c("markdown", "ansi")) {
italicize_taxonomy <- function(string, type = c("markdown", "ansi", "html")) {
if (missing(type)) {
type <- "markdown"
}
+3 -5
View File
@@ -149,10 +149,6 @@ key_antimicrobials <- function(x = NULL,
meet_criteria(gram_positive, allow_class = "character", allow_NULL = TRUE)
meet_criteria(antifungal, allow_class = "character", allow_NULL = TRUE)
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
# force regular data.frame, not a tibble or data.table
x <- as.data.frame(x, stringsAsFactors = FALSE)
@@ -286,6 +282,8 @@ generate_antimcrobials_string <- function(df) {
as.list(df),
function(x) {
x <- toupper(as.character(x))
x[x == "SDD"] <- "I"
# ignore "N" here, no use for determining first isolates
x[!x %in% c("S", "I", "R")] <- "."
paste(x)
}
@@ -316,7 +314,7 @@ antimicrobials_equal <- function(y,
val <- strsplit(val, "", fixed = TRUE)[[1L]]
val.int <- rep(NA_real_, length(val))
val.int[val == "S"] <- 1
val.int[val == "I"] <- 2
val.int[val %in% c("I", "SDD")] <- 2
val.int[val == "R"] <- 3
val.int
}
+1 -5
View File
@@ -192,10 +192,6 @@ mdro <- function(x = NULL,
meet_criteria(pct_required_classes, allow_class = "numeric", has_length = 1)
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
meet_criteria(verbose, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) {
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE)
only_sir_columns <- list(...)$only_rsi_columns
}
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if (!any(is_sir_eligible(x))) {
@@ -736,7 +732,7 @@ mdro <- function(x = NULL,
sum(vapply(
FUN.VALUE = logical(1),
group_tbl,
function(group) any(unlist(x[row, group[!is.na(group)], drop = TRUE]) %in% c("S", "I", "R"))
function(group) any(unlist(x[row, group[!is.na(group)], drop = TRUE]) %in% c("S", "SDD", "I", "R"))
))
}
)
+2 -2
View File
@@ -175,8 +175,8 @@ mean_amr_distance.data.frame <- function(x, ..., combine_SI = TRUE) {
#' @param row an index, such as a row number
#' @export
amr_distance_from_row <- function(amr_distance, row) {
meet_criteria(amr_distance, allow_class = c("double", "numeric"), is_finite = TRUE)
meet_criteria(row, allow_class = c("logical", "double", "numeric"))
meet_criteria(amr_distance, allow_class = "numeric", is_finite = TRUE)
meet_criteria(row, allow_class = c("logical", "numeric", "integer"))
if (is.logical(row)) {
row <- which(row)
}
+265 -155
View File
@@ -27,48 +27,25 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
# these are allowed MIC values and will become [factor] levels
operators <- c("<", "<=", "", ">=", ">")
valid_mic_levels <- c(
c(t(vapply(
FUN.VALUE = character(6), operators,
function(x) paste0(x, "0.000", c(1:4, 6, 8))
))),
c(t(vapply(
FUN.VALUE = character(90), operators,
function(x) paste0(x, "0.00", c(1:9, 11:19, 21:29, 31:39, 41:49, 51:59, 61:69, 71:79, 81:89, 91:99))
))),
unique(c(t(vapply(
FUN.VALUE = character(106), operators,
function(x) {
paste0(x, sort(as.double(paste0(
"0.0",
sort(c(1:99, 125, 128, 156, 165, 256, 512, 625))
))))
}
)))),
unique(c(t(vapply(
FUN.VALUE = character(103), operators,
function(x) {
paste0(x, sort(as.double(paste0(
"0.",
c(1:99, 125, 128, 256, 512)
))))
}
)))),
c(t(vapply(
FUN.VALUE = character(10), operators,
function(x) paste0(x, sort(c(1:9, 1.5)))
))),
c(t(vapply(
FUN.VALUE = character(45), operators,
function(x) paste0(x, c(10:98)[9:98 %% 2 == TRUE])
))),
c(t(vapply(
FUN.VALUE = character(17), operators,
function(x) paste0(x, sort(c(2^c(7:11), 192, 80 * c(2:12))))
)))
# these are allowed MIC values and will become factor levels
VALID_MIC_LEVELS <- c(
as.double(paste0("0.000", c(1:9))),
as.double(paste0("0.00", c(1:99, 1953125, 390625, 78125))),
as.double(paste0("0.0", c(1:99, 125, 128, 156, 165, 256, 512, 625, 3125, 15625))),
as.double(paste0("0.", c(1:99, 125, 128, 256, 512))),
1:9, 1.5,
c(10:98)[9:98 %% 2 == TRUE],
2^c(7:12), 192 * c(1:5), 80 * c(2:12)
)
VALID_MIC_LEVELS <- trimws(gsub("[.]?0+$", "", format(unique(sort(VALID_MIC_LEVELS)), scientific = FALSE), perl = TRUE))
operators <- c("<", "<=", "", ">=", ">")
VALID_MIC_LEVELS <- c(t(vapply(FUN.VALUE = character(length(VALID_MIC_LEVELS)),
c("<", "<=", "", ">=", ">"),
paste0,
VALID_MIC_LEVELS)))
COMMON_MIC_VALUES <- c(0.001, 0.002, 0.004, 0.008, 0.016, 0.032, 0.064,
0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32,
64, 128, 256, 512, 1024)
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
#'
@@ -76,6 +53,7 @@ valid_mic_levels <- c(
#' @rdname as.mic
#' @param x a [character] or [numeric] vector
#' @param na.rm a [logical] indicating whether missing values should be removed
#' @param keep_operators a [character] specifying how to handle operators (such as `>` and `<=`) in the input. Accepts one of three values: `"all"` (or `TRUE`) to keep all operators, `"none"` (or `FALSE`) to remove all operators, or `"edges"` to keep operators only at both ends of the range.
#' @param ... arguments passed on to methods
#' @details To interpret MIC values as SIR values, use [as.sir()] on MIC values. It supports guidelines from EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(clinical_breakpoints, guideline %like% "CLSI")$guideline)))`).
#'
@@ -115,12 +93,16 @@ valid_mic_levels <- c(
#' #> 10 16 A
#' ```
#'
#' The following [generic functions][groupGeneric()] are implemented for the MIC class: `!`, `!=`, `%%`, `%/%`, `&`, `*`, `+`, `-`, `/`, `<`, `<=`, `==`, `>`, `>=`, `^`, `|`, [abs()], [acos()], [acosh()], [all()], [any()], [asin()], [asinh()], [atan()], [atanh()], [ceiling()], [cos()], [cosh()], [cospi()], [cummax()], [cummin()], [cumprod()], [cumsum()], [digamma()], [exp()], [expm1()], [floor()], [gamma()], [lgamma()], [log()], [log1p()], [log2()], [log10()], [max()], [mean()], [min()], [prod()], [range()], [round()], [sign()], [signif()], [sin()], [sinh()], [sinpi()], [sqrt()], [sum()], [tan()], [tanh()], [tanpi()], [trigamma()] and [trunc()]. Some functions of the `stats` package are also implemented: [median()], [quantile()], [mad()], [IQR()], [fivenum()]. Also, [boxplot.stats()] is supported. Since [sd()] and [var()] are non-generic functions, these could not be extended. Use [mad()] as an alternative, or use e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
#' All so-called [group generic functions][groupGeneric()] are implemented for the MIC class (such as `!`, `!=`, `<`, `>=`, [exp()], [log2()]). Some functions of the `stats` package are also implemented (such as [quantile()], [median()], [fivenum()]). Since [sd()] and [var()] are non-generic functions, these could not be extended. Use [mad()] as an alternative, or use e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
#'
#' Using [as.double()] or [as.numeric()] on MIC values will remove the operators and return a numeric vector. Do **not** use [as.integer()] on MIC values as by the \R convention on [factor]s, it will return the index of the factor levels (which is often useless for regular users).
#'
#' Use [droplevels()] to drop unused levels. At default, it will return a plain factor. Use `droplevels(..., as.mic = TRUE)` to maintain the `mic` class.
#' @return Ordered [factor] with additional class [`mic`], that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a [numeric] value.
#'
#' With [rescale_mic()], existing MIC ranges can be limited to a defined range of MIC values. This can be useful to better compare MIC distributions.
#'
#' For `ggplot2`, use one of the [`scale_*_mic()`][scale_x_mic()] functions to plot MIC values. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values.
#' @return Ordered [factor] with additional class [`mic`], that in mathematical operations acts as a [numeric] vector. Bear in mind that the outcome of any mathematical operation on MICs will return a [numeric] value.
#' @aliases mic
#' @export
#' @seealso [as.sir()]
@@ -136,6 +118,9 @@ valid_mic_levels <- c(
#' fivenum(mic_data)
#' quantile(mic_data)
#' all(mic_data < 512)
#'
#' # limit MICs using rescale_mic()
#' rescale_mic(mic_data, mic_range = c(4, 16))
#'
#' # interpret MIC values
#' as.sir(
@@ -161,112 +146,182 @@ valid_mic_levels <- c(
#' if (require("ggplot2")) {
#' autoplot(mic_data, mo = "E. coli", ab = "cipro", language = "nl") # Dutch
#' }
as.mic <- function(x, na.rm = FALSE) {
as.mic <- function(x, na.rm = FALSE, keep_operators = "all") {
meet_criteria(x, allow_NA = TRUE)
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
if (is.mic(x)) {
x
meet_criteria(keep_operators, allow_class = c("character", "logical"), is_in = c("all", "none", "edges", FALSE, TRUE), has_length = 1)
if (isTRUE(keep_operators)) {
keep_operators <- "all"
} else if (isFALSE(keep_operators)) {
keep_operators <- "none"
}
if (is.mic(x) && (keep_operators == "all" || !any(x %like% "[>=<]", na.rm = TRUE))) {
if (!identical(levels(x), VALID_MIC_LEVELS)) {
# from an older AMR version - just update MIC factor levels
x <- set_clean_class(factor(as.character(x), levels = VALID_MIC_LEVELS, ordered = TRUE),
new_class = c("mic", "ordered", "factor"))
}
return(x)
}
x.bak <- NULL
if (is.numeric(x)) {
x.bak <- format(x, scientific = FALSE)
# MICs never have more than 9 decimals, so:
x <- format(round(x, 9), scientific = FALSE)
} else {
if (is.numeric(x)) {
x <- format(x, scientific = FALSE)
} else {
x <- as.character(unlist(x))
}
if (isTRUE(na.rm)) {
x <- x[!is.na(x)]
}
x[trimws2(x) == ""] <- NA
x <- as.character(unlist(x))
}
if (isTRUE(na.rm)) {
x <- x[!is.na(x)]
}
x <- trimws2(x)
x[x == ""] <- NA
if (is.null(x.bak)) {
x.bak <- x
# comma to period
x <- gsub(",", ".", x, fixed = TRUE)
# transform scientific notation
x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"] <- as.double(x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"])
# transform Unicode for >= and <=
x <- gsub("\u2264", "<=", x, fixed = TRUE)
x <- gsub("\u2265", ">=", x, fixed = TRUE)
# remove other invalid characters
x <- gsub("[^a-zA-Z0-9.><= ]+", "", x, perl = TRUE)
# remove space between operator and number ("<= 0.002" -> "<=0.002")
x <- gsub("(<|=|>) +", "\\1", x, perl = TRUE)
# transform => to >= and =< to <=
x <- gsub("=<", "<=", x, fixed = TRUE)
x <- gsub("=>", ">=", x, fixed = TRUE)
# dots without a leading zero must start with 0
x <- gsub("([^0-9]|^)[.]", "\\10.", x, perl = TRUE)
# values like "<=0.2560.512" should be 0.512
x <- gsub(".*[.].*[.]", "0.", x, perl = TRUE)
# remove ending .0
x <- gsub("[.]+0$", "", x, perl = TRUE)
# remove all after last digit
x <- gsub("[^0-9]+$", "", x, perl = TRUE)
# keep only one zero before dot
x <- gsub("0+[.]", "0.", x, perl = TRUE)
# starting 00 is probably 0.0 if there's no dot yet
x[x %unlike% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"])
# remove last zeroes
x <- gsub("([.].?)0+$", "\\1", x, perl = TRUE)
x <- gsub("(.*[.])0+$", "\\10", x, perl = TRUE)
# remove ending .0 again
x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"])
# never end with dot
x <- gsub("[.]$", "", x, perl = TRUE)
# trim it
x <- trimws2(x)
## previously unempty values now empty - should return a warning later on
x[x.bak != "" & x == ""] <- "invalid"
na_before <- x[is.na(x) | x == ""] %pm>% length()
x[!x %in% valid_mic_levels] <- NA
na_after <- x[is.na(x) | x == ""] %pm>% length()
if (na_before != na_after) {
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
unique() %pm>%
sort() %pm>%
vector_and(quotes = TRUE)
cur_col <- get_current_column()
warning_("in `as.mic()`: ", na_after - na_before, " result",
ifelse(na_after - na_before > 1, "s", ""),
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
" truncated (",
round(((na_after - na_before) / length(x)) * 100),
"%) that were invalid MICs: ",
list_missing,
call = FALSE
)
}
set_clean_class(factor(x, levels = valid_mic_levels, ordered = TRUE),
new_class = c("mic", "ordered", "factor")
}
# comma to period
x <- gsub(",", ".", x, fixed = TRUE)
# transform scientific notation
x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"] <- as.double(x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"])
# transform Unicode for >= and <=
x <- gsub("\u2264", "<=", x, fixed = TRUE)
x <- gsub("\u2265", ">=", x, fixed = TRUE)
# remove other invalid characters
x <- gsub("[^a-zA-Z0-9.><= ]+", "", x, perl = TRUE)
# remove space between operator and number ("<= 0.002" -> "<=0.002")
x <- gsub("(<|=|>) +", "\\1", x, perl = TRUE)
# transform => to >= and =< to <=
x <- gsub("=<", "<=", x, fixed = TRUE)
x <- gsub("=>", ">=", x, fixed = TRUE)
# dots without a leading zero must start with 0
x <- gsub("([^0-9]|^)[.]", "\\10.", x, perl = TRUE)
# values like "<=0.2560.512" should be 0.512
x <- gsub(".*[.].*[.]", "0.", x, perl = TRUE)
# remove ending .0
x <- gsub("[.]+0$", "", x, perl = TRUE)
# remove all after last digit
x <- gsub("[^0-9]+$", "", x, perl = TRUE)
# keep only one zero before dot
x <- gsub("0+[.]", "0.", x, perl = TRUE)
# starting 00 is probably 0.0 if there's no dot yet
x[x %unlike% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"])
# remove last zeroes
x <- gsub("([.].?)0+$", "\\1", x, perl = TRUE)
x <- gsub("(.*[.])0+$", "\\10", x, perl = TRUE)
# remove ending .0 again
x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"])
# never end with dot
x <- gsub("[.]$", "", x, perl = TRUE)
# trim it
x <- trimws2(x)
## previously unempty values now empty - should return a warning later on
x[x.bak != "" & x == ""] <- "invalid"
na_before <- x[is.na(x) | x == ""] %pm>% length()
x[!x %in% VALID_MIC_LEVELS] <- NA
na_after <- x[is.na(x) | x == ""] %pm>% length()
if (na_before != na_after) {
list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
unique() %pm>%
sort() %pm>%
vector_and(quotes = TRUE)
cur_col <- get_current_column()
warning_("in `as.mic()`: ", na_after - na_before, " result",
ifelse(na_after - na_before > 1, "s", ""),
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
" truncated (",
round(((na_after - na_before) / length(x)) * 100),
"%) that were invalid MICs: ",
list_missing,
call = FALSE
)
}
if (keep_operators == "none" && !all(is.na(x))) {
x <- gsub("[>=<]", "", x)
} else if (keep_operators == "edges" && !all(is.na(x))) {
dbls <- as.double(gsub("[>=<]", "", x))
x[dbls == min(dbls, na.rm = TRUE)] <- paste0("<=", min(dbls, na.rm = TRUE))
x[dbls == max(dbls, na.rm = TRUE)] <- paste0(">=", max(dbls, na.rm = TRUE))
keep <- x[dbls == max(dbls, na.rm = TRUE) | dbls == min(dbls, na.rm = TRUE)]
x[!x %in% keep] <- gsub("[>=<]", "", x[!x %in% keep])
}
set_clean_class(factor(x, levels = VALID_MIC_LEVELS, ordered = TRUE),
new_class = c("mic", "ordered", "factor"))
}
all_valid_mics <- function(x) {
if (!inherits(x, c("mic", "character", "factor", "numeric", "integer"))) {
return(FALSE)
}
x_mic <- tryCatch(suppressWarnings(as.mic(x[!is.na(x)])),
error = function(e) NA
)
!any(is.na(x_mic)) && !all(is.na(x))
#' @rdname as.mic
#' @export
is.mic <- function(x) {
inherits(x, "mic")
}
#' @rdname as.mic
#' @details `NA_mic_` is a missing value of the new `mic` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_mic_ <- set_clean_class(factor(NA, levels = valid_mic_levels, ordered = TRUE),
NA_mic_ <- set_clean_class(factor(NA, levels = VALID_MIC_LEVELS, ordered = TRUE),
new_class = c("mic", "ordered", "factor")
)
#' @rdname as.mic
#' @param mic_range a manual range to limit the MIC values, e.g., `mic_range = c(0.001, 32)`. Use `NA` to set no limit on one side, e.g., `mic_range = c(NA, 32)`.
#' @export
is.mic <- function(x) {
inherits(x, "mic")
rescale_mic <- function(x, mic_range, keep_operators = "edges", as.mic = TRUE) {
meet_criteria(mic_range, allow_class = c("numeric", "integer", "logical"), has_length = 2, allow_NA = TRUE, allow_NULL = TRUE)
stop_ifnot(all(mic_range %in% c(VALID_MIC_LEVELS, NA)),
"Values in `mic_range` must be valid MIC values. Unvalid: ", vector_and(mic_range[mic_range %in% c(VALID_MIC_LEVELS, NA)]))
x <- as.mic(x)
if (is.null(mic_range)) {
mic_range <- c(NA, NA)
}
mic_range <- as.mic(mic_range)
min_mic <- mic_range[1]
max_mic <- mic_range[2]
if (!is.na(min_mic)) {
x[x < min_mic] <- min_mic
}
if (!is.na(max_mic)) {
x[x > max_mic] <- max_mic
}
x <- as.mic(x, keep_operators = ifelse(keep_operators == "edges", "none", keep_operators))
if (isTRUE(as.mic)) {
if (keep_operators == "edges") {
x[x == min(x, na.rm = TRUE)] <- paste0("<=", x[x == min(x, na.rm = TRUE)])
x[x == max(x, na.rm = TRUE)] <- paste0(">=", x[x == max(x, na.rm = TRUE)])
}
return(x)
}
# create a manual factor with levels only within desired range
expanded <- plotrange_as_table(x,
expand = TRUE,
keep_operators = ifelse(keep_operators == "edges", "none", keep_operators),
mic_range = mic_range)
if (keep_operators == "edges") {
names(expanded)[1] <- paste0("<=", names(expanded)[1])
names(expanded)[length(expanded)] <- paste0(">=", names(expanded)[length(expanded)])
}
# MICs contain all MIC levels, so strip this to only existing levels and their intermediate values
out <- factor(names(expanded),
levels = names(expanded),
ordered = TRUE)
# and only keep the ones in the data
if (keep_operators == "edges") {
out <- out[match(x, as.double(as.mic(out, keep_operators = "all")))]
} else {
out <- out[match(x, out)]
}
out
}
#' @method as.double mic
@@ -288,6 +343,7 @@ as.numeric.mic <- function(x, ...) {
#' @param as.mic a [logical] to indicate whether the `mic` class should be kept - the default is `FALSE`
#' @export
droplevels.mic <- function(x, as.mic = FALSE, ...) {
x <- as.mic(x) # make sure that currently implemented MIC levels are used
x <- droplevels.factor(x, ...)
if (as.mic == TRUE) {
class(x) <- c("mic", "ordered", "factor")
@@ -295,32 +351,50 @@ droplevels.mic <- function(x, as.mic = FALSE, ...) {
x
}
all_valid_mics <- function(x) {
if (!inherits(x, c("mic", "character", "factor", "numeric", "integer"))) {
return(FALSE)
}
x_mic <- tryCatch(suppressWarnings(as.mic(x[!is.na(x)])),
error = function(e) NA
)
!any(is.na(x_mic)) && !all(is.na(x))
}
# will be exported using s3_register() in R/zzz.R
pillar_shaft.mic <- function(x, ...) {
if(!identical(levels(x), VALID_MIC_LEVELS) && message_not_thrown_before("pillar_shaft.mic")) {
warning_(AMR_env$sup_1_icon, " These columns contain an outdated or altered structure - convert with `as.mic()` to update",
call = FALSE)
}
crude_numbers <- as.double(x)
operators <- gsub("[^<=>]+", "", as.character(x))
operators[!is.na(operators) & operators != ""] <- font_silver(operators[!is.na(operators) & operators != ""], collapse = NULL)
out <- trimws(paste0(operators, trimws(format(crude_numbers))))
out[is.na(x)] <- font_na(NA)
# maketrailing zeroes almost invisible
out[out %like% "[.]"] <- gsub("([.]?0+)$", font_white("\\1"), out[out %like% "[.]"], perl = TRUE)
# make trailing zeroes less visible
out[out %like% "[.]"] <- gsub("([.]?0+)$", font_silver("\\1"), out[out %like% "[.]"], perl = TRUE)
create_pillar_column(out, align = "right", width = max(nchar(font_stripstyle(out))))
}
# will be exported using s3_register() in R/zzz.R
type_sum.mic <- function(x, ...) {
"mic"
if(!identical(levels(x), VALID_MIC_LEVELS)) {
paste0("mic", AMR_env$sup_1_icon)
} else {
"mic"
}
}
#' @method print mic
#' @export
#' @noRd
print.mic <- function(x, ...) {
cat("Class 'mic'",
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""),
"\n",
sep = ""
)
cat("Class 'mic'")
if(!identical(levels(x), VALID_MIC_LEVELS)) {
cat(font_red(" with an outdated or altered structure - convert with `as.mic()` to update"))
}
cat("\n")
print(as.character(x), quote = FALSE)
att <- attributes(x)
if ("na.action" %in% names(att)) {
@@ -341,22 +415,44 @@ summary.mic <- function(object, ...) {
as.matrix.mic <- function(x, ...) {
as.matrix(as.double(x), ...)
}
#' @method as.vector mic
#' @export
#' @noRd
as.vector.mic <- function(x, mode = "numneric", ...) {
y <- NextMethod()
y <- as.mic(y)
calls <- unlist(lapply(sys.calls(), as.character))
if (any(calls %in% c("rbind", "cbind")) && message_not_thrown_before("as.vector.mic")) {
warning_("Functions `rbind()` and `cbind()` cannot preserve the structure of MIC values. Use dplyr's `bind_rows()` or `bind_cols()` instead.", call = FALSE)
}
y
}
#' @method as.list mic
#' @export
#' @noRd
as.list.mic <- function(x, ...) {
lapply(as.list(as.character(x), ...), as.mic)
}
#' @method as.data.frame mic
#' @export
#' @noRd
as.data.frame.mic <- function(x, ...) {
as.data.frame.vector(as.mic(x), ...)
}
#' @method [ mic
#' @export
#' @noRd
"[.mic" <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
as.mic(y)
}
#' @method [[ mic
#' @export
#' @noRd
"[[.mic" <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
as.mic(y)
}
#' @method [<- mic
#' @export
@@ -364,8 +460,7 @@ as.matrix.mic <- function(x, ...) {
"[<-.mic" <- function(i, j, ..., value) {
value <- as.mic(value)
y <- NextMethod()
attributes(y) <- attributes(i)
y
as.mic(y)
}
#' @method [[<- mic
#' @export
@@ -373,8 +468,7 @@ as.matrix.mic <- function(x, ...) {
"[[<-.mic" <- function(i, j, ..., value) {
value <- as.mic(value)
y <- NextMethod()
attributes(y) <- attributes(i)
y
as.mic(y)
}
#' @method c mic
#' @export
@@ -388,8 +482,7 @@ c.mic <- function(...) {
#' @noRd
unique.mic <- function(x, incomparables = FALSE, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
as.mic(y)
}
#' @method rep mic
@@ -397,20 +490,25 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
#' @noRd
rep.mic <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
as.mic(y)
}
#' @method sort mic
#' @export
#' @noRd
sort.mic <- function(x, decreasing = FALSE, ...) {
x <- as.mic(x) # make sure that currently implemented MIC levels are used
dbl <- as.double(x)
# make sure that e.g. '<0.001' comes before '0.001', and '>0.001' comes after
dbl[as.character(x) %like% "<[0-9]"] <- dbl[as.character(x) %like% "<[0-9]"] - 0.000002
dbl[as.character(x) %like% "<="] <- dbl[as.character(x) %like% "<="] - 0.000001
dbl[as.character(x) %like% ">="] <- dbl[as.character(x) %like% ">="] + 0.000001
dbl[as.character(x) %like% ">[0-9]"] <- dbl[as.character(x) %like% ">[0-9]"] + 0.000002
if (decreasing == TRUE) {
ord <- order(-as.double(x))
x[order(-dbl)]
} else {
ord <- order(as.double(x))
x[order(dbl)]
}
x[ord]
}
#' @method hist mic
@@ -424,6 +522,7 @@ hist.mic <- function(x, ...) {
# will be exported using s3_register() in R/zzz.R
get_skimmers.mic <- function(column) {
column <- as.mic(column) # make sure that currently implemented MIC levels are used
skimr::sfl(
skim_type = "mic",
p0 = ~ stats::quantile(., probs = 0, na.rm = TRUE, names = FALSE),
@@ -475,12 +574,23 @@ Math.mic <- function(x, ...) {
#' @export
Ops.mic <- function(e1, e2) {
e1_chr <- as.character(e1)
e2_chr <- character(0)
e1 <- as.double(e1)
if (!missing(e2)) {
# when e1 is `!`, e2 is missing
# when .Generic is `!`, e2 is missing
e2_chr <- as.character(e2)
e2 <- as.double(e2)
}
# set class to numeric, because otherwise NextMethod will be factor (since mic is a factor)
if (as.character(.Generic) %in% c("<", "<=", "==", "!=", ">", ">=")) {
# make sure that <0.002 is lower than 0.002
# and that >32 is higher than 32, but equal to >=32
e1[e1_chr %like% "<" & e1_chr %unlike% "="] <- e1[e1_chr %like% "<" & e1_chr %unlike% "="] - 0.000001
e1[e1_chr %like% ">" & e1_chr %unlike% "="] <- e1[e1_chr %like% ">" & e1_chr %unlike% "="] + 0.000001
e2[e2_chr %like% "<" & e2_chr %unlike% "="] <- e2[e2_chr %like% "<" & e2_chr %unlike% "="] - 0.000001
e2[e2_chr %like% ">" & e2_chr %unlike% "="] <- e2[e2_chr %like% ">" & e2_chr %unlike% "="] + 0.000001
}
# set .Class to numeric, because otherwise NextMethod will be factor (since mic is a factor)
.Class <- class(e1)
NextMethod(.Generic)
}
+2 -2
View File
@@ -250,7 +250,7 @@ as.mo <- function(x,
x_unique <- unique(x[is.na(out) & !is.na(x)])
# set up progress bar
progress <- progress_ticker(n = length(x_unique), n_min = 10, print = info)
progress <- progress_ticker(n = length(x_unique), n_min = 10, print = info, title = "Converting microorganism input")
on.exit(close(progress))
msg <- character(0)
@@ -460,7 +460,7 @@ as.mo <- function(x,
}
}
# 'MO_CONS' and 'MO_COPS' are 'mo' vectors created in R/_pre_commit_hook.R
# 'MO_CONS' and 'MO_COPS' are 'mo' vectors created in R/_pre_commit_checks.R
out[out %in% MO_CONS] <- "B_STPHY_CONS"
out[out %in% MO_COPS] <- "B_STPHY_COPS"
if (Becker == "all") {
+40 -3
View File
@@ -106,7 +106,12 @@
#' mo_rank("Klebsiella pneumoniae")
#' mo_url("Klebsiella pneumoniae")
#' mo_is_yeast(c("Candida", "Trichophyton", "Klebsiella"))
#'
#'
#' mo_group_members("Streptococcus group A")
#' mo_group_members(c("Streptococcus group C",
#' "Streptococcus group G",
#' "Streptococcus group L"))
#'
#'
#' # scientific reference -----------------------------------------------------
#'
@@ -245,7 +250,7 @@ mo_shortname <- function(x, language = get_AMR_locale(), keep_synonyms = getOpti
# unknown species etc.
shortnames[shortnames %like% "unknown"] <- paste0("(", trimws2(gsub("[^a-zA-Z -]", "", shortnames[shortnames %like% "unknown"], perl = TRUE)), ")")
shortnames[mo_rank(x.mo) %in% c("kingdom", "phylum", "class", "order", "family")] <- mo_name(x.mo, language = NULL, keep_synonyms = keep_synonyms)
shortnames[mo_rank(x.mo) %in% c("kingdom", "phylum", "class", "order", "family")] <- mo_name(x.mo[mo_rank(x.mo) %in% c("kingdom", "phylum", "class", "order", "family")], language = NULL, keep_synonyms = keep_synonyms)
shortnames[is.na(x.mo)] <- NA_character_
load_mo_uncertainties(metadata)
@@ -796,6 +801,37 @@ mo_current <- function(x, language = get_AMR_locale(), ...) {
mo_name(out, language = language)
}
#' @rdname mo_property
#' @export
mo_group_members <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
if (missing(x)) {
# this tries to find the data and an 'mo' column
x <- find_mo_col(fn = "mo_synonyms")
}
meet_criteria(x, allow_NA = TRUE)
language <- validate_language(language)
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
add_MO_lookup_to_AMR_env()
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
metadata <- get_mo_uncertainties()
members <- lapply(x.mo, function(y) {
AMR::microorganisms.groups$mo_name[which(AMR::microorganisms.groups$mo_group == y)]
})
names(members) <- mo_name(x, keep_synonyms = TRUE, language = language)
if (length(members) == 1) {
members <- unname(unlist(members))
}
load_mo_uncertainties(metadata)
members
}
#' @rdname mo_property
#' @export
mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
@@ -823,7 +859,8 @@ mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("A
ref = mo_ref(y, keep_synonyms = keep_synonyms),
snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms)),
lpsn = mo_lpsn(y, language = language, keep_synonyms = keep_synonyms),
gbif = mo_gbif(y, language = language, keep_synonyms = keep_synonyms)
gbif = mo_gbif(y, language = language, keep_synonyms = keep_synonyms),
group_members = mo_group_members(y, language = language, keep_synonyms = keep_synonyms)
)
)
})
+8 -3
View File
@@ -125,14 +125,13 @@
#' If the original file (in the previous case an Excel file) is moved or deleted, the `mo_source.rds` file will be removed upon the next use of [as.mo()] or any [`mo_*`][mo_property()] function.
#' @export
set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_source.rds")) {
stop_ifnot(interactive(), "this function can only be used in interactive mode, since it must ask for the user's permission to write a file to their file system.")
meet_criteria(path, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(destination, allow_class = "character", has_length = 1)
stop_ifnot(destination %like% "[.]rds$", "the `destination` must be a file location with file extension .rds.")
mo_source_destination <- path.expand(destination)
stop_ifnot(interactive(), "this function can only be used in interactive mode, since it must ask for the user's permission to write a file to their file system.")
if (is.null(path) || path %in% c(FALSE, "")) {
AMR_env$mo_source <- NULL
if (file.exists(mo_source_destination)) {
@@ -247,6 +246,12 @@ get_mo_source <- function(destination = getOption("AMR_mo_source", "~/mo_source.
}
return(NULL)
}
if (destination %unlike% "[.]rds$") {
current_ext <- regexpr("\\.([[:alnum:]]+)$", destination)
current_ext <- ifelse(current_ext > -1L, substring(destination, current_ext + 1L), "")
vowel <- ifelse(current_ext %like% "^[AEFHILMNORSX]", "n", "")
stop_("The AMR mo source must be an RDS file, not a", vowel, " ", toupper(current_ext), " file. If `\"", basename(destination), "\"` was meant as your input file, use `set_mo_source()` on this file. In any case, the option `AMR_mo_source` must be set to another path.")
}
if (is.null(AMR_env$mo_source)) {
AMR_env$mo_source <- readRDS_AMR(path.expand(destination))
}
+139 -53
View File
@@ -29,8 +29,10 @@
#' Plotting for Classes `sir`, `mic` and `disk`
#'
#' @description
#' Functions to plot classes `sir`, `mic` and `disk`, with support for base \R and `ggplot2`.
#'
#' Especially the `scale_*_mic()` functions are relevant wrappers to plot MIC values for `ggplot2`. They allows custom MIC ranges and to plot intermediate log2 levels for missing MIC values.
#' @param x,object values created with [as.mic()], [as.disk()] or [as.sir()] (or their `random_*` variants, such as [random_mic()])
#' @param mo any (vector of) text that can be coerced to a valid microorganism code with [as.mo()]
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial drug code with [as.ab()]
@@ -66,9 +68,35 @@
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro", language = "nl")
#'
#'
#'
#' # Plotting using scale_x_mic()
#' \donttest{
#' if (require("ggplot2")) {
#' mic_plot <- ggplot(data.frame(mics = as.mic(c(0.125, "<=4", 4, 8, 32, ">=32")),
#' counts = c(1, 1, 2, 2, 3, 3)),
#' aes(mics, counts)) +
#' geom_col()
#' mic_plot +
#' labs(title = "without scale_x_mic()")
#' }
#' if (require("ggplot2")) {
#' mic_plot +
#' scale_x_mic() +
#' labs(title = "with scale_x_mic()")
#' }
#' if (require("ggplot2")) {
#' mic_plot +
#' scale_x_mic(keep_operators = "all") +
#' labs(title = "with scale_x_mic() keeping all operators")
#' }
#' if (require("ggplot2")) {
#' mic_plot +
#' scale_x_mic(mic_range = c(1, 128)) +
#' labs(title = "with scale_x_mic() using a manual range")
#' }
#'
#' if (require("ggplot2")) {
#' autoplot(some_mic_values)
#' }
#' if (require("ggplot2")) {
@@ -80,6 +108,59 @@
#' }
NULL
#' @export
#' @inheritParams as.mic
#' @param drop a [logical] to remove intermediate MIC values, defaults to `FALSE`
#' @rdname plot
scale_x_mic <- function(keep_operators = "edges", mic_range = NULL, drop = FALSE, ...) {
stop_ifnot_installed("ggplot2")
meet_criteria(drop, allow_class = "logical", has_length = 1)
scale <- ggplot2::scale_x_discrete(drop = drop, ...)
scale$transform <- function(x, keep_ops = keep_operators, mic_rng = mic_range) {
rescale_mic(x = x, keep_operators = keep_ops, mic_range = mic_rng, as.mic = FALSE)
}
scale
}
#' @export
#' @inheritParams as.mic
#' @rdname plot
scale_y_mic <- function(keep_operators = "edges", mic_range = NULL, drop = FALSE, ...) {
stop_ifnot_installed("ggplot2")
meet_criteria(drop, allow_class = "logical", has_length = 1)
scale <- ggplot2::scale_y_discrete(drop = drop, ...)
scale$transform <- function(x, keep_ops = keep_operators, mic_rng = mic_range) {
rescale_mic(x = x, keep_operators = keep_ops, mic_range = mic_rng, as.mic = FALSE)
}
scale
}
#' @export
#' @inheritParams as.mic
#' @rdname plot
scale_colour_mic <- function(keep_operators = "edges", mic_range = NULL, drop = FALSE, ...) {
stop_ifnot_installed("ggplot2")
meet_criteria(drop, allow_class = "logical", has_length = 1)
scale <- ggplot2::scale_colour_discrete(drop = drop, ...)
scale$transform <- function(x, keep_ops = keep_operators, mic_rng = mic_range) {
rescale_mic(x = x, keep_operators = keep_ops, mic_range = mic_rng, as.mic = FALSE)
}
scale
}
#' @export
#' @inheritParams as.mic
#' @rdname plot
scale_fill_mic <- function(keep_operators = "edges", mic_range = NULL, drop = FALSE, ...) {
stop_ifnot_installed("ggplot2")
meet_criteria(drop, allow_class = "logical", has_length = 1)
scale <- ggplot2::scale_fill_discrete(drop = drop, ...)
scale$transform <- function(x, keep_ops = keep_operators, mic_rng = mic_range) {
rescale_mic(x = x, keep_operators = keep_ops, mic_range = mic_rng, as.mic = FALSE)
}
scale
}
#' @method plot mic
#' @importFrom graphics barplot axis mtext legend
#' @export
@@ -103,21 +184,18 @@ plot.mic <- function(x,
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1)
meet_criteria(xlab, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
x <- as.mic(x) # make sure that currently implemented MIC levels are used
if (length(colours_SIR) == 1) {
colours_SIR <- rep(colours_SIR, 3)
}
main <- gsub(" +", " ", paste0(main, collapse = " "))
x <- plot_prepare_table(x, expand = expand)
x <- plotrange_as_table(x, expand = expand)
cols_sub <- plot_colours_subtitle_guideline(
x = x,
mo = mo,
@@ -193,15 +271,13 @@ barplot.mic <- function(height,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
main <- gsub(" +", " ", paste0(main, collapse = " "))
height <- as.mic(height) # make sure that currently implemented MIC levels are used
plot(
x = height,
@@ -239,10 +315,6 @@ autoplot.mic <- function(object,
meet_criteria(title, allow_class = "character", allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1)
meet_criteria(xlab, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -254,7 +326,8 @@ autoplot.mic <- function(object,
title <- gsub(" +", " ", paste0(title, collapse = " "))
}
x <- plot_prepare_table(object, expand = expand)
object <- as.mic(object) # make sure that currently implemented MIC levels are used
x <- plotrange_as_table(object, expand = expand)
cols_sub <- plot_colours_subtitle_guideline(
x = x,
mo = mo,
@@ -290,6 +363,7 @@ autoplot.mic <- function(object,
if (any(colours_SIR %in% cols_sub$cols)) {
vals <- c(
"(S) Susceptible" = colours_SIR[1],
"(SDD) Susceptible dose-dependent" = colours_SIR[2],
"(I) Susceptible, incr. exp." = colours_SIR[2],
"(I) Intermediate" = colours_SIR[2],
"(R) Resistant" = colours_SIR[3]
@@ -316,12 +390,14 @@ autoplot.mic <- function(object,
#' @rdname plot
# will be exported using s3_register() in R/zzz.R
fortify.mic <- function(object, ...) {
object <- as.mic(object) # make sure that currently implemented MIC levels are used
stats::setNames(
as.data.frame(plot_prepare_table(object, expand = FALSE)),
as.data.frame(plotrange_as_table(object, expand = FALSE)),
c("x", "y")
)
}
#' @method plot disk
#' @export
#' @importFrom graphics barplot axis mtext legend
@@ -345,10 +421,6 @@ plot.disk <- function(x,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -358,8 +430,7 @@ plot.disk <- function(x,
}
main <- gsub(" +", " ", paste0(main, collapse = " "))
x <- plot_prepare_table(x, expand = expand)
x <- plotrange_as_table(x, expand = expand)
cols_sub <- plot_colours_subtitle_guideline(
x = x,
mo = mo,
@@ -435,10 +506,6 @@ barplot.disk <- function(height,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -481,10 +548,6 @@ autoplot.disk <- function(object,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -496,7 +559,7 @@ autoplot.disk <- function(object,
title <- gsub(" +", " ", paste0(title, collapse = " "))
}
x <- plot_prepare_table(object, expand = expand)
x <- plotrange_as_table(object, expand = expand)
cols_sub <- plot_colours_subtitle_guideline(
x = x,
mo = mo,
@@ -533,6 +596,7 @@ autoplot.disk <- function(object,
if (any(colours_SIR %in% cols_sub$cols)) {
vals <- c(
"(S) Susceptible" = colours_SIR[1],
"(SDD) Susceptible dose-dependent" = colours_SIR[2],
"(I) Susceptible, incr. exp." = colours_SIR[2],
"(I) Intermediate" = colours_SIR[2],
"(R) Resistant" = colours_SIR[3]
@@ -560,7 +624,7 @@ autoplot.disk <- function(object,
# will be exported using s3_register() in R/zzz.R
fortify.disk <- function(object, ...) {
stats::setNames(
as.data.frame(plot_prepare_table(object, expand = FALSE)),
as.data.frame(plotrange_as_table(object, expand = FALSE)),
c("x", "y")
)
}
@@ -586,14 +650,21 @@ plot.sir <- function(x,
if (!"S" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "S", n = 0, s = 0, stringsAsFactors = FALSE))
}
if (!"SDD" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "SDD", n = 0, s = 0, stringsAsFactors = FALSE))
}
if (!"I" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "I", n = 0, s = 0, stringsAsFactors = FALSE))
}
if (!"R" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "R", n = 0, s = 0, stringsAsFactors = FALSE))
}
data$x <- factor(data$x, levels = c("S", "I", "R"), ordered = TRUE)
if (!"N" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "N", n = 0, s = 0, stringsAsFactors = FALSE))
}
data <- data[!(data$n == 0 & data$x %in% c("SDD", "I", "N")), , drop = FALSE]
data$x <- factor(data$x, levels = intersect(unique(data$x), c("S", "SDD", "I", "R", "N")), ordered = TRUE)
ymax <- pm_if_else(max(data$s) > 95, 105, 100)
@@ -635,10 +706,6 @@ barplot.sir <- function(height,
meet_criteria(xlab, allow_class = "character", has_length = 1)
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1)
if ("colours_RSI" %in% names(list(...))) {
deprecation_warning(extra_msg = "The 'colours_RSI' argument has been replaced with 'colours_SIR'.")
colours_SIR <- list(...)$colours_RSI
}
meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -646,10 +713,15 @@ barplot.sir <- function(height,
if (length(colours_SIR) == 1) {
colours_SIR <- rep(colours_SIR, 3)
}
# add SDD and N to colours
colours_SIR <- c(colours_SIR[1:2], colours_SIR[2], colours_SIR[3], "#888888")
main <- gsub(" +", " ", paste0(main, collapse = " "))
x <- table(height)
x <- x[c(1, 2, 3)]
# remove missing I, SDD, and N
colours_SIR <- colours_SIR[!(names(x) %in% c("SDD", "I", "N") & x == 0)]
x <- x[!(names(x) %in% c("SDD", "I", "N") & x == 0)]
# plot it
barplot(x,
col = colours_SIR,
xlab = xlab,
@@ -688,15 +760,18 @@ autoplot.sir <- function(object,
}
df <- as.data.frame(table(object), stringsAsFactors = TRUE)
colnames(df) <- c("sir", "count")
colnames(df) <- c("x", "n")
df <- df[!(df$n == 0 & df$x %in% c("SDD", "I", "N")), , drop = FALSE]
ggplot2::ggplot(df) +
ggplot2::geom_col(ggplot2::aes(x = sir, y = count, fill = sir)) +
ggplot2::geom_col(ggplot2::aes(x = x, y = n, fill = x)) +
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
ggplot2::scale_fill_manual(
values = c(
"S" = colours_SIR[1],
"SDD" = colours_SIR[2],
"I" = colours_SIR[2],
"R" = colours_SIR[3]
"R" = colours_SIR[3],
"N" = "#888888"
),
limits = force
) +
@@ -714,22 +789,20 @@ fortify.sir <- function(object, ...) {
)
}
plot_prepare_table <- function(x, expand) {
plotrange_as_table <- function(x, expand, keep_operators = "all", mic_range = NULL) {
x <- x[!is.na(x)]
stop_if(length(x) == 0, "no observations to plot", call = FALSE)
if (is.mic(x)) {
x <- as.mic(x, keep_operators = keep_operators)
if (expand == TRUE) {
# expand range for MIC by adding factors of 2 from lowest to highest so all MICs in between also print
valid_lvls <- levels(x)
extra_range <- max(x) / 2
while (min(extra_range) / 2 > min(x)) {
extra_range <- c(min(extra_range) / 2, extra_range)
}
# expand range for MIC by adding common intermediate factors levels
extra_range <- COMMON_MIC_VALUES[COMMON_MIC_VALUES > min(x, na.rm = TRUE) & COMMON_MIC_VALUES < max(x, na.rm = TRUE)]
# remove the ones that are in 25% range of user values
extra_range <- extra_range[!vapply(FUN.VALUE = logical(1), extra_range, function(r) any(abs(r - x) / x < 0.25, na.rm = TRUE))]
nms <- extra_range
extra_range <- rep(0, length(extra_range))
names(extra_range) <- nms
x <- table(droplevels(x, as.mic = FALSE))
extra_range <- extra_range[!names(extra_range) %in% names(x) & names(extra_range) %in% valid_lvls]
extra_range <- extra_range[!names(extra_range) %in% names(x) & names(extra_range) %in% VALID_MIC_LEVELS]
x <- as.table(c(x, extra_range))
} else {
x <- table(droplevels(x, as.mic = FALSE))
@@ -751,6 +824,15 @@ plot_prepare_table <- function(x, expand) {
as.table(x)
}
ggplot2_get_from_dots <- function(arg, default, ...) {
dots <- list(...)
if (!arg %in% names(dots)) {
default
} else {
dots[[arg]]
}
}
plot_name_of_I <- function(guideline) {
if (guideline %unlike% "CLSI" && as.double(gsub("[^0-9]+", "", guideline)) >= 2019) {
# interpretation since 2019
@@ -762,6 +844,8 @@ plot_name_of_I <- function(guideline) {
}
plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_SIR, fn, language, method, breakpoint_type, include_PKPD, ...) {
stop_if(length(x) == 0, "no observations to plot", call = FALSE)
guideline <- get_guideline(guideline, AMR::clinical_breakpoints)
# store previous interpretations to backup
@@ -804,8 +888,10 @@ plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_SIR, f
cols <- character(length = length(sir))
cols[is.na(sir)] <- "#BEBEBE"
cols[sir == "S"] <- colours_SIR[1]
cols[sir == "SDD"] <- colours_SIR[2]
cols[sir == "I"] <- colours_SIR[2]
cols[sir == "R"] <- colours_SIR[3]
cols[sir == "N"] <- "#888888"
sub <- bquote(.(abname) ~ "-" ~ italic(.(moname)) ~ .(guideline_txt))
} else {
cols <- "#BEBEBE"
+17 -8
View File
@@ -48,7 +48,7 @@
#' @details
#' **Remember that you should filter your data to let it contain only first isolates!** This is needed to exclude duplicates and to reduce selection bias. Use [first_isolate()] to determine them in your data set with one of the four available algorithms.
#'
#' The function [resistance()] is equal to the function [proportion_R()]. The function [susceptibility()] is equal to the function [proportion_SI()].
#' The function [resistance()] is equal to the function [proportion_R()]. The function [susceptibility()] is equal to the function [proportion_SI()]. Since AMR v3.0, [proportion_SI()] and [proportion_I()] include dose-dependent susceptibility ('SDD').
#'
#' Use [sir_confidence_interval()] to calculate the confidence interval, which relies on [binom.test()], i.e., the Clopper-Pearson method. This function returns a vector of length 2 at default for antimicrobial *resistance*. Change the `side` argument to "left"/"min" or "right"/"max" to return a single value, and change the `ab_result` argument to e.g. `c("S", "I")` to test for antimicrobial *susceptibility*, see Examples.
#'
@@ -247,7 +247,7 @@ susceptibility <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "I"),
ab_result = c("S", "SDD", "I"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -267,7 +267,7 @@ sir_confidence_interval <- function(...,
confidence_level = 0.95,
side = "both",
collapse = FALSE) {
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = c(1, 2, 3), is_in = c("S", "I", "R"))
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = c(1:5), is_in = c("S", "SDD", "I", "R", "N"))
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE)
meet_criteria(as_percent, allow_class = "logical", has_length = 1)
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1)
@@ -285,7 +285,7 @@ sir_confidence_interval <- function(...,
)
n <- tryCatch(
sir_calc(...,
ab_result = c("S", "I", "R"),
ab_result = c("S", "SDD", "I", "R", "N"),
only_all_tested = only_all_tested,
only_count = TRUE
),
@@ -294,7 +294,7 @@ sir_confidence_interval <- function(...,
# this applies the Clopper-Pearson method
out <- stats::binom.test(x = x, n = n, conf.level = confidence_level)$conf.int
out <- set_clean_class(out, "double")
out <- set_clean_class(out, "numeric")
if (side %in% c("left", "l", "lower", "lowest", "less", "min")) {
out <- out[1]
@@ -351,9 +351,12 @@ proportion_IR <- function(...,
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE) {
if (message_not_thrown_before("proportion_IR", entire_session = TRUE)) {
message_("Note that `proportion_IR()` will also include dose-dependent susceptibility, 'SDD'. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("I", "R"),
ab_result = c("I", "SDD", "R"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -369,9 +372,12 @@ proportion_I <- function(...,
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE) {
if (message_not_thrown_before("proportion_I", entire_session = TRUE)) {
message_("Note that `proportion_I()` will also include dose-dependent susceptibility, 'SDD'. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = "I",
ab_result = c("I", "SDD"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -387,9 +393,12 @@ proportion_SI <- function(...,
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE) {
if (message_not_thrown_before("proportion_SI", entire_session = TRUE)) {
message_("Note that `proportion_SI()` will also include dose-dependent susceptibility, 'SDD'. This note will be shown once for this session.", as_note = FALSE)
}
tryCatch(
sir_calc(...,
ab_result = c("S", "I"),
ab_result = c("S", "I", "SDD"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
-4
View File
@@ -83,10 +83,6 @@ random_disk <- function(size = NULL, mo = NULL, ab = NULL, ...) {
#' @export
random_sir <- function(size = NULL, prob_SIR = c(0.33, 0.33, 0.33), ...) {
meet_criteria(size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE, allow_NULL = TRUE)
if ("prob_RSI" %in% names(list(...))) {
deprecation_warning("prob_RSI", "prob_SIR", is_function = FALSE)
prob_SIR <- list(...)$prob_RSI
}
meet_criteria(prob_SIR, allow_class = c("numeric", "integer"), has_length = 3)
if (is.null(size)) {
size <- NROW(get_current_data(arg_name = "size", call = -3))
+326 -185
View File
@@ -29,47 +29,61 @@
#' Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data
#'
#' @description Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing SIR values. This transforms the input to a new class [`sir`], which is an ordered [factor] with levels `S < I < R`.
#' @description Clean up existing SIR values, or interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI. [as.sir()] transforms the input to a new class [`sir`], which is an ordered [factor].
#'
#' Currently available **breakpoint guidelines** are EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`, and available **breakpoint types** are `r vector_and(clinical_breakpoints$type)`.
#'
#' All breakpoints used for interpretation are publicly available in the [clinical_breakpoints] data set.
#' These breakpoints are currently implemented:
#' - For **clinical microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`;
#' - For **veterinary microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`;
#' - ECOFFs (Epidemiological cut-off values): EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "ECOFF")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "ECOFF")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "ECOFF")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "ECOFF")$guideline)))`.
#'
#' All breakpoints used for interpretation are available in our [clinical_breakpoints] data set.
#' @rdname as.sir
#' @param x vector of values (for class [`mic`]: MIC values in mg/L, for class [`disk`]: a disk diffusion radius in millimetres)
#' @param mo any (vector of) text that can be coerced to valid microorganism codes with [as.mo()], can be left empty to determine it automatically
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial drug code with [as.ab()]
#' @param uti (Urinary Tract Infection) A vector with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.sir()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
#' @param mo a vector (or column name) with [character]s that can be coerced to valid microorganism codes with [as.mo()], can be left empty to determine it automatically
#' @param ab a vector (or column name) with [character]s that can be coerced to a valid antimicrobial drug code with [as.ab()]
#' @param uti (Urinary Tract Infection) a vector (or column name) with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.sir()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
#' @inheritParams first_isolate
#' @param guideline defaults to EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))` (the latest implemented EUCAST guideline in the [AMR::clinical_breakpoints] data set), but can be set with the [package option][AMR-options] [`AMR_guideline`][AMR-options]. Currently supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`), see *Details*.
#' @param conserve_capped_values a [logical] to indicate that MIC values starting with `">"` (but not `">="`) must always return "R" , and that MIC values starting with `"<"` (but not `"<="`) must always return "S"
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
#' @param include_screening a [logical] to indicate that clinical breakpoints for screening are allowed - the default is `FALSE`. Can also be set with the [package option][AMR-options] [`AMR_include_screening`][AMR-options].
#' @param include_PKPD a [logical] to indicate that PK/PD clinical breakpoints must be applied as a last resort - the default is `TRUE`. Can also be set with the [package option][AMR-options] [`AMR_include_PKPD`][AMR-options].
#' @param breakpoint_type the type of breakpoints to use, either `r vector_or(clinical_breakpoints$type)`. ECOFF stands for Epidemiological Cut-Off values. The default is `"human"`, which can also be set with the [package option][AMR-options] [`AMR_breakpoint_type`][AMR-options].
#' @param breakpoint_type the type of breakpoints to use, either `r vector_or(clinical_breakpoints$type)`. ECOFF stands for Epidemiological Cut-Off values. The default is `"human"`, which can also be set with the [package option][AMR-options] [`AMR_breakpoint_type`][AMR-options]. If `host` is set to values of veterinary species, this will automatically be set to `"animal"`.
#' @param host a vector (or column name) with [character]s to indicate the host. Only useful for veterinary breakpoints, as it requires `breakpoint_type = "animal"`. The values can be any text resembling the animal species, even in any of the `r length(LANGUAGES_SUPPORTED)` supported languages of this package. For foreign languages, be sure to set the language with [set_AMR_locale()] (though it will be automatically guessed based on the system language).
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [clinical_breakpoints] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [clinical_breakpoints] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
#' @param threshold maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*
#' @param ... for using on a [data.frame]: names of columns to apply [as.sir()] on (supports tidy selection such as `column1:column4`). Otherwise: arguments passed on to methods.
#' @details
#' *Note: The clinical breakpoints in this package were validated through and imported from [WHONET](https://whonet.org) and the public use of this `AMR` package has been endorsed by CLSI and EUCAST, please see [clinical_breakpoints] for more information.*
#' *Note: The clinical breakpoints in this package were validated through, and imported from, [WHONET](https://whonet.org). The public use of this `AMR` package has been endorsed by both CLSI and EUCAST. See [clinical_breakpoints] for more information.*
#'
#' ### How it Works
#'
#' The [as.sir()] function works in four ways:
#' The [as.sir()] function can work in four ways:
#'
#' 1. For **cleaning raw / untransformed data**. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with SIR interpretations and MIC values such as `"<0.25; S"` will be coerced to `"S"`. Combined interpretations for multiple test methods (as seen in laboratory records) such as `"S; S"` will be coerced to `"S"`, but a value like `"S; I"` will return `NA` with a warning that the input is unclear.
#' 1. For **cleaning raw / untransformed data**. The data will be cleaned to only contain valid values, namely: **S** for susceptible, **I** for intermediate or 'susceptible, increased exposure', **R** for resistant, **N** for non-interpretable, and **SDD** for susceptible dose-dependent. Each of these can be set using a [regular expression][base::regex]. Furthermore, [as.sir()] will try its best to clean with some intelligence. For example, mixed values with SIR interpretations and MIC values such as `"<0.25; S"` will be coerced to `"S"`. Combined interpretations for multiple test methods (as seen in laboratory records) such as `"S; S"` will be coerced to `"S"`, but a value like `"S; I"` will return `NA` with a warning that the input is invalid.
#'
#' 2. For **interpreting minimum inhibitory concentration (MIC) values** according to EUCAST or CLSI. You must clean your MIC values first using [as.mic()], that also gives your columns the new data class [`mic`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
#' * Using `dplyr`, SIR interpretation can be done very easily with either:
#' ```
#' ```r
#' your_data %>% mutate_if(is.mic, as.sir)
#' your_data %>% mutate(across(where(is.mic), as.sir))
#' your_data %>% mutate_if(is.mic, as.sir, ab = "column_with_antibiotics", mo = "column_with_microorganisms")
#' your_data %>% mutate_if(is.mic, as.sir, ab = c("cipro", "ampicillin", ...), mo = c("E. coli", "K. pneumoniae", ...))
#'
#' # for veterinary breakpoints, also set `host`:
#' your_data %>% mutate_if(is.mic, as.sir, host = "column_with_animal_hosts", guideline = "CLSI")
#' ```
#' * Operators like "<=" will be stripped before interpretation. When using `conserve_capped_values = TRUE`, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (`conserve_capped_values = FALSE`) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
#' * Using `dplyr`, SIR interpretation can be done very easily with either:
#' ```
#' ```r
#' your_data %>% mutate_if(is.disk, as.sir)
#' your_data %>% mutate(across(where(is.disk), as.sir))
#' your_data %>% mutate_if(is.disk, as.sir, ab = "column_with_antibiotics", mo = "column_with_microorganisms")
#' your_data %>% mutate_if(is.disk, as.sir, ab = c("cipro", "ampicillin", ...), mo = c("E. coli", "K. pneumoniae", ...))
#'
#' # for veterinary breakpoints, also set `host`:
#' your_data %>% mutate_if(is.disk, as.sir, host = "column_with_animal_hosts", guideline = "CLSI")
#' ```
#' 4. For **interpreting a complete data set**, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running `as.sir(your_data)`.
#'
@@ -77,7 +91,7 @@
#'
#' ### Supported Guidelines
#'
#' For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`).
#' For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are for **clinical microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "human")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "human")$guideline)))`, and for **veterinary microbiology**: EUCAST `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST" & type == "animal")$guideline)))` and CLSI `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`.
#'
#' Thus, the `guideline` argument must be set to e.g., ``r paste0('"', subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline[1], '"')`` or ``r paste0('"', subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline[1], '"')``. By simply using `"EUCAST"` (the default) or `"CLSI"` as input, the latest included version of that guideline will automatically be selected. You can set your own data set using the `reference_data` argument. The `guideline` argument will then be ignored.
#'
@@ -90,6 +104,13 @@
#' # or to reset:
#' options(AMR_guideline = NULL)
#' ```
#'
#' For veterinary guidelines, these might be the best options:
#'
#' ```
#' options(AMR_guideline = "CLSI")
#' options(AMR_breakpoint_type = "animal")
#' ```
#'
#' ### After Interpretation
#'
@@ -103,7 +124,7 @@
#'
#' The function [is.sir()] detects if the input contains class `sir`. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
#'
#' The function [is_sir_eligible()] returns `TRUE` when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and `FALSE` otherwise. The threshold of 5% can be set with the `threshold` argument. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
#' The function [is_sir_eligible()] returns `TRUE` when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R and/or N and/or SDD), and `FALSE` otherwise. The threshold of 5% can be set with the `threshold` argument. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
#' @section Interpretation of SIR:
#' In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (<https://www.eucast.org/newsiandr>):
#'
@@ -124,9 +145,10 @@
#' @source
#' For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:
#'
#' - **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m39/>.
#' - **M100 Performance Standard for Antimicrobial Susceptibility Testing**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m100/>.
#' - **Breakpoint tables for interpretation of MICs and zone diameters**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`, *European Committee on Antimicrobial Susceptibility Testing* (EUCAST). <https://www.eucast.org/clinical_breakpoints>.
#' - **CLSI M39: Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m39/>.
#' - **CLSI M100: Performance Standard for Antimicrobial Susceptibility Testing**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type != "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type != "animal")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m100/>.
#' - **CLSI VET01: Performance Standards for Antimicrobial Disk and Dilution Susceptibility Tests for Bacteria Isolated From Animals**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "CLSI" & type == "animal")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/veterinary-medicine/documents/vet01//>.
#' - **EUCAST Breakpoint tables for interpretation of MICs and zone diameters**, `r min(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(AMR::clinical_breakpoints, guideline %like% "EUCAST")$guideline)))`, *European Committee on Antimicrobial Susceptibility Testing* (EUCAST). <https://www.eucast.org/clinical_breakpoints>.
#' @inheritSection AMR Reference Data Publicly Available
#' @examples
#' example_isolates
@@ -173,7 +195,7 @@
#' df %>% mutate(across(AMP:TOB, as.sir))
#'
#' df %>%
#' mutate_at(vars(AMP:TOB), as.sir, mo = .$microorganism)
#' mutate_at(vars(AMP:TOB), as.sir, mo = "microorganism")
#'
#' # to include information about urinary tract infections (UTI)
#' data.frame(
@@ -196,7 +218,7 @@
#'
#' # For CLEANING existing SIR values ------------------------------------
#'
#' as.sir(c("S", "I", "R", "A", "B", "C"))
#' as.sir(c("S", "SDD", "I", "R", "N", "A", "B", "C"))
#' as.sir("<= 0.002; S") # will return "S"
#' sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
#' is.sir(sir_data)
@@ -224,12 +246,18 @@ as.sir <- function(x, ...) {
UseMethod("as.sir")
}
as_sir_structure <- function(x) {
structure(factor(as.character(unlist(unname(x))),
levels = c("S", "SDD", "I", "R", "N"),
ordered = TRUE),
class = c("sir", "ordered", "factor"))
}
#' @rdname as.sir
#' @details `NA_sir_` is a missing value of the new `sir` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_sir_ <- set_clean_class(factor(NA_character_, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("sir", "ordered", "factor")
)
NA_sir_ <- as_sir_structure(NA_character_)
#' @rdname as.sir
#' @export
@@ -237,12 +265,7 @@ is.sir <- function(x) {
if (inherits(x, "data.frame")) {
unname(vapply(FUN.VALUE = logical(1), x, is.sir))
} else {
rsi <- inherits(x, "rsi")
sir <- inherits(x, "sir")
if (isTRUE(rsi) && message_not_thrown_before("is.sir-rsi")) {
deprecation_warning(extra_msg = "The 'rsi' class has been replaced with 'sir'. Transform your 'rsi' columns to 'sir' with `as.sir()`, e.g.:\n your_data %>% mutate_if(is.rsi, as.sir)")
}
isTRUE(rsi) || isTRUE(sir)
isTRUE(inherits(x, "sir"))
}
}
@@ -272,9 +295,9 @@ is_sir_eligible <- function(x, threshold = 0.05) {
%in% class(x))) {
# no transformation needed
return(FALSE)
} else if (all(x %in% c("S", "I", "R", NA)) & !all(is.na(x))) {
} else if (all(x %in% c("S", "SDD", "I", "R", "N", NA)) & !all(is.na(x))) {
return(TRUE)
} else if (!any(c("S", "I", "R") %in% x, na.rm = TRUE) & !all(is.na(x))) {
} else if (!any(c("S", "SDD", "I", "R", "N") %in% x, na.rm = TRUE) & !all(is.na(x))) {
return(FALSE)
} else {
x <- x[!is.na(x) & !is.null(x) & !x %in% c("", "-", "NULL")]
@@ -302,17 +325,19 @@ is_sir_eligible <- function(x, threshold = 0.05) {
}
}
#' @rdname as.sir
#' @export
#' @param S,I,R,N,SDD a case-independent [regular expression][base::regex] to translate input to this result. This regular expression will be run *after* all non-letters are removed from the input.
# extra param: warn (logical, to never throw a warning)
as.sir.default <- function(x, ...) {
as.sir.default <- function(x, S = "^(S|U)+$", I = "^(I|H)+$", R = "^(R)+$", N = "^(N|V)+$", SDD = "^(SDD|D)+$", ...) {
if (inherits(x, "sir")) {
return(x)
return(as_sir_structure(x))
}
x.bak <- x
x <- as.character(x) # this is needed to prevent the vctrs pkg from throwing an error
if (inherits(x.bak, c("integer", "numeric", "double")) && all(x %in% c(1:3, NA))) {
if (inherits(x.bak, c("numeric", "integer")) && all(x %in% c(1:3, NA))) {
# support haven package for importing e.g., from SPSS - it adds the 'labels' attribute
lbls <- attributes(x.bak)$labels
if (!is.null(lbls) && all(c("S", "I", "R") %in% names(lbls)) && all(c(1:3) %in% lbls)) {
@@ -324,12 +349,12 @@ as.sir.default <- function(x, ...) {
x[x.bak == 2] <- "I"
x[x.bak == 3] <- "R"
}
} else if (inherits(x.bak, "character") && all(x %in% c("1", "2", "3", "S", "I", "R", NA_character_))) {
} else if (inherits(x.bak, "character") && all(x %in% c("1", "2", "3", c("S", "SDD", "I", "R", "N"), NA_character_))) {
x[x.bak == "1"] <- "S"
x[x.bak == "2"] <- "I"
x[x.bak == "3"] <- "R"
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "I", "R")) && !all(x %in% c("S", "I", "R", NA))) {
if (all(x %unlike% "(R|S|I)", na.rm = TRUE)) {
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "SDD", "I", "R", "N")) && !all(x %in% c("S", "SDD", "I", "R", "N", NA))) {
if (all(x %unlike% "(S|I|R)", na.rm = TRUE)) {
# check if they are actually MICs or disks
if (all_valid_mics(x)) {
warning_("in `as.sir()`: the input seems to contain MIC values. You can transform them with `as.mic()` before running `as.sir()` to interpret them.")
@@ -365,23 +390,14 @@ as.sir.default <- function(x, ...) {
x[x %like% "([^a-z]|^)res(is(tant)?)?"] <- "R"
x[x %like% "([^a-z]|^)sus(cep(tible)?)?"] <- "S"
x[x %like% "([^a-z]|^)int(er(mediate)?)?|incr.*exp"] <- "I"
# remove other invalid characters
# set to capitals
x <- toupper(x)
x <- gsub("[^A-Z]+", "", x, perl = TRUE)
# CLSI uses SDD for "susceptible dose-dependent"
x <- gsub("SDD", "I", x, fixed = TRUE)
# some labs now report "H" instead of "I" to not interfere with EUCAST prior to 2019
x <- gsub("H", "I", x, fixed = TRUE)
# MIPS uses D for Dose-dependent (which is I, but it will throw a note)
x <- gsub("D", "I", x, fixed = TRUE)
# MIPS uses U for "susceptible urine"
x <- gsub("U", "S", x, fixed = TRUE)
# in cases of "S;S" keep S, but in case of "S;I" make it NA
x <- gsub("^S+$", "S", x)
x <- gsub("^I+$", "I", x)
x <- gsub("^R+$", "R", x)
x[!x %in% c("S", "I", "R")] <- NA_character_
# apply regexes set by user
x[x %like% S] <- "S"
x[x %like% I] <- "I"
x[x %like% R] <- "R"
x[x %like% N] <- "N"
x[x %like% SDD] <- "SDD"
x[!x %in% c("S", "SDD", "I", "R", "N")] <- NA_character_
na_after <- length(x[is.na(x) | x == ""])
if (!isFALSE(list(...)$warn)) { # so as.sir(..., warn = FALSE) will never throw a warning
@@ -401,24 +417,10 @@ as.sir.default <- function(x, ...) {
call = FALSE
)
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "U") && message_not_thrown_before("as.sir", "U")) {
warning_("in `as.sir()`: 'U' was interpreted as 'S', following some laboratory systems")
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "D") && message_not_thrown_before("as.sir", "D")) {
warning_("in `as.sir()`: 'D' (dose-dependent) was interpreted as 'I', following some laboratory systems")
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "SDD") && message_not_thrown_before("as.sir", "SDD")) {
warning_("in `as.sir()`: 'SDD' (susceptible dose-dependent, coined by CLSI) was interpreted as 'I' to comply with EUCAST's 'I'")
}
if (any(toupper(x.bak[!is.na(x.bak)]) == "H") && message_not_thrown_before("as.sir", "H")) {
warning_("in `as.sir()`: 'H' was interpreted as 'I', following some laboratory systems")
}
}
}
set_clean_class(factor(x, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("sir", "ordered", "factor")
)
as_sir_structure(x)
}
#' @rdname as.sir
@@ -434,6 +436,7 @@ as.sir.mic <- function(x,
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL,
...) {
as_sir_method(
method_short = "mic",
@@ -449,6 +452,7 @@ as.sir.mic <- function(x,
include_screening = include_screening,
include_PKPD = include_PKPD,
breakpoint_type = breakpoint_type,
host = host,
...
)
}
@@ -465,6 +469,7 @@ as.sir.disk <- function(x,
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL,
...) {
as_sir_method(
method_short = "disk",
@@ -480,6 +485,7 @@ as.sir.disk <- function(x,
include_screening = include_screening,
include_PKPD = include_PKPD,
breakpoint_type = breakpoint_type,
host = NULL,
...
)
}
@@ -496,7 +502,8 @@ as.sir.data.frame <- function(x,
reference_data = AMR::clinical_breakpoints,
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human")) {
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL) {
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1)
@@ -507,7 +514,7 @@ as.sir.data.frame <- function(x,
meet_criteria(include_screening, allow_class = "logical", has_length = 1)
meet_criteria(include_PKPD, allow_class = "logical", has_length = 1)
meet_criteria(breakpoint_type, allow_class = "character", is_in = reference_data$type, has_length = 1)
meet_criteria(host, allow_class = c("character", "factor"), allow_NULL = TRUE, allow_NA = TRUE)
x.bak <- x
for (i in seq_len(ncol(x))) {
# don't keep factors, overwriting them is hard
@@ -521,15 +528,26 @@ as.sir.data.frame <- function(x,
if (is.null(col_mo)) {
col_mo <- search_type_in_df(x = x, type = "mo", info = FALSE)
}
# -- host
if (breakpoint_type == "animal") {
if (is.null(host)) {
host <- search_type_in_df(x = x, type = "host", add_col_prefix = FALSE)
} else if (length(host) == 1 && as.character(host) %in% colnames(x)) {
host <- x[[as.character(host)]]
}
} else {
host <- breakpoint_type
}
# -- UTIs
col_uti <- uti
if (is.null(col_uti)) {
col_uti <- search_type_in_df(x = x, type = "uti")
col_uti <- search_type_in_df(x = x, type = "uti", add_col_prefix = FALSE)
}
if (!is.null(col_uti)) {
if (is.logical(col_uti)) {
# already a [logical] vector as input
# already a logical vector as input
if (length(col_uti) == 1) {
uti <- rep(col_uti, NROW(x))
} else {
@@ -639,6 +657,7 @@ as.sir.data.frame <- function(x,
include_screening = include_screening,
include_PKPD = include_PKPD,
breakpoint_type = breakpoint_type,
host = host,
is_data.frame = TRUE
)
} else if (types[i] == "disk") {
@@ -657,16 +676,17 @@ as.sir.data.frame <- function(x,
include_screening = include_screening,
include_PKPD = include_PKPD,
breakpoint_type = breakpoint_type,
host = host,
is_data.frame = TRUE
)
} else if (types[i] == "sir") {
show_message <- FALSE
ab <- ab_cols[i]
ab_coerced <- suppressWarnings(as.ab(ab))
if (!all(x[, ab_cols[i], drop = TRUE] %in% c("S", "I", "R", NA), na.rm = TRUE)) {
if (!all(x[, ab_cols[i], drop = TRUE] %in% c("S", "SDD", "I", "R", "N", NA), na.rm = TRUE)) {
show_message <- TRUE
# only print message if values are not already clean
message_("=> Cleaning values in column '", font_bold(ab), "' (",
message_("Cleaning values in column '", font_bold(ab), "' (",
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
ab_name(ab_coerced, tolower = TRUE), ")... ",
appendLF = FALSE,
@@ -675,7 +695,7 @@ as.sir.data.frame <- function(x,
} else if (!is.sir(x.bak[, ab_cols[i], drop = TRUE])) {
show_message <- TRUE
# only print message if class not already set
message_("=> Assigning class 'sir' to already clean column '", font_bold(ab), "' (",
message_("Assigning class 'sir' to already clean column '", font_bold(ab), "' (",
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
ab_name(ab_coerced, tolower = TRUE, language = NULL), ")... ",
appendLF = FALSE,
@@ -684,7 +704,7 @@ as.sir.data.frame <- function(x,
}
x[, ab_cols[i]] <- as.sir.default(x = as.character(x[, ab_cols[i], drop = TRUE]))
if (show_message == TRUE) {
message_(" OK.", add_fn = list(font_green), as_note = FALSE)
message(font_green_bg(" OK "))
}
}
}
@@ -714,6 +734,23 @@ get_guideline <- function(guideline, reference_data) {
guideline_param
}
convert_host <- function(x, lang = get_AMR_locale()) {
x <- trimws2(tolower(as.character(x)))
x_out <- rep(NA_character_, length(x))
x_out[trimws2(tolower(x)) == "human"] <- "human"
x_out[trimws2(tolower(x)) == "ecoff"] <- "ecoff"
# this order is based on: clinical_breakpoints |> filter(type == "animal") |> count(host, sort = TRUE)
x_out[is.na(x_out) & (x %like% "dog|canine" | x %like% translate_AMR("dog|dogs|canine", lang))] <- "dogs"
x_out[is.na(x_out) & (x %like% "cattle|bovine" | x %like% translate_AMR("cattle|bovine", lang))] <- "cattle"
x_out[is.na(x_out) & (x %like% "swine|suida(e)?" | x %like% translate_AMR("swine|swines", lang))] <- "swine"
x_out[is.na(x_out) & (x %like% "cat|feline" | x %like% translate_AMR("cat|cats|feline", lang))] <- "cats"
x_out[is.na(x_out) & (x %like% "horse|equine" | x %like% translate_AMR("horse|horses|equine", lang))] <- "horse"
x_out[is.na(x_out) & (x %like% "aqua|fish" | x %like% translate_AMR("aquatic|fish", lang))] <- "aquatic"
x_out[is.na(x_out) & (x %like% "bird|chicken|poultry|avia" | x %like% translate_AMR("bird|birds|poultry", lang))] <- "poultry"
x_out[x_out == "ecoff"] <- "ECOFF"
x_out
}
as_sir_method <- function(method_short,
method_long,
x,
@@ -727,12 +764,13 @@ as_sir_method <- function(method_short,
include_screening,
include_PKPD,
breakpoint_type,
host,
...) {
meet_criteria(x, allow_NA = TRUE, .call_depth = -2)
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE, .call_depth = -2)
meet_criteria(ab, allow_class = c("ab", "character"), has_length = 1, .call_depth = -2)
meet_criteria(mo, allow_class = c("mo", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, .call_depth = -2)
meet_criteria(ab, allow_class = c("ab", "character"), has_length = c(1, length(x)), .call_depth = -2)
meet_criteria(guideline, allow_class = "character", has_length = 1, .call_depth = -2)
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
meet_criteria(uti, allow_class = c("logical", "character"), has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1, .call_depth = -2)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
@@ -740,44 +778,88 @@ as_sir_method <- function(method_short,
meet_criteria(include_PKPD, allow_class = "logical", has_length = 1, .call_depth = -2)
check_reference_data(reference_data, .call_depth = -2)
meet_criteria(breakpoint_type, allow_class = "character", is_in = reference_data$type, has_length = 1, .call_depth = -2)
meet_criteria(host, allow_class = c("character", "factor"), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
# backward compatibilty
dots <- list(...)
dots <- dots[which(!names(dots) %in% c("warn", "mo.bak", "is_data.frame"))]
if (length(dots) != 0) {
warning_("These arguments in `as.sir()` are no longer used: ", vector_and(names(dots), quotes = "`"), ".", call = FALSE)
}
guideline_coerced <- get_guideline(guideline, reference_data)
if (breakpoint_type == "animal") {
if (is.null(host)) {
host <- AMR_env$host_preferred_order[1]
if (message_not_thrown_before("as.sir", "host_missing")) {
message_("Animal hosts not set in `host`, assuming `host = \"", host, "\"`, since these have the highest breakpoint availability.\n\n")
}
}
} else {
if (!is.null(host) && !all(toupper(as.character(host)) %in% c("HUMAN", "ECOFF"))) {
if (message_not_thrown_before("as.sir", "assumed_breakpoint_animal")) {
message_("Assuming `breakpoint_type = \"animal\"`, since `host` is set.", ifelse(guideline_coerced %like% "EUCAST", " Do you also need to set `guideline = \"CLSI\"`?", ""), "\n\n")
}
breakpoint_type <- "animal"
} else {
host <- breakpoint_type
}
}
host <- convert_host(host)
if (message_not_thrown_before("as.sir", "sir_interpretation_history")) {
message_("Run `sir_interpretation_history()` afterwards to retrieve a logbook with all the details of the breakpoint interpretations. Note that some microorganisms might not have breakpoints for each antimicrobial drug in ", guideline_coerced, ".\n\n")
message_("Run `sir_interpretation_history()` afterwards to retrieve a logbook with all the details of the breakpoint interpretations. Note that some ", ifelse(breakpoint_type == "animal", "animal hosts and ", ""), "microorganisms might not have breakpoints for each antimicrobial drug in ", guideline_coerced, ".\n\n")
}
if (breakpoint_type == "animal" && message_not_thrown_before("as.sir", "host_preferred_order")) {
message_("Please note that in the absence of specific veterinary breakpoints for certain animal hosts, breakpoints for dogs, cattle, swine, cats, horse, aquatic, and poultry, in that order, are used as substitutes.\n\n")
}
# for dplyr's across()
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_column_dplyr) && tryCatch(is.data.frame(get_current_data("ab", call = 0)), error = function(e) FALSE)) {
# try to get current column, which will only be available when in across()
ab <- tryCatch(cur_column_dplyr(),
error = function(e) ab
)
}
current_df <- tryCatch(get_current_data(NA, 0), error = function(e) NULL)
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
tryCatch(
{
df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
mo <- NULL
try(
{
mo <- suppressMessages(search_type_in_df(df, "mo"))
},
silent = TRUE
)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- df[, mo, drop = TRUE]
# get ab
if (!is.null(current_df) && length(ab) == 1 && ab %in% colnames(current_df) && any(current_df[[ab]] %like% "[A-Z]", na.rm = TRUE)) {
ab <- current_df[[ab]]
} else if (length(ab) != length(x)) {
# for dplyr's across()
cur_column_dplyr <- import_fn("cur_column", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_column_dplyr) && is.data.frame(current_df)) {
# try to get current column, which will only be available when in across()
ab <- tryCatch(cur_column_dplyr(),
error = function(e) ab
)
}
}
# get mo
if (!is.null(current_df) && length(mo) == 1 && mo %in% colnames(current_df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- current_df[[mo]]
} else if (length(mo) != length(x)) {
mo_var_found <- ""
if (is.null(mo)) {
tryCatch(
{
df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
mo <- NULL
try(
{
mo <- suppressMessages(search_type_in_df(df, "mo", add_col_prefix = FALSE))
},
silent = TRUE
)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
mo_var_found <- paste0(" based on column '", font_bold(mo), "'")
mo <- df[, mo, drop = TRUE]
}
},
error = function(e) {
mo <- NULL
}
},
error = function(e) {
mo <- NULL
}
)
)
}
} else {
mo_var_found <- ""
}
if (is.null(mo)) {
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class 'mo' found). See ?as.sir.\n\n",
@@ -786,6 +868,32 @@ as_sir_method <- function(method_short,
call = FALSE
)
}
# get uti
if (!is.null(current_df) && length(uti) == 1 && uti %in% colnames(current_df)) {
uti <- current_df[[uti]]
} else if (length(uti) != length(x)) {
if (is.null(uti)) {
tryCatch(
{
df <- get_current_data(arg_name = "uti", call = -3) # will return an error if not found
uti <- NULL
try(
{
uti <- suppressMessages(search_type_in_df(df, "uti", add_col_prefix = FALSE))
},
silent = TRUE
)
if (!is.null(df) && !is.null(uti) && is.data.frame(df)) {
uti <- df[, uti, drop = TRUE]
}
},
error = function(e) {
uti <- NULL
}
)
}
}
if (length(ab) == 1 && ab %like% paste0("as.", method_short)) {
stop_("No unambiguous name was supplied about the antibiotic (argument `ab`). See ?as.sir.", call = FALSE)
@@ -800,9 +908,9 @@ as_sir_method <- function(method_short,
}
# be sure to take current taxonomy, as the 'clinical_breakpoints' data set only contains current taxonomy
mo <- suppressWarnings(suppressMessages(as.mo(mo, keep_synonyms = FALSE, info = FALSE)))
if (is.na(ab)) {
message_("Returning NAs for unknown antibiotic: '", font_bold(ab.bak),
"'. Rename this column to a valid name or code, and check the output with `as.ab()`.",
if (all(is.na(ab))) {
message_("Returning NAs for unknown antibiotic: ", vector_and(ab.bak, sort = FALSE, quotes = TRUE),
". Rename this column to a valid name or code, and check the output with `as.ab()`.",
add_fn = font_red,
as_note = FALSE
)
@@ -811,44 +919,44 @@ as_sir_method <- function(method_short,
if (length(mo) == 1) {
mo <- rep(mo, length(x))
}
if (length(ab) == 1) {
ab <- rep(ab, length(x))
}
if (length(host) == 1) {
host <- rep(host, length(x))
}
if (is.null(uti)) {
uti <- NA
}
if (length(uti) == 1) {
uti <- rep(uti, length(x))
}
uti[is.na(uti)] <- FALSE
if (isTRUE(add_intrinsic_resistance) && guideline_coerced %unlike% "EUCAST") {
if (message_not_thrown_before("as.sir", "intrinsic")) {
warning_("in `as.sir()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.")
}
}
agent_formatted <- paste0("'", font_bold(ab.bak), "'")
agent_formatted <- paste0("'", font_bold(ab.bak, collapse = NULL), "'")
agent_name <- ab_name(ab, tolower = TRUE, language = NULL)
if (generalise_antibiotic_name(ab.bak) == generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(
agent_formatted,
" (", ab, ")"
)
} else if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
agent_formatted <- paste0(
agent_formatted,
" (", ifelse(ab.bak == ab, "",
paste0(ab, ", ")
), agent_name, ")"
)
}
# this intro text will also be printed in the progress bar in the `progress` package is installed
same_ab <- generalise_antibiotic_name(ab) == generalise_antibiotic_name(agent_name)
same_ab.bak <- generalise_antibiotic_name(ab.bak) == generalise_antibiotic_name(agent_name)
agent_formatted[same_ab.bak] <- paste0(agent_formatted[same_ab.bak], " (", ab[same_ab.bak], ")")
agent_formatted[!same_ab.bak & !same_ab] <- paste0(agent_formatted[!same_ab.bak & !same_ab],
" (", ifelse(ab.bak[!same_ab.bak & !same_ab] == ab[!same_ab.bak & !same_ab],
"",
paste0(ab[!same_ab.bak & !same_ab], ", ")),
agent_name[!same_ab.bak & !same_ab],
")")
# this intro text will also be printed in the progress bar if the `progress` package is installed
intro_txt <- paste0("Interpreting ", method_long, ": ", ifelse(isTRUE(list(...)$is_data.frame), "column ", ""),
agent_formatted,
ifelse(length(unique(agent_formatted)) == 1, unique(agent_formatted), paste0("for ", vector_and(ab, quotes = FALSE, sort = FALSE))),
mo_var_found,
ifelse(identical(reference_data, AMR::clinical_breakpoints),
paste0(", ", font_bold(guideline_coerced)),
""),
"... ")
message_(intro_txt, appendLF = FALSE, as_note = FALSE)
msg_note <- function(messages) {
messages <- unique(messages)
@@ -865,22 +973,6 @@ as_sir_method <- function(method_short,
metadata_mo <- get_mo_uncertainties()
df <- data.frame(
values = x,
mo = mo,
result = NA_sir_,
uti = uti,
stringsAsFactors = FALSE
)
if (method == "mic") {
# when as.sir.mic is called directly
df$values <- as.mic(df$values)
} else if (method == "disk") {
# when as.sir.disk is called directly
df$values <- as.disk(df$values)
}
df_unique <- unique(df[ , c("mo", "uti"), drop = FALSE])
rise_warning <- FALSE
rise_note <- FALSE
method_coerced <- toupper(method)
@@ -888,20 +980,41 @@ as_sir_method <- function(method_short,
if (identical(reference_data, AMR::clinical_breakpoints)) {
breakpoints <- reference_data %pm>%
subset(guideline == guideline_coerced & method == method_coerced & ab == ab_coerced)
if (ab_coerced == "AMX" && nrow(breakpoints) == 0) {
ab_coerced <- "AMP"
subset(guideline == guideline_coerced & method == method_coerced & ab %in% ab_coerced)
if (any(ab_coerced == "AMX") && nrow(breakpoints[breakpoints$ab == "AMX", , drop = FALSE]) == 0) {
ab_coerced[ab_coerced == "AMX"] <- "AMP"
breakpoints <- reference_data %pm>%
subset(guideline == guideline_coerced & method == method_coerced & ab == ab_coerced)
subset(guideline == guideline_coerced & method == method_coerced & ab %in% ab_coerced)
}
} else {
breakpoints <- reference_data %pm>%
subset(method == method_coerced & ab == ab_coerced)
subset(method == method_coerced & ab %in% ab_coerced)
}
# create the unique data frame to be filled to save time
df <- data.frame(
values = x,
mo = mo,
ab = ab,
result = NA_sir_,
uti = uti,
host = host,
stringsAsFactors = FALSE
)
if (method == "mic") {
# when as.sir.mic is called directly
df$values <- as.mic(df$values)
} else if (method == "disk") {
# when as.sir.disk is called directly
df$values <- as.disk(df$values)
}
df_unique <- unique(df[ , c("mo", "ab", "uti", "host"), drop = FALSE])
# get all breakpoints
breakpoints <- breakpoints %pm>%
subset(type == breakpoint_type)
if (isFALSE(include_screening)) {
# remove screening rules from the breakpoints table
breakpoints <- breakpoints %pm>%
@@ -918,7 +1031,7 @@ as_sir_method <- function(method_short,
# apparently no breakpoints found
message(
paste0(font_rose_bg(" WARNING "), "\n"),
font_black(paste0(" ", AMR_env$bullet_icon, " No ", method_coerced, " breakpoints available for ",
font_black(paste0(" ", AMR_env$bullet_icon, " No ", guideline_coerced, " ", method_coerced, " breakpoints available for ",
suppressMessages(suppressWarnings(ab_name(ab_coerced, language = NULL, tolower = TRUE))),
" (", ab_coerced, ").")))
@@ -931,20 +1044,26 @@ as_sir_method <- function(method_short,
add_intrinsic_resistance_to_AMR_env()
}
if (nrow(df_unique) < 10) {
# only print intro under 10 items, otherwise progressbar will print this and then it will be printed double
message_(intro_txt, appendLF = FALSE, as_note = FALSE)
}
p <- progress_ticker(n = nrow(df_unique), n_min = 10, title = font_blue(intro_txt), only_bar_percent = TRUE)
has_progress_bar <- !is.null(import_fn("progress_bar", "progress", error_on_fail = FALSE)) && nrow(df_unique) >= 10
on.exit(close(p))
# run the rules
# run the rules (df_unique is a row combination per mo/ab/uti/host)
for (i in seq_len(nrow(df_unique))) {
p$tick()
mo_current <- df_unique[i, "mo", drop = TRUE]
ab_current <- df_unique[i, "ab", drop = TRUE]
host_current <- df_unique[i, "host", drop = TRUE]
uti_current <- df_unique[i, "uti", drop = TRUE]
if (is.na(uti_current)) {
if (isFALSE(uti_current)) {
# no preference, so no filter on UTIs
rows <- which(df$mo == mo_current)
rows <- which(df$mo == mo_current & df$ab == ab_current & df$host == host_current)
} else {
rows <- which(df$mo == mo_current & df$uti == uti_current)
rows <- which(df$mo == mo_current & df$ab == ab_current & df$host == host_current & df$uti == uti_current)
}
values <- df[rows, "values", drop = TRUE]
new_sir <- rep(NA_sir_, length(rows))
@@ -966,39 +1085,61 @@ as_sir_method <- function(method_short,
# formatted for notes
mo_formatted <- mo_current_name
if (!mo_current_rank %in% c("kingdom", "phylum", "class", "order")) {
mo_formatted <- font_italic(mo_formatted)
mo_formatted <- font_italic(mo_formatted, collapse = NULL)
}
ab_formatted <- paste0(
suppressMessages(suppressWarnings(ab_name(ab_coerced, language = NULL, tolower = TRUE))),
" (", ab_coerced, ")"
suppressMessages(suppressWarnings(ab_name(ab_current, language = NULL, tolower = TRUE))),
" (", ab_current, ")"
)
# gather all available breakpoints for current MO and sort on taxonomic rank
# (this will prefer species breakpoints over order breakpoints)
# gather all available breakpoints for current MO
breakpoints_current <- breakpoints %pm>%
subset(ab == ab_current) %pm>%
subset(mo %in% c(
mo_current, mo_current_genus, mo_current_family,
mo_current_order, mo_current_class,
mo_current_species_group,
mo_current_other
))
if (is.na(unique(uti_current))) {
# set the host index according to most available breakpoints (see R/zzz.R where this is set in the pkg environment)
breakpoints_current$host_index <- match(breakpoints_current$host, c("human", "ECOFF", AMR_env$host_preferred_order))
# sort on host and taxonomic rank
# (this will e.g. prefer 'species' breakpoints over 'order' breakpoints)
if (all(uti_current == FALSE, na.rm = TRUE)) {
breakpoints_current <- breakpoints_current %pm>%
# this will put UTI = FALSE first, then UTI = TRUE, then UTI = NA
pm_arrange(rank_index, uti) # 'uti' is a column in data set 'clinical_breakpoints'
} else if (unique(uti_current) == TRUE) {
# this will put UTI = FALSE first, then UTI = NA, then UTI = TRUE
pm_mutate(uti_index = ifelse(uti == FALSE, 1,
ifelse(is.na(uti), 2,
3))) %pm>%
# be as specific as possible (i.e. prefer species over genus):
pm_arrange(host_index, rank_index, uti_index)
} else if (all(uti_current == TRUE, na.rm = TRUE)) {
breakpoints_current <- breakpoints_current %pm>%
subset(uti == TRUE) %pm>%
# be as specific as possible (i.e. prefer species over genus):
pm_arrange(rank_index)
} else if (unique(uti_current) == FALSE) {
breakpoints_current <- breakpoints_current %pm>%
subset(uti == FALSE) %pm>%
# be as specific as possible (i.e. prefer species over genus):
pm_arrange(rank_index)
pm_arrange(host_index, rank_index)
}
if (NROW(breakpoints_current) == 0) {
# no note about missing breakpoints - it's already in the header before the interpretation starts
next
}
# veterinary host check
host_current <- unique(df_unique[i, "host", drop = TRUE])[1]
breakpoints_current$host_match <- breakpoints_current$host == host_current
if (breakpoint_type == "animal") {
if (any(breakpoints_current$host_match == TRUE, na.rm = TRUE)) {
breakpoints_current <- breakpoints_current %pm>%
subset(host_match == TRUE)
} else {
# no breakpoint found for this host, so sort on mostly available guidelines
msgs <- c(msgs, paste0("No ", guideline_coerced, " breakpoints for ", font_bold(host_current), " available for ", ab_formatted, " in ", mo_formatted, " - using ", font_bold(breakpoints_current$host[1]), " breakpoints instead."))
}
}
# throw notes for different body sites
site <- breakpoints_current[1L, "site", drop = FALSE] # this is the one we'll take
if (is.na(site)) {
@@ -1012,15 +1153,12 @@ as_sir_method <- function(method_short,
rise_warning <- TRUE
} else if (nrow(breakpoints_current) > 1 && length(unique(breakpoints_current$site)) > 1 && any(is.na(uti_current)) && all(c(TRUE, FALSE) %in% breakpoints_current$uti, na.rm = TRUE) && message_not_thrown_before("as.sir", "siteUTI", mo_current, ab_coerced)) {
# both UTI and Non-UTI breakpoints available
msgs <- c(msgs, paste0("Breakpoints for UTI ", font_underline("and"), " non-UTI available for ", ab_formatted, " in ", mo_formatted, " - assuming ", site, ". Use argument `uti` to set which isolates are from urine. See `?as.sir`."))
msgs <- c(msgs, paste0("Breakpoints for UTI ", font_bold("and"), " non-UTI available for ", ab_formatted, " in ", mo_formatted, " - assuming ", site, ". Use argument `uti` to set which isolates are from urine. See `?as.sir`."))
breakpoints_current <- breakpoints_current %pm>%
pm_filter(uti == FALSE)
} else if (nrow(breakpoints_current) > 1 && length(unique(breakpoints_current$site)) > 1 && all(breakpoints_current$uti == FALSE, na.rm = TRUE) && message_not_thrown_before("as.sir", "siteOther", mo_current, ab_coerced)) {
# breakpoints for multiple body sites available
msgs <- c(msgs, paste0("Multiple breakpoints available for ", ab_formatted, " in ", mo_formatted, " - assuming ", site, "."))
} else if (nrow(breakpoints_current) == 0) {
# # do not note - it's already in the header before the interpretation starts
next
}
# first check if mo is intrinsic resistant
@@ -1072,15 +1210,16 @@ as_sir_method <- function(method_short,
data.frame(
datetime = rep(Sys.time(), length(rows)),
index = rows,
ab_user = rep(ab.bak, length(rows)),
ab_user = rep(ab.bak[match(ab_current, df$ab)][1], length(rows)),
mo_user = rep(mo.bak[match(mo_current, df$mo)][1], length(rows)),
ab = rep(ab_coerced, length(rows)),
ab = rep(ab_current, length(rows)),
mo = rep(breakpoints_current[, "mo", drop = TRUE], length(rows)),
input = as.double(values),
outcome = as.sir(new_sir),
method = rep(method_coerced, length(rows)),
breakpoint_S_R = rep(paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE]), length(rows)),
guideline = rep(guideline_coerced, length(rows)),
host = rep(breakpoints_current[, "host", drop = TRUE], length(rows)),
ref_table = rep(breakpoints_current[, "ref_tbl", drop = TRUE], length(rows)),
uti = rep(breakpoints_current[, "uti", drop = TRUE], length(rows)),
stringsAsFactors = FALSE
@@ -1145,8 +1284,10 @@ pillar_shaft.sir <- function(x, ...) {
# colours will anyway not work when has_colour() == FALSE,
# but then the indentation should also not be applied
out[is.na(x)] <- font_grey(" NA")
out[x == "N"] <- font_grey_bg(" N ")
out[x == "S"] <- font_green_bg(" S ")
out[x == "I"] <- font_orange_bg(" I ")
out[x == "SDD"] <- font_orange_bg(" SDD ")
if (is_dark()) {
out[x == "R"] <- font_red_bg(" R ")
} else {
+24 -9
View File
@@ -41,7 +41,7 @@ sir_calc <- function(...,
as_percent = FALSE,
only_all_tested = FALSE,
only_count = FALSE) {
meet_criteria(ab_result, allow_class = c("character", "numeric", "integer"), has_length = c(1, 2, 3))
meet_criteria(ab_result, allow_class = c("character", "numeric", "integer"), has_length = c(1:5))
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE)
meet_criteria(as_percent, allow_class = "logical", has_length = 1)
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1)
@@ -135,13 +135,20 @@ sir_calc <- function(...,
x_transposed <- as.list(as.data.frame(t(x), stringsAsFactors = FALSE))
if (isTRUE(only_all_tested)) {
get_integers <- function(x) {
ints <- rep(NA_integer_, length(x))
ints[x == "S"] <- 1L
ints[x %in% c("SDD", "I")] <- 2L
ints[x == "R"] <- 3L
ints
}
# no NAs in any column
y <- apply(
X = as.data.frame(lapply(x, as.integer), stringsAsFactors = FALSE),
X = as.data.frame(lapply(x, get_integers), stringsAsFactors = FALSE),
MARGIN = 1,
FUN = min
)
numerator <- sum(as.integer(y) %in% as.integer(ab_result), na.rm = TRUE)
numerator <- sum(!is.na(y) & y %in% get_integers(ab_result), na.rm = TRUE)
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(anyNA(y))))
} else {
# may contain NAs in any column
@@ -223,7 +230,7 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
combine_SI = TRUE,
confidence_level = 0.95) {
meet_criteria(type, is_in = c("proportion", "count", "both"), has_length = 1)
meet_criteria(data, allow_class = "data.frame", contains_column_class = c("sir", "rsi"))
meet_criteria(data, allow_class = "data.frame", contains_column_class = "sir")
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
language <- validate_language(language)
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE)
@@ -249,7 +256,13 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
for (i in seq_len(ncol(data))) {
if (is.sir(data[, i, drop = TRUE])) {
data[, i] <- as.character(data[, i, drop = TRUE])
data[, i] <- gsub("(I|S)", "SI", data[, i, drop = TRUE])
if ("SDD" %in% data[, i, drop = TRUE]) {
if (message_not_thrown_before("sir_calc_df", combine_SI, entire_session = TRUE)) {
message_("Note that `sir_calc_df()` will also count dose-dependent susceptibility, 'SDD', as 'SI' when `combine_SI = TRUE`. This note will be shown once for this session.", as_note = FALSE)
}
}
data[, i] <- gsub("(I|S|SDD)", "SI", data[, i, drop = TRUE])
}
}
}
@@ -272,9 +285,9 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
for (i in seq_len(ncol(.data))) {
values <- .data[, i, drop = TRUE]
if (isTRUE(combine_SI)) {
values <- factor(values, levels = c("SI", "R"), ordered = TRUE)
values <- factor(values, levels = c("SI", "R", "N"), ordered = TRUE)
} else {
values <- factor(values, levels = c("S", "I", "R"), ordered = TRUE)
values <- factor(values, levels = c("S", "SDD", "I", "R", "N"), ordered = TRUE)
}
col_results <- as.data.frame(as.matrix(table(values)), stringsAsFactors = FALSE)
col_results$interpretation <- rownames(col_results)
@@ -351,8 +364,10 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
} else {
# don't use as.sir() here, as it would add the class 'sir' and we would like
# the same data structure as output, regardless of input
out$interpretation <- factor(out$interpretation, levels = c("S", "I", "R"), ordered = TRUE)
out$interpretation <- factor(out$interpretation, levels = c("S", "SDD", "I", "R", "N"), ordered = TRUE)
}
out <- out[!is.na(out$interpretation), , drop = FALSE]
if (data_has_groups) {
# ordering by the groups and two more: "antibiotic" and "interpretation"
@@ -373,5 +388,5 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
rownames(out) <- NULL
out <- as_original_data_class(out, class(data.bak)) # will remove tibble groups
structure(out, class = c("sir_df", "rsi_df", class(out)))
structure(out, class = c("sir_df", class(out)))
}
BIN
View File
Binary file not shown.
+1
View File
@@ -244,6 +244,7 @@ translate_into_language <- function(from,
# starting with longest pattern, since more general translations are shorter, such as 'Group'
order(nchar(df_trans$pattern), decreasing = TRUE),
function(i) {
if (df_trans$pattern[i] %like% "[/]") return(df_trans$pattern[i])
from_unique_translated <<- gsub(
pattern = df_trans$pattern[i],
replacement = df_trans[i, lang, drop = TRUE],
+58 -23
View File
@@ -34,7 +34,8 @@
# see https://github.com/tidyverse/dplyr/issues/5955 why this is required
# S3: ab_selector
# S3: ab_selector ----
# this does not need a .default method since it's used internally only
vec_ptype2.character.ab_selector <- function(x, y, ...) {
x
}
@@ -45,7 +46,8 @@ vec_cast.character.ab_selector <- function(x, to, ...) {
unclass(x)
}
# S3: ab_selector_any_all
# S3: ab_selector_any_all ----
# this does not need a .default method since it's used internally only
vec_ptype2.logical.ab_selector_any_all <- function(x, y, ...) {
x
}
@@ -56,12 +58,12 @@ vec_cast.logical.ab_selector_any_all <- function(x, to, ...) {
unclass(x)
}
# S3: ab
vec_ptype2.character.ab <- function(x, y, ...) {
# S3: ab ----
vec_ptype2.ab.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x
}
vec_ptype2.ab.character <- function(x, y, ...) {
y
vec_ptype2.ab.ab <- function(x, y, ...) {
x
}
vec_cast.character.ab <- function(x, to, ...) {
as.character(x)
@@ -70,12 +72,12 @@ vec_cast.ab.character <- function(x, to, ...) {
return_after_integrity_check(x, "antimicrobial drug code", as.character(AMR_env$AB_lookup$ab))
}
# S3: av
vec_ptype2.character.av <- function(x, y, ...) {
# S3: av ----
vec_ptype2.av.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x
}
vec_ptype2.av.character <- function(x, y, ...) {
y
vec_ptype2.av.av <- function(x, y, ...) {
x
}
vec_cast.character.av <- function(x, to, ...) {
as.character(x)
@@ -84,12 +86,12 @@ vec_cast.av.character <- function(x, to, ...) {
return_after_integrity_check(x, "antiviral drug code", as.character(AMR_env$AV_lookup$av))
}
# S3: mo
vec_ptype2.character.mo <- function(x, y, ...) {
# S3: mo ----
vec_ptype2.mo.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x
}
vec_ptype2.mo.character <- function(x, y, ...) {
y
vec_ptype2.mo.mo <- function(x, y, ...) {
x
}
vec_cast.character.mo <- function(x, to, ...) {
as.character(x)
@@ -99,12 +101,18 @@ vec_cast.mo.character <- function(x, to, ...) {
return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo))
}
# S3: disk
vec_ptype2.integer.disk <- function(x, y, ...) {
# S3: disk ----
vec_ptype_full.disk <- function(x, ...) {
"disk"
}
vec_ptype_abbr.disk <- function(x, ...) {
"dsk"
}
vec_ptype2.disk.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x
}
vec_ptype2.disk.integer <- function(x, y, ...) {
y
vec_ptype2.disk.disk <- function(x, y, ...) {
x
}
vec_cast.integer.disk <- function(x, to, ...) {
unclass(x)
@@ -125,29 +133,56 @@ vec_cast.disk.character <- function(x, to, ...) {
as.disk(x)
}
# S3: mic
# S3: mic ----
vec_ptype2.mic.default <- function (x, y, ..., x_arg = "", y_arg = "") {
# this will make sure that currently implemented MIC levels are returned
as.mic(x)
}
vec_ptype2.mic.mic <- function(x, y, ...) {
# this will make sure that currently implemented MIC levels are returned
as.mic(x)
}
vec_cast.mic.mic <- function(x, to, ...) {
# this will make sure that currently implemented MIC levels are returned
as.mic(x)
}
vec_cast.character.mic <- function(x, to, ...) {
as.character(x)
}
vec_cast.double.mic <- function(x, to, ...) {
as.double(x)
}
vec_cast.integer.mic <- function(x, to, ...) {
as.integer(x)
}
vec_cast.factor.mic <- function(x, to, ...) {
factor(as.character(x))
}
vec_cast.mic.double <- function(x, to, ...) {
as.mic(x)
}
vec_cast.mic.character <- function(x, to, ...) {
as.mic(x)
}
vec_cast.mic.integer <- function(x, to, ...) {
as.mic(x)
}
vec_cast.mic.factor <- function(x, to, ...) {
as.mic(x)
}
vec_math.mic <- function(.fn, x, ...) {
.fn(as.double(x), ...)
}
vec_arith.mic <- function(op, x, y, ...) {
vctrs::vec_arith(op, as.double(x), as.double(y))
}
# S3: sir
vec_ptype2.character.sir <- function(x, y, ...) {
# S3: sir ----
vec_ptype2.sir.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x
}
vec_ptype2.sir.character <- function(x, y, ...) {
y
vec_ptype2.sir.sir <- function(x, y, ...) {
x
}
vec_cast.character.sir <- function(x, to, ...) {
as.character(x)
+2 -2
View File
@@ -31,13 +31,13 @@
#'
#' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology.
#' @section WHOCC:
#' This package contains **all ~550 antibiotic, antimycotic and antiviral drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <https://www.whocc.no>) and the Pharmaceuticals Community Register of the European Commission (<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
#' This package contains **all ~550 antibiotic, antimycotic and antiviral drugs** and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <https://atcddd.fhi.no>) and the Pharmaceuticals Community Register of the European Commission (<https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>).
#'
#' These have become the gold standard for international drug utilisation monitoring and research.
#'
#' The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
#'
#' **NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package.** See <https://www.whocc.no/copyright_disclaimer/.>
#' **NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package.** See <https://atcddd.fhi.no/copyright_disclaimer/.>
#' @name WHOCC
#' @rdname WHOCC
+8 -165
View File
@@ -27,171 +27,14 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#' Deprecated Functions
#'
#' These functions are so-called '[Deprecated]'. **They will be removed in a future release.** Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
#' @keywords internal
#' @name AMR-deprecated
#' @rdname AMR-deprecated
#' @export
NA_rsi_ <- set_clean_class(factor(NA_character_, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("rsi", "ordered", "factor")
)
#' @rdname AMR-deprecated
#' @export
as.rsi <- function(x, ...) {
deprecation_warning("as.rsi", "as.sir")
UseMethod("as.rsi")
}
#' @noRd
#' @export
as.rsi.default <- function(...) {
as.sir.default(...)
}
#' @noRd
#' @export
as.rsi.mic <- function(...) {
as.sir.mic(...)
}
#' @noRd
#' @export
as.rsi.disk <- function(...) {
as.sir.disk(...)
}
#' @noRd
#' @export
as.rsi.data.frame <- function(...) {
as.sir.data.frame(...)
}
#' @rdname AMR-deprecated
#' @export
facet_rsi <- function(...) {
deprecation_warning("facet_rsi", "facet_sir")
facet_sir(...)
}
#' @rdname AMR-deprecated
#' @export
geom_rsi <- function(...) {
deprecation_warning("geom_rsi", "geom_sir")
geom_sir(...)
}
#' @rdname AMR-deprecated
#' @export
ggplot_rsi <- function(...) {
deprecation_warning("ggplot_rsi", "ggplot_sir")
ggplot_sir(...)
}
#' @rdname AMR-deprecated
#' @export
ggplot_rsi_predict <- function(...) {
deprecation_warning("ggplot_rsi_predict", "ggplot_sir_predict")
ggplot_sir_predict(...)
}
#' @rdname AMR-deprecated
#' @export
is.rsi <- function(...) {
# REMINDER: change as.sir() to remove the deprecation warning there
suppressWarnings(is.sir(...))
}
#' @rdname AMR-deprecated
#' @export
is.rsi.eligible <- function(...) {
deprecation_warning("is.rsi.eligible", "is_sir_eligible")
is_sir_eligible(...)
}
#' @rdname AMR-deprecated
#' @export
labels_rsi_count <- function(...) {
deprecation_warning("labels_rsi_count", "labels_sir_count")
labels_sir_count(...)
}
#' @rdname AMR-deprecated
#' @export
n_rsi <- function(...) {
deprecation_warning("n_rsi", "n_sir")
n_sir(...)
}
#' @rdname AMR-deprecated
#' @export
random_rsi <- function(...) {
deprecation_warning("random_rsi", "random_sir")
random_sir(...)
}
#' @rdname AMR-deprecated
#' @export
rsi_df <- function(...) {
deprecation_warning("rsi_df", "sir_df")
sir_df(...)
}
#' @rdname AMR-deprecated
#' @export
rsi_predict <- function(...) {
deprecation_warning("rsi_predict", "sir_predict")
sir_predict(...)
}
#' @rdname AMR-deprecated
#' @export
scale_rsi_colours <- function(...) {
deprecation_warning("scale_rsi_colours", "scale_sir_colours")
scale_sir_colours(...)
}
#' @rdname AMR-deprecated
#' @export
theme_rsi <- function(...) {
deprecation_warning("theme_rsi", "theme_sir")
theme_sir(...)
}
# will be exported using s3_register() in R/zzz.R
pillar_shaft.rsi <- pillar_shaft.sir
type_sum.rsi <- function(x, ...) {
if (message_not_thrown_before("type_sum.rsi")) {
deprecation_warning(extra_msg = "The 'rsi' class has been replaced with 'sir'. Transform your 'rsi' columns to 'sir' with `as.sir()`, e.g.:\n your_data %>% mutate_if(is.rsi, as.sir)")
}
"rsi"
}
#' @method print rsi
#' @export
#' @noRd
print.rsi <- function(x, ...) {
deprecation_warning(extra_msg = "The 'rsi' class has been replaced with 'sir' - transform your 'rsi' data with `as.sir()`")
cat("Class 'rsi'", font_bold(font_red("[!]\n")))
print(as.character(x), quote = FALSE)
}
#' @noRd
#' @export
`[<-.rsi` <- `[<-.sir`
#' @noRd
#' @export
`[[<-.rsi` <- `[[<-.sir`
#' @noRd
#' @export
barplot.rsi <- barplot.sir
#' @noRd
#' @export
c.rsi <- c.sir
#' @noRd
#' @export
droplevels.rsi <- droplevels.sir
#' @noRd
#' @export
plot.rsi <- plot.sir
#' @noRd
#' @export
rep.rsi <- rep.sir
#' @noRd
#' @export
summary.rsi <- summary.sir
#' @noRd
#' @export
unique.rsi <- unique.sir
# WHEN REMOVING RSI, DON'T FORGET TO REMOVE :
# - THE "rsi_df" CLASS FROM R/sir_calc.R
# - CODE CONTAINING only_rsi_columns, colours_RSI, include_untested_rsi, prob_RSI
# #' Deprecated Functions
# #'
# #' These functions are so-called '[Deprecated]'. **They will be removed in a future release.** Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
# #' @keywords internal
# #' @name AMR-deprecated
# #' @rdname AMR-deprecated
# #' @export
# NULL
deprecation_warning <- function(old = NULL, new = NULL, extra_msg = NULL, is_function = TRUE) {
if (is.null(old)) {
+55 -42
View File
@@ -67,6 +67,7 @@ AMR_env$sir_interpretation_history <- data.frame(
method = character(0),
breakpoint_S_R = character(0),
guideline = character(0),
host = character(0),
ref_table = character(0),
stringsAsFactors = FALSE
)
@@ -77,17 +78,11 @@ AMR_env$is_dark_theme <- NULL
AMR_env$chmatch <- import_fn("chmatch", "data.table", error_on_fail = FALSE)
AMR_env$chin <- import_fn("%chin%", "data.table", error_on_fail = FALSE)
# determine info icon for messages
if (pkg_is_available("cli")) {
# let cli do the determination of supported symbols
AMR_env$info_icon <- import_fn("symbol", "cli")$info
AMR_env$bullet_icon <- import_fn("symbol", "cli")$bullet
AMR_env$dots <- import_fn("symbol", "cli")$ellipsis
} else {
AMR_env$info_icon <- "i"
AMR_env$bullet_icon <- "*"
AMR_env$dots <- "..."
}
# take cli symbols if available
AMR_env$info_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$info %or% "i"
AMR_env$bullet_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$bullet %or% "*"
AMR_env$dots <- import_fn("symbol", "cli", error_on_fail = FALSE)$ellipsis %or% "..."
AMR_env$sup_1_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$sup_1 %or% "*"
.onLoad <- function(lib, pkg) {
# Support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
@@ -98,16 +93,13 @@ if (pkg_is_available("cli")) {
s3_register("pillar::pillar_shaft", "av")
s3_register("pillar::pillar_shaft", "mo")
s3_register("pillar::pillar_shaft", "sir")
s3_register("pillar::pillar_shaft", "rsi") # remove in a later version
s3_register("pillar::pillar_shaft", "mic")
s3_register("pillar::pillar_shaft", "disk")
s3_register("pillar::type_sum", "ab")
s3_register("pillar::type_sum", "av")
s3_register("pillar::type_sum", "mo")
s3_register("pillar::type_sum", "sir")
s3_register("pillar::type_sum", "rsi") # remove in a later version
s3_register("pillar::type_sum", "mic")
s3_register("pillar::type_sum", "disk")
# Support for frequency tables from the cleaner package
s3_register("cleaner::freq", "mo")
s3_register("cleaner::freq", "sir")
@@ -132,6 +124,7 @@ if (pkg_is_available("cli")) {
s3_register("knitr::knit_print", "antibiogram")
s3_register("knitr::knit_print", "formatted_bug_drug_combinations")
# Support vctrs package for use in e.g. dplyr verbs
# NOTE 2024-02-22 this is the right way - it should be 2 S3 classes in the second argument
# S3: ab_selector
s3_register("vctrs::vec_ptype2", "character.ab_selector")
s3_register("vctrs::vec_ptype2", "ab_selector.character")
@@ -141,23 +134,25 @@ if (pkg_is_available("cli")) {
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
# S3: ab
s3_register("vctrs::vec_ptype2", "character.ab")
s3_register("vctrs::vec_ptype2", "ab.character")
s3_register("vctrs::vec_ptype2", "ab.default")
s3_register("vctrs::vec_ptype2", "ab.ab")
s3_register("vctrs::vec_cast", "character.ab")
s3_register("vctrs::vec_cast", "ab.character")
# S3: av
s3_register("vctrs::vec_ptype2", "character.av")
s3_register("vctrs::vec_ptype2", "av.character")
s3_register("vctrs::vec_ptype2", "av.default")
s3_register("vctrs::vec_ptype2", "av.av")
s3_register("vctrs::vec_cast", "character.av")
s3_register("vctrs::vec_cast", "av.character")
# S3: mo
s3_register("vctrs::vec_ptype2", "character.mo")
s3_register("vctrs::vec_ptype2", "mo.character")
s3_register("vctrs::vec_ptype2", "mo.default")
s3_register("vctrs::vec_ptype2", "mo.mo")
s3_register("vctrs::vec_cast", "character.mo")
s3_register("vctrs::vec_cast", "mo.character")
# S3: disk
s3_register("vctrs::vec_ptype2", "integer.disk")
s3_register("vctrs::vec_ptype2", "disk.integer")
s3_register("vctrs::vec_ptype_full", "disk")
s3_register("vctrs::vec_ptype_abbr", "disk")
s3_register("vctrs::vec_ptype2", "disk.default")
s3_register("vctrs::vec_ptype2", "disk.disk")
s3_register("vctrs::vec_cast", "integer.disk")
s3_register("vctrs::vec_cast", "disk.integer")
s3_register("vctrs::vec_cast", "double.disk")
@@ -165,14 +160,22 @@ if (pkg_is_available("cli")) {
s3_register("vctrs::vec_cast", "character.disk")
s3_register("vctrs::vec_cast", "disk.character")
# S3: mic
s3_register("vctrs::vec_ptype2", "mic.default")
s3_register("vctrs::vec_ptype2", "mic.mic")
s3_register("vctrs::vec_cast", "character.mic")
s3_register("vctrs::vec_cast", "double.mic")
s3_register("vctrs::vec_cast", "integer.mic")
s3_register("vctrs::vec_cast", "factor.mic")
s3_register("vctrs::vec_cast", "mic.character")
s3_register("vctrs::vec_cast", "mic.double")
s3_register("vctrs::vec_cast", "mic.integer")
s3_register("vctrs::vec_cast", "mic.factor")
s3_register("vctrs::vec_cast", "mic.mic")
s3_register("vctrs::vec_math", "mic")
s3_register("vctrs::vec_arith", "mic")
# S3: sir
s3_register("vctrs::vec_ptype2", "character.sir")
s3_register("vctrs::vec_ptype2", "sir.character")
s3_register("vctrs::vec_ptype2", "sir.default")
s3_register("vctrs::vec_ptype2", "sir.sir")
s3_register("vctrs::vec_cast", "character.sir")
s3_register("vctrs::vec_cast", "sir.character")
@@ -189,31 +192,41 @@ if (pkg_is_available("cli")) {
# they cannot be part of R/sysdata.rda since CRAN thinks it would make the package too large (+3 MB)
AMR_env$AB_lookup <- cbind(AMR::antibiotics, AB_LOOKUP)
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_LOOKUP)
AMR_env$host_preferred_order <- names(sort(table(AMR::clinical_breakpoints$host[!AMR::clinical_breakpoints$host %in% AMR::clinical_breakpoints$type]), decreasing = TRUE))
}
.onAttach <- function(lib, pkg) {
# if custom ab option is available, load it
if (!is.null(getOption("AMR_custom_ab")) && file.exists(getOption("AMR_custom_ab", default = ""))) {
packageStartupMessage("Adding custom antimicrobials from '", getOption("AMR_custom_ab"), "'...", appendLF = FALSE)
x <- readRDS_AMR(getOption("AMR_custom_ab"))
tryCatch(
{
suppressWarnings(suppressMessages(add_custom_antimicrobials(x)))
packageStartupMessage("OK.")
},
error = function(e) packageStartupMessage("Failed: ", e$message)
)
if (getOption("AMR_custom_ab") %unlike% "[.]rds$") {
packageStartupMessage("The file with custom antimicrobials must be an RDS file. Set the option `AMR_custom_ab` to another path.")
} else {
packageStartupMessage("Adding custom antimicrobials from '", getOption("AMR_custom_ab"), "'...", appendLF = FALSE)
x <- readRDS_AMR(getOption("AMR_custom_ab"))
tryCatch(
{
suppressWarnings(suppressMessages(add_custom_antimicrobials(x)))
packageStartupMessage("OK.")
},
error = function(e) packageStartupMessage("Failed: ", e$message)
)
}
}
# if custom mo option is available, load it
if (!is.null(getOption("AMR_custom_mo")) && file.exists(getOption("AMR_custom_mo", default = ""))) {
packageStartupMessage("Adding custom microorganisms from '", getOption("AMR_custom_mo"), "'...", appendLF = FALSE)
x <- readRDS_AMR(getOption("AMR_custom_mo"))
tryCatch(
{
suppressWarnings(suppressMessages(add_custom_microorganisms(x)))
packageStartupMessage("OK.")
},
error = function(e) packageStartupMessage("Failed: ", e$message)
)
if (getOption("AMR_custom_mo") %unlike% "[.]rds$") {
packageStartupMessage("The file with custom microorganisms must be an RDS file. Set the option `AMR_custom_mo` to another path.")
} else {
packageStartupMessage("Adding custom microorganisms from '", getOption("AMR_custom_mo"), "'...", appendLF = FALSE)
x <- readRDS_AMR(getOption("AMR_custom_mo"))
tryCatch(
{
suppressWarnings(suppressMessages(add_custom_microorganisms(x)))
packageStartupMessage("OK.")
},
error = function(e) packageStartupMessage("Failed: ", e$message)
)
}
}
}
+1 -3
View File
@@ -4,9 +4,7 @@
----
This work was published in the Journal of Statistical Software (Volume 104(3); [DOI 10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and formed the basis of two PhD theses ([DOI 10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and [DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. It is currently being used in over 175 countries.
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. It is currently being used in over 175 countries. This work was published in the Journal of Statistical Software (2022, Volume 104(3); [DOI 10.18637/jss.v104.i03](https://doi.org/10.18637/jss.v104.i03)) and formed the basis of two PhD theses ([DOI 10.33612/diss.177417131](https://doi.org/10.33612/diss.177417131) and [DOI 10.33612/diss.192486375](https://doi.org/10.33612/diss.192486375)).
After installing this package, R knows ~52,000 distinct microbial species and all ~600 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. It supports any data format, including WHONET/EARS-Net data. Antimicrobial names and group names are available in English, Chinese, Danish, Dutch, French, German, Greek, Italian, Japanese, Polish, Portuguese, Russian, Spanish, Swedish, Turkish, and Ukrainian.
+24 -18
View File
@@ -35,15 +35,11 @@ template:
bootswatch: "flatly"
assets: "pkgdown/logos" # use logos in this folder
bslib:
base_font: {google: "Lato"}
heading_font: {google: "Lato"}
code_font: {google: "Fira Code"}
# body-text-align: "justify"
line-height-base: 1.75
# the green "success" colour of this bootstrap theme should be the same as the green in our logo
success: "#128f76"
link-color: "#128f76"
light: "#128f76a6" # this is success with 60% alpha
# the template "info" is blue - this should be a green fitting our theme
info: "#60a799"
# make top bar a bit wider
navbar-padding-y: "0.5rem"
opengraph:
@@ -174,7 +170,7 @@ reference:
- "`atc_online_property`"
- "`add_custom_antimicrobials`"
- title: "Preparing data: antimicrobial resistance"
- title: "Preparing data"
desc: >
With `as.mic()` and `as.disk()` you can transform your raw input to valid MIC or disk diffusion values.
Use `as.sir()` for cleaning raw data to let it only contain "R", "I" and "S", or to interpret MIC or disk diffusion values as SIR based on the lastest EUCAST and CLSI guidelines.
@@ -186,7 +182,7 @@ reference:
- "`eucast_rules`"
- "`custom_eucast_rules`"
- title: "Analysing data: antimicrobial resistance"
- title: "Analysing data"
desc: >
Use these function for the analysis part. You can use `susceptibility()` or `resistance()` on any antibiotic column.
With `antibiogram()`, you can generate a traditional, combined, syndromic, or weighted-incidence syndromic combination
@@ -202,14 +198,25 @@ reference:
- "`key_antimicrobials`"
- "`mdro`"
- "`count`"
- "`plot`"
- "`ggplot_sir`"
- "`bug_drug_combinations`"
- "`antibiotic_class_selectors`"
- "`mean_amr_distance`"
- "`resistance_predict`"
- "`guess_ab_col`"
- title: "Plotting data"
desc: >
Use these functions for the plotting part. The `scale_*_mic()` functions extend the ggplot2 package to allow plotting of
MIC values, even within a manually set range.
If using `plot()` (base R) or `autoplot()` (ggplot2) on MIC values or disk diffusion values, the user can
set the interpretation guideline to give the bars the right SIR colours.
The `ggplot_sir()` function is a short wrapper for users not much accustomed to ggplot2 yet.
The `ggplot_pca()` function is a specific function to plot so-called biplots for PCA (principal component analysis).
contents:
- "`plot`"
- "`ggplot_sir`"
- "`ggplot_pca`"
- title: "Other: AMR-specific options"
desc: >
The AMR package is customisable, by providing settings that can be set per user or per team. For
@@ -257,7 +264,6 @@ reference:
- "`age`"
- "`availability`"
- "`get_AMR_locale`"
- "`ggplot_pca`"
- "`italicise_taxonomy`"
- "`join`"
- "`like`"
@@ -273,10 +279,10 @@ reference:
- "`kurtosis`"
- "`skewness`"
- title: "Other: deprecated functions"
desc: >
These functions are deprecated, meaning that they will still
work but show a warning with every use and will be removed
in a future version.
contents:
- "`AMR-deprecated`"
# - title: "Other: deprecated functions"
# desc: >
# These functions are deprecated, meaning that they will still
# work but show a warning with every use and will be removed
# in a future version.
# contents:
# - "`AMR-deprecated`"
+3
View File
@@ -0,0 +1,3 @@
green grass #a7dbc3
green bacteria #128F76
blue sky #a8d5ef
Binary file not shown.
File diff suppressed because one or more lines are too long
+71
View File
@@ -0,0 +1,71 @@
---
title: "AMR Goes Vet"
author: "Jason, Matthew, Javier, Matthijs"
date: "2024-02-20"
format:
html:
embed-resources: true
---
## Import WHONET data set
```{r, message=FALSE, warning=FALSE}
library(dplyr)
library(readr)
library(tidyr)
library(janitor)
# WHONET version of 16th Feb 2024
whonet_breakpoints <- read_tsv("WHONET/Resources/Breakpoints.txt", na = c("", "NA", "-"),
show_col_types = FALSE, guess_max = Inf) %>%
filter(GUIDELINES %in% c("CLSI", "EUCAST"))
dim(whonet_breakpoints)
```
# EDA of Animal Breakpoints
```{r}
whonet_breakpoints |>
filter(BREAKPOINT_TYPE != "Human")
whonet_breakpoints |>
filter(BREAKPOINT_TYPE != "Human") |>
count(BREAKPOINT_TYPE)
whonet_breakpoints |>
filter(BREAKPOINT_TYPE == "Animal")
```
### Count of all animal breakpoints
```{r}
whonet_breakpoints |>
filter(BREAKPOINT_TYPE == "Animal") |>
count(YEAR, HOST, REFERENCE_TABLE = gsub("VET[0-9]+ ", "", REFERENCE_TABLE)) |>
pivot_wider(names_from = YEAR, values_from = n, values_fill = list(n = 0)) |>
arrange(HOST, REFERENCE_TABLE) |>
adorn_totals(name = "TOTAL")
```
### Cats only
```{r}
whonet_breakpoints |>
filter(HOST == "Cats", YEAR >= 2021) |>
select(GUIDELINES, YEAR, TEST_METHOD, ORGANISM_CODE, R, S) |>
mutate(MO_NAME = AMR::mo_shortname(ORGANISM_CODE), .before = R) |>
as.data.frame()
```
### Site of infection in cats (2023)
```{r}
whonet_breakpoints |>
filter(HOST == "Cats", YEAR == 2023) |>
mutate(MO = AMR::mo_shortname(ORGANISM_CODE),
AB = AMR::ab_name(WHONET_ABX_CODE),
SITE_OF_INFECTION = substr(SITE_OF_INFECTION, 1, 25)) |>
arrange(MO, AB) |>
select(MO, AB, SITE_OF_INFECTION) |>
as.data.frame()
```
@@ -28,7 +28,7 @@
# ==================================================================== #
# Run this file to update the package using:
# source("data-raw/_pre_commit_hook.R")
# source("data-raw/_pre_commit_checks.R")
library(dplyr, warn.conflicts = FALSE)
try(detach("package:data.table", unload = TRUE), silent = TRUE) # to prevent like() to precede over AMR::like
@@ -157,20 +157,21 @@ MO_STREP_ABCG <- AMR::microorganisms$mo[which(AMR::microorganisms$genus == "Stre
MO_LANCEFIELD <- AMR::microorganisms$mo[which(AMR::microorganisms$mo %like% "^(B_STRPT_PYGN(_|$)|B_STRPT_AGLC(_|$)|B_STRPT_(DYSG|EQUI)(_|$)|B_STRPT_ANGN(_|$)|B_STRPT_(DYSG|CANS)(_|$)|B_STRPT_SNGN(_|$)|B_STRPT_SLVR(_|$))")]
MO_PREVALENT_GENERA <- c(
"Absidia", "Acanthamoeba", "Acremonium", "Aedes", "Alternaria", "Amoeba", "Ancylostoma", "Angiostrongylus",
"Anisakis", "Anopheles", "Apophysomyces", "Aspergillus", "Aureobasidium", "Basidiobolus", "Beauveria",
"Blastocystis", "Blastomyces", "Candida", "Capillaria", "Chaetomium", "Chrysonilia", "Cladophialophora",
"Anisakis", "Anopheles", "Apophysomyces", "Arthroderma", "Aspergillus", "Aureobasidium", "Basidiobolus", "Beauveria",
"Blastocystis", "Blastomyces", "Candida", "Capillaria", "Chaetomium", "Chrysonilia", "Chrysosporium", "Cladophialophora",
"Cladosporium", "Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex",
"Dermatobia", "Dientamoeba", "Diphyllobothrium", "Dirofilaria", "Echinostoma", "Entamoeba", "Enterobius",
"Exophiala", "Exserohilum", "Fasciola", "Fonsecaea", "Fusarium", "Giardia", "Haloarcula", "Halobacterium",
"Exophiala", "Exserohilum", "Fasciola", "Fonsecaea", "Fusarium", "Geotrichum", "Giardia", "Haloarcula", "Halobacterium",
"Halococcus", "Hendersonula", "Heterophyes", "Histomonas", "Histoplasma", "Hymenolepis", "Hypomyces",
"Hysterothylacium", "Leishmania", "Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma", "Microsporidium",
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Necator", "Nectria", "Ochroconis", "Oesophagostomum",
"Oidiodendron", "Opisthorchis", "Pediculus", "Penicillium", "Phlebotomus", "Phoma", "Pichia", "Piedraia", "Pithomyces",
"Hysterothylacium", "Kloeckera", "Kodamaea", "Leishmania", "Lichtheimia", "Lodderomyces",
"Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma", "Microsporidium",
"Microsporum", "Millerozyma", "Mortierella", "Mucor", "Mycocentrospora", "Necator", "Nectria", "Ochroconis", "Oesophagostomum",
"Oidiodendron", "Opisthorchis", "Paecilomyces", "Pediculus", "Penicillium", "Phlebotomus", "Phoma", "Pichia", "Piedraia", "Pithomyces",
"Pityrosporum", "Pneumocystis", "Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus",
"Rhodotorula", "Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra",
"Sporobolomyces", "Stachybotrys", "Strongyloides", "Syngamus", "Taenia", "Talaromyces", "Toxocara", "Trichinella",
"Rhodotorula", "Saccharomyces", "Saprochaete", "Sarcoptes", "Scedosporium", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra",
"Sporobolomyces", "Sporotrichum", "Stachybotrys", "Strongyloides", "Syngamus", "Taenia", "Talaromyces", "Toxocara", "Trichinella",
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris",
"Tritirachium", "Trombicula", "Trypanosoma", "Tunga", "Wuchereria"
"Tritirachium", "Trombicula", "Trypanosoma", "Tunga", "Verticillium", "Wuchereria"
)
# antibiotic groups
@@ -180,10 +181,10 @@ AB_AMINOGLYCOSIDES <- antibiotics %>%
filter(group %like% "aminoglycoside") %>%
pull(ab)
AB_AMINOPENICILLINS <- as.ab(c("AMP", "AMX"))
AB_ANTIFUNGALS <- AMR_env$AB_lookup %>%
AB_ANTIFUNGALS <- antibiotics %>%
filter(group %like% "antifungal") %>%
pull(ab)
AB_ANTIMYCOBACTERIALS <- AMR_env$AB_lookup %>%
AB_ANTIMYCOBACTERIALS <- antibiotics %>%
filter(group %like% "antimycobacterial") %>%
pull(ab)
AB_CARBAPENEMS <- antibiotics %>%
@@ -220,7 +221,10 @@ AB_LINCOSAMIDES <- antibiotics %>%
filter(atc_group2 %like% "lincosamide" | (group %like% "lincosamide" & is.na(atc_group2))) %>%
pull(ab)
AB_MACROLIDES <- antibiotics %>%
filter(atc_group2 %like% "macrolide" | (group %like% "macrolide" & is.na(atc_group2))) %>%
filter(atc_group2 %like% "macrolide" | (group %like% "macrolide" & is.na(atc_group2) & name %unlike% "screening|inducible")) %>%
pull(ab)
AB_NITROFURANS <- antibiotics %>%
filter(name %like% "^furaz|nitrofura" | atc_group2 %like% "nitrofuran") %>%
pull(ab)
AB_OXAZOLIDINONES <- antibiotics %>%
filter(group %like% "oxazolidinone") %>%
@@ -234,6 +238,9 @@ AB_POLYMYXINS <- antibiotics %>%
AB_QUINOLONES <- antibiotics %>%
filter(group %like% "quinolone") %>%
pull(ab)
AB_RIFAMYCINS <- antibiotics %>%
filter(name %like% "Rifampi|Rifabutin|Rifapentine|rifamy") %>%
pull(ab)
AB_STREPTOGRAMINS <- antibiotics %>%
filter(atc_group2 %like% "streptogramin") %>%
pull(ab)
@@ -309,10 +316,12 @@ suppressMessages(usethis::use_data(EUCAST_RULES_DF,
AB_GLYCOPEPTIDES_EXCEPT_LIPO,
AB_LINCOSAMIDES,
AB_MACROLIDES,
AB_NITROFURANS,
AB_OXAZOLIDINONES,
AB_PENICILLINS,
AB_POLYMYXINS,
AB_QUINOLONES,
AB_RIFAMYCINS,
AB_STREPTOGRAMINS,
AB_TETRACYCLINES,
AB_TETRACYCLINES_EXCEPT_TGC,
+1 -1
View File
@@ -1 +1 @@
3d8c509ec95d61889cae83af43b0e6b7
3e7a1cbb21b49cdc7626ea3016a017cc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+57 -56
View File
@@ -8,19 +8,19 @@
"AMX" 33613 "Amoxicillin" "Beta-lactams/penicillins" "J01CA04" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "ac,amox,amx" "actimoxi,amoclen,amolin,amopen,amopenixin,amoxibiotic,amoxicaps,amoxicilina,amoxicillin,amoxicillin hydrate,amoxicilline,amoxicillinum,amoxiden,amoxil,amoxivet,amoxy,amoxycillin,amoxyke,anemolin,aspenil,atoksilin,biomox,bristamox,cemoxin,clamoxyl,damoxy,delacillin,demoksil,dispermox,efpenix,flemoxin,hiconcil,histocillin,hydroxyampicillin,ibiamox,imacillin,lamoxy,largopen,metafarma capsules,metifarma capsules,moksilin,moxacin,moxatag,ospamox,pamoxicillin,piramox,promoxil,remoxil,robamox,sawamox pm,tolodina,topramoxin,unicillin,utimox,vetramox" 1.5 "g" 3 "g" "101498-4,15-8,16-6,16365-9,17-4,18-2,18861-5,18862-3,19-0,20-8,21-6,22-4,25274-2,25310-4,3344-9,55614-2,55615-9,55616-7,6976-5,6977-3,80133-2"
"AMC" 23665637 "Amoxicillin/clavulanic acid" "Beta-lactams/penicillins" "J01CR02" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "a/c,amcl,aml,aug,xl" "amocla,amoclan,amoclav,amoksiclav,amoxsiklav,amoxyclav,augmentan,augmentin,augmentin xr,augmentine,auspilic,clamentin,clamobit,clavamox,clavinex,clavoxilin plus,clavulin,clavumox,coamoxiclav,eumetinex,kmoxilin,spectramox,spektramox,synulox,viaclav,xiclav" 1.5 "g" 3 "g" ""
"AXS" 465441 "Amoxicillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" "55614-2,55615-9,55616-7"
"AMB" 5280965 "Amphotericin B" "Antifungals/antimycotics" "A01AB04,A07AA07,G01AA03,J02AA01" "Antimycotics for systemic use" "Antibiotics" "amf,amfb,amph" "abelcet,abelecet,ambisome,amfotericina b,amphocin,amphomoronal,amphortericin b,amphotec,amphotericin,amphotericin b,amphotericine b,amphotericinum b,amphozone,anfotericine b,fungilin,fungisome,fungisone,fungizone,halizon" 40 "mg" 35 "mg" "16370-9,18863-1,23-2,24-0,25-7,26-5,3353-0,3354-8,40707-2,40757-7,49859-2,6978-1"
"AMB" 5280965 "Amphotericin B" "Antifungals/antimycotics" "A01AB04,A07AA07,G01AA03,J02AA01" "Antimycotics for systemic use" "Antibiotics" "amf,amfb,amph" "abelcet,abelecet,ambisome,amfotericina b,amphocin,amphomoronal,amphortericin b,amphotec,amphotericin,amphotericin b,amphotericine b,amphotericinum b,amphozone,anfotericine b,fungilin,fungisome,fungisone,fungizone,halizon" 40 "mg" 210 "mg" "16370-9,18863-1,23-2,24-0,25-7,26-5,3353-0,3354-8,40707-2,40757-7,49859-2,6978-1"
"AMH" "Amphotericin B-high" "Aminoglycosides" "NA" "amfo b high,amhl,ampho b high,amphotericin high" "" ""
"AMP" 6249 "Ampicillin" "Beta-lactams/penicillins" "J01CA01,S01AA19" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "am,amp,ampi" "acillin,adobacillin,amblosin,amcill,amfipen,amfipen v,amipenix s,ampichel,ampicil,ampicilina,ampicillin,ampicillin a,ampicillin acid,ampicillin anhydrate,ampicillin anhydrous,ampicillin base,ampicillin hydrate,ampicillin sodium,ampicillina,ampicilline,ampicillinum,ampicin,ampifarm,ampikel,ampimed,ampipenin,ampiscel,ampisyn,ampivax,ampivet,amplacilina,amplin,amplipenyl,amplisom,amplital,anhydrous ampicillin,austrapen,binotal,bonapicillin,britacil,campicillin,copharcilin,delcillin,deripen,divercillin,doktacillin,duphacillin,grampenil,guicitrina,guicitrine,lifeampil,marcillin,morepen,norobrittin,nuvapen,olin kid,omnipen,orbicilina,pen a oral,pen ampil,penbristol,penbritin,penbritin paediatric,penbritin syrup,penbrock,penicline,penimic,pensyn,pentrex,pentrexl,pentrexyl,pentritin,pfizerpen a,polycillin,polyflex,ponecil,princillin,principen,qidamp,racenacillin,redicilin,rosampline,roscillin,semicillin,semicillin r,servicillin,sumipanto,synpenin,texcillin,tokiocillin,tolomol,totacillin,totalciclina,totapen,trifacilina,ukapen,ultrabion,ultrabron,vampen,viccillin,viccillin s,vidocillin,wypicil" 2 "g" 6 "g" "101477-8,101478-6,18864-9,18865-6,20374-5,21066-6,23618-2,27-3,28-1,29-9,30-7,31-5,32-3,33-1,3355-5,33562-0,33919-2,34-9,43883-8,43884-6,6979-9,6980-7,87604-5"
"SAM" 119561 "Ampicillin/sulbactam" "Beta-lactams/penicillins" "J01CR01" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "a/s,ab,ams,amsu,apsu,sam" "sulacillin" 6 "g" "101478-6,18865-6,20374-5,23618-2,31-5,32-3,33-1,34-9,6980-7"
"AMR" 73341 "Amprolium" "Other antibacterials" "NA" "" "amprocidum,amprol,amprolio,amprolium,amprolium chloride,amprovine,thiacoccid" ""
"AMR" 73341 "Amprolium" "Other antibacterials" "QP51BX02" "" "amprocidum,amprol,amprolio,amprolium,amprolium chloride,amprovine,thiacoccid" ""
"ANI" 166548 "Anidulafungin" "Antifungals/antimycotics" "J02AX06" "Antimycotics for systemic use" "Other antimycotics for systemic use" "anid" "anidulafungin,anidulafungina,anidulafungine,anidulafunginum,ecalta,eraxis" 0.1 "g" "55343-8,57095-2,58420-1,77162-6"
"APL" 6602341 "Apalcillin" "Beta-lactams/penicillins" "NA" "" "apalcilina,apalcillin,apalcilline,apalcillinum" ""
"APR" 3081545 "Apramycin" "Aminoglycosides" "NA" "" "ambylan,apralan,apramicina,apramycin,apramycine,apramycinum,nebramycin ii" "23659-6,73652-0,73653-8"
"APR" 3081545 "Apramycin" "Aminoglycosides" "QA07AA92,QJ01GB90,QJ51GB90" "" "ambylan,apralan,apramicina,apramycin,apramycine,apramycinum,nebramycin ii" "23659-6,73652-0,73653-8"
"ARB" 68682 "Arbekacin" "Aminoglycosides" "J01GB12" "" "arbekacin,arbekacina,arbekacine,arbekacini sulfas,arbekacinum,habekacin,haberacin" 0.2 "g" "32373-3,53818-1,54173-0"
"APX" 71961 "Aspoxicillin" "Beta-lactams/penicillins" "J01CA19" "" "aspoxicilina,aspoxicillan,aspoxicillin,aspoxicilline,aspoxicillinum" 4 "g" ""
"AST" 5284517 "Astromicin" "Aminoglycosides" "NA" "" "astromicin,astromicin a,astromicina,astromicine,astromicinum,fortimicin,fortimicin a" ""
"AVB" 9835049 "Avibactam" "Beta-lactams/penicillins" "NA" "" "avibactam,avibactam free acid,avibactamfreeacid" ""
"AVI" 71674 "Avilamycin" "Other antibacterials" "NA" "" "avilamycin,avilamycina,avilamycine,avilamycinum,surmax" "35754-1,35755-8,35756-6,55619-1"
"AVI" 71674 "Avilamycin" "Other antibacterials" "QA07AA95" "" "avilamycin,avilamycina,avilamycine,avilamycinum,surmax" "35754-1,35755-8,35756-6,55619-1"
"AVO" 16131159 "Avoparcin" "Glycopeptides" "NA" "" "avoparcin,avoparcina,avoparcine,avoparcinum,avotan" ""
"AZD" 15574941 "Azidocillin" "Beta-lactams/penicillins" "J01CE04" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "azidocilina,azidocillin,azidocillina,azidocilline,azidocillinum" 1.5 "g" ""
"AZM" 447043 "Azithromycin" "Macrolides/lincosamides" "J01FA10,S01AA26" "Macrolides, lincosamides and streptogramins" "Macrolides" "az,azi,azit,azm" "aritromicina,aruzilina,azasite,azenil,azifast,azigram,azimakrol,azithramycine,azithrocin,azithromycin,azithromycine,azithromycinum,azitrocin,azitromax,azitromicina,azitromicine,azitromin,aziwin,aziwok,aztrin,azyter,azythromycin,durasite,hemomycin,macrozit,misultina,mixoterin,setron,sumamed,toraseptol,tromix,trozocina,trulimax,xithrone,zentavion,zithrax,zithromac,zithromax,zithromax iv,zithromycin,zitrim,zitromax,zitrotek,zmax sr,zythromax" 0.3 "g" 0.5 "g" "100043-9,16420-2,16421-0,18866-4,23612-5,25233-8,35-6,36-4,37-2,38-0,6981-5,89480-8"
@@ -30,7 +30,7 @@
"AZA" "Aztreonam/avibactam" "Beta-lactams/penicillins" "NA" "" "" ""
"ANC" "Aztreonam/nacubactam" "Beta-lactams/penicillins" "NA" "" "" ""
"BAM" 441397 "Bacampicillin" "Beta-lactams/penicillins" "J01CA06" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "bacampicilina,bacampicillin,bacampicilline,bacampicillinum,penglobe" 1.2 "g" "18869-8,47-1,48-9,49-7,50-5,55620-9"
"BAC" 78358334 "Bacitracin" "Other antibacterials" "R02AB04,J01XX10" "baci" "fortracin,md bacitracin" "10868-8,16428-5,18870-6,6827-0,6983-1,87603-7"
"BAC" 78358334 "Bacitracin" "Other antibacterials" "D06AX05,J01XX10,R02AB04,S01AA32" "baci" "fortracin,md bacitracin" "10868-8,16428-5,18870-6,6827-0,6983-1,87603-7"
"BDQ" 5388906 "Bedaquiline" "Other antibacterials" "J04AK05" "" "bedaquiline,sirturo" 86 "mg" "80637-2,88703-4,88704-2,94274-8,96107-8"
"BEK" 439318 "Bekanamycin" "Aminoglycosides" "J01GB13" "" "aminodeoxykanamycin,becanamicina,bekanamycin,bekanamycine,bekanamycinum,kanamycin b,klebcil,nebramycin v" 0.6 "g" ""
"BNB" "Benzathine benzylpenicillin" "Beta-lactams/penicillins" "J01CE08" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "beacillin,cepacilina,extencilline,lentopenil,penidural,tardocillin" 3.6 "g" ""
@@ -75,10 +75,10 @@
"CPI" 5486182 "Cefetamet pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefetamet pivoxyl,globocef" ""
"CCL" 71719688 "Cefetecol" "Cephalosporins (4th gen.)" "NA" "cefcatacol" "cefetecol,cefetecol anhydrous" ""
"CZL" 193956 "Cefetrizole" "Cephalosporins (unclassified gen.)" "NA" "" "cefetrizole,cefetrizolum" ""
"FDC" 77843966 "Cefiderocol" "Other antibacterials" "J01DI04" "" "cefiderocol" "95767-0,99280-0,99503-5"
"FDC" 77843966 "Cefiderocol" "Other antibacterials" "J01DI04" "" "cefiderocol" 6 "g" "95767-0,99280-0,99503-5"
"CFM" 5362065 "Cefixime" "Cephalosporins (3rd gen.)" "J01DD08" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfe,cfix,cfxm,dcfm,fix,ix" "anhydrous cefixime,cefixim,cefixima,cefixime,cefixime anhydrous,cefixime hydrate,cefiximum,cefixoral,cefspan,cephoral,citropen,denvar,necopen,oroken,suprax,tricef,unixime" 0.4 "g" "16567-0,18880-5,25236-1,35766-5,79-4,80-2,81-0,82-8"
"CEO" "Cefixime/ornidazole" "Other antibacterials" "J01RA15" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CMX" 9570757 "Cefmenoxime" "Cephalosporins (3rd gen.)" "J01DD05" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "bestron,cefmax,cefmenoxima,cefmenoxime,cefmenoximum" 2 "g" "32375-8,54174-8,54203-5,55641-5"
"CMX" 9570757 "Cefmenoxime" "Cephalosporins (3rd gen.)" "J01DD05,S01AA31,S02AA18" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "bestron,cefmax,cefmenoxima,cefmenoxime,cefmenoximum" 2 "g" "32375-8,54174-8,54203-5,55641-5"
"CMZ" 42008 "Cefmetazole" "Cephalosporins (2nd gen.)" "J01DC09" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "" "cefmetazole,cefmetazolesodium,cefmetazolo,cefmetazolum" 4 "g" "11575-8,18881-3,25222-1,87-7,88-5,89-3,90-1"
"CNX" 71141 "Cefminox" "Other antibacterials" "J01DC12" "" "cefminox,cefminoxum" 4 "g" "54908-9"
"DIZ" 5361871 "Cefodizime" "Cephalosporins (3rd gen.)" "J01DD09" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "cefodizima,cefodizime,cefodizime acid,cefodizime disodium,cefodizimum,cefodizme,diezime,modivid,neucef,timecef" 2 "g" "18882-1,6988-0,91-9,92-7,93-5,94-3"
@@ -93,7 +93,7 @@
"CTT" 53025 "Cefotetan" "Cephalosporins (2nd gen.)" "J01DC05" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cftt,cn,cte,ctn,ctt,tans" "apacef,cefotan,cefotetan,cefotetan acid,cefotetan free acid,cefotetanum" 4 "g" "111-5,112-3,113-1,114-9,18887-0,25239-5,3447-0,41672-7,41673-5,41674-3,41729-5,6990-6"
"CTF" 43708 "Cefotiam" "Cephalosporins (2nd gen.)" "J01DC07" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "" "cefotiam,cefotiam?,cefotiamum,ceradolan,ceradon,haloapor" 1.2 "g" 4 "g" "32374-1,35772-3,35773-1,55645-6,55737-1,55738-9,55739-7,55740-5"
"CHE" 125846 "Cefotiam hexetil" "Cephalosporins (3rd gen.)" "NA" "" "cefotiam cilexetil,pansporin t" "55737-1,55738-9,55739-7,55740-5"
"FOV" 9578573 "Cefovecin" "Cephalosporins (3rd gen.)" "NA" "" "cefovecin" "76147-8,87792-8"
"FOV" 9578573 "Cefovecin" "Cephalosporins (3rd gen.)" "QJ01DD91" "" "cefovecin" "76147-8,87792-8"
"FOX" 441199 "Cefoxitin" "Cephalosporins (2nd gen.)" "J01DC01" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cfox,cfx,cfxt,cx,fox,fx" "cefoxitin,cefoxitina,cefoxitine,cefoxitinum,cefoxotin,cenomycin,cephoxitin,mefoxin,mefoxitin,rephoxitin" 6 "g" "101492-7,115-6,116-4,117-2,118-0,18888-8,25220-5,25240-3,25366-6,3448-8,41675-0,41676-8,41677-6,41730-3,6991-4"
"FOX1" "Cefoxitin screening" "Cephalosporins (2nd gen.)" "NA" "cfsc" "" ""
"ZOP" 9571080 "Cefozopran" "Cephalosporins (4th gen.)" "J01DE03" "" "cefozopran" 4 "g" "100045-4,53820-7"
@@ -104,7 +104,7 @@
"CPX" 6526396 "Cefpodoxime proxetil" "Cephalosporins (3rd gen.)" "NA" "" "cefodox,cefoprox,cefpodoxime proxetil,cepodem,orelox,orelox paed,otreon,podomexef,simplicef,vantin" ""
"CDC" "Cefpodoxime/clavulanic acid" "Cephalosporins (3rd gen.)" "NA" "cecl" "" ""
"CPR" 5281006 "Cefprozil" "Cephalosporins (2nd gen.)" "J01DC10" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cpr,cpz,fp" "arzimol,brisoral,cefprozil,cefprozil anhydrous,cefprozil hydrate,cefprozilo,cefprozilum,cefzil,cronocef,procef,serozil" 1 "g" "123-0,124-8,125-5,126-3,18891-2,6994-8"
"CEQ" 5464355 "Cefquinome" "Cephalosporins (4th gen.)" "NA" "" "cefquinoma,cefquinome,cefquinomum,cobactan" "100046-2,76150-2"
"CEQ" 5464355 "Cefquinome" "Cephalosporins (4th gen.)" "QG51AA07,QJ01DE90,QJ51DE90" "" "cefquinoma,cefquinome,cefquinomum,cobactan" "100046-2,76150-2"
"CRD" 5284529 "Cefroxadine" "Cephalosporins (1st gen.)" "J01DB11" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "cefroxadin,cefroxadine,cefroxadino,cefroxadinum,oraspor" 2.1 "g" ""
"CFS" 656575 "Cefsulodin" "Cephalosporins (3rd gen.)" "J01DD03" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfsl,cfsu" "cefonomil,cefsulodin,cefsulodine,cefsulodino,cefsulodinum" 4 "g" "127-1,128-9,129-7,130-5,131-3,18892-0,25242-9,55647-2"
"CSU" 68718 "Cefsumide" "Cephalosporins (unclassified gen.)" "NA" "" "cefsulmid,cefsumide,cefsumido,cefsumidum" ""
@@ -117,12 +117,12 @@
"CPL" 5362114 "Cefteram pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefteram pivoxil,cefterampivoxil,tomiron" ""
"CTL" 65755 "Ceftezole" "Cephalosporins (1st gen.)" "J01DB12" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "ceftezol,ceftezole,ceftezolo,ceftezolum,demethylcefazolin" 3 "g" ""
"CTB" 5282242 "Ceftibuten" "Cephalosporins (3rd gen.)" "J01DD14" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cb,cfbu,ctb,tib" "ceftem,ceftibuten,ceftibuten dihydrate,ceftibuten hydrate,ceftibutene,ceftibuteno,ceftibutenum,ceftibutin,cephem,ceprifran,isocef,keimax" 0.4 "g" "35777-2,35778-0,35779-8,6996-3"
"TIO" 6328657 "Ceftiofur" "Cephalosporins (3rd gen.)" "NA" "" "ceftiofur,ceftiofurum,excede,excenel,naxcel" "23709-9,35780-6,35781-4,55652-2"
"TIO" 6328657 "Ceftiofur" "Cephalosporins (3rd gen.)" "QJ01DD90,QJ51DD90" "" "ceftiofur,ceftiofurum,excede,excenel,naxcel" "23709-9,35780-6,35781-4,55652-2"
"CZX" 6533629 "Ceftizoxime" "Cephalosporins (3rd gen.)" "J01DD07" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfzx,ctz,cz,czx,tiz,zox" "cefizox,ceftisomin,ceftix,ceftizoxima,ceftizoxime,ceftizoximum,epocelin,eposerin" 4 "g" "136-2,137-0,138-8,139-6,18894-6,20378-6,23622-4,25243-7,3450-4,6997-1"
"CZP" 9578661 "Ceftizoxime alapivoxil" "Cephalosporins (3rd gen.)" "NA" "" "" ""
"BPR" 135413542 "Ceftobiprole" "Cephalosporins (5th gen.)" "NA" "" "ceftobiprole" "43269-0,43270-8,43271-6,43272-4,85052-9"
"CFM1" 135413544 "Ceftobiprole medocaril" "Cephalosporins (5th gen.)" "J01DI01" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "" 1.5 "g" ""
"CZT" 86291594 "Ceftolozane/tazobactam" "Cephalosporins (5th gen.)" "J01DI54" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "CEI" "zerbaxa" 3 "g" "101484-4,73602-5,73624-9,73647-0,87735-7"
"CZT" 86291594 "Ceftolozane/tazobactam" "Cephalosporins (5th gen.)" "J01DI54" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "cei" "zerbaxa" 3 "g" "101484-4,73602-5,73624-9,73647-0,87735-7"
"CRO" 5479530 "Ceftriaxone" "Cephalosporins (3rd gen.)" "J01DD04" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "axo,cax,cftr,cro,ctr,frx,tx" "biotrakson,cefatriaxone,cefatriaxone hydrate,ceftriaxon,ceftriaxona,ceftriaxone,ceftriaxone sodium,ceftriaxonum,ceftriazone,cephtriaxone,longacef,rocefin,rocephalin,rocephin,rocephine,rophex" 2 "g" "101485-1,140-4,141-2,142-0,143-8,18895-3,25244-5,25367-4,31140-7,31141-5,3451-2,41681-8,41682-6,41683-4,41732-9,50633-7,55190-3,6998-9,80957-4"
"CEB" "Ceftriaxone/beta-lactamase inhibitor" "Cephalosporins (3rd gen.)" "J01DD63" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "" 2 "g" ""
"CXM" 5479529 "Cefuroxime" "Cephalosporins (2nd gen.)" "J01DC02,S01AA27" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cfrx,cfur,cfx,crm,cxm,fur,rox,xm" "biofuroksym,cefuril,cefuroxim,cefuroxima,cefuroxime,cefuroxime acid,cefuroximine,cefuroximo,cefuroximum,cephuroxime,kefurox,sharox,zinacef,zinacef danmark" 0.5 "g" 3 "g" "101503-1,144-6,145-3,146-1,147-9,18896-1,20460-2,25245-2,3452-0,35782-2,35783-0,51724-3,51774-8,55653-0,55654-8,6999-7,74699-0,80608-3,80617-4"
@@ -137,13 +137,14 @@
"CIX" 47472 "Ciclopirox" "Antifungals/antimycotics" "D01AE14,G01AX12" "Antifungals for topical use" "Other antifungals for topical use" "cipx" "butaconazole,butoconazol,butoconazole,butoconazolum,ciclodan,ciclopirox,ciclopirox gel,ciclopirox olamin,ciclopiroxum,compositenstarke,dahlin,femstat,gynofort,loprox,loprox cream,loprox gel,penlac,polyfructosanum,stieprox" ""
"CIN" 2762 "Cinoxacin" "Quinolones" "J01MB06" "Quinolone antibacterials" "Other quinolones" "cino,cnox" "azolinic acid,cinobac,cinobactin,cinoxacin,cinoxacine,cinoxacino,cinoxacinum,clinoxacin,noxigram,uronorm" 1 "g" "180-0,181-8,182-6,183-4,18905-0,55656-3"
"CIP" 2764 "Ciprofloxacin" "Quinolones" "J01MA02,S01AE03,S02AA15,S03AA07" "Quinolone antibacterials" "Fluoroquinolones" "ci,cip,cipr,cp" "alcon cilox,auripro,bacquinor,baflox,baycip,bernoflox,cetraxal,ciflox,cifloxin,ciloxan,ciplus,ciprecu,ciprine,ciprinol,cipro i.v.,cipro iv,cipro xl,cipro xr,ciprobay,ciprobay uro,ciprocinol,ciprodar,ciproflox,ciprofloxacin,ciprofloxacina,ciprofloxacine,ciprofloxacino,ciprofloxacinum,ciprogis,ciprolin,ciprolon,cipromycin,ciproquinol,ciprowin,ciproxan,ciproxin,ciproxina,ciproxine,ciriax,citopcin,corsacin,cyprobay,fimoflox,flociprin,ipiflox,italnik,linhaliq,otiprio,probiox,proflaxin,quinolid,quintor,rancif,roxytal,septicide,sophixin ofteno,spitacin,superocin,velmonit,velomonit,zumaflox" 1 "g" 0.8 "g" "101500-7,14031-9,14032-7,14058-2,14059-0,184-2,185-9,186-7,187-5,18906-8,20377-8,23621-6,25180-1,25181-9,25188-4,25189-2,25248-6,34636-1,3484-3,42644-5,55194-5,7002-9"
"CIM" "Ciprofloxacin/metronidazole" "Other antibacterials" "J01RA10" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIO" "Ciprofloxacin/ornidazole" "Other antibacterials" "J01RA12" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIT" "Ciprofloxacin/tinidazole" "Other antibacterials" "J01RA11" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIM" "Ciprofloxacin/metronidazole" "Quinolones" "J01RA10" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIO" "Ciprofloxacin/ornidazole" "Quinolones" "J01RA12" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIT" "Ciprofloxacin/tinidazole" "Quinolones" "J01RA11" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CLR" 84029 "Clarithromycin" "Macrolides/lincosamides" "J01FA09" "Macrolides, lincosamides and streptogramins" "Macrolides" "ch,cla,clar,clm,clr" "abbotic,astromen,biaxin,biaxin filmtab,biaxin hp,biaxin xl,biaxin xl filmtab,bicrolid,clacee,clacid,clacine,clambiotic,clarem,claribid,claricide,claridar,claripen,clarith,clarithromycin,clarithromycine,clarithromycinum,claritromicina,clathromycin,crixan,cyllid,cyllind,fromilid,heliclar,klabax,klacid,klaciped,klaricid,klaricid h.p,klaricid h.p.,klaricid pediatric,klaricid xl,klarid,klarin,kofron,mabicrol,macladin,maclar,prevpac,veclam,vikrol,zeclar" 0.5 "g" 1 "g" "100048-8,16619-9,16620-7,188-3,189-1,18907-6,190-9,191-7,20375-2,23619-0,25190-0,25191-8,25192-6,25253-6,34638-7,43987-7,43990-1,43991-9,7003-7,80559-8,89485-7"
"CLA1" 5280980 "Clavulanic acid" "Other antibacterials" "NA" "" "acide clavulanique,acido clavulanico,acidum clavulanicum,clavulanate,clavulanate acid,clavulanate lithium,clavulanateacid,clavulanic acid,clavulansaeure,clavulansaure,clavulinic acid,clavulox,serdaxin,sodium clavulanate" ""
"CLX" 60063 "Clinafloxacin" "Quinolones" "NA" "" "clinafloxacin" "32376-6,33284-1,35785-5,35786-3,7004-5"
"CLI" 446598 "Clindamycin" "Macrolides/lincosamides" "D10AF01,G01AA10,J01FF01" "Macrolides, lincosamides and streptogramins" "Lincosamides" "cc,cd,cli,clin,cm,da" "antirobe,chlolincocin,clindaderm,clindamicina,clindamycin,clindamycine,clindamycinum,clinimycin,dalacin c,dalacine,klimicin,sobelin" 1.2 "g" 1.8 "g" "16621-5,16622-3,18908-4,192-5,193-3,194-1,195-8,25249-4,3486-8,42720-3,55657-1,55658-9,55659-7,55660-5,61188-9,7005-2"
"CLI1" "Clindamycin inducible screening" "Macrolides/lincosamides" "NA" "clindamycin inducible,clinda inducible,clin inducible" "" ""
"CLF" 2794 "Clofazimine" "Antimycobacterials" "J04BA01" "Drugs for treatment of lepra" "Drugs for treatment of lepra" "clof" "chlofazimine,clofazimin,clofazimina,clofazimine,clofaziminum,colfazimine,lampren,lamprene,riminophenazine" 0.1 "g" "16623-1,20376-0,23620-8,23627-3,43986-9,43988-5,43989-3,55661-3,55662-1,96108-6"
"CLF1" 2799 "Clofoctol" "Other antibacterials" "J01XX03" "Other antibacterials" "Other antibacterials" "" "clofoctol,clofoctolo,clofoctolum,gramplus,octofene" ""
"CLM" 71807 "Clometocillin" "Beta-lactams/penicillins" "J01CE07" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "chlomethocillin,clometacillin,clometocilina,clometocillin,clometocilline,clometocillinum,rixapen" 1 "g" ""
@@ -154,32 +155,32 @@
"COP" "Colistin/polysorbate" "Other antibacterials" "NA" "" "" ""
"CYC" 6234 "Cycloserine" "Oxazolidinones" "J04AB01" "Drugs for treatment of tuberculosis" "Antibiotics" "cycl" "cicloserina,closerin,closina,cyclorin,cycloserin,cycloserine,cycloserinum,farmiserina,micoserina,miroserina,miroseryn,novoserin,oxamicina,oxamycin,seromycin,tebemicina,tisomycin,wasserina" 0.75 "g" "16702-3,18914-2,212-1,213-9,214-7,215-4,23608-3,25207-2,25208-0,25209-8,25251-0,3519-6,55667-0"
"DAL" 23724878 "Dalbavancin" "Glycopeptides" "J01XA04" "Other antibacterials" "Glycopeptide antibacterials" "dalb" "dalbavancin,dalvance" 1.5 "g" "41688-3,41689-1,41690-9,41734-5"
"DAN" 71335 "Danofloxacin" "Quinolones" "NA" "" "advocin,danofloxacin,danofloxacine,danofloxacino,danofloxacinum" "73601-7,73623-1,73646-2"
"DAN" 71335 "Danofloxacin" "Quinolones" "QJ01MA92" "" "advocin,danofloxacin,danofloxacine,danofloxacino,danofloxacinum" "73601-7,73623-1,73646-2"
"DPS" 2955 "Dapsone" "Other antibacterials" "D10AX05,J04BA02" "Drugs for treatment of lepra" "Drugs for treatment of lepra" "" "aczone,araldite ht,atrisone,avlosulfon,avlosulfone,avlosulphone,avsulfor,bis sulfone,bissulfone,bissulphone,croysulfone,croysulphone,dapson,dapsona,dapsone,dapsonum,di sulfone,diaphenyl sulfone,diaphenylsulfon,diaphenylsulfone,diaphenylsulphon,diaphenylsulphone,dimitone,diphenasone,diphone,disulfone,disulone,disulphone,dubronax,dubronaz,dumitone,eporal,metabolite c,novophone,protogen,servidapson,slphadione,sulfadione,sulfona,sulfone ucb,sulfonyldianiline,sulphadione,sulphonyldianiline,sumicure s,tarimyl,udolac" 50 "mg" "51698-9,9747-7"
"DAP" 16134395 "Daptomycin" "Other antibacterials" "J01XX09" "Other antibacterials" "Other antibacterials" "dap,dapt" "cidecin,cubicin,dapcin,daptomicina,daptomycine,daptomycinum" 0.28 "g" "35787-1,35788-9,35789-7,41691-7"
"DFX" 487101 "Delafloxacin" "Quinolones" "J01MA23" "" "baxdela,delafloxacin,delafloxacinum,quofenix" 0.9 "g" 0.6 "g" "88885-9,90447-4,93790-4"
"DLM" 6480466 "Delamanid" "Antimycobacterials" "J04AK06" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "dela" "delamanid,deltyba" 0.2 "g" "93851-4,96109-4"
"DEM" 54680690 "Demeclocycline" "Tetracyclines" "D06AA01,J01AA01" "Tetracyclines" "Tetracyclines" "" "bioterciclin,clortetrin,declomycin,deganol,demeclociclina,demeclocycline,demeclocyclinum,demeclor,demetraclin,diuciclin,elkamicina,ledermycin,mexocine,novotriclina,perciclina,sumaclina" 0.6 "g" "10982-7,18915-9,216-2,217-0,218-8,219-6,29494-2,7006-0"
"DKB" 470999 "Dibekacin" "Aminoglycosides" "J01GB09" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "debecacin,dibekacin,dibekacin sulfate,dibekacina,dibekacine,dibekacinum,dideoxykanamycin b,kappati,orbicin,panamicin" 0.14 "g" "55669-6,55670-4,55671-2,55672-0"
"DKB" 470999 "Dibekacin" "Aminoglycosides" "J01GB09,S01AA29" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "debecacin,dibekacin,dibekacin sulfate,dibekacina,dibekacine,dibekacinum,dideoxykanamycin b,kappati,orbicin,panamicin" 0.14 "g" "55669-6,55670-4,55671-2,55672-0"
"DIC" 18381 "Dicloxacillin" "Beta-lactams/penicillins" "J01CF01" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "dicl" "dichloroxacillin,diclossacillina,dicloxaciclin,dicloxacilin,dicloxacilina,dicloxacillin,dicloxacillin sodium,dicloxacillina,dicloxacilline,dicloxacillinum,dicloxacycline,dycill,dynapen,maclicine,nm|| dicloxacillin,pathocil" 2 "g" 2 "g" "10984-3,16769-2,18916-7,220-4,221-2,222-0,223-8,25252-8,32380-8,55668-8"
"DIF" 56206 "Difloxacin" "Quinolones" "NA" "" "dicural,difloxacin,pulsaflox" "35790-5,35791-3,35792-1"
"DIF" 56206 "Difloxacin" "Quinolones" "QJ01MA94" "" "dicural,difloxacin,pulsaflox" "35790-5,35791-3,35792-1"
"DIR" 6473883 "Dirithromycin" "Macrolides/lincosamides" "J01FA13" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "dirithromycin,dirithromycine,dirithromycinum,diritromicina,divitross,dynabac,noriclan,valodin" 0.5 "g" "35793-9,35794-7,35795-4,7007-8"
"DOR" 73303 "Doripenem" "Carbapenems" "J01DH04" "Other beta-lactam antibacterials" "Carbapenems" "dori" "doribax,doripenem,doripenem hydrate,finibax" 1.5 "g" "56031-8,58711-3,60535-2,72893-1"
"DOX" 54671203 "Doxycycline" "Tetracyclines" "A01AB22,J01AA02" "Tetracyclines" "Tetracyclines" "dox,doxy" "atridox,azudoxat,deoxymykoin,dossiciclina,doxcycline anhydrous,doxiciclina,doxirobe,doxitard,doxivetin,doxycen,doxychel,doxycin,doxycyclin,doxycycline,doxycycline calcium,doxycycline hyclate,doxycyclinum,doxylin,doxysol,doxytec,doxytetracycline,hydramycin,investin,jenacyclin,liviatin,monodox,oracea,periostat,ronaxan,spanor,supracyclin,vibramycin,vibramycin novum,vibramycine,vibravenos,zenavod" 0.1 "g" 0.1 "g" "10986-8,18917-5,20379-4,21250-6,224-6,225-3,226-1,227-9,23623-2,25223-9,26902-7,7008-6"
"ECO" 3198 "Econazole" "Antifungals/antimycotics" "D01AC03,G01AF05" "Antifungals for topical use" "Imidazole and triazole derivatives" "econ" "econazol,econazole,econazolum,ecostatin,ecostatin cream,palavale,pevaryl,spectazole,spectazole cream" "25595-0,25637-0,54178-9,55673-8"
"ENX" 3229 "Enoxacin" "Quinolones" "J01MA04" "Quinolone antibacterials" "Fluoroquinolones" "enox" "almitil,bactidan,bactidron,comprecin,enofloxacine,enoksetin,enoram,enoxacin,enoxacina,enoxacine,enoxacino,enoxacinum,enoxen,enoxin,enoxor,flumark,penetrex" 0.8 "g" "16816-1,18918-3,228-7,229-5,230-3,231-1,3590-7,41692-5"
"ENR" 71188 "Enrofloxacin" "Quinolones" "NA" "" "baytril,enrofloxacin,enrofloxacine,enrofloxacino,enrofloxacinum,enroxil" "23712-3,35796-2,35797-0,35798-8"
"ENV" 135565326 "Enviomycin" "Antimycobacterials" "J04AB06" "tuberactinomycin" "enviomicina,enviomycin,enviomycina,enviomycinum,tuberactin" ""
"ENR" 71188 "Enrofloxacin" "Quinolones" "QJ01MA90" "" "baytril,enrofloxacin,enrofloxacine,enrofloxacino,enrofloxacinum,enroxil" "23712-3,35796-2,35797-0,35798-8"
"ENV" 135565326 "Enviomycin" "Antimycobacterials" "J04AB06" "tuberactinomycin" "enviomicina,enviomycin,enviomycina,enviomycinum,tuberactin" 1 "g" ""
"EPE" "Eperozolid" "Other antibacterials" "NA" "" "" ""
"EPC" 71392 "Epicillin" "Beta-lactams/penicillins" "J01CA07" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "dexacillin,dihydroampicillin,epicilina,epicillin,epicilline,epicillinum" 2 "g" 2 "g" ""
"EPP" 68916 "Epiroprim" "Other antibacterials" "NA" "" "epiroprim,epiroprima,epiroprime,epiroprimum" ""
"ERV" 54726192 "Eravacycline" "Tetracyclines" "J01AA13" "Tetracyclines" "Tetracyclines" "erav" "eravacycline,xerava" "100049-6,85423-2,93767-2"
"ERV" 54726192 "Eravacycline" "Tetracyclines" "J01AA13" "Tetracyclines" "Tetracyclines" "erav" "eravacycline,xerava" 0.14 "g" "100049-6,85423-2,93767-2"
"ETP" 150610 "Ertapenem" "Carbapenems" "J01DH03" "Other beta-lactam antibacterials" "Carbapenems" "erta,etp" "ertapenem,invanz" 1 "g" "101486-9,35799-6,35800-2,35801-0,35802-8"
"ERY" 12560 "Erythromycin" "Macrolides/lincosamides" "D10AF02,J01FA01,S01AA17" "Macrolides, lincosamides and streptogramins" "Macrolides" "e,em,ery,eryt" "abboticin,abomacetin,acneryne,acnesol,akne cordes losung,aknederm ery gel,aknemycin,austrias,benzamycin,bristamycin,derimer,deripil,dotycin,dumotrycin,emuvin,emycin,endoeritrin,erecin,erisone,eritomicina,eritrocina,eritromicina,ermycin,eryacne,eryacnen,eryc sprinkles,erycen,erycette,erycin,erycinum,eryderm,erydermer,erygel,eryhexal,erymax,erymed,erypar,erysafe,erytab,erythrocin,erythrocin stearate,erythroderm,erythrogran,erythroguent,erythromid,erythromycin,erythromycin a,erythromycin base,erythromycin lactate,erythromycine,erythromycines,erythromycinum,erytop,erytrociclin,ilocaps,ilosone,iloticina,ilotycin,ilotycin gluceptate,ilotycin t.s.,inderm,inderm gel,indermretcin,latotryd,lederpax,mephamycin,mercina,oftamolets,paediathrocin,pantoderm,pantodrin,pantomicina,pce dispertab,pharyngocin,primacine,propiocine,proterytrin,retcin,robimycin,romycin,sansac,skid gel e,staticin,stiemicyn,stiemycin,theramycin z,tiloryth,tiprocin,torlamicina,udima ery gel,wyamycin s" 2 "g" 1 "g" "100050-4,11576-6,12298-6,16829-4,16830-2,18919-1,18920-9,20380-2,232-9,233-7,234-5,235-2,236-0,23633-1,237-8,238-6,239-4,25224-7,25275-9,3597-2,7009-4"
"ETH" 14052 "Ethambutol" "Antimycobacterials" "J04AK02" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "etha" "aethambutolum,diambutol,ebutol,etambutol,etambutolo,etapiam,ethambutol,ethambutolum,myambutol,mycobutol,purderal,servambutol,tibutol" 1.2 "g" 1.2 "g" "100051-2,16841-9,18921-7,20381-0,23625-7,240-2,241-0,242-8,243-6,25187-6,25194-2,25195-9,25230-4,25404-5,3607-9,42645-2,42646-0,55154-9,55674-6,56025-0,7010-2,89491-5"
"ETI" 456476 "Ethambutol/isoniazid" "Antimycobacterials" "J04AM03" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
"ETI1" 2761171 "Ethionamide" "Antimycobacterials" "J04AD03" "Drugs for treatment of tuberculosis" "Thiocarbamide derivatives" "ethi" "aethionamidum,aetina,aetiva,amidazin,amidazine,ethatyl,ethimide,ethina,ethinamide,ethionamide,ethionamidum,ethioniamide,ethylisothiamide,ethyonomide,etimid,etiocidan,etionamid,etionamida,etionamide,etioniamid,etionid,etionizin,etionizina,etionizine,fatoliamid,iridocin,iridocin bayer,iridozin,isothin,isotiamida,itiocide,nicotion,nisotin,nizotin,rigenicid,sertinon,teberus,thianid,thianide,thioamide,thiodine,thiomid,thioniden,tianid,tiomid,trecator,trecator sc,trekator,trescatyl,trescazide,tubenamide,tubermin,tuberoid,tuberoson" 0.75 "g" "16099-4,16845-0,18922-5,20382-8,23617-4,25183-5,25196-7,25198-3,25231-2,41693-3,42647-8,42648-6,7011-0,96110-2"
"ETO" 6034 "Ethopabate" "Other antibacterials" "NA" "" "amprol plus,ethopabat,ethopabate,ethyl pabate" ""
"ETO" 6034 "Ethopabate" "Other antibacterials" "QP51AX17" "" "amprol plus,ethopabat,ethopabate,ethyl pabate" ""
"EXE" "Exebacase" "NA" "" "" ""
"FAR" 65894 "Faropenem" "Other antibacterials" "J01DI03" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "faropenem,faropenem sodium,fropenem,fropenum sodium" 0.75 "g" "73600-9,73622-3,73645-4"
"FDX" 10034073 "Fidaxomicin" "Other antibacterials" "A07AA12" "" "dificid,dificlir,difimicin,fidaxomicin,lipiarmicin,lipiarmycin,lipiarrmycin,tiacumicin b" 0.4 "g" "73599-3,73621-5,73644-7"
@@ -187,23 +188,23 @@
"FLA" 46783781 "Flavomycin" "Other antibacterials" "NA" "" "flavophospholipol,moenomycin complex" ""
"FLE" 3357 "Fleroxacin" "Quinolones" "J01MA08" "Quinolone antibacterials" "Fluoroquinolones" "fler" "fleroxacin,fleroxacine,fleroxacino,fleroxacinum,fleroxicin,megalocin,megalone,megalosin,quinodis" 0.4 "g" 0.4 "g" "25411-0,32372-5,35806-9,7012-8"
"FLO" 65864 "Flomoxef" "Other antibacterials" "J01DC14" "" "flomoxef,flomoxefo,flomoxefum" 2 "g" "100052-0,53822-3"
"FLR" 114811 "Florfenicol" "Other antibacterials" "NA" "" "aquafen,florfenicol,nuflor,nuflor gold" "23740-4,35807-7,35808-5,87599-7"
"FLR" 114811 "Florfenicol" "Other antibacterials" "QJ01BA90,QJ51BA90" "" "aquafen,florfenicol,nuflor,nuflor gold" "23740-4,35807-7,35808-5,87599-7"
"FLC" 21319 "Flucloxacillin" "Beta-lactams/penicillins" "J01CF05" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "clox,flux" "culpen,floxacillin,floxacillin sodium,floxapen,floxapen sodium salt,fluclox,flucloxacilina,flucloxacillin,flucloxacilline,flucloxacillinum,fluorochloroxacillin,staphylex" 2 "g" 2 "g" ""
"FLU" 3365 "Fluconazole" "Antifungals/antimycotics" "D01AC15,J02AC01" "Antimycotics for systemic use" "Triazole derivatives" "fluc,fluz,flz" "alflucoz,alfumet,alkanazole,biocanol,biozole,biozolene,canzol,cryptal,diflazon,diflucan,dimycon,elazor,flucazol,fluconazol,fluconazole,fluconazole capsules,fluconazoli,fluconazolum,flucoral,flucostat,flukezol,flunazol,flunizol,flusol,fluzon,fluzone,forcan,fuconal,fungata,loitin,oxifugol,pritenzol,syscan,trican,triconal,triflucan,zoltec" 0.2 "g" 0.2 "g" "10987-6,16870-8,18924-1,248-5,249-3,250-1,251-9,25255-1,7013-6,80530-9"
"FCT" 3366 "Flucytosine" "Antifungals/antimycotics" "D01AE21,J02AX01" "Antifungals for topical use" "Other antifungals for topical use" "5flc,fcu,fluo,fluy" "alcobon,ancoban,ancobon,ancotil,ancotyl,flourocytosine,flucitosina,flucystine,flucytosin,flucytosine,flucytosinum,flucytosone,fluocytosine,fluorcytosine,fluorocytosine" ""
"FCT" 3366 "Flucytosine" "Antifungals/antimycotics" "D01AE21,J02AX01" "Antifungals for topical use" "Other antifungals for topical use" "5flc,fcu,fluo,fluy" "alcobon,ancoban,ancobon,ancotil,ancotyl,flourocytosine,flucitosina,flucystine,flucytosin,flucytosine,flucytosinum,flucytosone,fluocytosine,fluorcytosine,fluorocytosine" 10 "g" 10 "g" ""
"FLM" 3374 "Flumequine" "Quinolones" "J01MB07" "Quinolone antibacterials" "Other quinolones" "" "apurone,fantacin,flumequine,flumequino,flumequinum,flumigal,flumiquil,flumisol,flumix,imequyl" 1.2 "g" "55675-3,55676-1,55677-9,55678-7"
"FLR1" 71260 "Flurithromycin" "Macrolides/lincosamides" "J01FA14" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "flurithromicina,flurithromycime,flurithromycin,flurithromycine,flurithromycinum,fluritromicina,fluritromycinum,flurizic" 0.75 "g" ""
"FFL" 214356 "Fosfluconazole" "Antifungals/antimycotics" "NA" "" "fosfluconazole,phosfluconazole,procif,prodif" ""
"FOS" 446987 "Fosfomycin" "Other antibacterials" "J01XX01" "Other antibacterials" "Other antibacterials" "ff,fm,fo,fof,fos,fosf" "calcium fosfomycin,fosfocina,fosfomicin,fosfomicina,fosfomycin,fosfomycin sodium,fosfomycine,fosfomycinum,fosfonomycin,infectophos,monuril,monurol,phosphonemycin,phosphonomycin,veramina" 3 "g" 8 "g" "25596-8,25653-7,35809-3,35810-1"
"FOS" 446987 "Fosfomycin" "Other antibacterials" "J01XX01,S02AA17" "Other antibacterials" "Other antibacterials" "ff,fm,fo,fof,fos,fosf" "calcium fosfomycin,fosfocina,fosfomicin,fosfomicina,fosfomycin,fosfomycin sodium,fosfomycine,fosfomycinum,fosfonomycin,infectophos,monuril,monurol,phosphonemycin,phosphonomycin,veramina" 3 "g" 8 "g" "25596-8,25653-7,35809-3,35810-1"
"FMD" 572 "Fosmidomycin" "Other antibacterials" "NA" "" "fosmidomycin,fosmidomycina,fosmidomycine,fosmidomycinum" ""
"FRM" 8378 "Framycetin" "Aminoglycosides" "D09AA01,R01AX08,S01AA07" "fram" "actilin,actiline,antibiotique,bycomycin,dekamycin iii,endomixin,enterfram,fradiomycin,fradiomycin b,fradiomycinum,framicetina,framidal,framycetin,framycetin sulfate,framycetine,framycetinum,framycin,framygen,francetin,fraquinol,jernadex,myacine,myacyne,mycerin,mycifradin,neobrettin,neolate,neomas,neomcin,neomicina,neomin,neomycin,neomycin b,neomycin b sulfate,neomycin solution,neomycin sulfate,neomycin sulphate,neomycinb,neomycine,neomycinum,nivemycin,pimavecort,soframycin,soframycine,tuttomycin,vonamycin,vonamycin powder v" "18926-6,257-6,258-4,259-2,260-0,55679-5"
"FUR" 6870646 "Furazidin" "Other antibacterials" "J01XE03" "Other antibacterials" "Nitrofuran derivatives" "" "akritoin,furagin,furaginum,furamag,furazidin,furazidine" 0.3 "g" ""
"FRZ" 5323714 "Furazolidone" "Other antibacterials" "G01AX06" "" "bifuron,corizium,coryzium,diafuron,enterotoxon,furall,furaxon,furaxone,furazol,furazolidine,furazolidon,furazolidona,furazolidone,furazolidonum,furazolum,furazon,furidon,furovag,furox aerosol powder,furoxal,furoxane,furoxon,furoxone,furoxone liquid,furoxone swine mix,furozolidine,giardil,giarlam,medaron,neftin,nicolen,nifulidone,nifuran,nifurazolidone,nifurazolidonum,nitrofurazolidone,nitrofurazolidonum,nitrofuroxon,optazol,ortazol,puradin,roptazol,sclaventerol,tikofuran,topazone,trichofuron,tricofuron,tricoron,trifurox,viofuragyn" "69574-2,87794-4"
"FUS" 3000226 "Fusidic acid" "Other antibacterials" "D06AX01,D09AA02,J01XC01,S01AA13" "Other antibacterials" "Steroid antibacterials" "fa,fusi" "acide fusidique,acido fusidico,acidum fusidicum,flucidin,fucidate,fucidate sodium,fucidic acid,fucidin,fucidin acid,fucithalmic,fusidate,fusidate acid,fusidic acid,fusidicacid,fusidine,fusidinic acid,ramycin,taksta" 1.5 "g" 1.5 "g" ""
"GAM" 59364992 "Gamithromycin" "Macrolides/lincosamides" "NA" "" "gamithromycin" "100054-6,88376-9,88378-5"
"GAM" 59364992 "Gamithromycin" "Macrolides/lincosamides" "QJ01FA95" "" "gamithromycin" "100054-6,88376-9,88378-5"
"GRN" 124093 "Garenoxacin" "Quinolones" "J01MA19" "" "ganefloxacin,garenfloxacin,garenoxacin" 0.4 "g" "35811-9,35812-7,35813-5"
"GAT" 5379 "Gatifloxacin" "Quinolones" "J01MA16,S01AE06" "Quinolone antibacterials" "Fluoroquinolones" "gati" "gatiflo,gatifloxacin,gatifloxacin hydrate,gatifloxacine,gatifloxcin,gatilox,gatiquin,gatispan,tequin,tequin and zymar,zymaxid" 0.4 "g" 0.4 "g" "31036-7,31038-3,31040-9,31042-5,41494-6"
"GEM" 9571107 "Gemifloxacin" "Quinolones" "J01MA15" "Quinolone antibacterials" "Fluoroquinolones" "" "factiv,factive,gemifioxacin,gemifloxacin,gemifloxacine,gemifloxacino,gemifloxacinum" 0.32 "g" "35814-3,35815-0,35816-8,41697-4"
"GEM" 9571107 "Gemifloxacin" "Quinolones" "J01MA15" "Quinolone antibacterials" "Fluoroquinolones" "" "factiv,factive,gemifioxacin,gemifloxacin,gemifloxacine,gemifloxacino,gemifloxacinum" 0.32 "g" 0.2 "g" "35814-3,35815-0,35816-8,41697-4"
"GEN" 3467 "Gentamicin" "Aminoglycosides" "D06AX07,J01GB03,S01AA11,S02AA14,S03AA06" "Aminoglycoside antibacterials" "Other aminoglycosides" "cn,gen,gent,gm" "apogen,centicin,cidomycin,garamycin,garasol,genoptic liquifilm,genoptic s.o.p.,gentacycol,gentafair,gentak,gentamar,gentamcin sulfate,gentamicin,gentamicina,gentamicine,gentamicins,gentamicinum,gentamycin,gentamycins,gentamycinum,gentavet,gentocin,jenamicin,lyramycin,oksitselanim,refobacin,refobacin tm,septigen,uromycine" 0.24 "g" "101494-3,13561-6,13562-4,15106-8,18928-2,18929-0,22746-2,22747-0,266-7,267-5,268-3,269-1,31091-2,31092-0,31093-8,35668-3,35817-6,3663-2,3664-0,3665-7,39082-3,47109-4,50630-3,59379-8,7016-9,7017-7,7018-5,80971-5,88111-0,89481-6"
"GEH" "Gentamicin-high" "Aminoglycosides" "NA" "gehi,gehl,genta high,gentamicin high" "" "18929-0,35817-6,7017-7,7018-5"
"GEP" 25101874 "Gepotidacin" "Other antibacterials" "NA" "" "gepotidacin" ""
@@ -213,11 +214,11 @@
"HCH" 11979956 "Hachimycin" "Antifungals/antimycotics" "D01AA03,G01AA06,J02AA02" "Antimycotics for systemic use" "Antibiotics" "" "cabimicina,hachimicina,hachimycin,hachimycine,hachimycinum,trichomycinum,trichonat" ""
"HET" 443387 "Hetacillin" "Beta-lactams/penicillins" "J01CA18" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "etacillina,hetacilina,hetacillin,hetacillin acid,hetacilline,hetacillinum,phenazacillin,versapen" 2 "g" "18931-6,274-1,275-8,276-6,277-4"
"HYG" 56928061 "Hygromycin" "Aminoglycosides" "NA" "" "antihelmycin,hydromycin b,hygrovetine" ""
"IBX" "Ibrexafungerp" "Antifungals" "NA" "" "ibrexafungerp" ""
"IBX" "Ibrexafungerp" "Antifungals" "J02AX07" "" "ibrexafungerp" ""
"ICL" 213043 "Iclaprim" "Other antibacterials" "J01EA03" "" "iclaprim,mersarex" "73597-7,73619-9,73642-1"
"IPM" 104838 "Imipenem" "Carbapenems" "J01DH51" "Other beta-lactam antibacterials" "Carbapenems" "imci,imi,imip,imp" "imipemide,imipenem,imipenem anhydrous,imipenem hydrate,imipenem/cilastatin,imipenemum,imipenen,primaxin,recarbrio .,tienamycin" 2 "g" "101487-7,17010-0,18932-4,18933-2,23613-3,25221-3,25257-7,27331-8,278-2,279-0,280-8,281-6,282-4,283-2,284-0,285-7,35819-2,3688-9,54170-6,54171-4,54172-2,7019-3,85424-0,93232-7,96372-8"
"IPE" "Imipenem/EDTA" "Carbapenems" "NA" "" "" "35819-2,54170-6,54171-4,54172-2"
"IMR" "Imipenem/relebactam" "Carbapenems" "NA,J01DH56" "" "" "85424-0,93232-7,96372-8"
"IMR" "Imipenem/relebactam" "Carbapenems" "NA,J01DH56" "" "" 2 "g" "85424-0,93232-7,96372-8"
"ISV" 6918485 "Isavuconazole" "Antifungals/antimycotics" "J02AC05" "isav" "isavuconazole" 0.2 "g" 0.2 "g" "85381-2,88887-5"
"ISE" 3037209 "Isepamicin" "Aminoglycosides" "J01GB11" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "isepacin,isepalline,isepamicin,isepamicina,isepamicine,isepamicinsulphate,isepamicinum" 0.4 "g" "32381-6,35820-0,35821-8,55680-3"
"ISO" 3760 "Isoconazole" "Antifungals/antimycotics" "D01AC05,G01AF07" "Antimycotics for topic use" "Triazole derivatives" "" "isoconazol,isoconazole,isoconazolum,travogen" "55681-1,55682-9,55683-7,55684-5"
@@ -229,8 +230,8 @@
"KAH" "Kanamycin-high" "Aminoglycosides" "NA" "k_h,kahl" "" "18936-5,7023-5,7024-3"
"KAC" "Kanamycin/cephalexin" "Aminoglycosides" "NA" "" "" ""
"KET" 456201 "Ketoconazole" "Antifungals/antimycotics" "D01AC08,G01AF11,H02CA03,J02AB02" "Antimycotics for systemic use" "Imidazole derivatives" "keto,ktc" "extina,fungarest,fungoral,ketocanazole,ketoconazol,ketoconazole,ketoconazolum,ketoderm,nizoral,xolegel" 0.6 "g" "10990-0,12393-5,18937-3,25259-3,294-9,295-6,296-4,297-2,60091-6,60092-4,7025-0"
"KIT" "Kitasamycin" "Macrolides/lincosamides" "NA" "leucomycin" "jomybel,josacine,josamicina,josamycin,josamycine,josamycinum" ""
"LAS" 5360807 "Lasalocid" "Other antibacterials" "NA" "" "avatec,lasalocid,lasalocid a,lasalocide,lasalocide a,lasalocido,lasalocidum" "87598-9"
"KIT" "Kitasamycin" "Macrolides/lincosamides" "QJ01FA93" "leucomycin" "jomybel,josacine,josamicina,josamycin,josamycine,josamycinum" ""
"LAS" 5360807 "Lasalocid" "Other antibacterials" "QP51BB02" "" "avatec,lasalocid,lasalocid a,lasalocide,lasalocide a,lasalocido,lasalocidum" "87598-9"
"LSC" 71528768 "Lascufloxacin" "Quinolones" "J01MA25" "Quinolone antibacterials" "Fluoroquinolones" "" "lascufloxacin" 75 "mg" ""
"LTM" 47499 "Latamoxef" "Cephalosporins (3rd gen.)" "J01DD06" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "mox,moxa,moxalactam" "disodium moxalactam,festamoxin,lamoxactam,latamoxef,latamoxefum,moxalactamsupplement,shiomarin" 4 "g" ""
"LMU" 25185057 "Lefamulin" "Other antibacterials" "J01XX12" "" "lefamulin,xenleta" "85425-7,99281-8"
@@ -247,7 +248,7 @@
"LYM" 54707177 "Lymecycline" "Tetracyclines" "J01AA04" "Tetracyclines" "Tetracyclines" "" "biovetin,chlortetracyclin,ciclisin,ciclolysal,ciclolysine,infaciclina,limeciclina,lisinbiotic,lymecyclin,lymecycline,lymecyclinum,mucomycin,ntetracycline,tetralisal,tetralysal,vebicyclysal" 0.6 "g" 0.6 "g" "18941-5,310-3,311-1,312-9,313-7"
"MNA" 1292 "Mandelic acid" "Other antibacterials" "B05CA06,J01XX06" "Other antibacterials" "Other antibacterials" "" "acido mandelico,almond acid,ammonium mandelate,amygdalic acid,benzoglycolic acid,hydroxyacetic acid,kyselina mandlova,mandelic acid,paramandelic acid,phenylglycolic acid,uromaline" 12 "g" ""
"MGX" "Manogepix" "Antifungals" "NA" "" "manogepix" ""
"MAR" 60651 "Marbofloxacin" "Quinolones" "NA" "" "marbocyl,marbofloxacin,marbofloxacine,marbofloxacino,marbofloxacinum,zeniquin" "73596-9,73618-1,73641-3"
"MAR" 60651 "Marbofloxacin" "Quinolones" "QJ01MA93" "" "marbocyl,marbofloxacin,marbofloxacine,marbofloxacino,marbofloxacinum,zeniquin" "73596-9,73618-1,73641-3"
"MEC" 36273 "Mecillinam" "Beta-lactams/penicillins" "J01CA11" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "amdinocillin" "amdinocillin,coactin,hexacillin,mecilinamo,mecillinam,mecillinamum,micillinam,penicillin hx,selexidin" 1.2 "g" ""
"MEL" 71306732 "Meleumycin" "Macrolides/lincosamides" "NA" "" "" ""
"MEM" 441130 "Meropenem" "Carbapenems" "J01DH02" "Other beta-lactam antibacterials" "Carbapenems" "mem,mer,mero,mp,mrp" "meronem,meropen,meropenem,meropenem anhydrous,meropenem hydrate,meropenem trihydrate,meropenemum,merrem,merrem i.v.,merrem iv" 3 "g" "101222-8,101488-5,101489-3,18943-1,41406-0,6651-4,6652-2,6653-0,6654-8,7029-2,85426-5,85427-3,88892-5,90980-4"
@@ -279,9 +280,9 @@
"NAF" 8982 "Nafcillin" "Beta-lactams/penicillins" "J01CF06" "" "nafcilina,nafcillin,nafcillin sodium,nafcilline,nafcillinum,nallpen,naphcillin,unipen" 3 "g" "10993-4,18951-4,25232-0,346-7,347-5,348-3,349-1,41704-8"
"ZWK" 117587595 "Nafithromycin" "Macrolides/lincosamides" "NA" "" "nafithromycin" ""
"NAL" 4421 "Nalidixic acid" "Quinolones" "J01MB02" "Quinolone antibacterials" "Other quinolones" "na,nal,nali" "acide nalidixico,acide nalidixique,acido nalidissico,acido nalidixico,acidum nalidixicum,betaxina,dixiben,dixinal,eucisten,eucistin,innoxalomn,innoxalon,jicsron,kusnarin,naldixic acid,nalidic acid,nalidicron,nalidixan,nalidixane,nalidixate,nalidixate sodium,nalidixic,nalidixic acid,nalidixicacid,nalidixin,nalidixinic acid,nalidixinsaure,nalitucsan,nalurin,narigix,naxuril,neggram,negram,nevigramon,nicelate,nogram,poleon,sicmylon,specifen,specifin,unaserus,uralgin,uriben,uriclar,urisal,urodixin,uroman,uroneg,uronidix,uropan,wintomylon,wintron" 4 "g" ""
"NAR" 65452 "Narasin" "Other antibacterials" "NA" "" "monteban,narasin,narasin a,narasine,narasino,narasinum,narasul" "87570-8"
"NAR" 65452 "Narasin" "Other antibacterials" "QP51BB04" "" "monteban,narasin,narasin a,narasine,narasino,narasinum,narasul" "87570-8"
"NEM" 11993740 "Nemonoxacin" "Quinolones" "J01MB08" "Quinolone antibacterials" "Other quinolones" "" "nemonoxacin" ""
"NEO" 8378 "Neomycin" "Aminoglycosides" "A01AB08,A07AA01,B05CA09,D06AX04,J01GB05,R02AB01,S01AA03,S02AA07,S03AA01" "Aminoglycoside antibacterials" "Other aminoglycosides" "neom" "actilin,actiline,antibiotique,bycomycin,dekamycin iii,endomixin,enterfram,fradiomycin,fradiomycin b,fradiomycinum,framicetina,framidal,framycetin,framycetin sulfate,framycetine,framycetinum,framycin,framygen,francetin,fraquinol,jernadex,myacine,myacyne,mycerin,mycifradin,neobrettin,neolate,neomas,neomcin,neomicina,neomin,neomycin,neomycin b,neomycin b sulfate,neomycin solution,neomycin sulfate,neomycin sulphate,neomycinb,neomycine,neomycinum,nivemycin,pimavecort,soframycin,soframycine,tuttomycin,vonamycin,vonamycin powder v" 5 "g" "10995-9,18953-0,25262-7,354-1,355-8,356-6,357-4,41705-5"
"NEO" 8378 "Neomycin" "Aminoglycosides" "A01AB08,A07AA01,B05CA09,D06AX04,J01GB05,R02AB01,S01AA03,S02AA07,S03AA01" "Aminoglycoside antibacterials" "Other aminoglycosides" "neom" "actilin,actiline,antibiotique,bycomycin,dekamycin iii,endomixin,enterfram,fradiomycin,fradiomycin b,fradiomycinum,framicetina,framidal,framycetin,framycetin sulfate,framycetine,framycetinum,framycin,framygen,francetin,fraquinol,jernadex,myacine,myacyne,mycerin,mycifradin,neobrettin,neolate,neomas,neomcin,neomicina,neomin,neomycin,neomycin b,neomycin b sulfate,neomycin solution,neomycin sulfate,neomycin sulphate,neomycinb,neomycine,neomycinum,nivemycin,pimavecort,soframycin,soframycine,tuttomycin,vonamycin,vonamycin powder v" 5 "g" 1 "g" "10995-9,18953-0,25262-7,354-1,355-8,356-6,357-4,41705-5"
"NET" 441306 "Netilmicin" "Aminoglycosides" "J01GB07,S01AA23" "Aminoglycoside antibacterials" "Other aminoglycosides" "neti" "netillin,netilmicin,netilmicin sulfate,netilmicina,netilmicine,netilmicinum,netilyn,netira,nettacin,vectacin" 0.35 "g" 0.35 "g" "18954-8,25263-5,358-2,359-0,360-8,361-6,3848-9,3849-7,3850-5,47385-0,59565-2,59566-0,59567-8,7035-9"
"NIC" 9507 "Nicarbazin" "Other antibacterials" "NA" "" "nicarb,nicarbasin,nicarbazin,nicarbazine,nicoxin,nicrazin,nicrazine,nirazin" ""
"NIF" 71946 "Nifuroquine" "Quinolones" "NA" "" "abimasten,nifuroquina,nifuroquine,nifuroquinum,quinaldofur" ""
@@ -294,24 +295,24 @@
"NME" "Norfloxacin/metronidazole" "Other antibacterials" "J01RA14" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"NTI" "Norfloxacin/tinidazole" "Other antibacterials" "J01RA13" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"NVA" 10419027 "Norvancomycin" "Glycopeptides" "NA" "" "norvancomycin" ""
"NOV" 54675769 "Novobiocin" "Other antibacterials" "NA" "novo" "albamix,albamycin,cardelmycin,cathocin,cathomycin,crystallinic acid,inamycin,novobiocin,novobiocina,novobiocine,novobiocinum,robiocina,sirbiocina,spheromycin,stilbiocina,streptonivicin" "17378-1,18957-1,370-7,371-5,372-3,373-1,41706-3"
"NOV" 54675769 "Novobiocin" "Other antibacterials" "QJ01XX95" "novo" "albamix,albamycin,cardelmycin,cathocin,cathomycin,crystallinic acid,inamycin,novobiocin,novobiocina,novobiocine,novobiocinum,robiocina,sirbiocina,spheromycin,stilbiocina,streptonivicin" "17378-1,18957-1,370-7,371-5,372-3,373-1,41706-3"
"NYS" 6433272 "Nystatin" "Antifungals/antimycotics" "A07AA02,D01AA01,G01AA01" "nyst" "biofanal,candex lotion,comycin,diastatin,herniocid,moronal,myconystatin,mycostatin,mycostatin pastilles,mykinac,mykostatyna,nilstat,nistatin,nistatina,nyamyc,nyotran,nyotrantrade mark,nystaform,nystan,nystatin,nystatin a,nystatin g,nystatin hydrate,nystatin lf,nystatine,nystatinum,nystatyna,nystavescent,nystex,nystop,stamycin,terrastatin,zydin e" 1.5 "MU" "10697-1,10698-9,18958-9,35824-2,55689-4"
"OFX" 4583 "Ofloxacin" "Quinolones" "J01MA01,S01AE01,S02AA16" "Quinolone antibacterials" "Fluoroquinolones" "of,ofl,oflo,ofx" "bactocin,danoflox,dextrofloxacin,effexin,exocin,exocine,flobacin,flodemex,flotavid,flovid,floxal,floxil,floxin,floxin otic,floxstat,fugacin,inoflox,kinflocin,kinoxacin,levofloxacin hcl,liflox,loxinter,marfloxacin,medofloxine,mergexin,monoflocet,novecin,nufafloqo,occidal,ocuflox,oflocee,oflocet,oflocin,oflodal,oflodex,oflodura,ofloxacin,ofloxacin otic,ofloxacina,ofloxacine,ofloxacino,ofloxacinum,ofloxin,onexacin,operan,orocin,otonil,oxaldin,pharflox,praxin,puiritol,qinolon,quinolon,quotavil,sinflo,tabrin,taravid,tariflox,tarivid,telbit,tructum,uro tarivid,viotisone,visiren,zanocin" 0.4 "g" 0.4 "g" "18959-7,20384-4,23948-3,25264-3,374-9,375-6,376-4,377-2,3877-8,41408-6,41409-4,41410-2,42653-6,7038-3,72168-8"
"OOR" "Ofloxacin/ornidazole" "Other antibacterials" "J01RA09" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"OLE" 72493 "Oleandomycin" "Macrolides/lincosamides" "J01FA05" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "amimycin,landomycin,matromycin,oleandomicina,oleandomycin,oleandomycin a,oleandomycine,oleandomycinum,romicil" 1 "g" "18960-5,378-0,379-8,380-6,381-4,55690-2"
"OMC" 54697325 "Omadacycline" "Tetracyclines" "J01AA15" "" "amadacycline,omadacycline" 0.3 "g" 0.1 "g" "73594-4,73616-5,73639-7"
"OPT" 87880 "Optochin" "Other antibacterials" "NA" "" "numoquin,optochin,optoquine" "100055-3,73665-2"
"ORB" 60605 "Orbifloxacin" "Quinolones" "NA" "" "orbifloxacin" "35825-9,35826-7,35827-5"
"ORB" 60605 "Orbifloxacin" "Quinolones" "QJ01MA95" "" "orbifloxacin" "35825-9,35826-7,35827-5"
"ORI" 16136912 "Oritavancin" "Glycopeptides" "J01XA05" "Other antibacterials" "Glycopeptide antibacterials" "orit" "kimyrsa,oritavancin" "41707-1,41708-9,41709-7,41736-0"
"ORS" "Ormetroprim/sulfamethoxazole" "Other antibacterials" "NA" "" "" "73593-6,73615-7,73638-9"
"ORN" 28061 "Ornidazole" "Other antibacterials" "G01AF06,J01XD03,P01AB03" "Other antibacterials" "Imidazole derivatives" "" "madelen,ornidal,ornidazol,ornidazole,ornidazolum,tiberal" 1.5 "g" 1 "g" "55691-0,55692-8,55693-6,55694-4"
"OTE" 77050711 "Oteseconazole" "Antifungals/antimycotics" "J02AC06" "Antimycotics for systemic use" "Triazole derivatives" "" "oteseconazole" ""
"OTE" 77050711 "Oteseconazole" "Antifungals/antimycotics" "J02AC06" "Antimycotics for systemic use" "Triazole derivatives" "" "oteseconazole" 21 "mg" ""
"OXA" 6196 "Oxacillin" "Beta-lactams/penicillins" "J01CF04" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "ox,oxa,oxac,oxal,oxs" "bactocill,ossacillina,oxacilina,oxacillin,oxacillin sodium,oxacilline,oxacillinum,oxazocillin,oxazocilline,prostaphlin,prostaphlyn,sodium oxacillin" 2 "g" 2 "g" "18961-3,25265-0,382-2,383-0,384-8,385-5,3882-8,7039-1"
"OXO" 4628 "Oxolinic acid" "Quinolones" "J01MB05" "Quinolone antibacterials" "Other quinolones" "" "acide oxolinique,acido ossolico,acido oxolinico,acidum oxolinicum,aqualinic,cistopax,dioxacin,emyrenil,gramurin,inoxyl,nidantin,oksaren,orthurine,ossian,oxoboi,oxolinic,oxolinic acid,pietil,prodoxal,prodoxol,starner,tiurasin,ultibid,urinox,uritrate,urotrate,uroxol,utibid" 1 "g" ""
"OXY" 54675779 "Oxytetracycline" "Tetracyclines" "D06AA03,G01AA07,J01AA06,S01AA04" "Tetracyclines" "Tetracyclines" "" "adamycin,berkmycen,biostat,biostat pa,bisolvomycin,dabicycline,dalimycin,embryostat,fanterrin,galsenomycin,geomycin,geotilin,hydroxytetracyclinum,imperacin,lenocycline,macocyn,medamycin,mepatar,oksisyklin,ossitetraciclina,oxacycline,oxitetraciclina,oxitetracyclin,oxitetracycline,oxitetracyclinum,oxydon,oxymycin,oxymykoin,oxypam,oxysteclin,oxyterracin,oxyterracine,oxyterracyne,oxytetracid,oxytetracyclin,oxytetracycline,oxytetracycline base,oxytetracyclinum,proteroxyna,riomitsin,ryomycin,solkaciclina,stecsolin,stevacin,tarocyn,tarosin,teravit,terrafungine,terramitsin,terramycin,terramycin im,terramycine,tetran,unimycin,ursocyclin,ursocycline,vendarcin" 1 "g" 1 "g" "17396-3,18962-1,25266-8,386-3,387-1,388-9,389-7,55699-3,87595-5"
"OXY" 54675779 "Oxytetracycline" "Tetracyclines" "A01AB25,D06AA03,G01AA07,J01AA06,S01AA04" "Tetracyclines" "Tetracyclines" "" "adamycin,berkmycen,biostat,biostat pa,bisolvomycin,dabicycline,dalimycin,embryostat,fanterrin,galsenomycin,geomycin,geotilin,hydroxytetracyclinum,imperacin,lenocycline,macocyn,medamycin,mepatar,oksisyklin,ossitetraciclina,oxacycline,oxitetraciclina,oxitetracyclin,oxitetracycline,oxitetracyclinum,oxydon,oxymycin,oxymykoin,oxypam,oxysteclin,oxyterracin,oxyterracine,oxyterracyne,oxytetracid,oxytetracyclin,oxytetracycline,oxytetracycline base,oxytetracyclinum,proteroxyna,riomitsin,ryomycin,solkaciclina,stecsolin,stevacin,tarocyn,tarosin,teravit,terrafungine,terramitsin,terramycin,terramycin im,terramycine,tetran,unimycin,ursocyclin,ursocycline,vendarcin" 1 "g" 1 "g" "17396-3,18962-1,25266-8,386-3,387-1,388-9,389-7,55699-3,87595-5"
"OZN" "Ozenoxacin" "D06AX14" "" "ozadub,ozenoxacin,ozenoxacin cream" ""
"PAS" 4649 "P-aminosalicylic acid" "Antimycobacterials" "NA" "" "aminopar,aminosalicylic,aminosalicylic acid,aminosalyl,aminox,apacil,deapasil,entepas,ferrosan,gabbropas,granupas,helipidyl,hellipidyl,neopasalate,osacyl,pamacyl,pamisyl,paramycin,parasal,parasalicil,parasalindon,pasalon,pasara,pascorbic,pasdium,paser granules,paskalium,pasmed,pasnodia,pasolac,propasa,rezipas,teebacin" ""
"PAN" 72015 "Panipenem" "Carbapenems" "NA,J01DH55" "" "panipenem,panipenem/betamipron,panipenemum,penipanem" "100056-1,53823-1"
"PAN" 72015 "Panipenem" "Carbapenems" "NA,J01DH55" "" "panipenem,panipenem/betamipron,panipenemum,penipanem" 2 "g" "100056-1,53823-1"
"PAR" 165580 "Paromomycin" "Other antibacterials" "A07AA06" "" "aminosidin,aminosidine,aminosidine i,aminosidine sulfate,amminosidin,crestomycin,estomycin,gabbromicina,gabbromycin,gabromycin,humatin,humycin,hydroxymycin,hydroxymycin sulfate,monomycin,monomycin a,neomycin e,paramomycin,paramomycin sulfate,paromomicina,paromomycin,paromomycin i,paromomycine,paromomycinum,paucimycin,paucimycinum,quintomycin c" 3 "g" "51719-3,53824-9,55700-9,55701-7,55702-5"
"PAZ" 65957 "Pazufloxacin" "Quinolones" "J01MA18" "Quinolone antibacterials" "Fluoroquinolones" "" "pazufloxacin,pazufloxacine,pazufloxacino,pazufloxacinum" 1 "g" ""
"PEF" 51081 "Pefloxacin" "Quinolones" "J01MA03" "Quinolone antibacterials" "Fluoroquinolones" "pefl" "abactal,labocton,pefloxacin,pefloxacine,pefloxacinium,pefloxacino,pefloxacinum,perfloxacin,silver pefloxacin" 0.8 "g" 0.8 "g" "18963-9,35828-3,390-5,3906-5,7040-9"
@@ -330,7 +331,7 @@
"PIS" "Piperacillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" "54197-9,54198-7,54199-5,55704-1"
"TZP" 461573 "Piperacillin/tazobactam" "Beta-lactams/penicillins" "J01CR05" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "p/t,piptaz,piptazo,pit,pita,pt,ptc,ptz,tzp" "tazocel,tazocillin,tazocin,zosyn" 14 "g" "101491-9,18970-4,411-9,412-7,413-5,414-3,7044-1"
"PRC" 71978 "Piridicillin" "Beta-lactams/penicillins" "NA" "" "piridicillin" ""
"PRL" 157385 "Pirlimycin" "Macrolides/lincosamides" "NA" "" "pirlimycin,pirlimycina,pirlimycine,pirlimycinum,pirsue" "35829-1,35830-9,35831-7"
"PRL" 157385 "Pirlimycin" "Macrolides/lincosamides" "QJ51FF90" "" "pirlimycin,pirlimycina,pirlimycine,pirlimycinum,pirsue" "35829-1,35830-9,35831-7"
"PIR" 4855 "Piromidic acid" "Quinolones" "J01MB03" "Quinolone antibacterials" "Other quinolones" "" "acide piromidique,acido piromidico,acidum piromidicum,actrun c,bactramyl,enterol,gastrurol,panacid,pirodal,piromidate,piromidic acid,piromidicacid,pyrido,reelon,septural,urisept,uropir,zaomeal" 2 "g" ""
"PVM" 33478 "Pivampicillin" "Beta-lactams/penicillins" "J01CA02" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "berocillin,pivaloylampicillin,pivampicilina,pivampicillin,pivampicilline,pivampicillinum,pondocillin" 1.05 "g" "18971-2,415-0,416-8,417-6,418-4"
"PME" 115163 "Pivmecillinam" "Beta-lactams/penicillins" "J01CA08" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "amdinocillin pivoxil,coactabs,hydroxymethyl,pivmecilinamo,pivmecillinam,pivmecillinam hcl,pivmecillinamum" 0.6 "g" ""
@@ -338,9 +339,9 @@
"PLB" 49800004 "Polymyxin B" "Polymyxins" "A07AA05,J01XB02,S01AA18,S02AA11,S03AA03" "Other antibacterials" "Polymyxins" "pb,pol,polb,poly,poly b,polymixin,polymixin b" "polimixina b,polumyxin b,polymixin b,polymyxine b" 3 "MU" 0.15 "g" "17473-0,18972-0,25269-2,35832-5,419-2,420-0,421-8,422-6"
"POP" "Polymyxin B/polysorbate 80" "Polymyxins" "NA" "" "" ""
"POS" 468595 "Posaconazole" "Antifungals/antimycotics" "J02AC04" "Antimycotics for systemic use" "Triazole derivatives" "posa" "noxafil,posaconazole,posaconazole sp,posconazole" 0.3 "g" 0.3 "g" "53731-6,54186-2,54187-0,54188-8,54189-6,80545-7"
"PRA" 9802884 "Pradofloxacin" "Quinolones" "NA" "" "pradofloxacin,pudofloxacin,veraflox" "76148-6,87800-9"
"PRA" 9802884 "Pradofloxacin" "Quinolones" "QJ01MA97" "" "pradofloxacin,pudofloxacin,veraflox" "76148-6,87800-9"
"PRX" 71455 "Premafloxacin" "Quinolones" "NA" "" "premafloxacin,remafloxacin" "73591-0,73613-2,73636-3"
"PMD" 456199 "Pretomanid" "Antimycobacterials" "J04AK08" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "oxazine,pretomanid" "93850-6"
"PMD" 456199 "Pretomanid" "Antimycobacterials" "J04AK08" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "oxazine,pretomanid" 0.2 "g" "93850-6"
"PRM" 6446787 "Primycin" "Macrolides/lincosamides" "NA" "" "primycin" ""
"PRI" 11979535 "Pristinamycin" "Macrolides/lincosamides" "J01FG01" "Macrolides, lincosamides and streptogramins" "Streptogramins" "pris" "eskalin v,mikamycin,mikamycine,mikamycinum,ostreogrycinum,pristinamycine,pristinamycinum,stafac,stafytracine,staphylomycin,starfac,streptogramin,vernamycin,virgimycin,virgimycine,virginiamycin,virginiamycina,virginiamycine,virginiamycinum" 2 "g" "32383-2,35833-3,35834-1,55709-0"
"PRB" 5903 "Procaine benzylpenicillin" "Beta-lactams/penicillins" "J01CE09" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "depocillin,duphapen,hostacillin,hydracillin,jenacillin o,nopcaine,penicillin procaine,retardillin,vetspen,vitablend" 0.6 "g" ""
@@ -349,13 +350,13 @@
"PTH" 666418 "Protionamide" "Antimycobacterials" "J04AD01" "Drugs for treatment of tuberculosis" "Thiocarbamide derivatives" "prot" "ektebin,peteha,prothionamide,prothionamidum,protion,protionamid,protionamida,protionamide,protionamidum,protionizina,tebeform,trevintix,tuberex" 0.75 "g" ""
"PRU" 65947 "Prulifloxacin" "Quinolones" "J01MA17" "Quinolone antibacterials" "Fluoroquinolones" "" "prulifloxacin,pruvel,pufloxacin dioxolil,quisnon" 0.6 "g" "100058-7,76145-2"
"PZA" 1046 "Pyrazinamide" "Antimycobacterials" "J04AK01" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "pyra" "aldinamid,aldinamide,braccopiral,corsazinmid,dipimide,eprazin,farmizina,isopas,lynamide,novamid,p ezetamid,pezetamid,pharozinamide,piraldina,pirazimida,pirazinamid,pirazinamida,pirazinamide,prazina,pyrafat,pyramide,pyrazide,pyrazinamdie,pyrazinamid,pyrazinamide,pyrazinamidum,pyrazine carboxamide,pyrazineamide,pyrizinamide,rifafour,rozide,tebrazid,tebrazio,tisamid,unipyranamide,zinamide,zinastat" 1.5 "g" "11001-5,18973-8,20461-0,23632-3,25186-8,25229-6,25270-0,423-4,424-2,425-9,426-7,42935-7,55710-8,55711-6,56026-8,92242-7"
"QDA" 11979418 "Quinupristin/dalfopristin" "Macrolides/lincosamides" "J01FG02" "Macrolides, lincosamides and streptogramins" "Streptogramins" "q/d,qda,qida,quda,rp,syn" "" 1.5 "g" "23640-6,23641-4,33334-4,35835-8,58712-1"
"QDA" 11979418 "Quinupristin/dalfopristin" "Macrolides/lincosamides" "QJ01FG02" "Macrolides, lincosamides and streptogramins" "Streptogramins" "q/d,qda,qida,quda,rp,syn" "" "23640-6,23641-4,33334-4,35835-8,58712-1"
"RAC" 56052 "Ractopamine" "Other antibacterials" "NA" "" "optaflexx,paylean,ractopamina,ractopamine,ractopaminum" ""
"RAM" 16132338 "Ramoplanin" "Glycopeptides" "NA" "" "ramoplanin" "41710-5,41711-3,41712-1,41737-8"
"RZM" 10993211 "Razupenem" "Carbapenems" "NA" "" "razupenem" "73590-2,73612-4,73635-5"
"RTP" 6918462 "Retapamulin" "Other antibacterials" "D06AX13" "Antibiotics for topical use" "Other antibiotics for topical use" "ret" "altabax,altargo,retapamulin" ""
"RZF" "Rezafungin" "Antifungals" "NA" "" "biafungin,rezafungin cation,rezafungin ion" ""
"RBC" 44631912 "Ribociclib" "Antifungals/antimycotics" "L01EF02" "Antimycotics for systemic use" "Triazole derivatives" "ribo" "kisqali,ribociclib" 0.45 ""
"RBC" 44631912 "Ribociclib" "Antifungals/antimycotics" "L01EF02" "Antimycotics for systemic use" "Triazole derivatives" "ribo" "kisqali,ribociclib" 0.45 "g" ""
"RST" 33042 "Ribostamycin" "Aminoglycosides" "J01GB10" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "dekamycin iv,hetangmycin,ribastamin,ribostamicina,ribostamycin,ribostamycine,ribostamycinum,vistamycin,xylostatin" 1 "g" ""
"RID1" 16659285 "Ridinilazole" "Other antibacterials" "NA" "" "ridinilazole" ""
"RIB" 135398743 "Rifabutin" "Antimycobacterials" "J04AB04" "Drugs for treatment of tuberculosis" "Antibiotics" "rifb" "alfacid,ansamicin,ansamycin,ansatipin,ansatipine,assatipin,mycobutin,rifabutin,rifabutina,rifabutine,rifabutinum" 0.15 "g" "100699-8,16100-0,16386-5,16387-3,19149-4,20386-9,23630-7,24032-5,25199-1,25200-7,25201-5,42655-1,42656-9,54183-9,96113-6"
@@ -364,7 +365,7 @@
"RFI" "Rifampicin/isoniazid" "Antimycobacterials" "J04AM02" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "rifinah,rimactazid" ""
"RPEI" "Rifampicin/pyrazinamide/ethambutol/isoniazid" "Antimycobacterials" "J04AM06" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
"RPI" "Rifampicin/pyrazinamide/isoniazid" "Antimycobacterials" "J04AM05" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
"RFM" 6324616 "Rifamycin" "Antimycobacterials" "A07AA13,D06AX15,J04AB03,S01AA16,S02AA12" "Drugs for treatment of tuberculosis" "Antibiotics" "" "aemcolo,rifacin,rifamicina,rifamicine sv,rifamycin,rifamycine,rifamycinum,rifocin,rifocyn,rifomycin,rifomycin sv,tuborin" 0.6 "g" ""
"RFM" 6324616 "Rifamycin" "Antimycobacterials" "A07AA13,D06AX15,J04AB03,S01AA16,S02AA12" "Drugs for treatment of tuberculosis" "Antibiotics" "" "aemcolo,rifacin,rifamicina,rifamicine sv,rifamycin,rifamycine,rifamycinum,rifocin,rifocyn,rifomycin,rifomycin sv,tuborin" 0.8 "g" 0.6 "g" ""
"RFP" 135403821 "Rifapentine" "Antimycobacterials" "J04AB05" "Drugs for treatment of tuberculosis" "Antibiotics" "rifp,rpt" "cyclopentyl rifampin,prifitin,priftin,rifapentin,rifapentina,rifapentine,rifapentinum" 0.11 "g" "100059-5,76627-9"
"RFX" 6436173 "Rifaximin" "Other antibacterials" "A07AA11,D06AX11" "Intestinal antiinfectives" "Antibiotics" "" "fatroximin,flonorm,lormyx,lumenax,normix,redactiv,rifacol,rifamixin,rifaxidin,rifaximin,rifaximina,rifaximine,rifaximinum,rifaxin,ritacol,spiraxin,xifaxan,xifaxsan" 0.6 "g" "73589-4,73611-6,73634-8"
"RIT" 65633 "Ritipenem" "Carbapenems" "NA" "" "ritipenem" ""
@@ -374,8 +375,8 @@
"ROS" 287180 "Rosoxacin" "Quinolones" "J01MB01" "Quinolone antibacterials" "Other quinolones" "" "acrosoxacin,eracine,eradacil,eradacin,eradicin,rosoxacin,rosoxacine,rosoxacino,rosoxacinum,roxadyl,winoxacin,winuron" 0.3 "g" "18977-9,439-0,440-8,441-6,442-4,55713-2"
"RXT" "Roxithromycin" "Macrolides/lincosamides" "J01FA06" "Macrolides, lincosamides and streptogramins" "Macrolides" "roxi" "roxithromycin,roxithromycine,roxithromycinum,roxitromicina,rulide" 0.3 "g" "18978-7,443-2,444-0,445-7,446-5,7046-6"
"RFL" 58258 "Rufloxacin" "Quinolones" "J01MA10" "Quinolone antibacterials" "Fluoroquinolones" "" "rufloxacin,rufloxacin hcl,rufloxacine,rufloxacino,rufloxacinum" 0.2 "g" ""
"SAL" 3085092 "Salinomycin" "Other antibacterials" "NA" "" "coxistac,procoxacin,salinomicina,salinomycin,salinomycine,salinomycinum" "35836-6,35837-4,35838-2,87593-0"
"SAR" 56208 "Sarafloxacin" "Quinolones" "NA" "" "difloxacine,difloxacino,difloxacinum,quinolone der.,saraflox,sarafloxacin,sarafloxacine,sarafloxacino,sarafloxacinum" "73588-6,73610-8,73633-0"
"SAL" 3085092 "Salinomycin" "Other antibacterials" "QP51BB01" "" "coxistac,procoxacin,salinomicina,salinomycin,salinomycine,salinomycinum" "35836-6,35837-4,35838-2,87593-0"
"SAR" 56208 "Sarafloxacin" "Quinolones" "QJ01MA98" "" "difloxacine,difloxacino,difloxacinum,quinolone der.,saraflox,sarafloxacin,sarafloxacine,sarafloxacino,sarafloxacinum" "73588-6,73610-8,73633-0"
"SRC" 54681908 "Sarecycline" "Tetracyclines" "J01AA14" "Tetracyclines" "Tetracyclines" "" "sarecycline,seysara" 0.1 "g" ""
"SRX" 9933415 "Sarmoxicillin" "Beta-lactams/penicillins" "NA" "" "sarmoxicillin" ""
"SEC" 71815 "Secnidazole" "Other antibacterials" "P01AB07" "" "flagentyl,secnidal,secnidazol,secnidazole,secnidazolum,secnil,sindose,solosec" 2 "g" ""
@@ -395,7 +396,7 @@
"SUL" 130313 "Sulbactam" "Beta-lactams/penicillins" "J01CG01" "Beta-lactam antibacterials, penicillins" "Beta-lactamase inhibitors" "" "betamaze,sulbactam,sulbactam acid,sulbactam free acid,sulbactamum" 1 "g" "41716-2,41717-0,41718-8,41739-4"
"SBC" 20055036 "Sulbenicillin" "Beta-lactams/penicillins" "J01CA16" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "kedacillina,sulbenicilina,sulbenicillin,sulbenicilline,sulbenicillinum" 15 "g" ""
"SUC" 5318 "Sulconazole" "Antifungals/antimycotics" "D01AC09" "" "sulconazol,sulconazole,sulconazolum" ""
"SUP" 6634 "Sulfachlorpyridazine" "Other antibacterials" "NA" "" "cluricol,cosulid,cosumix,durasulf,nefrosul,nsulfanilamide,prinzone vet,prinzone vet.,solfaclorpiridazina,sonilyn,sulfachlorpyridazine,sulfacloropiridazina,vetisulid" ""
"SUP" 6634 "Sulfachlorpyridazine" "Other antibacterials" "QJ01EQ12" "" "cluricol,cosulid,cosumix,durasulf,nefrosul,nsulfanilamide,prinzone vet,prinzone vet.,solfaclorpiridazina,sonilyn,sulfachlorpyridazine,sulfacloropiridazina,vetisulid" ""
"SDI" 5215 "Sulfadiazine" "Trimethoprims" "J01EC02" "Sulfonamides and trimethoprim" "Intermediate-acting sulfonamides" "" "adiazin,adiazine,cocodiazine,codiazine,cremodiazine,cremotres,debenal,deltazina,diazin,diazolone,diazovit,diazyl,eskadiazine,honey diazine,liquadiazine,microsulfon,neazine,neotrizine,nsulfanilamide,palatrize,piridisir,pirimal,pyrimal,quadetts,quadramoid,sanodiazine,sildaflo,silvadene,solfadiazina,spofadrizine,sterazine,sulfacombin,sulfadiazene,sulfadiazin,sulfadiazina,sulfadiazine,sulfadiazinum,sulfapirimidin,sulfapyrimidin,sulfapyrimidine,sulfatryl,sulfazine,sulfolex,sulfonamides duplex,sulfonsol,sulfose,sulphadiazine,sulphadiazine e,terfonyl,theradiazine,thermazene,trifonamide,triple sulfa,triple sulfas,trisem,truozine,zinc sulfadiazine" 0.6 "g" "18984-5,27216-1,463-0,464-8,465-5,466-3,59742-7,6907-0,7050-8"
"SLT" 122284 "Sulfadiazine/tetroxoprim" "Trimethoprims" "J01EE06" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "" "cotetroxazine" ""
"SLT1" 64932 "Sulfadiazine/trimethoprim" "Trimethoprims" "J01EE02" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "" "antastmon,cotrimazine,diaziprim forte,ditrim,ditrivet,sultrisan,triglobe,trimin,tucoprim,uniprim" ""
@@ -432,7 +433,7 @@
"TAL" 71447 "Talampicillin" "Beta-lactams/penicillins" "J01CA15" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "talampicilina,talampicillin,talampicilline,talampicillinum" 2 "g" "18988-6,479-6,480-4,481-2,482-0"
"TLP" 163307 "Talmetoprim" "Other antibacterials" "NA" "" "talmetoprim" ""
"TAZ" 123630 "Tazobactam" "Beta-lactams/penicillins" "J01CG02" "Beta-lactam antibacterials, penicillins" "Beta-lactamase inhibitors" "tazo" "tazobactam,tazobactam acid,tazobactamum,tazobactum" "41719-6,41720-4,41721-2,41740-2"
"TBP" 9800194 "Tebipenem" "Carbapenems" "NA,J01DH06" "" "tebipenem pivoxil" ""
"TBP" 9800194 "Tebipenem" "Carbapenems" "NA,J01DH06" "" "tebipenem pivoxil" 0.56 "g" ""
"TZD" 11234049 "Tedizolid" "Oxazolidinones" "J01XX11" "Other antibacterials" "Other antibacterials" "tedi" "sivextro,tedizolid,torezolid" 0.2 "g" 0.2 "g" "73586-0,73608-2,73631-4"
"TEC" 16131923 "Teicoplanin" "Glycopeptides" "J01XA02" "Other antibacterials" "Glycopeptide antibacterials" "tec,tei,teic,tp,tpl,tpn" "targocid,tecoplanina,tecoplanine,tecoplaninum,teichomycin,teicoplanin,teicoplanina,teicoplanine,teicoplaninum" 0.4 "g" "18989-4,25534-9,25535-6,34378-0,34379-8,4043-6,483-8,484-6,485-3,486-1,7051-6,80968-1"
"TCM" "Teicoplanin-macromethod" "Glycopeptides" "NA" "" "" ""
@@ -450,29 +451,29 @@
"THI" 27200 "Thiamphenicol" "Amphenicols" "J01BA02" "Amphenicols" "Amphenicols" "" "descocin,dexawin,dextrosulfenidol,dextrosulphenidol,efnicol,hyrazin,igralin,macphenicol,masatirin,neomyson,racefenicol,racefenicolo,racefenicolum,raceophenidol,racephenicol,rincrol,thiamcol,thiamphenicol,thiamphenicolum,thiocymetin,thiomycetin,thiophenicol,tiamfenicol,tiamfenicolo,urfamicina,urfamycine,vicemycetin" 1.5 "g" 1.5 "g" "41723-8,41724-6,41725-3,54169-8"
"TAT" 9568512 "Thioacetazone" "Antimycobacterials" "J04AK07" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "aktivan,ambathizon,amithiozone,amitiozon,benthiozone,benzothiozane,benzothiozon,berculon a,berkazon,citazone,conteben,diasan,domakol,ilbion,livazone,mirizone neustab,mivizon,myvizone,neotibil,neustab,novakol,nuclon argentinian,panrone,parazone,seroden,siocarbazone,tebalon,tebecure,tebemar,tebesone i,tebethion,tebethione,tebezon,thiacetone,thiacetozone,thibon,thibone,thioacetazon,thioacetazone,thioacetazonum,thioazetazone,thiocarbazil,thiomicid,thionicid,thioparamizon,thioparamizone,thiosemicarbarzone,thiosemicarbazone,thiotebesin,thiotebezin,thiotebicina,thizone,tiacetazon,tibicur,tibion,tibione,tibizan,tibone,tioacetazon,tioacetazona,tioatsetazon,tiobicina,tiocarone,tiosecolo,tubercazon,tubigal" ""
"THI1" "Thioacetazone/isoniazid" "Antimycobacterials" "J04AM04" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
"TIA" 656958 "Tiamulin" "Other antibacterials" "NA" "" "denagard,thiamutilin,tiamulin,tiamulin pamoate,tiamulina,tiamuline,tiamulinum,tiavet p" "35846-5,35847-3,35848-1,87589-8"
"TIA" 656958 "Tiamulin" "Other antibacterials" "QJ01XQ01" "" "denagard,thiamutilin,tiamulin,tiamulin pamoate,tiamulina,tiamuline,tiamulinum,tiavet p" "35846-5,35847-3,35848-1,87589-8"
"TIC" 36921 "Ticarcillin" "Beta-lactams/penicillins" "J01CA13" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "tc,ti,tic,tica" "ticarcilina,ticarcillin,ticarcilline,ticarcillinum,ticillin,timentin" 15 "g" "18994-4,18995-1,25254-4,4054-3,4055-0,499-4,500-9,501-7,502-5,503-3,504-1,505-8,506-6,55716-5,55717-3,55718-1,55719-9,7053-2,7054-0"
"TCC" 6437075 "Ticarcillin/clavulanic acid" "Beta-lactams/penicillins" "J01CR03" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "t/c,tcc,ticl,tim,tlc" "timentin" 15 "g" ""
"TGC" 54686904 "Tigecycline" "Tetracyclines" "J01AA12" "Tetracyclines" "Tetracyclines" "tgc,tig,tige" "haizheng li xing,tigeciclina,tigecyclin,tigecycline,tigecycline hydrate,tigecyclinum,tigilcycline,tygacil" 0.1 "g" "101499-2,42354-1,42355-8,42356-6,42357-4,55158-0"
"TBQ" 65592 "Tilbroquinol" "Quinolones" "P01AA05" "" "tilbroquinol,tilbroquinolum" ""
"TIP" 24860548 "Tildipirosin" "Macrolides/lincosamides" "NA" "" "tildipirosin,zuprevo" "100060-3,88375-1,88377-7"
"TIL" 5282521 "Tilmicosin" "Macrolides/lincosamides" "NA" "" "micotil,pulmotil,tilmicosin,tilmicosina,tilmicosine,tilmicosinum" "35849-9,35850-7,35851-5,87588-0"
"TIN" 5479 "Tinidazole" "Other antibacterials" "J01XD02,P01AB02" "Other antibacterials" "Imidazole derivatives" "tini" "amtiba,bioshik,ethyl sulfone,fasigin,fasigyn,fasigyntrade mark,fasygin,glongyn,haisigyn,pletil,simplotan,simplotantrade mark,sorquetan,symplotan,tindamax,tindamaxtrade mark,tinidazol,tinidazole,tinidazolum,tricolam,trimonase" 2 "g" 1.5 "g" "54928-7,55720-7,55721-5,55722-3"
"TIP" 24860548 "Tildipirosin" "Macrolides/lincosamides" "QJ01FA96" "" "tildipirosin,zuprevo" "100060-3,88375-1,88377-7"
"TIL" 5282521 "Tilmicosin" "Macrolides/lincosamides" "QJ01FA91" "" "micotil,pulmotil,tilmicosin,tilmicosina,tilmicosine,tilmicosinum" "35849-9,35850-7,35851-5,87588-0"
"TIN" 5479 "Tinidazole" "Other antibacterials" "G01AF21,J01XD02,P01AB02" "Other antibacterials" "Imidazole derivatives" "tini" "amtiba,bioshik,ethyl sulfone,fasigin,fasigyn,fasigyntrade mark,fasygin,glongyn,haisigyn,pletil,simplotan,simplotantrade mark,sorquetan,symplotan,tindamax,tindamaxtrade mark,tinidazol,tinidazole,tinidazolum,tricolam,trimonase" 2 "g" 1.5 "g" "54928-7,55720-7,55721-5,55722-3"
"TCR" 3001386 "Tiocarlide" "Antimycobacterials" "J04AD02" "Drugs for treatment of tuberculosis" "Thiocarbamide derivatives" "" "amixyl,datanil,disocarban,disoxyl,isoxyl,thiocarlide,tiocarlid,tiocarlida,tiocarlide,tiocarlidum" 7 "g" ""
"TDC" 10247721 "Tiodonium chloride" "Other antibacterials" "NA" "" "cloruro de tiodonio,tiodonii chloridum,tiodonium chloride" ""
"TXC" 65788 "Tioxacin" "Quinolones" "NA" "" "tioxacin,tioxacine,tioxacino,tioxacinum,tioxic acid" ""
"TIZ" 394397 "Tizoxanide" "Other antibacterials" "NA" "" "ntzdes" "73585-2,73607-4,73629-8"
"TOB" 36294 "Tobramycin" "Aminoglycosides" "J01GB01,S01AA12" "Aminoglycoside antibacterials" "Other aminoglycosides" "nn,tm,to,tob,tobr" "bethkis,brulamycin,deoxykanamycin b,distobram,gernebcin,gotabiotic,kitabis,kitabis pak,nebcin,nebicin,nebramycin,nebramycin vi,obramycin,sybryx,tenebrimycin,tenemycin,tobacin,tobi podhaler,tobracin,tobradex,tobradistin,tobralex,tobramaxin,tobramicin,tobramicina,tobramitsetin,tobramycetin,tobramycin,tobramycin base,tobramycin sulfate,tobramycine,tobramycinum,tobrased,tobrasone,tobrex" 0.24 "g" "101496-8,13584-8,17808-7,18996-9,22750-4,22751-2,22752-0,25227-0,25800-4,31094-6,31095-3,31096-1,35239-3,35670-9,4057-6,4058-4,4059-2,507-4,508-2,509-0,50927-3,510-8,52962-8,59380-6,7055-7,80966-5"
"TOH" "Tobramycin-high" "Aminoglycosides" "NA" "tobra high,tobramycin high,tohl" "" ""
"TFX" 5517 "Tosufloxacin" "Quinolones" "J01MA22" "" "tosufloxacin" 0.45 "g" "100061-1,76146-0"
"TFX" 5517 "Tosufloxacin" "Quinolones" "J01MA22,S01AE09" "" "tosufloxacin" 0.45 "g" "100061-1,76146-0"
"TMP" 5578 "Trimethoprim" "Trimethoprims" "J01EA01" "Sulfonamides and trimethoprim" "Trimethoprim and derivatives" "t,tmp,tr,tri,trim,w" "abaprim,alprim,anitrim,antrima,antrimox,bacdan,bacidal,bacide,bacterial,bacticel,bactifor,bactin,bactoprim,bactramin,bactrim,bencole,bethaprim,biosulten,briscotrim,chemotrin,colizole,colizole ds,conprim,cotrimel,cotrimoxizole,deprim,dosulfin,duocide,esbesul,espectrin,euctrim,exbesul,fermagex,fortrim,idotrim,ikaprim,infectotrimet,instalac,kombinax,lagatrim,lagatrim forte,lastrim,lescot,methoprim,metoprim,monoprim,monotrim,monotrimin,novotrimel,omstat,oraprim,pancidim,polytrim,priloprim,primosept,primsol,proloprim,protrin,purbal,resprim,resprim forte,roubac,roubal,salvatrim,septrin ds,septrin forte,septrin s,setprin,sinotrim,stopan,streptoplus,sugaprim,sulfamar,sulfamethoprim,sulfoxaprim,sulthrim,sultrex,syraprim,tiempe,tmp smx,toprim,trimanyl,trimethioprim,trimethopim,trimethoprim,trimethoprime,trimethoprimum,trimethopriom,trimetoprim,trimetoprima,trimexazole,trimexol,trimezol,trimogal,trimono,trimopan,trimpex,triprim,trisul,trisulcom,trisulfam,trisural,uretrim,urobactrim,utetrin,velaten,wellcoprim,wellcoprin,xeroprim,zamboprim" 0.4 "g" 0.4 "g" "101495-0,11005-6,17747-7,18997-7,18998-5,20387-7,23614-1,23631-5,25273-4,32342-8,4079-0,4080-8,4081-6,511-6,512-4,513-2,514-0,515-7,516-5,517-3,518-1,55584-7,7056-5,7057-3,80552-3,80973-1"
"SXT" 358641 "Trimethoprim/sulfamethoxazole" "Trimethoprims" "J01EE01" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "cot,cotrim,sxt,t/s,trsu,trsx,ts" "abacin,abactrim,agoprim,alfatrim,aposulfatrim,bacteral,bacterial forte,bactilen,bactiver,bacton,bactoreduct,bactrim,bactrim ds,bactrim forte,bactrim pediatric,bactrimel,bactrizol,bactromin,bactropin,baktar,belcomycine,berlocid,bibacrim,biseptol,chemitrim,chemotrim,ciplin,colimycin,colimycin sulphate,colisticin,colistimethate,colistimethate sodium,colistin sulfate,colistin sulphate,colomycin,coly-mycin,cotribene,cotrim d.s.,cotrim eu rho,cotrim holsen,cotrim.l.u.t.,cotrimaxazol,cotrimazole,cotrimhexal,cotrimoxazol,cotrimoxazol al,cotrimoxazole,cotrimstada,cotriver,dibaprim,drylin,duratrimet,eltrianyl,escoprim,esteprim,eusaprim,fectrim,gantaprim,gantaprin,gantrim,groprim,helveprim,imexim,jenamoxazol,kemoprim,kepinol,kepinol forte,laratrim,linaris,maxtrim,microtrim,microtrim forte,mikrosid,momentol,oecotrim,oriprim,oxaprim,pantoprim,polymyxin e,polymyxin e. sulfate,primazole,promixin,septra,septra ds,septra grape,septrim,septrin,servitrim,sigaprim,sigaprin,sulfatrim pediatric,sulfotrim,sulfotrimin,sulmeprim pediatric,sulprim,sumetrolim,supracombin,suprim,tacumil,teleprim,teleprin,thiocuran,totazina,tribakin,trifen,trigonyl,trimesulf,trimetho comp,trimethoprimsulfa,trimetoger,trimexazol,trimforte,trimosulfa,uroplus,uroplus ds,uroplus ss" "101495-0,18998-5,20387-7,23631-5,25273-4,32342-8,4081-6,515-7,516-5,517-3,518-1,7057-3"
"TRL" 202225 "Troleandomycin" "Macrolides/lincosamides" "J01FA08" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "acetyloleandomycin,aovine,cyclamycin,evramicina,matromicina,matromycin t,micotil,oleandocetine,oleandomycin,t.a.o.,treolmicina,tribiocillina,triocetin,triolan,troleandomicina,troleandomycin,troleandomycine,troleandomycinum,viamicina,wytrion" 1 "g" "18999-3,519-9,520-7,521-5,522-3"
"TRO" 55886 "Trospectomycin" "Other antibacterials" "NA" "" "rubidiumnitrate,trospectinomycin,trospectomicina,trospectomycin,trospectomycine,trospectomycinum" ""
"TVA" 62959 "Trovafloxacin" "Quinolones" "J01MA13" "Quinolone antibacterials" "Fluoroquinolones" "trov" "trovafloxacin,trovan" 0.2 "g" 0.2 "g" "23642-2,23643-0,35855-6,7058-1"
"TUL" 9832301 "Tulathromycin" "Macrolides/lincosamides" "NA" "" "draxxin,tulathrmycin a,tulathromycin,tulathromycin a" "76149-4,87798-5"
"TYL" 5280440 "Tylosin" "Macrolides/lincosamides" "NA" "" "fradizine,tilosina,tylocine,tylosin,tylosin a,tylosine,tylosinum" "35856-4,35857-2,35858-0,87587-2"
"TYL1" 6441094 "Tylvalosin" "Macrolides/lincosamides" "NA" "tvn" "tylvalosin" "101526-2,87586-4"
"TUL" 9832301 "Tulathromycin" "Macrolides/lincosamides" "QJ01FA94" "" "draxxin,tulathrmycin a,tulathromycin,tulathromycin a" "76149-4,87798-5"
"TYL" 5280440 "Tylosin" "Macrolides/lincosamides" "QJ01FA90,QJ51FA90" "" "fradizine,tilosina,tylocine,tylosin,tylosin a,tylosine,tylosinum" "35856-4,35857-2,35858-0,87587-2"
"TYL1" 6441094 "Tylvalosin" "Macrolides/lincosamides" "QJ01FA92" "tvn" "tylvalosin" "101526-2,87586-4"
"PRU1" 124225 "Ulifloxacin (Prulifloxacin)" "Other antibacterials" "NA" "" "ulifloxacin" ""
"VAN" 14969 "Vancomycin" "Glycopeptides" "A07AA09,J01XA01,S01AA28" "Other antibacterials" "Glycopeptide antibacterials" "va,van,vanc" "vancocin,vancocin hcl,vancoled,vancomicina,vancomycin,vancomycin hcl,vancomycine,vancomycinum,vancor,viomycin derivative" 2 "g" 2 "g" "13586-3,13587-1,19000-9,20578-1,23615-8,25228-8,31012-8,39092-2,39796-8,39797-6,4089-9,4090-7,4091-5,4092-3,50938-0,523-1,524-9,525-6,526-4,59381-4,7059-9,92241-9,97657-1"
"VAM" "Vancomycin-macromethod" "Glycopeptides" "NA" "" "" ""
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
c4a5519e0ecc74220fc768e944a372f7
25f9e2b995124710eb121cc4e62eba16
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -2,7 +2,7 @@
# For editing this EUCAST reference file, these values can all be used for targeting antibiotics:
# aminoglycosides, aminopenicillins, antifungals, antimycobacterials, betalactams, carbapenems, cephalosporins, cephalosporins_1st, cephalosporins_2nd, cephalosporins_3rd, cephalosporins_4th, cephalosporins_5th, cephalosporins_except_CAZ, fluoroquinolones, glycopeptides, glycopeptides_except_lipo, lincosamides, lipoglycopeptides, macrolides, oxazolidinones, penicillins, polymyxins, quinolones, streptogramins, tetracyclines, tetracyclines_except_TGC, trimethoprims, ureidopenicillins
# and all separate EARS-Net letter codes such as AMC. They can be separated by comma: 'AMC, fluoroquinolones'.
# The 'if_mo_property' column can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain".
# The 'if_mo_property' column can be any column name from the AMR::microorganisms data set, or 'genus_species' or 'gramstain'.
# The like.is.one_of column must be 'like' or 'is' or 'one_of' ('like' will read the 'this_value' column as regular expression)
# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. All species in this group are noted on the 'B.cepacia' sheet of the EUCAST Clinical Breakpoint v.10.0 Excel file of 2020 and later
# >>>>> IF YOU WANT TO IMPORT THIS FILE INTO YOUR OWN SOFTWARE, HAVE THE FIRST 9 LINES SKIPPED <<<<<
Can't render this file because it contains an unexpected character in line 5 and column 96.
+1 -1
View File
@@ -4,7 +4,7 @@ library(tidyr)
library(AMR)
# we need J01, J02 and J04 (J03 does not exist)
url <- "https://www.whocc.no/atc_ddd_index/?code={code}&showdescription=no"
url <- "https://atcddd.fhi.no/atc_ddd_index/?code={code}&showdescription=no"
complete_vector <- character(0)
for (Jxx in c("J01", "J02", "J04")) {
site <- gsub("{code}", Jxx, url, fixed = TRUE)
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 164 KiB

+566 -3335
View File
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 171 KiB

+28 -4
View File
@@ -735,6 +735,18 @@ antibiotics <- antibiotics %>%
))
antibiotics[which(antibiotics$ab %in% c("CYC", "LNZ", "THA", "TZD")), "group"] <- "Oxazolidinones"
# add clindamycin inducible screening
clin <- antibiotics |>
filter(ab == "FOX1") |>
mutate(ab = as.character("CLI1"),
name = "Clindamycin inducible screening",
group = "Macrolides/lincosamides")
antibiotics <- antibiotics |>
mutate(ab = as.character(ab)) |>
bind_rows(clin)
class(antibiotics$ab) <- c("ab", "character")
antibiotics[which(antibiotics$ab == "CLI1"), "abbreviations"][[1]] <- list(c("clindamycin inducible", "clinda inducible", "clin inducible"))
# add pretomanid
antibiotics <- antibiotics %>%
mutate(ab = as.character(ab)) %>%
@@ -754,12 +766,20 @@ antibiotics <- antibiotics %>%
# update ATC codes from WHOCC website -------------------------------------
# last time checked: 2022-10-29
# last time checked: 2024-02-22
library(rvest)
updated_atc <- as.list(antibiotics$atc)
get_atcs <- function(ab_name, url = "https://www.whocc.no/atc_ddd_index/") {
get_atcs <- function(ab_name, type = "human") {
if (type == "human") {
url <- "https://atcddd.fhi.no/atc_ddd_index/"
} else if (type == "veterinary") {
url <- "https://atcddd.fhi.no/atcvet/atcvet_index/"
} else {
stop("invalid type")
}
ab_name <- gsub("/", " and ", tolower(ab_name), fixed = TRUE)
# we will do a search on their website, which means:
@@ -780,6 +800,7 @@ get_atcs <- function(ab_name, url = "https://www.whocc.no/atc_ddd_index/") {
html_node("table") %>%
# transform it to an R data set
html_table(header = FALSE)
# and get the ATCs (first column) of only exact hits
unique(as.character(atc_tbl[which(tolower(atc_tbl[, 2, drop = TRUE]) == ab_name), 1, drop = TRUE]))
}
@@ -790,7 +811,10 @@ for (i in seq_len(nrow(antibiotics))) {
" - Downloading ", antibiotics$name[i],
appendLF = FALSE
)
atcs <- get_atcs(antibiotics$name[i])
atcs <- get_atcs(antibiotics$name[i], type = "human")
if (all(is.na(atcs))) {
atcs <- get_atcs(antibiotics$name[i], type = "veterinary")
}
if (length(atcs) > 0) {
updated_atc[[i]] <- atcs
message(" (", length(atcs), " results)")
@@ -805,7 +829,7 @@ antibiotics$atc <- updated_atc
# update DDDs from WHOCC website ------------------------------------------
# last time checked: 2022-10-29
# last time checked: 2024-02-22
ddd_oral <- rep(NA_real_, nrow(antibiotics))
ddd_oral_units <- rep(NA_character_, nrow(antibiotics))
ddd_iv <- rep(NA_real_, nrow(antibiotics))
+2 -2
View File
@@ -34,7 +34,7 @@ library(rvest)
# get all data from the WHOCC website
get_atc_table <- function(atc_group) {
# give as input J0XXX, like atc_group = "J05AB"
downloaded <- read_html(paste0("https://www.whocc.no/atc_ddd_index/?code=", atc_group, "&showdescription=no"))
downloaded <- read_html(paste0("https://atcddd.fhi.no/atc_ddd_index/?code=", atc_group, "&showdescription=no"))
table_title <- downloaded %>%
html_nodes(paste0('a[href^="./?code=', atc_group, '&"]')) %>%
html_text()
@@ -62,7 +62,7 @@ get_atc_table <- function(atc_group) {
)
}
# these are the relevant groups for input: https://www.whocc.no/atc_ddd_index/?code=J05A (J05 only contains J05A)
# these are the relevant groups for input: https://atcddd.fhi.no/atc_ddd_index/?code=J05A (J05 only contains J05A)
atc_groups <- c("J05AA", "J05AB", "J05AC", "J05AD", "J05AE", "J05AF", "J05AG", "J05AH", "J05AJ", "J05AP", "J05AR", "J05AX")
# get the first
+26 -16
View File
@@ -213,7 +213,10 @@ unknown <- breakpoints %>%
breakpoints %>%
filter(code %in% unknown) %>%
count(GUIDELINES, YEAR, ORGANISM_CODE, BREAKPOINT_TYPE, sort = TRUE)
# these codes are currently (2023-07-08): clu, kma. No clue (are not in MO list of WHONET), so remove them:
# 2024-02-22: clu and kma are know (see below), fix the PBI one
breakpoints$mo[breakpoints$ORGANISM_CODE == "PBI"] <- as.mo("Parabacteroides")
breakpoints$ORGANISM_CODE[breakpoints$ORGANISM_CODE == "PBI"] <- "Parabacteroides"
# 2023-07-08: these codes are currently: clu, kma. No clue (are not in MO list of WHONET), so remove them:
breakpoints <- breakpoints %>%
filter(!is.na(mo))
@@ -236,6 +239,7 @@ breakpoints_new <- breakpoints %>%
transmute(
guideline = paste(GUIDELINES, YEAR),
type = ifelse(BREAKPOINT_TYPE == "ECOFF", "ECOFF", tolower(BREAKPOINT_TYPE)),
host = ifelse(BREAKPOINT_TYPE == "ECOFF", "ECOFF", tolower(HOST)),
method = TEST_METHOD,
site = SITE_OF_INFECTION,
mo,
@@ -263,15 +267,15 @@ breakpoints_new <- breakpoints %>%
gsub("", "-", ., fixed = TRUE)) %>%
arrange(desc(guideline), mo, ab, type, method) %>%
filter(!(is.na(breakpoint_S) & is.na(breakpoint_R)) & !is.na(mo) & !is.na(ab)) %>%
distinct(guideline, type, ab, mo, method, site, breakpoint_S, .keep_all = TRUE)
distinct(guideline, type, host, ab, mo, method, site, breakpoint_S, .keep_all = TRUE)
# check the strange duplicates
breakpoints_new %>%
mutate(id = paste(guideline, type, ab, mo, method, site)) %>%
mutate(id = paste(guideline, type, host, ab, mo, method, site)) %>%
filter(id %in% .$id[which(duplicated(id))])
# remove duplicates
breakpoints_new <- breakpoints_new %>%
distinct(guideline, type, ab, mo, method, site, .keep_all = TRUE)
distinct(guideline, type, host, ab, mo, method, site, .keep_all = TRUE)
# fix reference table names
breakpoints_new %>% filter(guideline %like% "EUCAST", is.na(ref_tbl)) %>% View()
@@ -284,6 +288,10 @@ breakpoints_new <- breakpoints_new %>%
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_S", drop = TRUE]))
breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R"] <- as.double(as.disk(breakpoints_new[which(breakpoints_new$method == "DISK"), "breakpoint_R", drop = TRUE]))
# regarding animal breakpoints, CLSI has adults and foals for horses, but only for amikacin - remove them
breakpoints_new <- breakpoints_new |>
filter(host %unlike% "foal") |>
mutate(host = ifelse(host %like% "horse", "horse", host))
# FIXES FOR WHONET ERRORS ----
@@ -301,27 +309,29 @@ breakpoints_new[which(breakpoints_new$breakpoint_R == 513), "breakpoint_R"] <- 5
breakpoints_new[which(breakpoints_new$breakpoint_R == 1025), "breakpoint_R"] <- 1024
# fix streptococci in WHONET table of EUCAST: Strep A, B, C and G must only include these groups and not all streptococci:
clinical_breakpoints$mo[clinical_breakpoints$mo == "B_STRPT" & clinical_breakpoints$ref_tbl %like% "^strep.* a.* b.*c.*g"] <- as.mo("B_STRPT_ABCG")
breakpoints_new$mo[breakpoints_new$mo == "B_STRPT" & breakpoints_new$ref_tbl %like% "^strep.* a.* b.*c.*g"] <- as.mo("B_STRPT_ABCG")
# Haemophilus same error (must only be H. influenzae)
clinical_breakpoints$mo[clinical_breakpoints$mo == "B_HMPHL" & clinical_breakpoints$ref_tbl %like% "^h.* influenzae"] <- as.mo("B_HMPHL_INFL")
breakpoints_new$mo[breakpoints_new$mo == "B_HMPHL" & breakpoints_new$ref_tbl %like% "^h.* influenzae"] <- as.mo("B_HMPHL_INFL")
# EUCAST says that for H. parainfluenzae the H. influenza rules can be used, so add them
clinical_breakpoints <- clinical_breakpoints %>%
breakpoints_new <- breakpoints_new %>%
bind_rows(
clinical_breakpoints %>%
breakpoints_new %>%
filter(guideline %like% "EUCAST", mo == "B_HMPHL_INFL") %>%
mutate(mo = as.mo("B_HMPHL_PRNF"))
) %>%
arrange(desc(guideline), mo, ab, type, method)
arrange(desc(guideline), mo, ab, type, host, method)
# Achromobacter denitrificans is in WHONET included in their A. xylosoxidans table, must be removed
clinical_breakpoints <- clinical_breakpoints %>% filter(mo != as.mo("Achromobacter denitrificans"))
breakpoints_new <- breakpoints_new %>% filter(mo != as.mo("Achromobacter denitrificans"))
# WHONET contains gentamicin breakpoints for viridans streptocci, which are intrinsic R - they meant genta-high, which is ALSO in their table, so we just remove gentamicin in viridans streptococci
clinical_breakpoints <- clinical_breakpoints %>% filter(!(mo == as.mo("Streptococcus viridans") & ab == "GEN"))
breakpoints_new <- breakpoints_new %>% filter(!(mo == as.mo("Streptococcus viridans") & ab == "GEN"))
# Nitrofurantoin in Staph (EUCAST) only applies to S. saprophyticus, while WHONET has the DISK correct but the MIC on genus level
clinical_breakpoints$mo[clinical_breakpoints$mo == "B_STPHY" & clinical_breakpoints$ab == "NIT" & clinical_breakpoints$guideline %like% "EUCAST"] <- as.mo("B_STPHY_SPRP")
breakpoints_new$mo[breakpoints_new$mo == "B_STPHY" & breakpoints_new$ab == "NIT" & breakpoints_new$guideline %like% "EUCAST"] <- as.mo("B_STPHY_SPRP")
# WHONET sets the 2023 breakpoints for SAM to MIC of 16/32 for Enterobacterales, should be MIC 8/32 like AMC (see issue #123 on github.com/msberends/AMR)
clinical_breakpoints$breakpoint_S[clinical_breakpoints$mo == "B_[ORD]_ENTRBCTR" & clinical_breakpoints$ab == "SAM" & clinical_breakpoints$guideline %like% "CLSI 2023" & clinical_breakpoints$method == "MIC"] <- 8
# UPDATE 2024-02-22: fixed now
# breakpoints_new$breakpoint_S[breakpoints_new$mo == "B_[ORD]_ENTRBCTR" & breakpoints_new$ab == "SAM" & breakpoints_new$guideline %like% "CLSI 2023" & breakpoints_new$method == "MIC"] <- 8
# determine rank again now that some changes were made on taxonomic level (genus -> species)
clinical_breakpoints <- clinical_breakpoints %>%
breakpoints_new <- breakpoints_new %>%
mutate(rank_index = case_when(
is.na(mo_rank(mo, keep_synonyms = TRUE)) ~ 6, # for UNKNOWN, B_GRAMN, B_ANAER, B_ANAER-NEG, etc.
mo_rank(mo, keep_synonyms = TRUE) %like% "(infra|sub)" ~ 1,
@@ -337,7 +347,7 @@ clinical_breakpoints <- clinical_breakpoints %>%
# EUCAST 2022 guideline: S <= 8 and R > 8
# WHONET file: S <= 8 and R >= 16
breakpoints_new %>% filter(guideline == "EUCAST 2023", ab == "AMC", mo == "B_[ORD]_ENTRBCTR", method == "MIC")
# this will make an MIC of 12 I, which should be R, so:
# this will make an MIC of 12 I, which should be R according to EUCAST, so:
breakpoints_new <- breakpoints_new %>%
mutate(breakpoint_R = ifelse(guideline %like% "EUCAST" & method == "MIC" & log2(breakpoint_R) - log2(breakpoint_S) != 0,
pmax(breakpoint_S, breakpoint_R / 2),
@@ -350,7 +360,7 @@ breakpoints_new <- breakpoints_new %>%
breakpoint_R + 1,
breakpoint_R
))
# fix missing R breakpoint where there is an S breakpoint
# fill missing R breakpoint where there is an S breakpoint
breakpoints_new[which(is.na(breakpoints_new$breakpoint_R)), "breakpoint_R"] <- breakpoints_new[which(is.na(breakpoints_new$breakpoint_R)), "breakpoint_S"]
+304 -126
View File
@@ -150,12 +150,14 @@ df_remove_nonASCII <- function(df) {
# to retrieve LPSN and authors from LPSN website
get_lpsn_and_author <- function(rank, name) {
name <- gsub("^Candidatus ", "", name)
url <- paste0("https://lpsn.dsmz.de/", tolower(rank), "/", tolower(name))
page_txt <- tryCatch(read_html(url), error = function(e) NULL)
if (is.null(page_txt)) {
warning("No LPSN found for ", tolower(rank), " '", name, "'")
lpsn <- NA_character_
ref <- NA_character_
status <- "unknown"
} else {
page_txt <- page_txt %>%
html_element("#detail-page") %>%
@@ -164,9 +166,33 @@ get_lpsn_and_author <- function(rank, name) {
ref <- page_txt %>%
gsub(".*?Name: (.*[0-9]{4}?).*", "\\1", ., perl = FALSE) %>%
gsub(name, "", ., fixed = TRUE) %>%
gsub("^\"?Candidatus ?\"?", "", .) %>%
trimws()
status <- trimws(gsub(".*Nomenclatural status:[\r\n\t ]*([a-zA-Z, ]+)[\r\n\t].*", "\\1", page_txt, perl = FALSE))
if ((status %like% "validly published" & status %unlike% "not valid") | status %like% "[\r\n\t]") {
# we used to take "accepted" for every LPSN record, also candidates. Now only for missing values and explicit accepted ones.
status <- "accepted"
} else {
status <- "not validly published"
}
}
c("lpsn" = lpsn, "ref" = ref, "status" = status)
}
# this will e.g. take the family from the root genus record, and gives all species that family
get_top_lvl <- function(current, rank, rank_target) {
if (!rank_target %in% rank) {
current[1]
} else {
out <- current[rank == rank_target][1]
if (out %in% c("", NA)) {
out <- names(sort(table(current[which(!current %in% c("", NA))]), decreasing = TRUE)[1])
if (is.null(out)) {
out <- ""
}
}
out
}
c("lpsn" = lpsn, "ref" = ref)
}
# MB/ August 2022: useless, does not contain full taxonomy, e.g. LPSN::request(cred, category = "family") is empty.
@@ -208,11 +234,12 @@ include_fungal_orders_ids <- taxonomy_gbif.bak %>%
include_fungal_orders <- taxonomy_gbif.bak %>%
filter(taxonID %in% c(include_fungal_orders_ids$taxonID, include_fungal_orders_ids$acceptedNameUsageID)) %>%
distinct(order) %>%
pull(order)
pull(order) |>
sort()
# check some columns to validate below filters
sort(table(taxonomy_gbif.bak$taxonomicStatus))
sort(table(taxonomy_gbif.bak$taxonRank))
taxonomy_gbif.bak$taxonomicStatus |> table() |> sort() |> as.data.frame()
taxonomy_gbif.bak$taxonRank |> table() |> sort() |> as.data.frame()
taxonomy_gbif <- taxonomy_gbif.bak %>%
# immediately filter rows we really never want
@@ -223,11 +250,8 @@ taxonomy_gbif <- taxonomy_gbif.bak %>%
# include these kingdoms (no Chromista)
kingdom %in% c("Archaea", "Bacteria", "Protozoa") |
# include all of these fungal orders
order %in% c(
"Eurotiales", "Microascales", "Mucorales", "Saccharomycetales",
"Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales"
) |
# and all of these important genera (see "data-raw/_pre_commit_hook.R")
order %in% include_fungal_orders |
# and all of these important genera (see "data-raw/_pre_commit_checks.R")
# (they also contain bacteria and protozoa, but these will get prevalence = 2 later on)
genus %in% AMR:::MO_PREVALENT_GENERA
) %>%
@@ -289,9 +313,6 @@ taxonomy_gbif
taxonomy_lpsn.bak <- vroom(file_lpsn)
# check some columns to validate below filters
sort(table(is.na(taxonomy_lpsn.bak$record_lnk))) # accepted = TRUE
taxonomy_lpsn <- taxonomy_lpsn.bak %>%
transmute(
genus = genus_name,
@@ -309,6 +330,10 @@ taxonomy_lpsn <- taxonomy_lpsn.bak %>%
lpsn_renamed_to = as.character(record_lnk)
) %>%
mutate(source = "LPSN")
# integrity tests
sort(table(taxonomy_lpsn$rank))
sort(table(taxonomy_lpsn$status))
taxonomy_lpsn
# download additional taxonomy to the domain/kingdom level (their API is not sufficient...)
@@ -322,17 +347,22 @@ taxonomy_lpsn_missing <- tibble(
)
for (page in LETTERS) {
# this will not alter `taxonomy_lpsn` yet
message("Downloading page ", page, "...", appendLF = FALSE)
message("Downloading page ", page, "...", appendLF = TRUE)
url <- paste0("https://lpsn.dsmz.de/genus?page=", page)
x <- read_html(url) %>%
x <- tryCatch(read_html(url),
error = function(e) {
message("Waiting 10 seconds because of error: ", e$message)
Sys.sleep(10)
read_html(url)
})
x <- x %>%
# class "main-list" is the main table
html_element(".main-list") %>%
# get every list element with a set <id> attribute
html_elements("li[id]")
pb <- progress_bar$new(total = length(x), format = "[:bar] :current/:total :eta")
for (i in seq_len(length(x))) {
if (i %% 25 == 0) {
message(".", appendLF = FALSE)
}
pb$tick()
elements <- x[[i]] %>% html_elements("a")
hrefs <- elements %>% html_attr("href")
ranks <- hrefs %>% gsub(".*/(.*?)/.*", "\\1", .)
@@ -344,21 +374,26 @@ for (page in LETTERS) {
names <- names[ranks != "species"]
ranks <- ranks[ranks != "species"]
ranks[ranks == "domain"] <- "kingdom"
df <- names %>%
tibble() %>%
t() %>%
as_tibble(.name_repair = "unique") %>%
setNames(ranks) %>%
# no candidates please
filter(genus %unlike% "^(Candidatus|\\[)")
suppressMessages(
df <- names %>%
tibble() %>%
t() %>%
as_tibble(.name_repair = "unique") %>%
setNames(ranks) %>%
# no candidates please
filter(genus %unlike% "^(Candidatus|\\[)")
)
taxonomy_lpsn_missing <- taxonomy_lpsn_missing %>%
bind_rows(df)
}
message(length(x), " entries incl. candidates (cleaned total: ", nrow(taxonomy_lpsn_missing), ")")
message(" => ", length(x), " entries incl. candidates (cleaned total: ", nrow(taxonomy_lpsn_missing), ")")
}
taxonomy_lpsn_missing
taxonomy_lpsn_missing <- taxonomy_lpsn_missing |> distinct()
# had to pick the right genus/family combination here:
taxonomy_lpsn_missing <- taxonomy_lpsn_missing |> filter(!(genus == "Pusillimonas" & family == "Oscillospiraceae"))
taxonomy_lpsn.bak2 <- taxonomy_lpsn.bak
taxonomy_lpsn <- taxonomy_lpsn %>%
left_join(taxonomy_lpsn_missing, by = "genus") %>%
@@ -367,8 +402,10 @@ taxonomy_lpsn <- taxonomy_lpsn %>%
mutate_all(function(x) ifelse(x %like_case% " no ", NA_character_, x))
taxonomy_lpsn.bak2 <- taxonomy_lpsn
# download family directly from LPSN website using scraping
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$family)))
# download family directly from LPSN website using scraping, by using get_lpsn_and_author()
# try it first:
# get_lpsn_and_author("genus", "Escherichia")
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$family)), format = "[:bar] :current/:total :eta")
for (f in unique(taxonomy_lpsn$family)) {
pb$tick()
if (is.na(f)) next
@@ -381,14 +418,14 @@ for (f in unique(taxonomy_lpsn$family)) {
order = taxonomy_lpsn$order[which(taxonomy_lpsn$family == f)[1]],
family = f,
rank = "family",
status = "accepted",
status = unname(tax_info["status"]),
source = "LPSN",
lpsn = unname(tax_info["lpsn"]),
ref = unname(tax_info["ref"])
))
}
# download order directly from LPSN website using scraping
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$order)))
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$order)), format = "[:bar] :current/:total :eta")
for (o in unique(taxonomy_lpsn$order)) {
pb$tick()
if (is.na(o)) next
@@ -400,14 +437,14 @@ for (o in unique(taxonomy_lpsn$order)) {
class = taxonomy_lpsn$class[which(taxonomy_lpsn$order == o)[1]],
order = o,
rank = "order",
status = "accepted",
status = unname(tax_info["status"]),
source = "LPSN",
lpsn = unname(tax_info["lpsn"]),
ref = unname(tax_info["ref"])
))
}
# download class directly from LPSN website using scraping
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$class)))
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$class)), format = "[:bar] :current/:total :eta")
for (cc in unique(taxonomy_lpsn$class)) {
pb$tick()
if (is.na(cc)) next
@@ -418,14 +455,14 @@ for (cc in unique(taxonomy_lpsn$class)) {
phylum = taxonomy_lpsn$phylum[which(taxonomy_lpsn$class == cc)[1]],
class = cc,
rank = "class",
status = "accepted",
status = unname(tax_info["status"]),
source = "LPSN",
lpsn = unname(tax_info["lpsn"]),
ref = unname(tax_info["ref"])
))
}
# download phylum directly from LPSN website using scraping
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$phylum)))
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$phylum)), format = "[:bar] :current/:total :eta")
for (p in unique(taxonomy_lpsn$phylum)) {
pb$tick()
if (is.na(p)) next
@@ -435,14 +472,14 @@ for (p in unique(taxonomy_lpsn$phylum)) {
kingdom = taxonomy_lpsn$kingdom[which(taxonomy_lpsn$phylum == p)[1]],
phylum = p,
rank = "phylum",
status = "accepted",
status = unname(tax_info["status"]),
source = "LPSN",
lpsn = unname(tax_info["lpsn"]),
ref = unname(tax_info["ref"])
))
}
# download kingdom directly from LPSN website using scraping
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$kingdom)))
pb <- progress_bar$new(total = length(unique(taxonomy_lpsn$kingdom)), format = "[:bar] :current/:total :eta")
for (k in unique(taxonomy_lpsn$kingdom)) {
pb$tick()
if (is.na(k)) next
@@ -451,7 +488,7 @@ for (k in unique(taxonomy_lpsn$kingdom)) {
bind_rows(tibble(
kingdom = k,
rank = "kingdom",
status = "accepted",
status = unname(tax_info["status"]),
source = "LPSN",
lpsn = unname(tax_info["lpsn"]),
ref = unname(tax_info["ref"])
@@ -469,6 +506,7 @@ saveRDS(taxonomy_gbif, "data-raw/taxonomy_gbif.rds", version = 2)
saveRDS(taxonomy_lpsn, "data-raw/taxonomy_lpsn.rds", version = 2)
# this allows to always get back to this point by simply loading the files from data-raw/.
# Add full names ----------------------------------------------------------
taxonomy_gbif <- taxonomy_gbif %>%
@@ -515,29 +553,28 @@ taxonomy_lpsn$lpsn_parent[taxonomy_lpsn$rank == "subspecies"] <- taxonomy_lpsn$l
# Combine the datasets ----------------------------------------------------
# basis must be LPSN as it's most recent
taxonomy <- taxonomy_lpsn %>%
# join GBIF identifiers to them
left_join(taxonomy_gbif %>% select(kingdom, fullname, starts_with("gbif")),
by = c("kingdom", "fullname")
)
# for everything else, add the GBIF data
taxonomy <- taxonomy %>%
bind_rows(taxonomy_gbif %>%
filter(!paste(kingdom, fullname) %in% paste(taxonomy$kingdom, taxonomy$fullname))) %>%
arrange(fullname) %>%
filter(fullname != "")
taxonomy <- taxonomy_lpsn |>
# start by adding GBIF to the bottom
bind_rows(taxonomy_gbif) |>
# group on unique species
group_by(kingdom, fullname) |>
# fill the NAs in LPSN/GBIF fields and ref with the other source (so LPSN: 123 and GBIF: NA will become LPSN: 123 and GBIF: 123)
mutate(across(matches("^(lpsn|gbif|ref)"), function(x) rep(x[!is.na(x)][1], length(x)))) |>
# ungroup again
ungroup() |>
# only keep unique species per kingdom
distinct(kingdom, fullname, .keep_all = TRUE) |>
arrange(fullname)
# get missing entries from existing microorganisms data set
taxonomy <- taxonomy %>%
bind_rows(AMR::microorganisms %>%
taxonomy.old <- AMR::microorganisms %>%
select(all_of(colnames(taxonomy))) %>%
filter(
!paste(kingdom, fullname) %in% paste(taxonomy$kingdom, taxonomy$fullname),
# these will be added later:
source != "manually added"
)) %>%
source != "manually added")
taxonomy <- taxonomy %>%
bind_rows(taxonomy.old) %>%
arrange(fullname) %>%
filter(fullname != "")
@@ -557,6 +594,29 @@ taxonomy <- taxonomy %>%
))
table(taxonomy$rank, useNA = "always")
# at this point, it happens that some genera within kingdoms have multiple families / orders, etc., see here:
taxonomy |> filter(genus != "") |> group_by(kingdom, genus) |> filter(n_distinct(family) > 1) |> View()
# so make this universal
taxonomy <- taxonomy |>
group_by(kingdom, genus) |>
mutate(family = get_top_lvl(family, rank, "genus")) |>
group_by(kingdom, family) |>
mutate(order = get_top_lvl(order, rank, "family")) |>
group_by(kingdom, order) |>
mutate(class = get_top_lvl(class, rank, "order")) |>
group_by(kingdom, class) |>
mutate(phylum = get_top_lvl(phylum, rank, "class")) |>
ungroup()
# and remove the taxonomy where it must remain empty
taxonomy <- taxonomy |>
mutate(phylum = ifelse(rank %in% c("kingdom"), "", phylum),
class = ifelse(rank %in% c("kingdom", "phylum"), "", class),
order = ifelse(rank %in% c("kingdom", "phylum", "class"), "", order),
family = ifelse(rank %in% c("kingdom", "phylum", "class", "order"), "", family),
genus = ifelse(rank %in% c("kingdom", "phylum", "class", "order", "family"), "", genus),
species = ifelse(rank %in% c("kingdom", "phylum", "class", "order", "family", "genus"), "", species),
subspecies = ifelse(rank %in% c("kingdom", "phylum", "class", "order", "family", "genus", "species"), "", subspecies))
# Save intermediate results (0) -------------------------------------------
@@ -575,28 +635,23 @@ current_gbif <- taxonomy_gbif.bak %>%
)
# add missing kingdoms
taxonomy <- taxonomy %>%
bind_rows(
taxonomy %>%
filter(kingdom != "") %>%
distinct(kingdom) %>%
mutate(
fullname = kingdom,
rank = "kingdom",
status = "accepted",
source = "manually added"
) %>%
filter(!paste(kingdom, rank) %in% paste(taxonomy$kingdom, taxonomy$rank)) %>%
left_join(
current_gbif %>%
select(kingdom, rank = taxonRank, ref = scientificNameAuthorship, gbif = taxonID, gbif_parent = parentNameUsageID),
by = c("kingdom", "rank")
) %>%
mutate(source = ifelse(!is.na(gbif), "GBIF", source))
)
taxonomy_all_missing <- taxonomy %>%
filter(kingdom != "") %>%
distinct(kingdom) %>%
mutate(
fullname = kingdom,
rank = "kingdom"
) %>%
filter(!paste(kingdom, rank) %in% paste(taxonomy$kingdom, taxonomy$rank)) %>%
left_join(
current_gbif %>%
select(kingdom, rank = taxonRank, ref = scientificNameAuthorship, gbif = taxonID, gbif_parent = parentNameUsageID),
by = c("kingdom", "rank")
) %>%
mutate(source = ifelse(!is.na(gbif), "GBIF", "manually added"),
status = ifelse(!is.na(gbif), "accepted", "unknown"))
# 2 = phylum ... 6 = genus
taxonomy_all_missing <- NULL
for (i in 2:6) {
i_name <- colnames(taxonomy)[i + 1]
message("Adding missing: ", i_name, "... ", appendLF = FALSE)
@@ -606,25 +661,20 @@ for (i in 2:6) {
select(kingdom:(i + 1)) %>%
mutate(
fullname = .[[ncol(.)]],
rank = i_name,
status = "accepted",
source = "manually added"
rank = i_name
) %>%
filter(!paste(kingdom, .[[ncol(.) - 4]], rank) %in% paste(taxonomy$kingdom, taxonomy[[i + 1]], taxonomy$rank)) %>%
filter(!paste(kingdom, .[[ncol(.) - 2]], rank) %in% paste(taxonomy$kingdom, taxonomy[[i + 1]], taxonomy$rank)) %>%
# get GBIF identifier where available
left_join(
current_gbif %>%
select(kingdom, all_of(i_name), rank = taxonRank, ref = scientificNameAuthorship, gbif = taxonID, gbif_parent = parentNameUsageID),
by = c("kingdom", "rank", i_name)
) %>%
mutate(source = ifelse(!is.na(gbif), "GBIF", source))
mutate(source = ifelse(!is.na(gbif), "GBIF", "manually added"),
status = ifelse(!is.na(gbif), "accepted", "unknown"))
message("n = ", nrow(to_add))
if (is.null(taxonomy_all_missing)) {
taxonomy_all_missing <- to_add
} else {
taxonomy_all_missing <- taxonomy_all_missing %>%
bind_rows(to_add)
}
taxonomy_all_missing <- taxonomy_all_missing %>%
bind_rows(to_add)
}
taxonomy_all_missing %>% View()
@@ -652,7 +702,7 @@ taxonomy <- taxonomy %>%
select(-fullname_rank, -rank_index) %>%
arrange(fullname)
# now also add missing species (requires combination with genus)
# now also add missing species that have subspecies (requires combination with genus)
taxonomy <- taxonomy %>%
bind_rows(
taxonomy %>%
@@ -661,9 +711,7 @@ taxonomy <- taxonomy %>%
select(kingdom:species) %>%
mutate(
fullname = paste(genus, species),
rank = "species",
status = "accepted",
source = "manually added"
rank = "species"
) %>%
filter(!paste(kingdom, genus, species, rank) %in% paste(taxonomy$kingdom, taxonomy$genus, taxonomy$species, taxonomy$rank)) %>%
# get GBIF identifier where available
@@ -672,13 +720,15 @@ taxonomy <- taxonomy %>%
select(kingdom, genus, species = specificEpithet, rank = taxonRank, ref = scientificNameAuthorship, gbif = taxonID, gbif_parent = parentNameUsageID),
by = c("kingdom", "rank", "genus", "species")
) %>%
mutate(source = ifelse(!is.na(gbif), "GBIF", source))
mutate(source = ifelse(!is.na(gbif), "GBIF", "manually added"),
status = ifelse(!is.na(gbif), "accepted", "unknown"))
)
# remove NAs from taxonomy again, and keep unique full names
taxonomy <- taxonomy %>%
mutate(across(kingdom:subspecies, function(x) ifelse(is.na(x), "", x))) %>%
arrange(kingdom, fullname, ref) |>
distinct(kingdom, fullname, .keep_all = TRUE) %>%
filter(kingdom != "")
@@ -691,12 +741,11 @@ saveRDS(taxonomy, "data-raw/taxonomy1.rds")
# Get previously manually added entries -----------------------------------
manually_added <- AMR::microorganisms %>%
filter(source == "manually added", !paste(kingdom, fullname) %in% paste(taxonomy$kingdom, taxonomy$fullname)) %>%
filter(source == "manually added",
!paste(kingdom, fullname) %in% paste(taxonomy$kingdom, taxonomy$fullname),
!rank %in% c("kingdom", "phylum", "class", "order", "family")) %>%
select(fullname:subspecies, ref, source, rank)
manually_added <- manually_added %>%
bind_rows(salmonellae)
# get latest taxonomy for those entries
for (g in unique(manually_added$genus[manually_added$genus != "" & manually_added$genus %in% taxonomy$genus])) {
manually_added$family[which(manually_added$genus == g)] <- taxonomy$family[which(taxonomy$genus == g & is.na(taxonomy$lpsn))][1]
@@ -716,11 +765,14 @@ for (p in unique(manually_added$phylum[manually_added$phylum != "" & manually_ad
manually_added <- manually_added %>%
mutate(
status = "accepted",
status = "unknown",
rank = ifelse(fullname %like% "unknown", "(unknown rank)", rank)
)
manually_added
# these are now included in the new taxonomy, check them
manually_added |> filter(fullname %in% taxonomy$fullname)
taxonomy <- taxonomy %>%
# here also the 'unknowns' are added, such as "(unknown fungus)"
bind_rows(manually_added) %>%
@@ -728,6 +780,31 @@ taxonomy <- taxonomy %>%
table(taxonomy$rank, useNA = "always")
# Get LPSN data for records missing from `taxonomy_lpsn` ------------------
# Weirdly enough, some LPSN records were lacking from `taxonomy_lpsn`,
# such as family Thiotrichaceae and its order Thiotrichales. When running
# get_lpsn_and_author("family", "Thiotrichaceae") you do get a result.
# So check every non-LPSN records from the kingdom of Bacteria and add it
gbif_bacteria <- which(taxonomy$kingdom == "Bacteria" & taxonomy$source == "GBIF" & taxonomy$rank %in% c("phylum", "class", "order", "family"))
added <- 0
pb <- progress_bar$new(total = length(gbif_bacteria), format = "[:bar] :current/:total :eta")
for (record in gbif_bacteria) {
pb$tick()
lpsn <- get_lpsn_and_author(rank = taxonomy$rank[record],
name = taxonomy$fullname[record])
if (is.na(lpsn["lpsn"])) {
next
} else {
added <- added + 1
taxonomy$source[record] <- "LPSN"
taxonomy$lpsn[record] <- unname(lpsn["lpsn"])
taxonomy$ref[record] <- unname(lpsn["ref"])
taxonomy$status[record] <- unname(lpsn["status"])
}
}
message(added, " GBIF records altered to latest LPSN")
taxbak <- taxonomy
# Clean scientific reference ----------------------------------------------
@@ -737,7 +814,7 @@ taxonomy <- taxonomy %>%
# Get the latest upper taxonomy from LPSN for non-LPSN data ---------------
# (e.g., phylum above class "Bacilli" was still "Firmicutes", should be "Bacillota" in 2022)
# (e.g., phylum above class "Bacilli" was still "Firmicutes" in 2023, should be "Bacillota")
for (k in unique(taxonomy$kingdom[taxonomy$kingdom != ""])) {
message("Fixing GBIF taxonomy for kingdom ", k, ".", appendLF = FALSE)
i <- 0
@@ -765,17 +842,25 @@ for (k in unique(taxonomy$kingdom[taxonomy$kingdom != ""])) {
}
# we need to fix parent GBIF identifiers
taxonomy$gbif_parent[taxonomy$rank == "phylum" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$kingdom[taxonomy$rank == "phylum" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "class" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$phylum[taxonomy$rank == "class" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "order" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$class[taxonomy$rank == "order" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "family" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$order[taxonomy$rank == "family" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "genus" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$family[taxonomy$rank == "genus" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "species" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(taxonomy$genus[taxonomy$rank == "species" & !is.na(taxonomy$gbif)], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "subspecies" & !is.na(taxonomy$gbif)] <- taxonomy$gbif[match(paste(taxonomy$genus[taxonomy$rank == "subspecies" & !is.na(taxonomy$gbif)], taxonomy$species[taxonomy$rank == "subspecies" & !is.na(taxonomy$gbif)]), taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "phylum"] <- taxonomy$gbif[match(taxonomy$kingdom[taxonomy$rank == "phylum"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "class"] <- taxonomy$gbif[match(taxonomy$phylum[taxonomy$rank == "class"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "order"] <- taxonomy$gbif[match(taxonomy$class[taxonomy$rank == "order"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "family"] <- taxonomy$gbif[match(taxonomy$order[taxonomy$rank == "family"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "genus"] <- taxonomy$gbif[match(taxonomy$family[taxonomy$rank == "genus"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "species"] <- taxonomy$gbif[match(taxonomy$genus[taxonomy$rank == "species"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "subspecies"] <- taxonomy$gbif[match(paste(taxonomy$genus[taxonomy$rank == "subspecies"], taxonomy$species[taxonomy$rank == "subspecies"]), taxonomy$fullname)]
# and LPSN parents
taxonomy$lpsn_parent[taxonomy$rank == "phylum"] <- taxonomy$lpsn[match(taxonomy$kingdom[taxonomy$rank == "phylum"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "class"] <- taxonomy$lpsn[match(taxonomy$phylum[taxonomy$rank == "class"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "order"] <- taxonomy$lpsn[match(taxonomy$class[taxonomy$rank == "order"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "family"] <- taxonomy$lpsn[match(taxonomy$order[taxonomy$rank == "family"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "genus"] <- taxonomy$lpsn[match(taxonomy$family[taxonomy$rank == "genus"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "species"] <- taxonomy$lpsn[match(taxonomy$genus[taxonomy$rank == "species"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "subspecies"] <- taxonomy$lpsn[match(paste(taxonomy$genus[taxonomy$rank == "subspecies"], taxonomy$species[taxonomy$rank == "subspecies"]), taxonomy$fullname)]
# these still have no record in our data set:
all(taxonomy$lpsn_parent %in% taxonomy$lpsn)
all(taxonomy$gbif_parent %in% taxonomy$gbif)
which(!taxonomy$lpsn_parent %in% taxonomy$lpsn)
which(!taxonomy$gbif_parent %in% taxonomy$gbif)
# fix rank
taxonomy <- taxonomy %>%
@@ -794,6 +879,7 @@ taxonomy <- taxonomy %>%
# Add prevalence ----------------------------------------------------------
taxonomy_lpsn.bak3 <- taxonomy
pathogens <- read_excel(file_bartlett, sheet = "Tab 6 Full List")
# get all established, both old and current taxonomic names
@@ -902,6 +988,7 @@ mo_kingdom <- taxonomy %>%
kingdom == "Protozoa" ~ "P",
TRUE ~ ""
))
# phylum until family are abbreviated with 8 characters and prefixed with their rank
# Phylum - keep old and fill up for new ones
@@ -1196,58 +1283,120 @@ taxonomy <- taxonomy %>%
taxonomy %>%
filter(fullname %in% .[duplicated(fullname), "fullname", drop = TRUE]) %>%
View()
# fullnames must be unique, we'll keep the most relevant ones only
taxonomy <- taxonomy %>%
mutate(rank_index = case_when(
kingdom == "Bacteria" ~ 1,
kingdom == "Fungi" ~ 2,
kingdom == "Protozoa" ~ 3,
kingdom == "Archaea" ~ 4,
TRUE ~ 5
kingdom == "Animalia" ~ 5,
TRUE ~ 6
)) %>%
arrange(fullname, rank_index) %>%
distinct(fullname, .keep_all = TRUE) %>%
select(-rank_index) %>%
filter(mo != "")
# keep the codes from manually added ones
manual_mos <- as.character(AMR::microorganisms$mo)[match(taxonomy$fullname[taxonomy$source == "manually added"], AMR::microorganisms$fullname)]
taxonomy$mo[taxonomy$source == "manually added"][!is.na(manual_mos)] <- manual_mos[!is.na(manual_mos)]
# this must not exist:
taxonomy %>%
filter(mo %like% "__") %>%
View()
taxonomy <- taxonomy %>% filter(mo %unlike% "__")
taxonomy_lpsn.bak4 <- taxonomy
# Some integrity checks ---------------------------------------------------
# are mo codes unique?
taxonomy %>% filter(mo %in% .[duplicated(mo), "mo", drop = TRUE])
taxonomy <- taxonomy %>% distinct(mo, .keep_all = TRUE)
taxonomy %>% filter(mo %in% .[duplicated(mo), "mo", drop = TRUE]) |> arrange(mo) |> View()
# no, there are not, so sort on MO and keep the first
taxonomy <- taxonomy %>% arrange(mo) |> distinct(mo, .keep_all = TRUE)
taxonomy <- taxonomy |>
mutate(fullname = case_match(rank,
"phylum" ~ phylum,
"class" ~ class,
"order" ~ order,
"family" ~ family,
.default = fullname))
# are fullnames unique?
taxonomy %>% filter(fullname %in% .[duplicated(fullname), "fullname", drop = TRUE])
# are all GBIFs available?
taxonomy %>%
filter(!gbif_parent %in% gbif) %>%
count(rank)
# try to find the right gbif IDs
taxonomy$gbif_parent[which(!taxonomy$gbif_parent %in% taxonomy$gbif & taxonomy$rank == "species")] <- taxonomy$gbif[match(taxonomy$genus[which(!taxonomy$gbif_parent %in% taxonomy$gbif & taxonomy$rank == "species")], taxonomy$genus)]
taxonomy$gbif_parent[which(!taxonomy$gbif_parent %in% taxonomy$gbif & taxonomy$rank == "class")] <- taxonomy$gbif[match(taxonomy$phylum[which(!taxonomy$gbif_parent %in% taxonomy$gbif & taxonomy$rank == "class")], taxonomy$phylum)]
taxonomy %>%
filter(!gbif_parent %in% gbif) %>%
count(rank)
filter((!gbif_parent %in% gbif) | (!lpsn_parent %in% lpsn)) %>%
count(source = ifelse(!gbif_parent %in% gbif, "GBIF", "LPSN"),
rank)
# are all LPSNs available?
# so fix again all parent GBIF identifiers
taxonomy$gbif_parent[taxonomy$rank == "phylum"] <- taxonomy$gbif[match(taxonomy$kingdom[taxonomy$rank == "phylum"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "class"] <- taxonomy$gbif[match(taxonomy$phylum[taxonomy$rank == "class"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "order"] <- taxonomy$gbif[match(taxonomy$class[taxonomy$rank == "order"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "family"] <- taxonomy$gbif[match(taxonomy$order[taxonomy$rank == "family"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "genus"] <- taxonomy$gbif[match(taxonomy$family[taxonomy$rank == "genus"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "species"] <- taxonomy$gbif[match(taxonomy$genus[taxonomy$rank == "species"], taxonomy$fullname)]
taxonomy$gbif_parent[taxonomy$rank == "subspecies"] <- taxonomy$gbif[match(paste(taxonomy$genus[taxonomy$rank == "subspecies"], taxonomy$species[taxonomy$rank == "subspecies"]), taxonomy$fullname)]
# and LPSN identifiers
taxonomy$lpsn_parent[taxonomy$rank == "phylum"] <- taxonomy$lpsn[match(taxonomy$kingdom[taxonomy$rank == "phylum"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "class"] <- taxonomy$lpsn[match(taxonomy$phylum[taxonomy$rank == "class"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "order"] <- taxonomy$lpsn[match(taxonomy$class[taxonomy$rank == "order"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "family"] <- taxonomy$lpsn[match(taxonomy$order[taxonomy$rank == "family"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "genus"] <- taxonomy$lpsn[match(taxonomy$family[taxonomy$rank == "genus"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "species"] <- taxonomy$lpsn[match(taxonomy$genus[taxonomy$rank == "species"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "subspecies"] <- taxonomy$lpsn[match(paste(taxonomy$genus[taxonomy$rank == "subspecies"], taxonomy$species[taxonomy$rank == "subspecies"]), taxonomy$fullname)]
# check again
taxonomy %>%
filter(!lpsn_parent %in% lpsn) %>%
count(rank)
# make GBIF refer to newest renaming according to LPSN
taxonomy$gbif_renamed_to[which(!is.na(taxonomy$gbif_renamed_to) & !is.na(taxonomy$lpsn_renamed_to))] <- taxonomy$gbif[match(taxonomy$lpsn_renamed_to[which(!is.na(taxonomy$gbif_renamed_to) & !is.na(taxonomy$lpsn_renamed_to))], taxonomy$lpsn)]
filter((!gbif_parent %in% gbif) | (!lpsn_parent %in% lpsn)) %>%
count(source = ifelse(!gbif_parent %in% gbif, "GBIF", "LPSN"),
rank)
# Save intermediate results (3) -------------------------------------------
saveRDS(taxonomy, "data-raw/taxonomy3.rds")
# Redo LPSN missings and parents ------------------------------------------
gbif_bacteria_second_run <- which(taxonomy$kingdom == "Bacteria" & taxonomy$source == "GBIF" & taxonomy$rank %in% c("phylum", "class", "order", "family"))
gbif_bacteria_second_run <- gbif_bacteria_second_run[!gbif_bacteria_second_run %in% gbif_bacteria]
added <- 0
pb <- progress_bar$new(total = length(gbif_bacteria_second_run), format = "[:bar] :current/:total :eta")
for (record in gbif_bacteria_second_run) {
pb$tick()
lpsn <- get_lpsn_and_author(rank = taxonomy$rank[record],
name = taxonomy$fullname[record])
if (is.na(lpsn["lpsn"])) {
next
} else {
added <- added + 1
taxonomy$source[record] <- "LPSN"
taxonomy$lpsn[record] <- unname(lpsn["lpsn"])
taxonomy$ref[record] <- unname(lpsn["ref"])
taxonomy$status[record] <- unname(lpsn["status"])
}
}
message(added, " GBIF records altered to latest LPSN")
taxbak <- taxonomy
taxonomy$lpsn_parent[taxonomy$rank == "phylum"] <- taxonomy$lpsn[match(taxonomy$kingdom[taxonomy$rank == "phylum"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "class"] <- taxonomy$lpsn[match(taxonomy$phylum[taxonomy$rank == "class"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "order"] <- taxonomy$lpsn[match(taxonomy$class[taxonomy$rank == "order"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "family"] <- taxonomy$lpsn[match(taxonomy$order[taxonomy$rank == "family"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "genus"] <- taxonomy$lpsn[match(taxonomy$family[taxonomy$rank == "genus"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "species"] <- taxonomy$lpsn[match(taxonomy$genus[taxonomy$rank == "species"], taxonomy$fullname)]
taxonomy$lpsn_parent[taxonomy$rank == "subspecies"] <- taxonomy$lpsn[match(paste(taxonomy$genus[taxonomy$rank == "subspecies"], taxonomy$species[taxonomy$rank == "subspecies"]), taxonomy$fullname)]
# TODO: there is no order Eggerthellales anymore
# Remove unwanted taxonomic entries from Protoza/Fungi --------------------
# this must be done after the microbial ID generation, since it will otherwise generate a lot of different IDs
@@ -1256,12 +1405,12 @@ taxonomy <- taxonomy %>%
# Protozoa:
!(phylum %in% c("Choanozoa", "Mycetozoa") & prevalence == 3),
# Fungi:
!(phylum %in% c("Ascomycota", "Zygomycota", "Basidiomycota") & prevalence == 3),
!(phylum %in% c("Ascomycota", "Zygomycota", "Basidiomycota") & prevalence == 3 & rank %in% c("genus", "species", "subspecies")),
!(genus %in% c("Phoma", "Leptosphaeria", "Physarum") & rank %in% c("species", "subspecies")), # only genus of this rare fungus, with resp. 1300 and 800 species
# (leave Alternaria in there, part of human mycobiome and opportunistic pathogen)
# Animalia:
!genus %in% c("Lucilia", "Lumbricus"),
!(class == "Insecta" & rank %in% c("species", "subspecies")), # keep only genus of insects
!(class == "Insecta" & rank %in% c("species", "subspecies")), # keep only genus of insects, not all of their (sub)species
!(genus == "Amoeba" & kingdom == "Animalia"),
!(genus %in% c("Aedes", "Anopheles") & rank %in% c("species", "subspecies")), # only genus of the many hundreds of mosquitoes species
kingdom != "Plantae"
@@ -1270,7 +1419,8 @@ taxonomy <- taxonomy %>%
# no ghost families, orders classes, phyla
taxonomy <- taxonomy %>%
group_by(kingdom, family) %>%
filter(n() > 1 | fullname %like% "unknown" | rank == "kingdom") %>%
# (but keep the ghost families of bacteria)
filter(n() > 1 | fullname %like% "unknown" | rank == "kingdom" | kingdom == "Bacteria") %>%
group_by(kingdom, order) %>%
filter(n() > 1 | fullname %like% "unknown" | rank == "kingdom") %>%
group_by(kingdom, class) %>%
@@ -1280,6 +1430,34 @@ taxonomy <- taxonomy %>%
ungroup()
for (i in which(colnames(taxonomy) %in% c("phylum", "class", "order", "family")) - 1) {
i_name <- colnames(taxonomy)[i + 1]
message("Adding missing: ", i_name, "... ", appendLF = FALSE)
to_add <- taxonomy %>%
filter(.[[i + 1]] != "") %>%
distinct(kingdom, .[[i + 1]], .keep_all = TRUE) %>%
select(kingdom:(i + 1)) %>%
mutate(
fullname = .[[ncol(.)]],
rank = i_name
) %>%
filter(!paste(kingdom, .[[ncol(.) - 2]], rank) %in% paste(taxonomy$kingdom, taxonomy[[i + 1]], taxonomy$rank)) %>%
# get GBIF identifier where available
left_join(
current_gbif %>%
select(kingdom, all_of(i_name), rank = taxonRank, ref = scientificNameAuthorship, gbif = taxonID, gbif_parent = parentNameUsageID),
by = c("kingdom", "rank", i_name)
) %>%
mutate(source = ifelse(!is.na(gbif), "GBIF", "manually added"),
status = ifelse(!is.na(gbif), "accepted", "unknown"))
message("n = ", nrow(to_add))
# taxonomy_all_missing <- taxonomy_all_missing %>%
# bind_rows(to_add)
}
message(
"\nCongratulations! The new taxonomic table will contain ", format(nrow(taxonomy), big.mark = " "), " rows.\n",
"This was ", format(nrow(AMR::microorganisms), big.mark = " "), " rows.\n"
@@ -1493,7 +1671,7 @@ if (!identical(example_isolates$mo, as.mo(example_isolates$mo, language = NULL))
# load new data sets again
devtools::load_all(".")
source("data-raw/_pre_commit_hook.R")
source("data-raw/_pre_commit_checks.R")
devtools::load_all(".")
if (!identical(intrinsic_resistant$mo, as.mo(intrinsic_resistant$mo, language = NULL))) {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+16
View File
@@ -73,6 +73,7 @@ Bacitracin FALSE TRUE TRUE FALSE 阿奇霉素 Bacitracin Bacitracin Bacitracine
Benzathine benzylpenicillin FALSE TRUE TRUE FALSE 苄丝肼青霉素 Benzathine benzylpenicillin Benzathinbenzylpenicillin Benzylpenicillinebenzathine Bentsatiinibentsyylipenisilliini Benzathine benzylpénicilline Benzathin-Benzylpenicillin Βενζαθίνη βενζυλπενικιλλίνη Benzatina benzilpenicillina ベンズシン・ベンジルペニシリン Benzathine benzylpenicillin Benzylpenicylina benzylowa Benzatina benzatina benzilpenicilina Benzatină benzilpenicilină Бензатин бензилпенициллин Bencilpenicilina benzatínica Benzathinbenzylpenicillin Benzatin benzilpenisilin Бензатину бензилпеніцилін
Benzathine phenoxymethylpenicillin FALSE TRUE TRUE FALSE 苄星苯氧甲基青霉素 Benzatinový fenoxymethylpenicilin Benzathinfenoxymethylpenicillin Fenoxymethylpenicillinebenzathine Bentsatiinifenoksimetyylipenisilliini Phénoxyméthylpénicilline benzathine Benzathin-Phenoxymethylpenicillin Βενζαθίνη φαινοξυμεθυλοπενικιλλίνη Benzatina fenossimetilpenicillina ベンザチンフェノキシメチルペニシリン Benzathine fenoksymetylpenicillin Fenoksymetylopenicylina benzylowa Benzatina fenoximetilpenicilina Benzatină fenoximetilpenicilină Бензатин феноксиметилпенициллин Fenoximetilpenicilina benzatínica Bensathinfenoximetylpenicillin Benzatin fenoksimetilpenisilin Бензатину феноксиметилпеніцилін
Benzylpenicillin FALSE TRUE TRUE FALSE 苄基青霉素 Benzylpenicilin Benzylpenicillin Benzylpenicilline Bentsyylipenisilliini Benzylpénicilline Benzylpenicillin Βενζυλοπενικιλλίνη Benzilpenicillina ベンジルペニシリン Benzylpenicillin Benzylpenicylina Benzilpenicilina Benzilpenicilină Бензилпенициллин Bencilpenicilina Bensylpenicillin Benzilpenisilin Бензилпеніцилін
Cadazolid FALSE TRUE TRUE FALSE 卡达唑利德 Kadazolid Cadazolid Cadazolid Kadazolid Cadazolid Cadazolid Καδαζολίδη Cadazolid カダゾリド Cadazolid Kadazolid Cadazolid Cadazolid Кадазолид Cadazolid Cadazolid Cadazolid Кадазолід
Calcium aminosalicylate FALSE TRUE TRUE FALSE 氨基水杨酸钙 Aminosalicylát vápenatý Calciumaminosalicylat Aminosalicylzuur Kalsiumaminosalisylaatti Aminosalicylate de calcium Kalzium-Aminosalicylat Αμινοσαλικυλικό ασβέστιο Calcio aminosalicilato アミノサリチル酸カルシウム Kalsiumaminosalicylat Aminosalicylan wapnia Aminosalicilato de cálcio Aminosalicilat de calciu Аминосалицилат кальция Aminosalicilato de calcio Kalciumaminosalicylat Kalsiyum aminosalisilat Кальцію аміносаліцилат
Capreomycin FALSE TRUE TRUE FALSE 氨水杨酸钙 Kapreomycin Capreomycin Capreomycine Kapreomysiini Capréomycine Capreomycin Καπρεομυκίνη Capreomicina カプレオマイシン Capreomycin Kapreomycyna Capreomicina Capreomicină Капреомицин Capreomicina Kapreomycin Kapreomisin Капреоміцин
Carbenicillin FALSE TRUE TRUE FALSE 羧基青霉素 Karbenicilin Carbenicillin Carbenicilline Karbenisilliini Carbénicilline Carbenicillin Καρβενικιλλίνη Carbenicillina カルベニシリン Karbenicillin Karbenicylina Carbenicilina Carbenicilină Карбенициллин Carbenicilina Karbenicillin Karbenisilin Карбеніцилін
@@ -110,14 +111,19 @@ Chloramphenicol FALSE TRUE TRUE FALSE 氯霉素 Chloramfenikol Kloramfenicol Chl
Chlortetracycline FALSE TRUE TRUE FALSE 金霉素 Chlortetracyklin Chlortetracyclin Chloortetracycline Klortetasykliini Chlortétracycline Chlortetracyclin Χλωροτετρακυκλίνη Clorotetraciclina クロルテトラサイクリン Klortetracyklin Chlortetracyklina Chlortetracycline Clortetraciclină Хлортетрациклин Clortetraciclina Klortetracyklin Klortetrasiklin Хлортетрациклін
Cinoxacin FALSE TRUE TRUE FALSE 西诺沙星 Cinoxacin Cinoxacin Cinoxacine Kinoksasiini Cinoxacine Cinoxacin Τσινοξακίνη Cinoxacina シノキサシン Cinoxacin Cinoxacin Cinoxacin Cinoxacină Циноксацин Cinoxacina Cinoxacin Cinoxacin Циноксацин
Ciprofloxacin FALSE TRUE TRUE FALSE 环丙沙星 Ciprofloxacin Ciprofloxacin Ciprofloxacine Siprofloksasiini Ciprofloxacine Ciprofloxacin Σιπροφλοξασίνη Ciprofloxacina シプロフロキサシン Ciprofloxacin Ciprofloksacyna Ciprofloxacin Ciprofloxacină Ципрофлоксацин Ciprofloxacina Ciprofloxacin Siprofloksasin Ципрофлоксацин
Ciprofloxacin/metronidazole FALSE TRUE TRUE FALSE 环丙沙星/甲硝唑 Ciprofloxacin/metronidazol Ciprofloxacin/metronidazol Ciprofloxacine/metronidazol Siprofloksasiini/metronidatsoli Ciprofloxacine/métronidazole Ciprofloxacin/metronidazol Σιπροφλοξασίνη/μετρονιδαζόλη Ciprofloxacina/metronidazolo シプロフロキサシン/メトロニダゾール Ciprofloxacin/metronidazol Ciprofloksacyna/metronidazol Ciprofloxacin/metronidazol Ciprofloxacină/metronidazol Ципрофлоксацин/метронидазол Ciprofloxacina/metronidazol Ciprofloxacin/metronidazol Siprofloksasin/metronidazol Ципрофлоксацин/метронідазол
Ciprofloxacin/ornidazole FALSE TRUE TRUE FALSE 环丙沙星/奥硝唑 Ciprofloxacin/ornidazol Ciprofloxacin/ornidazol Ciprofloxacine/ornidazol Siprofloksasiini/ornidatsoli Ciprofloxacine/ornidazole Ciprofloxacin/ornidazol Σιπροφλοξασίνη/ορνιδαζόλη Ciprofloxacina/ornidazolo シプロフロキサシン/オルニダゾール Ciprofloxacin/ornidazol Ciprofloksacyna/ornidazol Ciprofloxacin/ornidazole Ciprofloxacină/ornidazol Ципрофлоксацин/орнидазол Ciprofloxacina/ornidazol Ciprofloxacin/ornidazol Siprofloksasin/ornidazol Ципрофлоксацин/орнідазол
Ciprofloxacin/tinidazole FALSE TRUE TRUE FALSE 环丙沙星/替尼唑 Ciprofloxacin/tinidazol Ciprofloxacin/tinidazol Ciprofloxacine/tinidazol Siprofloksasiini/tinidatsoli Ciprofloxacine/tinidazole Ciprofloxacin/tinidazol Σιπροφλοξασίνη/τινιδαζόλη Ciprofloxacina/tinidazolo シプロフロキサシン/チニダゾール Ciprofloxacin/tinidazol Ciprofloksacyna/tinidazol Ciprofloxacin/tinidazole Ciprofloxacină/tinidazol Ципрофлоксацин/тинидазол Ciprofloxacina/tinidazol Ciprofloxacin/tinidazol Siprofloksasin/tinidazol Ципрофлоксацин/тинідазол
Clarithromycin FALSE TRUE TRUE FALSE 克拉霉素 Klaritromycin Clarithromycin Claritromycine Klaritromysiini Clarithromycine Clarithromycin Κλαριθρομυκίνη Claritromicina クラリスロマイシン Klaritromycin Klarytromycyna Claritromicina Claritromicină Кларитромицин Claritromicina Claritromycin Klaritromisin Кларитроміцин
Clavulanic acid FALSE TRUE TRUE FALSE 克拉维酸 Kyselina klavulanová Clavulansyre Clavulaanzuur Klavulaanihappo Acide clavulanique Clavulansäure Κλαβουλανικό οξύ Acido clavulanico クラビュラン酸 Klavulansyre Kwas klawulanowy Ácido clavulânico Acid clavulanic Клавулановая кислота Ácido clavulánico Clavulansyra Klavulanik asit Клавуланова кислота
clavulanic acid FALSE TRUE TRUE FALSE 克拉维酸 kyselina klavulanová clavulansyre clavulaanzuur klavulaanihappo acide clavulanique Clavulansäure Κλαβουλανικό οξύ acido clavulanico クラビュラン酸 klavulansyre kwas klawulanowy ácido clavulânico acid clavulanic клавулановая кислота ácido clavulánico clavulansyra klavulanik asit клавуланова кислота
Clindamycin FALSE TRUE TRUE FALSE 克林霉素 Klindamycin Clindamycin Clindamycine Klindamysiini Clindamycine Clindamycin Κλινδαμυκίνη Clindamicina クリンダマイシン Klindamycin Klindamycyna Clindamicina Clindamicină Клиндамицин Clindamicina Clindamycin Klindamisin Кліндаміцин
Clindamycin inducible screening FALSE TRUE TRUE FALSE 克林霉素诱导筛选 Klindamycin induzierbares Screening Clindamycin inducible screening Clindamycine induceerbare screening Klindamysiini indusoitava seulonta Clindamycine dépistage inductible Clindamycin induzierbares Screening Κλινδαμυκίνη επαγόμενο προσυμπτωματικό έλεγχο Clindamicina inducción del cribado クリンダマイシン誘導スクリーニング Klindamycin inducible screening Klindamycyna badanie indukcyjne Clindamicina cribado inducible Clindamicină screening inductibil Клиндамицин индуцируемый скрининг Clindamicina cribado inducible Clindamycin inducible screening Klindamisin indüklenebilir tarama Кліндаміцин індукційний скринінг
Clometocillin FALSE TRUE TRUE FALSE 克罗米修斯( Clometocillin Clometocillin Clometocilline Klometosilliini Clométocilline Clometocillin Κλομετοκιλλίνη Clometocillina クロメトシリン Klometocillin Clometocillin Clometocillin Clometocilină Клометоциллин Clometocilina Klometocillin Clometocillin Клометоцилін
Clotrimazole FALSE TRUE TRUE FALSE 克霉唑 Klotrimazol Clotrimazol Clotrimazol Klotrimatsoli Clotrimazole Clotrimazol Κλοτριμαζόλη Clotrimazolo クロトリマゾール Klotrimazol Klotrimazol Clotrimazole Clotrimazol Клотримазол Clotrimazol Klotrimazol Klotrimazol Клотримазол
Cloxacillin FALSE TRUE TRUE FALSE 克罗西林 Kloxacilin Cloxacillin Cloxacilline Kloksasilliini Cloxacilline Cloxacillin Κλοξακιλλίνη Cloxacillina クロキサシリン Cloxacillin Cloxacillin Cloxacillin Cloxacilină Клоксациллин Cloxacilina Kloxacillin Cloxacillin Клоксацилін
Colistin FALSE TRUE TRUE FALSE 唑啉酮 Kolistin Colistin Colistine Kolistiini Colistine Colistin Κολιστίνη Colistina コリスチン Kolistin Kolistyna Colistin Colistină Колистин Colistina Kolistin Kolistin Колістин
Cycloserine FALSE TRUE TRUE FALSE 环丝氨酸 Cykloserin Cykloserin Cycloserine Sykloserini Cyclosérine Cycloserin Κυκλοσερίνη Cicloserina サイクロセリン Cycloserine Cykloseryna Cicloserina Cicloserină Циклосерин Cicloserina Cycloserine Sikloserin Циклосерин
Dapsone FALSE TRUE TRUE FALSE 多普生 Dapson Dapson Dapson Dapsoni Dapsone Dapson Δαψόνη Dapsone ダプソン Dapsone Dapson Dapsone Dapsone Дапсон Dapsona Dapson Dapson Дапсон
Daptomycin FALSE TRUE TRUE FALSE 达托霉素 Daptomycin Daptomycin Daptomycine Daptomysiini Daptomycine Daptomycin Δαπτομυκίνη Daptomicina ダプトマイシン Daptomycin Daptomycyna Daptomicina Daptomicină Даптомицин Daptomicina Daptomycin Daptomisin Даптоміцин
Dibekacin FALSE TRUE TRUE FALSE 迪贝卡星 Dibekacin Dibekacin Dibekacine Dibekasiini Dibekacine Dibekacin Διβεκακίνη Dibekacin ジベカシン Dibekacin Dibekacin Dibekacin Dibekacin Дибекацин Dibekacina Dibekacin Dibekacin Дібекацин
@@ -153,6 +159,7 @@ Kanamycin FALSE TRUE TRUE FALSE 卡那霉素 Kanamycin Kanamycin Kanamycine Kana
Ketoconazole FALSE TRUE TRUE FALSE 酮康唑 Ketokonazol Ketoconazol Ketoconazol Ketokonatsoli Kétoconazole Ketoconazol Κετοκοναζόλη Ketoconazolo ケトコナゾール Ketokonazol Ketokonazol Ketoconazole Ketoconazol Кетоконазол Ketoconazol Ketokonazol Ketokonazol Кетоконазол
Levofloxacin FALSE TRUE TRUE FALSE 氧氟沙星 Levofloxacin Levofloxacin Levofloxacine Levofloksasiini Lévofloxacine Levofloxacin Λεβοφλοξασίνη Levofloxacina レボフロキサシン Levofloxacin Levofloxacin Levofloxacin Levofloxacină Левофлоксацин Levofloxacina Levofloxacin Levofloksasin Левофлоксацин
Lincomycin FALSE TRUE TRUE FALSE 林可霉素 Linkomycin Lincomycin Lincomycine Lincomycin Lincomycine Lincomycin Λινκομυκίνη Lincomicina リンコマイシン Lincomycin Lincomycyna Lincomycin Lincomicină Линкомицин Lincomicina Lincomycin Lincomycin Лінкоміцин
Linezolid FALSE TRUE TRUE FALSE 利奈唑胺 Linezolid Linezolid Linezolid Linezolid Linezolid Linezolid Λινεζολίδη Linezolid リネゾリド Linezolid Linezolid Linezolid Linezolid Линезолид Linezolid Linezolid Linezolid Лінезолід
Lomefloxacin FALSE TRUE TRUE FALSE 洛美沙星 Lomefloxacin Lomefloxacin Lomefloxacine Lomefloksasiini Loméfloxacine Lomefloxacin Λομεφλοξασίνη Lomefloxacina ロメフロキサシン Lomefloksacin Lomefloxacin Lomefloxacin Lomefloxacină Ломефлоксацин Lomefloxacina Lomefloxacin Lomefloksasin Ломефлоксацин
Lysozyme FALSE TRUE TRUE FALSE 硫酸钠 Lysozym Lysozym Lysozym Lysotsyymi Lysozyme Lysozym Λυσοζύμη Lisozima リゾチーム Lysozym Lizozym Lysozyme Lizozimă Лизоцим Lisozima Lysozym Lizozim Лізоцим
Mandelic acid FALSE TRUE TRUE FALSE 扁桃酸 Kyselina mandlová Mandelinsyre Amandelzuur Mandelihappo Acide mandélique Mandelsäure Μανδελικό οξύ Acido mandelico マンデル酸 Mandelsyre Kwas migdałowy Ácido mandélico Acid mandelic Мандаловая кислота Ácido mandélico Mandelsyra Mandelik asit Мигдалева кислота
@@ -243,12 +250,14 @@ Sulfathiazole FALSE TRUE TRUE FALSE 磺胺噻唑 Sulfathiazol Sulfathiazol Sulfa
Sulfathiourea FALSE TRUE TRUE FALSE 磺胺硫脲 Sulfathiomočovina Sulfathiourea Sulfathioureum Sulfathiourea Sulfathiourée Sulfathioharnstoff Σουλφαθειουρία Sulfathiourea スルファチオ尿素 Sulfathiourea Sulfathiourea Sulfathiourea Sulfathiourea Сульфатиомочевина Sulfathiourea Sulfatiourea Sulfathiourea Сульфатіосечовина
Sultamicillin FALSE TRUE TRUE FALSE 苏打米林 Sultamicilin Sultamicillin Sultamicilline Sultamisilliini Sultamicilline Sultamicillin Σουλταμικιλλίνη Sultamicillina スルタミシリン Sultamicillin Sultamicillin Sultamicillin Sultamicilină Сультамициллин Sultamicilina Sultamicillin Sultamicillin Сультаміцилін
Talampicillin FALSE TRUE TRUE FALSE 塔拉比西林 Talampicilin Talampicillin Talampicilline Talampisilliini Talampicilline Talampicillin Ταλαμπικιλλίνη Talampicillina タランピシリン Talampicillin Talampicylina Talampicilina Talampicilină Талампициллин Talampicilina Talampicillin Talampisilin Талампіцилін
Tedizolid FALSE TRUE TRUE FALSE 特地唑胺 Tedizolid Tedizolid Tedizolid Tedizolid Tedizolid Tedizolid Τεντιζολίδη Tedizolid テジゾリド Tedizolid Tedizolid Tedizolid Tedizolid Тедизолид Tedizolid Tedizolid Tedizolid Тедізолід
Teicoplanin FALSE TRUE TRUE FALSE 泰科普兰素 Teicoplanin Teicoplanin Teicoplanine Teikoplaniini Teicoplanine Teicoplanin Τεϊκοπλανίνη Teicoplanina テイコプラニン Teicoplanin Teicoplanin Teicoplanin Teicoplanin Тейкопланин Teicoplanina Teicoplanin Teikoplanin Тейкопланін
Telithromycin FALSE TRUE TRUE FALSE 泰利霉素 Telithromycin Telithromycin Telitromycine Telitromysiini Télithromycine Telithromycin Τελιθρομυκίνη Telitromicina テリスロマイシン Telitromycin Telitromycyna Telitromicina Telitromicină Телитромицин Telitromicina Telitromycin Telitromisin Телітроміцин
Temafloxacin FALSE TRUE TRUE FALSE 氨甲环酸 Temafloxacin Temafloxacin Temafloxacine Temafloksasiini Temafloxacine Temafloxacin Τεμαφλοξασίνη Temafloxacina テマフロキサシン Temafloxacin Temafloksacyna Temafloxacin Temafloxacin Темафлоксацин Temafloxacina Temafloxacin Temafloksasin Темафлоксацин
Temocillin FALSE TRUE TRUE FALSE 氨甲蝶呤 Temocillin Temocillin Temocilline Temosilliini Temocillin Temocillin Τεμοκιλλίνη Temocillina テモシリン Temocillin Temocillin Temocillin Temocilină Темоциллин Temocilina Temocillin Temocillin Темоцилін
Tenofovir disoproxil FALSE TRUE TRUE FALSE 特诺福韦酯 Tenofovir disoproxil Tenofovir disoproxil Tenofovir Tenofoviiridisoproksiili Tenofovir disoproxil Tenofovir Disoproxil Τενοφοβίρη δισοπροξίλη Tenofovir disoproxil テノホビルジソプロキシル Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproxil Тенофовир дизопроксил Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproksil Тенофовір дизопроксил
Terizidone FALSE TRUE TRUE FALSE 特立兹酮 Terizidon Terizidon Terizidon Teritsidoni Terizidone Terizidon Τεριζιδόνη Terizidone テリジドン Terizidon Terizidon Terizidone Terizidonă Теризидон Terizidona Terizidon Terizidon Теризидон
Thiacetazone FALSE TRUE TRUE FALSE 噻乙唑酮 Thiacetazon Thiacetazon Thiacetazone Thiacetazoni Thiacétazone Thiacetazon Θιακεταζόνη Thiacetazona チアセタゾン Thiacetazone Thiacetazon Thiacetazona Thiacetazonă Тиазетазон Thiacetazona Thiacetazone Thiasetazon Тіацетазон
Thiamphenicol FALSE TRUE TRUE FALSE 硫苯尼考 Thiamfenikol Thiamphenicol Thiamfenicol Tiamfenikoli Thiamphénicol Thiamphenicol Θειαμφενικόλη Tiamfenicolo チアンフェニコール Tiamfenikol Tiamfenikol Tiamfenicol Tiamfenicol Тиамфеникол Tiamfenicol Tiamfenikol Thiamphenicol Тіамфенікол
Thioacetazone/isoniazid FALSE TRUE TRUE FALSE 硫乙酰唑酮/异烟肼 Thioacetazon/isoniazid Thioacetazon/isoniazid Thioacetazon/isoniazide Tioasetatsoni/isonatsidi Thioacétazone/isoniazide Thioacetazon/Isoniazid Θειοακεταζόνη/ισονιαζίδη Tioacetazone/isoniazide チオアセタゾン/イソニアジド Thioacetazon/isoniazid Tioacetazon/izoniazyd Thioacetazone/isoniazid Tioacetazonă/isoniazidă Тиоацетазон/изониазид Tioacetazona/isoniazida Thioacetazon/isoniazid Tiyoasetazon/izoniazid Тіоацетазон/ізоніазид
Ticarcillin FALSE TRUE TRUE FALSE 替卡西林 Tykarcilinu Ticarcillin Ticarcilline Ticarcillin Ticarcilline Ticarcillin Τικαρκιλλίνη Ticarcillina チカルシリン Ticarcillin Ticarcillin Ticarcilina Ticarcilină Тикарциллин Ticarcilina Ticarcillin Ticarcillin Тикарцилін
@@ -278,3 +287,10 @@ Macrolides/lincosamides FALSE TRUE TRUE FALSE 大环内酯类/林可酰胺类 Ma
Other antibacterials FALSE TRUE TRUE FALSE 其他抗菌剂 Ostatní antibakteriální látky Andre antibakterielle stoffer Overige antibiotica Muut antibakteeriset aineet Autres antibactériens Andere Antibiotika Άλλα αντιβακτηριακά Altri antibatterici その他の抗菌薬 Andre antibakterielle midler Inne środki przeciwbakteryjne Outros antibacterianos Alte antibacteriene Другие антибактериальные препараты Otros antibacterianos Andra antibakteriella medel Diğer antibakteriyeller Інші антибактеріальні засоби
Polymyxins FALSE TRUE TRUE FALSE 多粘菌素类 Polymyxiny Polymyxiner Polymyxines Polymysiinit Polymyxines Polymyxine Πολυμυξίνες Polimixine ポリミキシン Polymyxiner Polimyksyny Polimixinas Polimixine Полимиксины Polimixinas Polymyxiner Polimiksinler Поліміксини
Quinolones FALSE TRUE TRUE FALSE 喹诺酮类 Chinolony Kinoloner Quinolonen Kinolonit Quinolones Quinolone Κινολόνες Chinoloni キノロン Kinoloner Quinolony Quinolones Quinolone Хинолоны Quinolonas Kinoloner Kinolonlar Хінолони
aquatic|fish FALSE FALSE FALSE FALSE 水生|条鱼|鱼 vodní|ryba|ryby akvatisk|fisk aquatisch|vis|vissen vesieliö|kala|kalaa aquatique|poisson|poissons wasser|fisch|fische υδρόβια|ψάρι|ψάρια acquatico|pesce|pesci アクアティック|1匹|魚 akvatisk|fisk wodny|ryba|ryby aquático|peixe|peixes acvatic|pește|pești водные|рыба|рыбы acuático|pez|peces vattenlevande|fisk|fiskar sucul|balık водний|риба|рибки
cattle|bovine FALSE FALSE FALSE FALSE 牛|牛 skot kvæg vee|rund karja|nauta bovins|bovin rinder βοοειδή bovini|bovino 牛|ウシ storfe|storfe bydło|bydło bovinos|bovino bovine|bovine крупный рогатый скот|крупный рогатый скот bovino|bovino nötkreatur|nötkreatur sığır|büyükbaş hayvan велика рогата худоба|бичачий
cat|cats|feline FALSE FALSE FALSE FALSE 猫|猫|猫科动物 kočka|kočky|kočky kat|katte|kat kat|katten|katachtig kissa|kissat|kissa chat|chats|félin katze|katzen γάτα|γάτες|αιλουροειδή gatto|gatti|felino 猫|猫|ネコ katt kot|koty gato|gatos|felino pisică|pisici|felină кошка|кошки|кошка gato|gatos|felino katt|katter|kattdjur kedi|kediler|kedi кіт|коти|котячий
dog|dogs|canine FALSE FALSE FALSE FALSE 狗|狗|犬类 pes|psi|psí hund|hunde hond|honden koira|koirat|koira chien|canine hund|hunde|hund σκύλος|σκύλοι|σκύλος cane|cani|canino 犬|犬|イヌ hund pies|psy|pies cão|cães|canino câine|câini|canin собака|собаки|собака perro|perros|canino hund|hundar köpek|köpekler пес|собаки|собачий
horse|horses|equine FALSE FALSE FALSE FALSE 马|马|马 kůň|koně|koně hest|heste paard|paarden hevonen|hevoset|hevoset cheval|chevaux|équine pferd|pferde άλογο|άλογα|ιπποειδή cavallo|cavalli|equino 馬|馬|馬 hest koń|konie|koń cavalo|cavalos|equinos cal|cai|ecvideu лошадь|лошади|лошадь caballo|caballos|equino häst|hästar|häst at|atlar|atçılık кінь|коні|конячий
bird|birds|poultry FALSE FALSE FALSE FALSE 鸟类|鸟类|家禽 ptáci|ptáci|drůbež fugl|fugle|fjerkræ vogel|vogels|pluimvee lintu|linnut|siipikarja oiseaux|oiseaux|volaille vogel|vögel|geflügel πουλιά|πουλιά|πουλερικά uccello|uccelli|pollame 鳥|鳥|家禽 fugl|fugler|fjørfe ptak|ptaki|drób aves|aves|aves de capoeira pasăre|păsări|păsări de curte птица|птицы|домашняя птица aves|aves|aves de corral fågel|fåglar|fjäderfä kuş|kuşlar|kümes hayvanları птах|птахів|птиця
swine|swines FALSE FALSE FALSE FALSE 猪|猪 prasata|prasata svin varken|varkens sika|sikaa porcine|porcs schwein|schweine χοίροι|χοίροι suino|suini 豚|豚|頭 svin trzoda chlewna|świnie suínos porc|porcine свинья|свиньи porcino|porcinos svin domuz|domuz свиня|свині
1 pattern regular_expr case_sensitive affect_ab_name affect_mo_name zh cs da nl fi fr de el it ja no pl pt ro ru es sv tr uk
73 Benzathine benzylpenicillin FALSE TRUE TRUE FALSE 苄丝肼青霉素 Benzathine benzylpenicillin Benzathinbenzylpenicillin Benzylpenicillinebenzathine Bentsatiinibentsyylipenisilliini Benzathine benzylpénicilline Benzathin-Benzylpenicillin Βενζαθίνη βενζυλπενικιλλίνη Benzatina benzilpenicillina ベンズシン・ベンジルペニシリン Benzathine benzylpenicillin Benzylpenicylina benzylowa Benzatina benzatina benzilpenicilina Benzatină benzilpenicilină Бензатин бензилпенициллин Bencilpenicilina benzatínica Benzathinbenzylpenicillin Benzatin benzilpenisilin Бензатину бензилпеніцилін
74 Benzathine phenoxymethylpenicillin FALSE TRUE TRUE FALSE 苄星苯氧甲基青霉素 Benzatinový fenoxymethylpenicilin Benzathinfenoxymethylpenicillin Fenoxymethylpenicillinebenzathine Bentsatiinifenoksimetyylipenisilliini Phénoxyméthylpénicilline benzathine Benzathin-Phenoxymethylpenicillin Βενζαθίνη φαινοξυμεθυλοπενικιλλίνη Benzatina fenossimetilpenicillina ベンザチンフェノキシメチルペニシリン Benzathine fenoksymetylpenicillin Fenoksymetylopenicylina benzylowa Benzatina fenoximetilpenicilina Benzatină fenoximetilpenicilină Бензатин феноксиметилпенициллин Fenoximetilpenicilina benzatínica Bensathinfenoximetylpenicillin Benzatin fenoksimetilpenisilin Бензатину феноксиметилпеніцилін
75 Benzylpenicillin FALSE TRUE TRUE FALSE 苄基青霉素 Benzylpenicilin Benzylpenicillin Benzylpenicilline Bentsyylipenisilliini Benzylpénicilline Benzylpenicillin Βενζυλοπενικιλλίνη Benzilpenicillina ベンジルペニシリン Benzylpenicillin Benzylpenicylina Benzilpenicilina Benzilpenicilină Бензилпенициллин Bencilpenicilina Bensylpenicillin Benzilpenisilin Бензилпеніцилін
76 Cadazolid FALSE TRUE TRUE FALSE 卡达唑利德 Kadazolid Cadazolid Cadazolid Kadazolid Cadazolid Cadazolid Καδαζολίδη Cadazolid カダゾリド Cadazolid Kadazolid Cadazolid Cadazolid Кадазолид Cadazolid Cadazolid Cadazolid Кадазолід
77 Calcium aminosalicylate FALSE TRUE TRUE FALSE 氨基水杨酸钙 Aminosalicylát vápenatý Calciumaminosalicylat Aminosalicylzuur Kalsiumaminosalisylaatti Aminosalicylate de calcium Kalzium-Aminosalicylat Αμινοσαλικυλικό ασβέστιο Calcio aminosalicilato アミノサリチル酸カルシウム Kalsiumaminosalicylat Aminosalicylan wapnia Aminosalicilato de cálcio Aminosalicilat de calciu Аминосалицилат кальция Aminosalicilato de calcio Kalciumaminosalicylat Kalsiyum aminosalisilat Кальцію аміносаліцилат
78 Capreomycin FALSE TRUE TRUE FALSE 氨水杨酸钙 Kapreomycin Capreomycin Capreomycine Kapreomysiini Capréomycine Capreomycin Καπρεομυκίνη Capreomicina カプレオマイシン Capreomycin Kapreomycyna Capreomicina Capreomicină Капреомицин Capreomicina Kapreomycin Kapreomisin Капреоміцин
79 Carbenicillin FALSE TRUE TRUE FALSE 羧基青霉素 Karbenicilin Carbenicillin Carbenicilline Karbenisilliini Carbénicilline Carbenicillin Καρβενικιλλίνη Carbenicillina カルベニシリン Karbenicillin Karbenicylina Carbenicilina Carbenicilină Карбенициллин Carbenicilina Karbenicillin Karbenisilin Карбеніцилін
111 Chlortetracycline FALSE TRUE TRUE FALSE 金霉素 Chlortetracyklin Chlortetracyclin Chloortetracycline Klortetasykliini Chlortétracycline Chlortetracyclin Χλωροτετρακυκλίνη Clorotetraciclina クロルテトラサイクリン Klortetracyklin Chlortetracyklina Chlortetracycline Clortetraciclină Хлортетрациклин Clortetraciclina Klortetracyklin Klortetrasiklin Хлортетрациклін
112 Cinoxacin FALSE TRUE TRUE FALSE 西诺沙星 Cinoxacin Cinoxacin Cinoxacine Kinoksasiini Cinoxacine Cinoxacin Τσινοξακίνη Cinoxacina シノキサシン Cinoxacin Cinoxacin Cinoxacin Cinoxacină Циноксацин Cinoxacina Cinoxacin Cinoxacin Циноксацин
113 Ciprofloxacin FALSE TRUE TRUE FALSE 环丙沙星 Ciprofloxacin Ciprofloxacin Ciprofloxacine Siprofloksasiini Ciprofloxacine Ciprofloxacin Σιπροφλοξασίνη Ciprofloxacina シプロフロキサシン Ciprofloxacin Ciprofloksacyna Ciprofloxacin Ciprofloxacină Ципрофлоксацин Ciprofloxacina Ciprofloxacin Siprofloksasin Ципрофлоксацин
114 Ciprofloxacin/metronidazole FALSE TRUE TRUE FALSE 环丙沙星/甲硝唑 Ciprofloxacin/metronidazol Ciprofloxacin/metronidazol Ciprofloxacine/metronidazol Siprofloksasiini/metronidatsoli Ciprofloxacine/métronidazole Ciprofloxacin/metronidazol Σιπροφλοξασίνη/μετρονιδαζόλη Ciprofloxacina/metronidazolo シプロフロキサシン/メトロニダゾール Ciprofloxacin/metronidazol Ciprofloksacyna/metronidazol Ciprofloxacin/metronidazol Ciprofloxacină/metronidazol Ципрофлоксацин/метронидазол Ciprofloxacina/metronidazol Ciprofloxacin/metronidazol Siprofloksasin/metronidazol Ципрофлоксацин/метронідазол
115 Ciprofloxacin/ornidazole FALSE TRUE TRUE FALSE 环丙沙星/奥硝唑 Ciprofloxacin/ornidazol Ciprofloxacin/ornidazol Ciprofloxacine/ornidazol Siprofloksasiini/ornidatsoli Ciprofloxacine/ornidazole Ciprofloxacin/ornidazol Σιπροφλοξασίνη/ορνιδαζόλη Ciprofloxacina/ornidazolo シプロフロキサシン/オルニダゾール Ciprofloxacin/ornidazol Ciprofloksacyna/ornidazol Ciprofloxacin/ornidazole Ciprofloxacină/ornidazol Ципрофлоксацин/орнидазол Ciprofloxacina/ornidazol Ciprofloxacin/ornidazol Siprofloksasin/ornidazol Ципрофлоксацин/орнідазол
116 Ciprofloxacin/tinidazole FALSE TRUE TRUE FALSE 环丙沙星/替尼唑 Ciprofloxacin/tinidazol Ciprofloxacin/tinidazol Ciprofloxacine/tinidazol Siprofloksasiini/tinidatsoli Ciprofloxacine/tinidazole Ciprofloxacin/tinidazol Σιπροφλοξασίνη/τινιδαζόλη Ciprofloxacina/tinidazolo シプロフロキサシン/チニダゾール Ciprofloxacin/tinidazol Ciprofloksacyna/tinidazol Ciprofloxacin/tinidazole Ciprofloxacină/tinidazol Ципрофлоксацин/тинидазол Ciprofloxacina/tinidazol Ciprofloxacin/tinidazol Siprofloksasin/tinidazol Ципрофлоксацин/тинідазол
117 Clarithromycin FALSE TRUE TRUE FALSE 克拉霉素 Klaritromycin Clarithromycin Claritromycine Klaritromysiini Clarithromycine Clarithromycin Κλαριθρομυκίνη Claritromicina クラリスロマイシン Klaritromycin Klarytromycyna Claritromicina Claritromicină Кларитромицин Claritromicina Claritromycin Klaritromisin Кларитроміцин
118 Clavulanic acid FALSE TRUE TRUE FALSE 克拉维酸 Kyselina klavulanová Clavulansyre Clavulaanzuur Klavulaanihappo Acide clavulanique Clavulansäure Κλαβουλανικό οξύ Acido clavulanico クラビュラン酸 Klavulansyre Kwas klawulanowy Ácido clavulânico Acid clavulanic Клавулановая кислота Ácido clavulánico Clavulansyra Klavulanik asit Клавуланова кислота
119 clavulanic acid FALSE TRUE TRUE FALSE 克拉维酸 kyselina klavulanová clavulansyre clavulaanzuur klavulaanihappo acide clavulanique Clavulansäure Κλαβουλανικό οξύ acido clavulanico クラビュラン酸 klavulansyre kwas klawulanowy ácido clavulânico acid clavulanic клавулановая кислота ácido clavulánico clavulansyra klavulanik asit клавуланова кислота
120 Clindamycin FALSE TRUE TRUE FALSE 克林霉素 Klindamycin Clindamycin Clindamycine Klindamysiini Clindamycine Clindamycin Κλινδαμυκίνη Clindamicina クリンダマイシン Klindamycin Klindamycyna Clindamicina Clindamicină Клиндамицин Clindamicina Clindamycin Klindamisin Кліндаміцин
121 Clindamycin inducible screening FALSE TRUE TRUE FALSE 克林霉素诱导筛选 Klindamycin induzierbares Screening Clindamycin inducible screening Clindamycine induceerbare screening Klindamysiini indusoitava seulonta Clindamycine dépistage inductible Clindamycin induzierbares Screening Κλινδαμυκίνη επαγόμενο προσυμπτωματικό έλεγχο Clindamicina inducción del cribado クリンダマイシン誘導スクリーニング Klindamycin inducible screening Klindamycyna badanie indukcyjne Clindamicina cribado inducible Clindamicină screening inductibil Клиндамицин индуцируемый скрининг Clindamicina cribado inducible Clindamycin inducible screening Klindamisin indüklenebilir tarama Кліндаміцин індукційний скринінг
122 Clometocillin FALSE TRUE TRUE FALSE 克罗米修斯( Clometocillin Clometocillin Clometocilline Klometosilliini Clométocilline Clometocillin Κλομετοκιλλίνη Clometocillina クロメトシリン Klometocillin Clometocillin Clometocillin Clometocilină Клометоциллин Clometocilina Klometocillin Clometocillin Клометоцилін
123 Clotrimazole FALSE TRUE TRUE FALSE 克霉唑 Klotrimazol Clotrimazol Clotrimazol Klotrimatsoli Clotrimazole Clotrimazol Κλοτριμαζόλη Clotrimazolo クロトリマゾール Klotrimazol Klotrimazol Clotrimazole Clotrimazol Клотримазол Clotrimazol Klotrimazol Klotrimazol Клотримазол
124 Cloxacillin FALSE TRUE TRUE FALSE 克罗西林 Kloxacilin Cloxacillin Cloxacilline Kloksasilliini Cloxacilline Cloxacillin Κλοξακιλλίνη Cloxacillina クロキサシリン Cloxacillin Cloxacillin Cloxacillin Cloxacilină Клоксациллин Cloxacilina Kloxacillin Cloxacillin Клоксацилін
125 Colistin FALSE TRUE TRUE FALSE 唑啉酮 Kolistin Colistin Colistine Kolistiini Colistine Colistin Κολιστίνη Colistina コリスチン Kolistin Kolistyna Colistin Colistină Колистин Colistina Kolistin Kolistin Колістин
126 Cycloserine FALSE TRUE TRUE FALSE 环丝氨酸 Cykloserin Cykloserin Cycloserine Sykloserini Cyclosérine Cycloserin Κυκλοσερίνη Cicloserina サイクロセリン Cycloserine Cykloseryna Cicloserina Cicloserină Циклосерин Cicloserina Cycloserine Sikloserin Циклосерин
127 Dapsone FALSE TRUE TRUE FALSE 多普生 Dapson Dapson Dapson Dapsoni Dapsone Dapson Δαψόνη Dapsone ダプソン Dapsone Dapson Dapsone Dapsone Дапсон Dapsona Dapson Dapson Дапсон
128 Daptomycin FALSE TRUE TRUE FALSE 达托霉素 Daptomycin Daptomycin Daptomycine Daptomysiini Daptomycine Daptomycin Δαπτομυκίνη Daptomicina ダプトマイシン Daptomycin Daptomycyna Daptomicina Daptomicină Даптомицин Daptomicina Daptomycin Daptomisin Даптоміцин
129 Dibekacin FALSE TRUE TRUE FALSE 迪贝卡星 Dibekacin Dibekacin Dibekacine Dibekasiini Dibekacine Dibekacin Διβεκακίνη Dibekacin ジベカシン Dibekacin Dibekacin Dibekacin Dibekacin Дибекацин Dibekacina Dibekacin Dibekacin Дібекацин
159 Ketoconazole FALSE TRUE TRUE FALSE 酮康唑 Ketokonazol Ketoconazol Ketoconazol Ketokonatsoli Kétoconazole Ketoconazol Κετοκοναζόλη Ketoconazolo ケトコナゾール Ketokonazol Ketokonazol Ketoconazole Ketoconazol Кетоконазол Ketoconazol Ketokonazol Ketokonazol Кетоконазол
160 Levofloxacin FALSE TRUE TRUE FALSE 氧氟沙星 Levofloxacin Levofloxacin Levofloxacine Levofloksasiini Lévofloxacine Levofloxacin Λεβοφλοξασίνη Levofloxacina レボフロキサシン Levofloxacin Levofloxacin Levofloxacin Levofloxacină Левофлоксацин Levofloxacina Levofloxacin Levofloksasin Левофлоксацин
161 Lincomycin FALSE TRUE TRUE FALSE 林可霉素 Linkomycin Lincomycin Lincomycine Lincomycin Lincomycine Lincomycin Λινκομυκίνη Lincomicina リンコマイシン Lincomycin Lincomycyna Lincomycin Lincomicină Линкомицин Lincomicina Lincomycin Lincomycin Лінкоміцин
162 Linezolid FALSE TRUE TRUE FALSE 利奈唑胺 Linezolid Linezolid Linezolid Linezolid Linezolid Linezolid Λινεζολίδη Linezolid リネゾリド Linezolid Linezolid Linezolid Linezolid Линезолид Linezolid Linezolid Linezolid Лінезолід
163 Lomefloxacin FALSE TRUE TRUE FALSE 洛美沙星 Lomefloxacin Lomefloxacin Lomefloxacine Lomefloksasiini Loméfloxacine Lomefloxacin Λομεφλοξασίνη Lomefloxacina ロメフロキサシン Lomefloksacin Lomefloxacin Lomefloxacin Lomefloxacină Ломефлоксацин Lomefloxacina Lomefloxacin Lomefloksasin Ломефлоксацин
164 Lysozyme FALSE TRUE TRUE FALSE 硫酸钠 Lysozym Lysozym Lysozym Lysotsyymi Lysozyme Lysozym Λυσοζύμη Lisozima リゾチーム Lysozym Lizozym Lysozyme Lizozimă Лизоцим Lisozima Lysozym Lizozim Лізоцим
165 Mandelic acid FALSE TRUE TRUE FALSE 扁桃酸 Kyselina mandlová Mandelinsyre Amandelzuur Mandelihappo Acide mandélique Mandelsäure Μανδελικό οξύ Acido mandelico マンデル酸 Mandelsyre Kwas migdałowy Ácido mandélico Acid mandelic Мандаловая кислота Ácido mandélico Mandelsyra Mandelik asit Мигдалева кислота
250 Sulfathiourea FALSE TRUE TRUE FALSE 磺胺硫脲 Sulfathiomočovina Sulfathiourea Sulfathioureum Sulfathiourea Sulfathiourée Sulfathioharnstoff Σουλφαθειουρία Sulfathiourea スルファチオ尿素 Sulfathiourea Sulfathiourea Sulfathiourea Sulfathiourea Сульфатиомочевина Sulfathiourea Sulfatiourea Sulfathiourea Сульфатіосечовина
251 Sultamicillin FALSE TRUE TRUE FALSE 苏打米林 Sultamicilin Sultamicillin Sultamicilline Sultamisilliini Sultamicilline Sultamicillin Σουλταμικιλλίνη Sultamicillina スルタミシリン Sultamicillin Sultamicillin Sultamicillin Sultamicilină Сультамициллин Sultamicilina Sultamicillin Sultamicillin Сультаміцилін
252 Talampicillin FALSE TRUE TRUE FALSE 塔拉比西林 Talampicilin Talampicillin Talampicilline Talampisilliini Talampicilline Talampicillin Ταλαμπικιλλίνη Talampicillina タランピシリン Talampicillin Talampicylina Talampicilina Talampicilină Талампициллин Talampicilina Talampicillin Talampisilin Талампіцилін
253 Tedizolid FALSE TRUE TRUE FALSE 特地唑胺 Tedizolid Tedizolid Tedizolid Tedizolid Tedizolid Tedizolid Τεντιζολίδη Tedizolid テジゾリド Tedizolid Tedizolid Tedizolid Tedizolid Тедизолид Tedizolid Tedizolid Tedizolid Тедізолід
254 Teicoplanin FALSE TRUE TRUE FALSE 泰科普兰素 Teicoplanin Teicoplanin Teicoplanine Teikoplaniini Teicoplanine Teicoplanin Τεϊκοπλανίνη Teicoplanina テイコプラニン Teicoplanin Teicoplanin Teicoplanin Teicoplanin Тейкопланин Teicoplanina Teicoplanin Teikoplanin Тейкопланін
255 Telithromycin FALSE TRUE TRUE FALSE 泰利霉素 Telithromycin Telithromycin Telitromycine Telitromysiini Télithromycine Telithromycin Τελιθρομυκίνη Telitromicina テリスロマイシン Telitromycin Telitromycyna Telitromicina Telitromicină Телитромицин Telitromicina Telitromycin Telitromisin Телітроміцин
256 Temafloxacin FALSE TRUE TRUE FALSE 氨甲环酸 Temafloxacin Temafloxacin Temafloxacine Temafloksasiini Temafloxacine Temafloxacin Τεμαφλοξασίνη Temafloxacina テマフロキサシン Temafloxacin Temafloksacyna Temafloxacin Temafloxacin Темафлоксацин Temafloxacina Temafloxacin Temafloksasin Темафлоксацин
257 Temocillin FALSE TRUE TRUE FALSE 氨甲蝶呤 Temocillin Temocillin Temocilline Temosilliini Temocillin Temocillin Τεμοκιλλίνη Temocillina テモシリン Temocillin Temocillin Temocillin Temocilină Темоциллин Temocilina Temocillin Temocillin Темоцилін
258 Tenofovir disoproxil FALSE TRUE TRUE FALSE 特诺福韦酯 Tenofovir disoproxil Tenofovir disoproxil Tenofovir Tenofoviiridisoproksiili Tenofovir disoproxil Tenofovir Disoproxil Τενοφοβίρη δισοπροξίλη Tenofovir disoproxil テノホビルジソプロキシル Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproxil Тенофовир дизопроксил Tenofovir disoproxil Tenofovir disoproxil Tenofovir disoproksil Тенофовір дизопроксил
259 Terizidone FALSE TRUE TRUE FALSE 特立兹酮 Terizidon Terizidon Terizidon Teritsidoni Terizidone Terizidon Τεριζιδόνη Terizidone テリジドン Terizidon Terizidon Terizidone Terizidonă Теризидон Terizidona Terizidon Terizidon Теризидон
260 Thiacetazone FALSE TRUE TRUE FALSE 噻乙唑酮 Thiacetazon Thiacetazon Thiacetazone Thiacetazoni Thiacétazone Thiacetazon Θιακεταζόνη Thiacetazona チアセタゾン Thiacetazone Thiacetazon Thiacetazona Thiacetazonă Тиазетазон Thiacetazona Thiacetazone Thiasetazon Тіацетазон
261 Thiamphenicol FALSE TRUE TRUE FALSE 硫苯尼考 Thiamfenikol Thiamphenicol Thiamfenicol Tiamfenikoli Thiamphénicol Thiamphenicol Θειαμφενικόλη Tiamfenicolo チアンフェニコール Tiamfenikol Tiamfenikol Tiamfenicol Tiamfenicol Тиамфеникол Tiamfenicol Tiamfenikol Thiamphenicol Тіамфенікол
262 Thioacetazone/isoniazid FALSE TRUE TRUE FALSE 硫乙酰唑酮/异烟肼 Thioacetazon/isoniazid Thioacetazon/isoniazid Thioacetazon/isoniazide Tioasetatsoni/isonatsidi Thioacétazone/isoniazide Thioacetazon/Isoniazid Θειοακεταζόνη/ισονιαζίδη Tioacetazone/isoniazide チオアセタゾン/イソニアジド Thioacetazon/isoniazid Tioacetazon/izoniazyd Thioacetazone/isoniazid Tioacetazonă/isoniazidă Тиоацетазон/изониазид Tioacetazona/isoniazida Thioacetazon/isoniazid Tiyoasetazon/izoniazid Тіоацетазон/ізоніазид
263 Ticarcillin FALSE TRUE TRUE FALSE 替卡西林 Tykarcilinu Ticarcillin Ticarcilline Ticarcillin Ticarcilline Ticarcillin Τικαρκιλλίνη Ticarcillina チカルシリン Ticarcillin Ticarcillin Ticarcilina Ticarcilină Тикарциллин Ticarcilina Ticarcillin Ticarcillin Тикарцилін
287 Other antibacterials FALSE TRUE TRUE FALSE 其他抗菌剂 Ostatní antibakteriální látky Andre antibakterielle stoffer Overige antibiotica Muut antibakteeriset aineet Autres antibactériens Andere Antibiotika Άλλα αντιβακτηριακά Altri antibatterici その他の抗菌薬 Andre antibakterielle midler Inne środki przeciwbakteryjne Outros antibacterianos Alte antibacteriene Другие антибактериальные препараты Otros antibacterianos Andra antibakteriella medel Diğer antibakteriyeller Інші антибактеріальні засоби
288 Polymyxins FALSE TRUE TRUE FALSE 多粘菌素类 Polymyxiny Polymyxiner Polymyxines Polymysiinit Polymyxines Polymyxine Πολυμυξίνες Polimixine ポリミキシン Polymyxiner Polimyksyny Polimixinas Polimixine Полимиксины Polimixinas Polymyxiner Polimiksinler Поліміксини
289 Quinolones FALSE TRUE TRUE FALSE 喹诺酮类 Chinolony Kinoloner Quinolonen Kinolonit Quinolones Quinolone Κινολόνες Chinoloni キノロン Kinoloner Quinolony Quinolones Quinolone Хинолоны Quinolonas Kinoloner Kinolonlar Хінолони
290 aquatic|fish FALSE FALSE FALSE FALSE 水生|条鱼|鱼 vodní|ryba|ryby akvatisk|fisk aquatisch|vis|vissen vesieliö|kala|kalaa aquatique|poisson|poissons wasser|fisch|fische υδρόβια|ψάρι|ψάρια acquatico|pesce|pesci アクアティック|1匹|魚 akvatisk|fisk wodny|ryba|ryby aquático|peixe|peixes acvatic|pește|pești водные|рыба|рыбы acuático|pez|peces vattenlevande|fisk|fiskar sucul|balık водний|риба|рибки
291 cattle|bovine FALSE FALSE FALSE FALSE 牛|牛 skot kvæg vee|rund karja|nauta bovins|bovin rinder βοοειδή bovini|bovino 牛|ウシ storfe|storfe bydło|bydło bovinos|bovino bovine|bovine крупный рогатый скот|крупный рогатый скот bovino|bovino nötkreatur|nötkreatur sığır|büyükbaş hayvan велика рогата худоба|бичачий
292 cat|cats|feline FALSE FALSE FALSE FALSE 猫|猫|猫科动物 kočka|kočky|kočky kat|katte|kat kat|katten|katachtig kissa|kissat|kissa chat|chats|félin katze|katzen γάτα|γάτες|αιλουροειδή gatto|gatti|felino 猫|猫|ネコ katt kot|koty gato|gatos|felino pisică|pisici|felină кошка|кошки|кошка gato|gatos|felino katt|katter|kattdjur kedi|kediler|kedi кіт|коти|котячий
293 dog|dogs|canine FALSE FALSE FALSE FALSE 狗|狗|犬类 pes|psi|psí hund|hunde hond|honden koira|koirat|koira chien|canine hund|hunde|hund σκύλος|σκύλοι|σκύλος cane|cani|canino 犬|犬|イヌ hund pies|psy|pies cão|cães|canino câine|câini|canin собака|собаки|собака perro|perros|canino hund|hundar köpek|köpekler пес|собаки|собачий
294 horse|horses|equine FALSE FALSE FALSE FALSE 马|马|马 kůň|koně|koně hest|heste paard|paarden hevonen|hevoset|hevoset cheval|chevaux|équine pferd|pferde άλογο|άλογα|ιπποειδή cavallo|cavalli|equino 馬|馬|馬 hest koń|konie|koń cavalo|cavalos|equinos cal|cai|ecvideu лошадь|лошади|лошадь caballo|caballos|equino häst|hästar|häst at|atlar|atçılık кінь|коні|конячий
295 bird|birds|poultry FALSE FALSE FALSE FALSE 鸟类|鸟类|家禽 ptáci|ptáci|drůbež fugl|fugle|fjerkræ vogel|vogels|pluimvee lintu|linnut|siipikarja oiseaux|oiseaux|volaille vogel|vögel|geflügel πουλιά|πουλιά|πουλερικά uccello|uccelli|pollame 鳥|鳥|家禽 fugl|fugler|fjørfe ptak|ptaki|drób aves|aves|aves de capoeira pasăre|păsări|păsări de curte птица|птицы|домашняя птица aves|aves|aves de corral fågel|fåglar|fjäderfä kuş|kuşlar|kümes hayvanları птах|птахів|птиця
296 swine|swines FALSE FALSE FALSE FALSE 猪|猪 prasata|prasata svin varken|varkens sika|sikaa porcine|porcs schwein|schweine χοίροι|χοίροι suino|suini 豚|豚|頭 svin trzoda chlewna|świnie suínos porc|porcine свинья|свиньи porcino|porcinos svin domuz|domuz свиня|свині
Binary file not shown.
Binary file not shown.
+10 -6
View File
@@ -1,15 +1,18 @@
# The `AMR` Package for R <a href="https://msberends.github.io/AMR/"><img src="./logo.svg" align="right" height="139" /></a>
<img src="./endorsement_clsi_eucast.jpg" align="right" height="120" />
* Provides an **all-in-one solution** for AMR data analysis in a One Health approach
* Generates **antibiograms** - traditional, combined, syndromic, and even WISCA
* Provides the **full microbiological taxonomy** and data on **all antimicrobial drugs**
* Applies all recent **CLSI and EUCAST clinical breakpoints** for MICs and disk zones
* Provides the **full microbiological taxonomy** and extensive info on **all antimicrobial drugs**
* Applies all recent **CLSI and EUCAST clinical and veterinary breakpoints** for MICs and disk zones
* Corrects for duplicate isolates, **calculates and predicts AMR** per antibiotic class
* Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC** and **SNOMED CT**
* Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**, **SNOMED CT**, and **NCBI**
* Works on Windows, macOS and Linux with **all versions of R** since R-3.0 and is completely **dependency-free**, highly suitable for places with **limited resources**
<div style="display: flex; font-size: 0.8em;">
<p style="text-align:left; width: 50%;"><small><a href="https://msberends.github.io/AMR/">https://msberends.github.io/AMR</a></small></p>
<p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03">https://doi.org/10.18637/jss.v104.i03</a></small></p>
<p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03" target="_blank">https://doi.org/10.18637/jss.v104.i03</a></small></p>
</div>
----
@@ -24,7 +27,7 @@ After installing this package, R knows [**~52,000 distinct microbial species**](
##### Used in over 175 countries, translated into 20 languages
<a href="./countries_large.png"><img src="./countries.png" target="_blank" align="right" style="max-width: 300px;" /></a>
<a href="./countries_large.png" target="_blank"><img src="./countries.png" align="right" style="max-width: 300px;" /></a>
Since its first public release in early 2018, this R package has been used in almost all countries in the world. Click the map to enlarge and to see the country names.
@@ -240,7 +243,8 @@ It will be downloaded and installed automatically. For RStudio, click on the men
#### Latest development version
[![R-code-check](https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=main)](https://codecov.io/gh/msberends/AMR?branch=main)
[![check-recent](https://github.com/msberends/AMR/workflows/check-old/badge.svg?branch=main)](https://codecov.io/gh/msberends/AMR?branch=main)
[![check-recent](https://github.com/msberends/AMR/workflows/check-recent/badge.svg?branch=main)](https://codecov.io/gh/msberends/AMR?branch=main)
[![CodeFactor](https://www.codefactor.io/repository/github/msberends/amr/badge)](https://www.codefactor.io/repository/github/msberends/amr)
[![Codecov](https://codecov.io/gh/msberends/AMR/branch/main/graph/badge.svg)](https://codecov.io/gh/msberends/AMR?branch=main)
-34
View File
@@ -27,38 +27,4 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
sir <- random_sir(100)
rsi <- sir
class(rsi) <- gsub("sir", "rsi", class(rsi))
mic <- random_mic(100)
disk <- random_disk(100)
expect_identical(summary(sir), summary(rsi))
expect_identical(c(sir), c(rsi))
expect_identical(suppressWarnings(suppressMessages(as.rsi(as.character(rsi)))),
suppressWarnings(suppressMessages(as.sir(as.character(sir)))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(mic, mo = "Escherichia coli", ab = "CIP"))),
suppressWarnings(suppressMessages(as.sir(mic, mo = "Escherichia coli", ab = "CIP"))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(disk, mo = "Escherichia coli", ab = "CIP"))),
suppressWarnings(suppressMessages(as.sir(disk, mo = "Escherichia coli", ab = "CIP"))))
expect_identical(suppressWarnings(suppressMessages(as.rsi(data.frame(CIP = mic, mo = "Escherichia coli")))),
suppressWarnings(suppressMessages(as.sir(data.frame(CIP = mic, mo = "Escherichia coli")))))
expect_identical(suppressWarnings(n_rsi(example_isolates$CIP)),
suppressWarnings(n_sir(example_isolates$CIP)))
expect_identical(suppressWarnings(rsi_df(example_isolates)),
suppressWarnings(sir_df(example_isolates)))
expect_identical(suppressWarnings(is.rsi.eligible(example_isolates)),
suppressWarnings(is_sir_eligible(example_isolates)))
if (AMR:::pkg_is_available("ggplot2")) {
expect_equal(suppressWarnings(ggplot_rsi(example_isolates[, c("CIP", "GEN", "TOB")])),
suppressWarnings(ggplot_sir(example_isolates[, c("CIP", "GEN", "TOB")])))
p <- ggplot2::ggplot(example_isolates[, c("CIP", "GEN", "TOB")])
expect_equal(suppressWarnings(p + geom_rsi() + scale_rsi_colours() + labels_rsi_count() + facet_rsi() + theme_rsi()),
suppressWarnings(p + geom_sir() + scale_sir_colours() + labels_sir_count() + facet_sir() + theme_sir()))
}
+10
View File
@@ -79,6 +79,16 @@ expect_equal(
# based on Levenshtein distance
expect_identical(ab_name("ceftazidim/avibactam", language = NULL), "Ceftazidime/avibactam")
expect_identical(as.character(as.ab(c("gentamicine High Level",
"gentamicine High",
"gentamicine (High Level)",
"gentamicine (High)",
"gentamicine HL",
"gentamicine H-L",
"gentamicine (HL)",
"gentamicine (H-L)"))),
rep("GEH", 8))
# assigning and subsetting
x <- antibiotics$ab
expect_inherits(x[1], "ab")
+1 -2
View File
@@ -66,8 +66,7 @@ expect_equal(
c("101477-8", "101478-6", "18864-9", "18865-6", "20374-5", "21066-6", "23618-2", "27-3", "28-1", "29-9", "30-7", "31-5", "32-3", "33-1", "3355-5", "33562-0", "33919-2", "34-9", "43883-8", "43884-6", "6979-9", "6980-7", "87604-5")
)
expect_true(ab_url("AMX") %like% "whocc.no")
# expect_warning(ab_url("ASP"))
expect_true(ab_url("AMX") %like% "fhi[.]no")
expect_identical(
colnames(set_ab_names(example_isolates[, 17:22])),
+1 -2
View File
@@ -60,5 +60,4 @@ expect_equal(
c("29113-8", "30273-7", "30287-7", "30303-2", "78772-1", "78773-9", "79134-3", "80118-3")
)
expect_true(av_url("ACI") %like% "whocc.no")
# expect_warning(av_url("ASP"))
expect_true(av_url("ACI") %like% "fhi[.]no")
+4 -2
View File
@@ -69,7 +69,7 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
example_isolates %>% count_susceptible(AMC, GEN, only_all_tested = TRUE) +
example_isolates %>% count_resistant(AMC, GEN, only_all_tested = TRUE)
)
# count of cases
expect_equal(
example_isolates %>%
@@ -95,8 +95,10 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0", also_load = TRUE)) {
example_isolates %>% select(AMX) %>% count_df(combine_SI = FALSE) %>% pull(value),
c(
suppressWarnings(example_isolates$AMX %>% count_S()),
0,
example_isolates$AMX %>% count_I(),
example_isolates$AMX %>% count_R()
example_isolates$AMX %>% count_R(),
0
)
)
+4
View File
@@ -41,3 +41,7 @@ if (AMR:::has_colour()) {
"test for \033[3mE. coli\033[23m"
)
}
expect_identical(
italicise_taxonomy("test for E. coli", "html"),
"test for <i>E. coli</i>"
)
+32 -7
View File
@@ -142,10 +142,35 @@ suppressWarnings(expect_identical(el1^el2, el1_double^el2_double))
suppressWarnings(expect_identical(el1 %% el2, el1_double %% el2_double))
suppressWarnings(expect_identical(el1 %/% el2, el1_double %/% el2_double))
suppressWarnings(expect_identical(el1 & el2, el1_double & el2_double))
suppressWarnings(expect_identical(el1 | el2, el1_double | el2_double))
suppressWarnings(expect_identical(el1 == el2, el1_double == el2_double))
suppressWarnings(expect_identical(el1 != el2, el1_double != el2_double))
suppressWarnings(expect_identical(el1 < el2, el1_double < el2_double))
suppressWarnings(expect_identical(el1 <= el2, el1_double <= el2_double))
suppressWarnings(expect_identical(el1 >= el2, el1_double >= el2_double))
suppressWarnings(expect_identical(el1 > el2, el1_double > el2_double))
# for comparison operators, be more strict:
expect_true(as.mic(">32") > as.mic(32))
expect_true(as.mic(">32") >= as.mic(32))
expect_true(as.mic(">32") >= as.mic("<32"))
expect_true(as.mic(">32") >= as.mic("<=32"))
expect_true(as.mic(">32") > as.mic("<=32"))
expect_false(as.mic("32") > as.mic(32))
expect_true(as.mic("32") >= as.mic(32))
expect_true(as.mic("32") >= as.mic("<32"))
expect_true(as.mic("32") >= as.mic("<=32"))
expect_false(as.mic("32") > as.mic("<=32"))
expect_true(as.mic("32") == as.mic(32))
expect_true(as.mic("32") == as.mic(32))
expect_false(as.mic("32") == as.mic("<32"))
expect_true(as.mic("32") == as.mic("<=32"))
expect_true(as.mic("32") == as.mic("<=32"))
expect_false(as.mic(">32") < as.mic(32))
expect_false(as.mic(">32") <= as.mic(32))
expect_false(as.mic(">32") <= as.mic("<32"))
expect_false(as.mic(">32") <= as.mic("<=32"))
expect_false(as.mic(">32") < as.mic("<=32"))
expect_false(as.mic("32") < as.mic(32))
expect_true(as.mic("32") <= as.mic(32))
expect_false(as.mic("32") <= as.mic("<32"))
expect_true(as.mic("32") <= as.mic("<=32"))
expect_false(as.mic("32") < as.mic("<=32"))
+3 -1
View File
@@ -98,9 +98,11 @@ expect_equal(names(mo_info("Escherichia coli")), c(
"mo",
"kingdom", "phylum", "class", "order", "family", "genus", "species", "subspecies",
"status", "synonyms", "gramstain", "oxygen_tolerance",
"url", "ref", "snomed", "lpsn", "gbif"
"url", "ref", "snomed", "lpsn", "gbif", "group_members"
))
expect_inherits(mo_info(c("Escherichia coli", "Staphylococcus aureus")), "list")
expect_true(length(mo_group_members("B_HACEK")) > 1)
expect_inherits(mo_group_members(c("Candida albicans", "Escherichia coli")), "list")
expect_identical(mo_oxygen_tolerance(c("Klebsiella pneumoniae", "Clostridioides difficile")),
c("aerobe", "anaerobe"))

Some files were not shown because too many files have changed in this diff Show More