72 Commits
Author SHA1 Message Date
dr. M.S. (Matthijs) Berends ef8ef28650 (v2.1.1.9072) 2024-09-19 11:46:17 +02:00
dr. M.S. (Matthijs) Berends ddb23b6e73 (v2.1.1.9071) update veterinary SIR interpretation, add only_fungi 2024-09-19 11:44:56 +02:00
dr. M.S. (Matthijs) Berends 573c0346ed (v2.1.1.9070) fix for mo_current mo (no-verify) 2024-07-19 18:05:49 +02:00
dr. M.S. (Matthijs) Berends 83907c9c65 add files (no-verify) 2024-07-17 14:31:09 +02:00
dr. M.S. (Matthijs) Berends 7258a491b9 (v2.1.1.9068) fix for mo_url() and as.mo() for synonyms 2024-07-17 14:29:55 +02:00
dr. M.S. (Matthijs) Berends 63f6790c58 add (no-verify) 2024-07-16 16:10:38 +02:00
dr. M.S. (Matthijs) Berends b94dac770c (v2.1.1.9066) git hook fix? 2024-07-16 16:09:33 +02:00
dr. M.S. (Matthijs) Berends ff03bb6471 (v2.1.1.9065) unit tests 2 2024-07-16 15:58:18 +02:00
dr. M.S. (Matthijs) Berends 7f344836ea (v2.1.1.9064) unit tests 2024-07-16 15:55:58 +02:00
dr. M.S. (Matthijs) Berends 640888f408 (v2.1.1.9064) update all microbial taxonomy, add mycobank, big documentation update 2024-07-16 14:53:17 +02:00
dr. M.S. (Matthijs) Berends 4f9db23684 check for windows unit test (no-check) 2024-06-23 16:18:42 +02:00
dr. M.S. (Matthijs) Berends 82585901a7 (v2.1.1.9061) animal host fix 2024-06-19 15:41:45 +02:00
dr. M.S. (Matthijs) Berends c67d003e9e (v2.1.1.9060) SDD results now in as.sir() 2024-06-19 15:08:23 +02:00
dr. M.S. (Matthijs) Berends 0c3d81f32e (v2.1.1.9059) documentation fix 2024-06-17 22:26:05 +02:00
dr. M.S. (Matthijs) Berends 1bc2e04e1c (v2.1.1.9058) fix hosts, add translations 2024-06-17 22:19:38 +02:00
dr. M.S. (Matthijs) Berends a4dc37a4e4 (v2.1.1.9057) fix for missing breakpoints 2024-06-17 16:52:12 +02:00
dr. M.S. (Matthijs) Berends d9e66fb118 (v2.1.1.9056) example fix 2024-06-17 14:52:18 +02:00
dr. M.S. (Matthijs) Berends 1e65b5a289 (v2.1.1.9055) example fix 2024-06-17 14:36:40 +02:00
dr. M.S. (Matthijs) Berends 13baf8d7be (v2.1.1.9054) fix examples 2024-06-17 13:52:02 +02:00
dr. M.S. (Matthijs) Berends 2dee1d71dc (v2.1.1.9053) add verbose to as.sir(), unit test fix 2024-06-17 10:38:45 +02:00
dr. M.S. (Matthijs) Berends 68f7795481 (v2.1.1.9052) unit test fix 2024-06-16 20:53:50 +02:00
dr. M.S. (Matthijs) Berends 4ffac7e22d (v2.1.1.9051) fix VGS mo code 2024-06-16 11:28:56 +02:00
dr. M.S. (Matthijs) Berends bdbf5198a2 (v2.1.1.9050) vctrs fix for sir, small documentation fixes 2024-06-15 15:33:49 +02:00
dr. M.S. (Matthijs) Berends 9bf7584d58 (v2.1.1.9049) new 2024 breakpoints, add AMO, set NI instead of N 2024-06-14 22:39:01 +02:00
dr. M.S. (Matthijs) Berends de17de1be9 (v2.1.1.9048) vctrs update for sir 2024-06-13 20:55:17 +02:00
dr. M.S. (Matthijs) Berends 3179216c81 (v2.1.1.9047) unit test and index 2024-06-13 07:37:53 +02:00
dr. M.S. (Matthijs) Berends cd1b37ff69 (v2.1.1.9046) unit test fix 2024-06-12 14:37:44 +02:00
dr. M.S. (Matthijs) Berends c753afcd76 (v2.1.1.9045) fix host in animal guidelines 2024-06-12 10:32:43 +02:00
dr. M.S. (Matthijs) Berends 3a54711dfe (v2.1.1.9044) update website 2024-06-10 15:10:54 +02:00
dr. M.S. (Matthijs) Berends 31207952d3 (v2.1.1.9043) fix sir translation with as.double 2024-06-10 10:34:45 +02:00
dr. M.S. (Matthijs) Berends a3071cf58b (v2.1.1.9042) update translations and example isolates 2024-06-09 11:31:04 +02:00
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
290 changed files with 365187 additions and 133877 deletions
+10 -73
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# ==================================================================== # # ==================================================================== #
# TITLE: # # TITLE: #
@@ -8,9 +8,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -29,73 +29,10 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ # # how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== # # ==================================================================== #
echo "Running pre-commit hook..." # always add these:
git add data-raw/*
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ git add man/*
if command -v Rscript > /dev/null; then git add R/sysdata.rda
if [ "$(Rscript -e 'cat(all(c('"'pkgload'"', '"'devtools'"', '"'dplyr'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then git add NAMESPACE
Rscript -e "source('data-raw/_pre_commit_hook.R')"
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
echo "- Adding changed files in ./data-raw and ./man to this commit"
git add data-raw/*
git add man/*
git add R/sysdata.rda
git add NAMESPACE
else
echo "- R package 'pkgload', 'devtools', 'dplyr', or 'styler' not installed!"
currentpkg="your"
fi
else
echo "- R is not available on your system!"
currentpkg="your"
fi
echo ""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo "Updating semantic versioning and date..."
# get tags from remote, and remove tags not on remote:
git fetch origin --prune --prune-tags --quiet
currenttagfull=$(git describe --tags --abbrev=0)
currenttag=$(git describe --tags --abbrev=0 | sed 's/v//')
# assume main branch to be 'main' or 'master', pick the right name:
defaultbranch=$(git branch | cut -c 3- | grep -E '^master$|^main$')
if [ "$currenttag" = "" ]; then
# there is no tag, so set tag to 0.0.1 and commit index to current count
currenttag="0.0.1"
currentcommit=$(git rev-list --count ${defaultbranch})
echo "- no git tags found, create one in format 'v(x).(y).(z)' - curently ${currentcommit} previous commits in '${defaultbranch}'"
else
# there is a tag, so base version number on that
currentcommit=$(git rev-list --count ${currenttagfull}..${defaultbranch})
echo "- latest tag is '${currenttagfull}', with ${currentcommit} previous commits in '${defaultbranch}'"
fi
# combine tag (e.g. 1.2.3) and commit number (like 5) increased by 9000 to indicate beta version
currentversion="$currenttag.$((currentcommit + 9001))" # results in e.g. 1.2.3.9005
echo "- ${currentpkg} pkg version set to ${currentversion}"
# set version number and date to DESCRIPTION file
sed -i -- "s/^Version: .*/Version: ${currentversion}/" DESCRIPTION
sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION
echo "- updated version number and date in ./DESCRIPTION"
# remove leftover on macOS
rm -f DESCRIPTION--
# add to commit
git add DESCRIPTION git add DESCRIPTION
git add NEWS.md
# set version number to NEWS file
if [ -e "NEWS.md" ]; then
if [ "$currentpkg" = "your" ]; then
currentpkg=""
fi
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
echo "- updated version number in ./NEWS.md"
# remove leftover on macOS
rm -f NEWS.md--
# add to commit
git add NEWS.md
else
echo "- no NEWS.md found!"
fi
echo ""
+126
View File
@@ -0,0 +1,126 @@
#!/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, et al. (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 before every commit #
########################################
COMMIT_MSG_FILE=".git/COMMIT_EDITMSG"
# Read the commit message
if [ -f "$COMMIT_MSG_FILE" ]; then
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
else
echo "Commit message file not found."
exit 1
fi
# Check the commit message and skip checks if needed
if [[ "$COMMIT_MSG" =~ no-?checks?|no-?verify ]]; then
echo "Not running prehook:"
echo "Commit message contains 'no-check' or 'no-verify'."
echo ""
exit 0
fi
echo "Running prehook..."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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_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/*
git add man/*
git add R/sysdata.rda
git add NAMESPACE
else
echo "- R package 'pkgload', 'devtools', or 'dplyr' not installed!"
currentpkg="your"
fi
else
echo "- R is not available on your system!"
currentpkg="your"
fi
echo ""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo "Updating semantic versioning and date..."
# get tags from remote, and remove tags not on remote:
git fetch origin --prune --prune-tags --quiet
currenttagfull=$(git describe --tags --abbrev=0)
currenttag=$(git describe --tags --abbrev=0 | sed 's/v//')
# assume main branch to be 'main' or 'master', pick the right name:
defaultbranch=$(git branch | cut -c 3- | grep -E '^master$|^main$')
if [ "$currenttag" = "" ]; then
# there is no tag, so set tag to 0.0.1 and commit index to current count
currenttag="0.0.1"
currentcommit=$(git rev-list --count ${defaultbranch})
echo "- no git tags found, create one in format 'v(x).(y).(z)' - curently ${currentcommit} previous commits in '${defaultbranch}'"
else
# there is a tag, so base version number on that
currentcommit=$(git rev-list --count ${currenttagfull}..${defaultbranch})
echo "- latest tag is '${currenttagfull}', with ${currentcommit} previous commits in '${defaultbranch}'"
fi
# combine tag (e.g. 1.2.3) and commit number (like 5) increased by 9000 to indicate beta version
currentversion="$currenttag.$((currentcommit + 9001))" # results in e.g. 1.2.3.9005
echo "- ${currentpkg} pkg version set to ${currentversion}"
# set version number and date to DESCRIPTION file
sed -i -- "s/^Version: .*/Version: ${currentversion}/" DESCRIPTION
sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION
echo "- updated version number and date in ./DESCRIPTION"
# remove leftover on macOS
rm -f DESCRIPTION--
# add to commit
git add DESCRIPTION
# set version number to NEWS file
if [ -e "NEWS.md" ]; then
if [ "$currentpkg" = "your" ]; then
currentpkg=""
fi
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
echo "- updated version number in ./NEWS.md"
# remove leftover on macOS
rm -f NEWS.md--
# add to commit
git add NEWS.md
else
echo "- no NEWS.md found!"
fi
echo ""
# Prepend the version number to the commit message
echo "(v${currentversion}) ${COMMIT_MSG}" > "$COMMIT_MSG_FILE"
+4 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -49,6 +49,7 @@ jobs:
# Test all old versions of R >= 3.0, we support them all! # Test all old versions of R >= 3.0, we support them all!
# For these old versions, dependencies and vignettes will not be checked. # 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). # 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: 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.4', allowfail: false}
- {os: ubuntu-latest, r: '3.3', allowfail: false} - {os: ubuntu-latest, r: '3.3', allowfail: false}
+8 -8
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -58,15 +58,15 @@ jobs:
- {os: ubuntu-latest, r: 'devel', allowfail: false} - {os: ubuntu-latest, r: 'devel', allowfail: false}
# current 'release' version, check all major OSes: # current 'release' version, check all major OSes:
- {os: macOS-latest, r: '4.3', allowfail: false} - {os: macOS-latest, r: 'release', allowfail: false}
- {os: windows-latest, r: '4.3', allowfail: false} - {os: windows-latest, r: 'release', allowfail: false}
- {os: ubuntu-latest, r: '4.3', allowfail: false} - {os: ubuntu-latest, r: 'release', allowfail: false}
# older versions (see also check-old.yaml for even older versions): # 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.2', allowfail: false}
- {os: ubuntu-latest, r: '4.1', allowfail: false} - {os: ubuntu-latest, r: '4.1', allowfail: false}
- {os: ubuntu-latest, r: '4.0', allowfail: false} - {os: ubuntu-latest, r: '4.0', allowfail: false} # when a new R releases, this one has to move to check-old.yaml
- {os: ubuntu-latest, r: '3.6', allowfail: false} # when a new R releases, this one has to move to check-old.yaml
env: env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+13 -12
View File
@@ -1,13 +1,12 @@
Package: AMR Package: AMR
Version: 2.1.1 Version: 2.1.1.9071
Date: 2023-10-20 Date: 2024-09-19
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by
using evidence-based methods, as described in <doi:10.18637/jss.v104.i03>. using evidence-based methods, as described in <doi:10.18637/jss.v104.i03>.
Authors@R: c( 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 = "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 = "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 = "Hassing", c("Erwin", "E.", "A."), role = c("aut", "ctb")),
person(family = "Albers", c("Casper", "J."), role = "ths", comment = c(ORCID = "0000-0002-9213-6743")), person(family = "Albers", c("Casper", "J."), role = "ths", comment = c(ORCID = "0000-0002-9213-6743")),
@@ -18,36 +17,38 @@ Authors@R: c(
person(family = "Hazenberg", c("Eric", "H.", "L.", "C.", "M."), role = "ctb"), 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 = "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 = "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 = "Meijer", c("Bart", "C."), role = "ctb"),
person(family = "Mykhailenko", c("Dmytro"), role = "ctb"), person(family = "Mykhailenko", c("Dmytro"), role = "ctb"),
person(family = "Mymrikov", c("Anton"), 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 = "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 = "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 = "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 = "Schade", c("Rogier", "P."), role = "ctb"),
person(family = "Sinha", c("Bhanu", "N.", "M."), role = "ths", comment = c(ORCID = "0000-0003-1634-0010")), 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 = "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"))) person(family = "Williams", c("Anita"), role = "ctb", comment = c(ORCID = "0000-0002-5295-8451")))
Depends: R (>= 3.0.0) Depends: R (>= 3.0.0)
Enhances:
cleaner,
ggplot2,
janitor,
skimr,
tibble,
tidyselect,
tsibble
Suggests: Suggests:
cleaner,
cli, cli,
curl, curl,
data.table, data.table,
dplyr, dplyr,
ggplot2,
knitr, knitr,
progress, progress,
readxl, readxl,
rmarkdown, rmarkdown,
rvest, rvest,
skimr,
tibble,
tidyselect,
tinytest, tinytest,
vctrs,
xml2 xml2
VignetteBuilder: knitr,rmarkdown VignetteBuilder: knitr,rmarkdown
URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR URL: https://msberends.github.io/AMR/, https://github.com/msberends/AMR
@@ -55,5 +56,5 @@ BugReports: https://github.com/msberends/AMR/issues
License: GPL-2 | file LICENSE License: GPL-2 | file LICENSE
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 7.2.3 RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE) Roxygen: list(markdown = TRUE)
+15 -29
View File
@@ -13,7 +13,6 @@ S3method("[<-",av)
S3method("[<-",disk) S3method("[<-",disk)
S3method("[<-",mic) S3method("[<-",mic)
S3method("[<-",mo) S3method("[<-",mo)
S3method("[<-",rsi)
S3method("[<-",sir) S3method("[<-",sir)
S3method("[[",ab) S3method("[[",ab)
S3method("[[",av) S3method("[[",av)
@@ -25,7 +24,6 @@ S3method("[[<-",av)
S3method("[[<-",disk) S3method("[[<-",disk)
S3method("[[<-",mic) S3method("[[<-",mic)
S3method("[[<-",mo) S3method("[[<-",mo)
S3method("[[<-",rsi)
S3method("[[<-",sir) S3method("[[<-",sir)
S3method("|",ab_selector) S3method("|",ab_selector)
S3method(Complex,mic) S3method(Complex,mic)
@@ -38,24 +36,23 @@ S3method(any,ab_selector)
S3method(any,ab_selector_any_all) S3method(any,ab_selector_any_all)
S3method(as.data.frame,ab) S3method(as.data.frame,ab)
S3method(as.data.frame,av) S3method(as.data.frame,av)
S3method(as.data.frame,mic)
S3method(as.data.frame,mo) S3method(as.data.frame,mo)
S3method(as.double,mic) S3method(as.double,mic)
S3method(as.double,sir)
S3method(as.list,custom_eucast_rules) S3method(as.list,custom_eucast_rules)
S3method(as.list,custom_mdro_guideline) S3method(as.list,custom_mdro_guideline)
S3method(as.list,mic)
S3method(as.matrix,mic) S3method(as.matrix,mic)
S3method(as.numeric,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,data.frame)
S3method(as.sir,default) S3method(as.sir,default)
S3method(as.sir,disk) S3method(as.sir,disk)
S3method(as.sir,mic) S3method(as.sir,mic)
S3method(as.vector,mic)
S3method(barplot,antibiogram) S3method(barplot,antibiogram)
S3method(barplot,disk) S3method(barplot,disk)
S3method(barplot,mic) S3method(barplot,mic)
S3method(barplot,rsi)
S3method(barplot,sir) S3method(barplot,sir)
S3method(c,ab) S3method(c,ab)
S3method(c,ab_selector) S3method(c,ab_selector)
@@ -65,11 +62,9 @@ S3method(c,custom_mdro_guideline)
S3method(c,disk) S3method(c,disk)
S3method(c,mic) S3method(c,mic)
S3method(c,mo) S3method(c,mo)
S3method(c,rsi)
S3method(c,sir) S3method(c,sir)
S3method(close,progress_bar) S3method(close,progress_bar)
S3method(droplevels,mic) S3method(droplevels,mic)
S3method(droplevels,rsi)
S3method(droplevels,sir) S3method(droplevels,sir)
S3method(format,bug_drug_combinations) S3method(format,bug_drug_combinations)
S3method(hist,mic) S3method(hist,mic)
@@ -87,9 +82,9 @@ S3method(plot,antibiogram)
S3method(plot,disk) S3method(plot,disk)
S3method(plot,mic) S3method(plot,mic)
S3method(plot,resistance_predict) S3method(plot,resistance_predict)
S3method(plot,rsi)
S3method(plot,sir) S3method(plot,sir)
S3method(print,ab) S3method(print,ab)
S3method(print,ab_selector)
S3method(print,av) S3method(print,av)
S3method(print,bug_drug_combinations) S3method(print,bug_drug_combinations)
S3method(print,custom_eucast_rules) S3method(print,custom_eucast_rules)
@@ -100,15 +95,14 @@ S3method(print,mo)
S3method(print,mo_renamed) S3method(print,mo_renamed)
S3method(print,mo_uncertainties) S3method(print,mo_uncertainties)
S3method(print,pca) S3method(print,pca)
S3method(print,rsi)
S3method(print,sir) S3method(print,sir)
S3method(print,sir_log)
S3method(quantile,mic) S3method(quantile,mic)
S3method(rep,ab) S3method(rep,ab)
S3method(rep,av) S3method(rep,av)
S3method(rep,disk) S3method(rep,disk)
S3method(rep,mic) S3method(rep,mic)
S3method(rep,mo) S3method(rep,mo)
S3method(rep,rsi)
S3method(rep,sir) S3method(rep,sir)
S3method(skewness,data.frame) S3method(skewness,data.frame)
S3method(skewness,default) S3method(skewness,default)
@@ -117,14 +111,12 @@ S3method(sort,mic)
S3method(summary,mic) S3method(summary,mic)
S3method(summary,mo) S3method(summary,mo)
S3method(summary,pca) S3method(summary,pca)
S3method(summary,rsi)
S3method(summary,sir) S3method(summary,sir)
S3method(unique,ab) S3method(unique,ab)
S3method(unique,av) S3method(unique,av)
S3method(unique,disk) S3method(unique,disk)
S3method(unique,mic) S3method(unique,mic)
S3method(unique,mo) S3method(unique,mo)
S3method(unique,rsi)
S3method(unique,sir) S3method(unique,sir)
export("%like%") export("%like%")
export("%like_case%") export("%like_case%")
@@ -132,7 +124,6 @@ export("%unlike%")
export("%unlike_case%") export("%unlike_case%")
export(NA_disk_) export(NA_disk_)
export(NA_mic_) export(NA_mic_)
export(NA_rsi_)
export(NA_sir_) export(NA_sir_)
export(ab_atc) export(ab_atc)
export(ab_atc_group1) export(ab_atc_group1)
@@ -171,7 +162,6 @@ export(as.av)
export(as.disk) export(as.disk)
export(as.mic) export(as.mic)
export(as.mo) export(as.mo)
export(as.rsi)
export(as.sir) export(as.sir)
export(atc_online_ddd) export(atc_online_ddd)
export(atc_online_ddd_units) export(atc_online_ddd_units)
@@ -217,21 +207,17 @@ export(custom_mdro_guideline)
export(eucast_dosage) export(eucast_dosage)
export(eucast_exceptional_phenotypes) export(eucast_exceptional_phenotypes)
export(eucast_rules) export(eucast_rules)
export(facet_rsi)
export(facet_sir) export(facet_sir)
export(filter_first_isolate) export(filter_first_isolate)
export(first_isolate) export(first_isolate)
export(fluoroquinolones) export(fluoroquinolones)
export(full_join_microorganisms) export(full_join_microorganisms)
export(g.test) export(g.test)
export(geom_rsi)
export(geom_sir) export(geom_sir)
export(get_AMR_locale) export(get_AMR_locale)
export(get_episode) export(get_episode)
export(get_mo_source) export(get_mo_source)
export(ggplot_pca) export(ggplot_pca)
export(ggplot_rsi)
export(ggplot_rsi_predict)
export(ggplot_sir) export(ggplot_sir)
export(ggplot_sir_predict) export(ggplot_sir_predict)
export(glycopeptides) export(glycopeptides)
@@ -242,8 +228,6 @@ export(is.av)
export(is.disk) export(is.disk)
export(is.mic) export(is.mic)
export(is.mo) export(is.mo)
export(is.rsi)
export(is.rsi.eligible)
export(is.sir) export(is.sir)
export(is_new_episode) export(is_new_episode)
export(is_sir_eligible) export(is_sir_eligible)
@@ -251,7 +235,6 @@ export(italicise_taxonomy)
export(italicize_taxonomy) export(italicize_taxonomy)
export(key_antimicrobials) export(key_antimicrobials)
export(kurtosis) export(kurtosis)
export(labels_rsi_count)
export(labels_sir_count) export(labels_sir_count)
export(left_join_microorganisms) export(left_join_microorganisms)
export(like) export(like)
@@ -273,6 +256,7 @@ export(mo_fullname)
export(mo_gbif) export(mo_gbif)
export(mo_genus) export(mo_genus)
export(mo_gramstain) export(mo_gramstain)
export(mo_group_members)
export(mo_info) export(mo_info)
export(mo_is_anaerobic) export(mo_is_anaerobic)
export(mo_is_gram_negative) export(mo_is_gram_negative)
@@ -282,6 +266,7 @@ export(mo_is_yeast)
export(mo_kingdom) export(mo_kingdom)
export(mo_lpsn) export(mo_lpsn)
export(mo_matching_score) export(mo_matching_score)
export(mo_mycobank)
export(mo_name) export(mo_name)
export(mo_order) export(mo_order)
export(mo_oxygen_tolerance) export(mo_oxygen_tolerance)
@@ -304,8 +289,8 @@ export(mo_uncertainties)
export(mo_url) export(mo_url)
export(mo_year) export(mo_year)
export(mrgn) export(mrgn)
export(n_rsi)
export(n_sir) export(n_sir)
export(nitrofurans)
export(not_intrinsic_resistant) export(not_intrinsic_resistant)
export(oxazolidinones) export(oxazolidinones)
export(pca) export(pca)
@@ -320,16 +305,18 @@ export(proportion_df)
export(quinolones) export(quinolones)
export(random_disk) export(random_disk)
export(random_mic) export(random_mic)
export(random_rsi)
export(random_sir) export(random_sir)
export(rescale_mic)
export(reset_AMR_locale) export(reset_AMR_locale)
export(resistance) export(resistance)
export(resistance_predict) export(resistance_predict)
export(rifamycins)
export(right_join_microorganisms) export(right_join_microorganisms)
export(rsi_df) export(scale_colour_mic)
export(rsi_predict) export(scale_fill_mic)
export(scale_rsi_colours)
export(scale_sir_colours) export(scale_sir_colours)
export(scale_x_mic)
export(scale_y_mic)
export(scale_y_percent) export(scale_y_percent)
export(semi_join_microorganisms) export(semi_join_microorganisms)
export(set_AMR_locale) export(set_AMR_locale)
@@ -343,7 +330,6 @@ export(skewness)
export(streptogramins) export(streptogramins)
export(susceptibility) export(susceptibility)
export(tetracyclines) export(tetracyclines)
export(theme_rsi)
export(theme_sir) export(theme_sir)
export(translate_AMR) export(translate_AMR)
export(trimethoprims) export(trimethoprims)
+71 -3
View File
@@ -1,3 +1,71 @@
# AMR 2.1.1.9071
*(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! Install this beta using [the instructions here](https://msberends.github.io/AMR/#latest-development-version).)*
#### A New Milestone: AMR v3.0 with 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's Atlantic Veterinary College](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
* Clinical breakpoints
* EUCAST 2024 and CLSI 2024 are now supported, by adding all of their over 4,000 new clinical breakpoints to the `clinical_breakpoints` data set for usage in `as.sir()`. EUCAST 2024 is now the new default guideline for all MIC and disks diffusion interpretations.
* `as.sir()` now brings additional factor levels: "NI" for non-interpretable and "SDD" for susceptible dose-dependent. Currently, the `clinical_breakpoints` data set contains 24 breakpoints that can return the value "SDD" instead of "I".
* MIC plotting and transforming
* New 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.
* New 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.
* Microbiological taxonomy (`microorganisms` data set) updated to June 2024, with some exciting new features:
* Added MycoBank as the primary taxonomic source for fungi
* The `microorganisms` data set now contains additional columns `mycobank`, `mycobank_parent`, and `mycobank_renamed_to`
* New function `mo_mycobank()` to get the MycoBank record number, analogous to existing functions `mo_lpsn()` and `mo_gbif()`
* We've welcomed over 2,000 records from 2023, over 900 from 2024, and many thousands of new fungi
* Improved support for mycologists:
* The `as.mo()` function now includes a new argument, `only_fungi` (TRUE/FALSE), which limits the results to fungi only. Normally, bacteria are often prioritised by the algorithm, but setting `only_fungi = TRUE` ensures only fungi are returned.
* You can also set this globally using the new R option `AMR_only_fungi`, e.g., `options(AMR_only_fungi = TRUE)`.
* Other
* New 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
* 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.
* Users can now set their own criteria (using regular expressions) as to what should be considered S, I, R, SDD, and NI.
* To get quantitative values, `as.double()` on a `sir` object will return 1 for S, 2 for SDD/I, and 3 for R (NI will become `NA`). Other functions using `sir` classes (e.g., `summary()`) are updated to reflect the change to contain NI and SDD.
* `antibiotics` data set
* Added "clindamycin inducible screening" as `CLI1`. 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)
* Added Amorolfine (`AMO`, D01AE16), which is now also part of the `antifungals()` selector
* Antibiotic selectors
* Added selectors `nitrofurans()` and `rifamycins()`
* 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`
* 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
* Improved overall algorithm of `as.mo()` for better performance and accuracy. Specifically, more weight is given to genus and species combinations in cases where the subspecies is miswritten, so that the result will be the correct genus and species.
* Intermediate log2 levels used for MIC plotting are now more common values instead of following a strict dilution range
* Fixed a bug for when `antibiogram()` returns an empty data set
## Other
* Greatly updated and expanded documentation
* Added Jordan Stull, Matthew Saab, and Javier Sanchez as contributors, to thank them for their valuable input
# AMR 2.1.1 # AMR 2.1.1
* Fix for selecting first isolates using the phenotype-based method * Fix for selecting first isolates using the phenotype-based method
@@ -75,7 +143,7 @@ The 'RSI functions' will be removed in a future version, but not before late 202
### New antibiogram function ### New antibiogram function
With the new `antibiogram()` function, users can now generate traditional, combined, syndromic, and even weighted-incidence syndromic combination antibiograms (WISCA). With this, we follow the logic in the previously described work of Klinker *et al.* (2021, DOI [10.1177/20499361211011373](https://doi.org/10.1177/20499361211011373)) and Barbieri *et al.* (2021, DOI [10.1186/s13756-021-00939-2](https://doi.org/10.1186/s13756-021-00939-2)). With the new `antibiogram()` function, users can now generate traditional, combined, syndromic, and even weighted-incidence syndromic combination antibiograms (WISCA). With this, we follow the logic in the previously described work of Klinker *et al.* (2021, DOI 10.1177/20499361211011373) and Barbieri *et al.* (2021, DOI 10.1186/s13756-021-00939-2).
The help page for `antibiogram()` extensively elaborates on use cases, and `antibiogram()` also supports printing in R Markdown and Quarto, with support for 20 languages. The help page for `antibiogram()` extensively elaborates on use cases, and `antibiogram()` also supports printing in R Markdown and Quarto, with support for 20 languages.
@@ -132,7 +200,7 @@ The new function `add_custom_antimicrobials()` allows users to add custom antimi
The `antibiotics` data set was greatly updated: 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 * Added some missing ATC codes
* Updated DDDs and PubChem Compound IDs * Updated DDDs and PubChem Compound IDs
* Updated some antibiotic name spelling, now used by WHOCC (such as cephalexin -> cefalexin, and phenethicillin -> pheneticillin) * Updated some antibiotic name spelling, now used by WHOCC (such as cephalexin -> cefalexin, and phenethicillin -> pheneticillin)
@@ -145,7 +213,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. 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 * 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 * Functions `as.av()`, `av_name()`, `av_atc()`, `av_synonyms()`, `av_from_text()` have all been added as siblings to their `ab_*()` equivalents
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+25 -9
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -28,7 +28,7 @@
# ==================================================================== # # ==================================================================== #
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and clinical_breakpoints # 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( EUCAST_VERSION_BREAKPOINTS <- list(
# "13.0" = list( # "13.0" = list(
# version_txt = "v13.0", # version_txt = "v13.0",
@@ -86,26 +86,37 @@ EUCAST_VERSION_EXPERT_RULES <- list(
TAXONOMY_VERSION <- list( TAXONOMY_VERSION <- list(
GBIF = list( GBIF = list(
accessed_date = as.Date("2022-12-11"), name = "Global Biodiversity Information Facility (GBIF)",
citation = "GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \\doi{10.15468/39omei}.", accessed_date = as.Date("2024-06-24"),
citation = "GBIF Secretariat (2023). GBIF Backbone Taxonomy. Checklist dataset \\doi{10.15468/39omei}.",
url = "https://www.gbif.org" url = "https://www.gbif.org"
), ),
LPSN = list( LPSN = list(
accessed_date = as.Date("2022-12-11"), name = "List of Prokaryotic names with Standing in Nomenclature (LPSN)",
accessed_date = as.Date("2024-06-24"),
citation = "Parte, AC *et al.* (2020). **List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.** International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \\doi{10.1099/ijsem.0.004332}.", citation = "Parte, AC *et al.* (2020). **List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.** International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \\doi{10.1099/ijsem.0.004332}.",
url = "https://lpsn.dsmz.de" url = "https://lpsn.dsmz.de"
), ),
MycoBank = list(
name = "MycoBank",
accessed_date = as.Date("2024-06-24"),
citation = "Vincent, R *et al* (2013). **MycoBank gearing up for new horizons.** IMA Fungus, 4(2), 371-9; \\doi{10.5598/imafungus.2013.04.02.16}.",
url = "https://www.mycobank.org"
),
BacDive = list( BacDive = list(
accessed_date = as.Date("2023-05-12"), name = "BacDive",
accessed_date = as.Date("2024-07-16"),
citation = "Reimer, LC *et al.* (2022). ***BacDive* in 2022: the knowledge base for standardized bacterial and archaeal data.** Nucleic Acids Res., 50(D1):D741-D74; \\doi{10.1093/nar/gkab961}.", citation = "Reimer, LC *et al.* (2022). ***BacDive* in 2022: the knowledge base for standardized bacterial and archaeal data.** Nucleic Acids Res., 50(D1):D741-D74; \\doi{10.1093/nar/gkab961}.",
url = "https://bacdive.dsmz.de" url = "https://bacdive.dsmz.de"
), ),
SNOMED = list( SNOMED = list(
accessed_date = as.Date("2021-07-01"), name = "Systematized Nomenclature of Medicine - Clinical Terms (SNOMED-CT)",
accessed_date = as.Date("2024-07-16"),
citation = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12).", citation = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12).",
url = "https://phinvads.cdc.gov" url = "https://phinvads.cdc.gov"
), ),
LOINC = list( LOINC = list(
name = "Logical Observation Identifiers Names and Codes (LOINC)",
accessed_date = as.Date("2023-10-19"), accessed_date = as.Date("2023-10-19"),
citation = "Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023).", citation = "Logical Observation Identifiers Names and Codes (LOINC), Version 2.76 (18 September, 2023).",
url = "https://loinc.org" url = "https://loinc.org"
@@ -146,6 +157,8 @@ globalVariables(c(
"group", "group",
"guideline", "guideline",
"hjust", "hjust",
"host_index",
"host_match",
"input", "input",
"intrinsic_resistant", "intrinsic_resistant",
"isolates", "isolates",
@@ -159,6 +172,7 @@ globalVariables(c(
"microorganisms", "microorganisms",
"microorganisms.codes", "microorganisms.codes",
"mo", "mo",
"n",
"name", "name",
"new", "new",
"numerator", "numerator",
@@ -184,8 +198,10 @@ globalVariables(c(
"total", "total",
"txt", "txt",
"type", "type",
"uti_index",
"value", "value",
"varname", "varname",
"x",
"xvar", "xvar",
"y", "y",
"year", "year",
+70 -30
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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(x, allow_class = "data.frame")
meet_criteria(type, allow_class = "character", has_length = 1) 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"))) { if (!inherits(pm_pull(x, found), c("Date", "POSIXct"))) {
stop( stop(
font_red(paste0( 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." "`, but this column contains no valid dates. Transform its values to valid dates first."
)), )),
call. = FALSE call. = FALSE
@@ -311,6 +311,14 @@ search_type_in_df <- function(x, type, info = TRUE) {
found <- sort(colnames(x)[colnames_formatted %like_case% "^(specimen)"]) 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) # -- UTI (urinary tract infection)
if (type == "uti") { if (type == "uti") {
if (any(colnames_formatted == "uti")) { if (any(colnames_formatted == "uti")) {
@@ -321,7 +329,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
if (!is.null(found)) { if (!is.null(found)) {
# this column should contain logicals # this column should contain logicals
if (!is.logical(x[, found, drop = TRUE])) { 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.", "`, but this column does not contain 'logical' values (TRUE/FALSE) and was ignored.",
add_fn = font_red add_fn = font_red
) )
@@ -334,9 +342,9 @@ search_type_in_df <- function(x, type, info = TRUE) {
if (!is.null(found) && isTRUE(info)) { if (!is.null(found) && isTRUE(info)) {
if (message_not_thrown_before("search_in_type", type)) { 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")) { 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) message_(msg)
} }
@@ -456,7 +464,8 @@ word_wrap <- function(...,
ops <- "([,./><\\]\\[])" ops <- "([,./><\\]\\[])"
msg <- gsub(paste0(ops, " ", ops), "\\1\\2", msg, perl = TRUE) msg <- gsub(paste0(ops, " ", ops), "\\1\\2", msg, perl = TRUE)
# we need to correct for already applied style, that adds text like "\033[31m\" # 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? # where are the spaces now?
msg_stripped_wrapped <- paste0( msg_stripped_wrapped <- paste0(
strwrap(msg_stripped, strwrap(msg_stripped,
@@ -515,6 +524,9 @@ word_wrap <- function(...,
# otherwise, give a 'click to run' popup # otherwise, give a 'click to run' popup
parts[cmds & parts %unlike% "[.]"] <- font_url(url = paste0("ide:run:AMR::", parts[cmds & parts %unlike% "[.]"]), parts[cmds & parts %unlike% "[.]"] <- font_url(url = paste0("ide:run:AMR::", parts[cmds & parts %unlike% "[.]"]),
txt = parts[cmds & parts %unlike% "[.]"]) txt = parts[cmds & parts %unlike% "[.]"])
# text starting with `?` must also lead to the help page
parts[parts %like% "^[?]"] <- font_url(url = paste0("ide:help:AMR::", gsub("()", "", gsub("^[?]", "", parts[parts %like% "^[?]"]), fixed = TRUE)),
txt = parts[parts %like% "^[?]"])
msg <- paste0(parts, collapse = "`") msg <- paste0(parts, collapse = "`")
} }
msg <- gsub("`(.+?)`", font_grey_bg("\\1"), msg) msg <- gsub("`(.+?)`", font_grey_bg("\\1"), msg)
@@ -561,6 +573,7 @@ warning_ <- function(...,
# - wraps text to never break lines within words # - wraps text to never break lines within words
stop_ <- function(..., call = TRUE) { stop_ <- function(..., call = TRUE) {
msg <- paste0(c(...), collapse = "") msg <- paste0(c(...), collapse = "")
msg_call <- ""
if (!isFALSE(call)) { if (!isFALSE(call)) {
if (isTRUE(call)) { if (isTRUE(call)) {
call <- as.character(sys.call(-1)[1]) call <- as.character(sys.call(-1)[1])
@@ -568,10 +581,19 @@ stop_ <- function(..., call = TRUE) {
# so you can go back more than 1 call, as used in sir_calc(), that now throws a reference to e.g. n_sir() # so you can go back more than 1 call, as used in sir_calc(), that now throws a reference to e.g. n_sir()
call <- as.character(sys.call(call)[1]) call <- as.character(sys.call(call)[1])
} }
msg <- paste0("in ", call, "(): ", msg) msg_call <- paste0("in ", call, "():")
} }
msg <- trimws2(word_wrap(msg, add_fn = list(), as_note = FALSE)) msg <- trimws2(word_wrap(msg, add_fn = list(), as_note = FALSE))
stop(msg, call. = FALSE) if (!is.null(AMR_env$cli_abort) && length(unlist(strsplit(msg, "\n", fixed = TRUE))) <= 1) {
if (is.character(call)) {
call <- as.call(str2lang(paste0(call, "()")))
} else {
call <- NULL
}
AMR_env$cli_abort(msg, call = call)
} else {
stop(paste(msg_call, msg), call. = FALSE)
}
} }
stop_if <- function(expr, ..., call = TRUE) { stop_if <- function(expr, ..., call = TRUE) {
@@ -680,7 +702,7 @@ create_eucast_ab_documentation <- function() {
ab <- character() ab <- character()
for (val in x) { for (val in x) {
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) { 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")) val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
} else if (val %in% AMR_env$AB_lookup$ab) { } else if (val %in% AMR_env$AB_lookup$ab) {
# separate drugs, such as `AMX` # separate drugs, such as `AMX`
@@ -734,6 +756,10 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
# class 'sir' should be sorted like this # class 'sir' should be sorted like this
v <- c("S", "I", "R") v <- c("S", "I", "R")
} }
if (identical(v, c("I", "NI", "R", "S", "SDD"))) {
# class 'sir' should be sorted like this
v <- c("S", "SDD", "I", "R", "NI")
}
# oxford comma # oxford comma
if (last_sep %in% c(" or ", " and ") && length(v) > 2) { if (last_sep %in% c(" or ", " and ") && length(v) > 2) {
last_sep <- paste0(",", last_sep) last_sep <- paste0(",", last_sep)
@@ -826,7 +852,7 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
return(invisible()) 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, stop_ifnot(inherits(object, allow_class), "argument `", obj_name,
"` must be ", format_class(allow_class, plural = isTRUE(has_length > 1)), "` must be ", format_class(allow_class, plural = isTRUE(has_length > 1)),
", i.e. not be ", format_class(class(object), plural = isTRUE(has_length > 1)), ", i.e. not be ", format_class(class(object), plural = isTRUE(has_length > 1)),
@@ -862,12 +888,20 @@ meet_criteria <- function(object, # can be literally `list(...)` for `allow_argu
object <- tolower(object) object <- tolower(object)
is_in <- tolower(is_in) 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, ifelse(!is.null(has_length) && length(has_length) == 1 && has_length == 1,
"must be either ", "must be either ",
"must only contain values " "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", ""), ifelse(allow_NA == TRUE, ", or NA", ""),
call = call_depth call = call_depth
) )
@@ -997,10 +1031,10 @@ get_current_data <- function(arg_name, call) {
fn <- as.character(sys.call(call + 1)[1]) fn <- as.character(sys.call(call + 1)[1])
examples <- paste0( examples <- paste0(
", e.g.:\n", ", e.g.:\n",
" your_data %>% select(", fn, "())\n", " ", AMR_env$bullet_icon, " your_data %>% select(", fn, "())\n",
" your_data %>% select(column_a, column_b, ", fn, "())\n", " ", AMR_env$bullet_icon, " your_data %>% select(column_a, column_b, ", fn, "())\n",
" your_data[, ", fn, "()]\n", " ", AMR_env$bullet_icon, " your_data[, ", fn, "()]\n",
' your_data[, c("column_a", "column_b", ', fn, "())]" " ", AMR_env$bullet_icon, " your_data[, c(\"column_a\", \"column_b\", ", fn, "())]"
) )
} else { } else {
examples <- "" examples <- ""
@@ -1028,10 +1062,15 @@ get_current_column <- function() {
if (tryCatch(!is.null(env$i), error = function(e) FALSE)) { if (tryCatch(!is.null(env$i), error = function(e) FALSE)) {
if (!is.null(env$tibble_vars)) { if (!is.null(env$tibble_vars)) {
# for mutate_if() # 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] env$tibble_vars[env$i]
} else { } else {
# for mutate(across()) # 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)) { if (is.data.frame(df)) {
colnames(df)[env$i] colnames(df)[env$i]
} else { } else {
@@ -1311,19 +1350,24 @@ progress_ticker <- function(n = 1, n_min = 0, print = TRUE, clear = TRUE, title
} }
set_clean_class(pb, new_class = "txtProgressBar") set_clean_class(pb, new_class = "txtProgressBar")
} else if (n >= n_min) { } else if (n >= n_min) {
# use `progress`, which also has a timer title <- trimws2(title)
if (title != "") {
title <- paste0(title, " ")
}
progress_bar <- import_fn("progress_bar", "progress", error_on_fail = FALSE) progress_bar <- import_fn("progress_bar", "progress", error_on_fail = FALSE)
if (!is.null(progress_bar)) { if (!is.null(progress_bar)) {
# so we use progress::progress_bar # so we use progress::progress_bar
# a close()-method was also added, see below for that # a close()-method was also added, see below for that
pb <- progress_bar$new( pb <- progress_bar$new(
show_after = 0,
format = paste0(title, format = paste0(title,
ifelse(only_bar_percent == TRUE, "[:bar] :percent", "[:bar] :percent (:current/:total,:eta)")), ifelse(only_bar_percent == TRUE, "[:bar] :percent", "[:bar] :percent (:current/:total,:eta)")),
clear = clear, clear = clear,
total = n total = n
) )
} else { } else {
# use base R # use base R's txtProgressBar
cat(title, "\n", sep = "")
pb <- utils::txtProgressBar(max = n, style = 3) pb <- utils::txtProgressBar(max = n, style = 3)
pb$tick <- function() { pb$tick <- function() {
pb$up(pb$getVal() + 1) pb$up(pb$getVal() + 1)
@@ -1378,12 +1422,8 @@ as_original_data_class <- function(df, old_class = NULL, extra_class = NULL) {
if ("tbl_df" %in% old_class && pkg_is_available("tibble")) { if ("tbl_df" %in% old_class && pkg_is_available("tibble")) {
# this will then also remove groups # this will then also remove groups
fn <- import_fn("as_tibble", "tibble") fn <- import_fn("as_tibble", "tibble")
} else if ("tbl_ts" %in% old_class && pkg_is_available("tsibble")) {
fn <- import_fn("as_tsibble", "tsibble")
} else if ("data.table" %in% old_class && pkg_is_available("data.table")) { } else if ("data.table" %in% old_class && pkg_is_available("data.table")) {
fn <- import_fn("as.data.table", "data.table") fn <- import_fn("as.data.table", "data.table")
} else if ("tabyl" %in% old_class && pkg_is_available("janitor")) {
fn <- import_fn("as_tabyl", "janitor")
} else { } else {
fn <- function(x) base::as.data.frame(df, stringsAsFactors = FALSE) fn <- function(x) base::as.data.frame(df, stringsAsFactors = FALSE)
} }
@@ -1512,14 +1552,14 @@ add_MO_lookup_to_AMR_env <- function() {
MO_lookup[which(is.na(MO_lookup$kingdom_index)), "kingdom_index"] <- 3 MO_lookup[which(is.na(MO_lookup$kingdom_index)), "kingdom_index"] <- 3
# the fullname lowercase, important for the internal algorithms in as.mo() # the fullname lowercase, important for the internal algorithms in as.mo()
MO_lookup$fullname_lower <- tolower(trimws(paste( MO_lookup$fullname_lower <- tolower(trimws2(paste(
MO_lookup$genus, MO_lookup$genus,
MO_lookup$species, MO_lookup$species,
MO_lookup$subspecies MO_lookup$subspecies
))) )))
ind <- MO_lookup$genus == "" | grepl("^[(]unknown ", MO_lookup$fullname, perl = TRUE) ind <- MO_lookup$genus == "" | grepl("^[(]unknown ", MO_lookup$fullname, perl = TRUE)
MO_lookup[ind, "fullname_lower"] <- tolower(MO_lookup[ind, "fullname", drop = TRUE]) MO_lookup[ind, "fullname_lower"] <- tolower(MO_lookup[ind, "fullname", drop = TRUE])
MO_lookup$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", MO_lookup$fullname_lower, perl = TRUE)) MO_lookup$fullname_lower <- trimws2(gsub("[^.a-z0-9/ \\-]+", "", MO_lookup$fullname_lower, perl = TRUE))
# special for Salmonella - they have cities as subspecies but not the species (enterica) in the fullname: # special for Salmonella - they have cities as subspecies but not the species (enterica) in the fullname:
MO_lookup$fullname_lower[which(MO_lookup$subspecies %like_case% "^[A-Z]")] <- gsub(" enterica ", " ", MO_lookup$fullname_lower[which(MO_lookup$subspecies %like_case% "^[A-Z]")], fixed = TRUE) MO_lookup$fullname_lower[which(MO_lookup$subspecies %like_case% "^[A-Z]")] <- gsub(" enterica ", " ", MO_lookup$fullname_lower[which(MO_lookup$subspecies %like_case% "^[A-Z]")], fixed = TRUE)
@@ -1551,7 +1591,7 @@ readRDS_AMR <- function(file, refhook = NULL) {
match <- function(x, table, ...) { match <- function(x, table, ...) {
if (!is.null(AMR_env$chmatch) && inherits(x, "character") && inherits(table, "character")) { if (!is.null(AMR_env$chmatch) && inherits(x, "character") && inherits(table, "character")) {
# data.table::chmatch() is much faster than base::match() for 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 { } else {
base::match(x, table, ...) base::match(x, table, ...)
} }
@@ -1559,7 +1599,7 @@ match <- function(x, table, ...) {
`%in%` <- function(x, table) { `%in%` <- function(x, table) {
if (!is.null(AMR_env$chin) && inherits(x, "character") && inherits(table, "character")) { if (!is.null(AMR_env$chin) && inherits(x, "character") && inherits(table, "character")) {
# data.table::`%chin%`() is much faster than base::`%in%`() for 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 { } else {
base::`%in%`(x, table) base::`%in%`(x, table)
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+14 -14
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -31,19 +31,19 @@
#' #'
#' This is an overview of all the package-specific [options()] you can set in the `AMR` package. #' This is an overview of all the package-specific [options()] you can set in the `AMR` package.
#' @section Options: #' @section Options:
#' * `AMR_custom_ab` \cr Allows to use custom antimicrobial drugs with this package. This is explained in [add_custom_antimicrobials()]. #' * `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_custom_mo` \cr Allows to use custom microorganisms with this package. This is explained in [add_custom_microorganisms()]. #' * `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_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_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_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_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_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_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_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_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 [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_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_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()]. #' * `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: #' @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: #' 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") #' utils::file.edit("~/.Rprofile")
#' ``` #' ```
#' #'
#' In this file, you can set options such as: #' In this file, you can set options such as...
#' #'
#' ```r #' ```r
#' options(AMR_locale = "pt") #' options(AMR_locale = "pt")
#' options(AMR_include_PKPD = TRUE) #' 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 #' ### 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. #' 1. Save a plain text file to e.g. "X:/team_folder/R_options.R" and fill it with preferred settings.
#' #'
+50 -40
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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()]. #' 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: #' @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} #' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
#' @aliases ab #' @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) already_regex <- isTRUE(list(...)$already_regex)
fast_mode <- isTRUE(list(...)$fast_mode) fast_mode <- isTRUE(list(...)$fast_mode)
@@ -117,8 +120,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# remove diacritics # remove diacritics
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT") x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
x <- gsub('"', "", x, fixed = TRUE) x <- gsub('"', "", x, fixed = TRUE)
x <- gsub("(specimen|specimen date|specimen_date|spec_date|gender|^dates?$)", "", x, ignore.case = TRUE, perl = TRUE) 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 mean benzylpenicillin # 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[x %like_case% "^PENICILLIN" & x %unlike_case% "[ /+-]"] <- "benzylpenicillin"
x_bak_clean <- x x_bak_clean <- x
if (already_regex == FALSE) { if (already_regex == FALSE) {
@@ -131,16 +134,21 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown_ATCs <- character(0) x_unknown_ATCs <- character(0)
note_if_more_than_one_found <- function(found, index, from_text) { note_if_more_than_one_found <- function(found, index, from_text) {
if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) { if (loop_time == 1 && isTRUE(length(from_text) > 1)) {
abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE) 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)") { 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")] abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam", "tazobactam", "vaborbactam", "monobactam")]
} }
if (length(abnames) > 1) { if (length(abnames) > 1) {
message_( if (toupper(paste(abnames, collapse = " ")) %in% AMR_env$AB_lookup$generalised_name) {
"More than one result was found for item ", index, ": ", # if the found values combined is a valid AB, return that
vector_and(abnames, quotes = FALSE) 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] found[1L]
@@ -174,13 +182,13 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[is.na(x)] <- NA x_new[is.na(x)] <- NA
already_known[is.na(x)] <- FALSE 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 progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
on.exit(close(progress)) on.exit(close(progress))
} }
for (i in which(!already_known)) { for (i in which(!already_known)) {
if (isTRUE(initial_search)) { if (loop_time == 1) {
progress$tick() 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% "[ ]") { 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) error = function(e) character(0)
) )
} else { } else {
@@ -314,13 +322,12 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
} }
# INITIAL SEARCH - More uncertain results ---- # INITIAL SEARCH - More uncertain results ----
if (loop_time <= 2 && fast_mode == FALSE) {
if (isTRUE(initial_search) && fast_mode == FALSE) { # only run on first and second try
# only run on first try
# try by removing all spaces # try by removing all spaces
if (x[i] %like% " ") { 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)) { if (length(found) > 0 && !is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -329,7 +336,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# try by removing all spaces and numbers # try by removing all spaces and numbers
if (x[i] %like% " " || x[i] %like% "[0-9]") { 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)) { if (length(found) > 0 && !is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -355,7 +362,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
)[[1]], )[[1]],
collapse = "/" 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)) { if (!is.na(x_translated_guess)) {
x_new[i] <- x_translated_guess x_new[i] <- x_translated_guess
next next
@@ -367,7 +374,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
strsplit(x_translated, "[^A-Z0-9 ]"), strsplit(x_translated, "[^A-Z0-9 ]"),
function(y) { function(y) {
for (i in seq_len(length(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[i] <- ifelse(!is.na(y_name),
y_name, y_name,
y[i] y[i]
@@ -378,7 +385,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
)[[1]], )[[1]],
collapse = "/" 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)) { if (!is.na(x_translated_guess)) {
x_new[i] <- x_translated_guess x_new[i] <- x_translated_guess
next next
@@ -386,7 +393,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# try by removing all trailing capitals # try by removing all trailing capitals
if (x[i] %like_case% "[a-z]+[A-Z]+$") { 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)) { if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -394,7 +401,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
} }
# keep only letters # 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)) { if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -405,7 +412,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
if (flag_multiple_results == TRUE) { if (flag_multiple_results == TRUE) {
found <- from_text[1L] found <- from_text[1L]
} else { } 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_ 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!) # 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)) found <- suppressWarnings(as.ab(substr(x[i], 1, 5), loop_time = loop_time + 2))
if (!is.na(found) && ab_group(found, initial_search = FALSE) %unlike% "cephalosporins") { 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) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next 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)) { if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -428,7 +435,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# make all consonants facultative # make all consonants facultative
search_str <- gsub("([BCDFGHJKLMNPQRSTVWXZ])", "\\1*", x[i], perl = TRUE) 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 # keep at least 4 normal characters
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 4) { if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 4) {
found <- NA found <- NA
@@ -440,7 +447,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# make all vowels facultative # make all vowels facultative
search_str <- gsub("([AEIOUY])", "\\1*", x[i], perl = TRUE) 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 # keep at least 5 normal characters
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 5) { if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 5) {
found <- NA 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("I+", "[AEIOU]+", x_spelling, fixed = TRUE)
x_spelling <- gsub("O+", "[AEIOU]+", x_spelling, fixed = TRUE) x_spelling <- gsub("O+", "[AEIOU]+", x_spelling, fixed = TRUE)
x_spelling <- gsub("U+", "[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)) { if (!is.na(found)) {
x_new[i] <- note_if_more_than_one_found(found, i, from_text) x_new[i] <- note_if_more_than_one_found(found, i, from_text)
next next
@@ -473,7 +480,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
# ending part: # ending part:
substr(x[i], j + 2, nchar(x[i])) 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)) { if (!is.na(found)) {
break break
} }
@@ -482,18 +489,18 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_new[i] <- found[1L] x_new[i] <- found[1L]
next next
} }
} # end of initial_search = TRUE } # end of loop_time <= 2
# not found # not found
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) 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) close(progress)
} }
# save to package env to save time for next time # 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 <- 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 <- unique(rbind_AMR(
AMR_env$ab_previously_coerced, AMR_env$ab_previously_coerced,
@@ -518,6 +525,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
x_unknown, x_unknown,
AMR_env$ab_previously_coerced$x_bak[which(AMR_env$ab_previously_coerced$x %in% x & is.na(AMR_env$ab_previously_coerced$ab))] AMR_env$ab_previously_coerced$x_bak[which(AMR_env$ab_previously_coerced$x %in% x & is.na(AMR_env$ab_previously_coerced$ab))]
) )
x_unknown <- x_unknown[!x_unknown %in% c("", NA)]
if (length(x_unknown) > 0 && fast_mode == FALSE) { if (length(x_unknown) > 0 && fast_mode == FALSE) {
warning_( warning_(
"in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ", "in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ",
@@ -645,12 +653,14 @@ generalise_antibiotic_name <- function(x) {
x <- gsub("_(MIC|RSI|SIR|DIS[CK])$", "", x, perl = TRUE) x <- gsub("_(MIC|RSI|SIR|DIS[CK])$", "", x, perl = TRUE)
# remove disk concentrations, like LVX_NM -> LVX # remove disk concentrations, like LVX_NM -> LVX
x <- gsub("_[A-Z]{2}[0-9_.]{0,3}$", "", x, perl = TRUE) 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 # keep only max 1 space
x <- trimws2(gsub(" +", " ", x, perl = TRUE)) x <- trimws2(gsub(" +", " ", x, perl = TRUE))
# non-character, space or number should be a slash # 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 # 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)
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)
+7 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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)] 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) { result <- lapply(text_split_all, function(text_split) {
progress$tick() 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( suppressWarnings(
as.ab(text_split, ...) as.ab(text_split, ...)
) )
+9 -6
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -245,7 +245,7 @@ ab_ddd <- function(x, administration = "oral", ...) {
warning_( warning_(
"in `ab_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.", "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", "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 out
@@ -265,7 +265,7 @@ ab_ddd_units <- function(x, administration = "oral", ...) {
warning_( warning_(
"in `ab_ddd_units()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.", "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", "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 out
@@ -310,7 +310,10 @@ ab_url <- function(x, open = FALSE, ...) {
ab <- as.ab(x = x, ...) ab <- as.ab(x = x, ...)
atcs <- ab_atc(ab, only_first = TRUE) 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_ u[is.na(atcs)] <- NA_character_
names(u) <- ab_name(ab) names(u) <- ab_name(ab)
+102 -175
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -57,59 +57,31 @@
#' example_isolates #' example_isolates
#' #'
#' #'
#' # Examples sections below are split into 'base R', 'dplyr', and 'data.table': #' # Examples sections below are split into 'dplyr', 'base R', and 'data.table':
#' #'
#'
#' # base R ------------------------------------------------------------------
#'
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
#' example_isolates[, carbapenems()]
#'
#' # select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
#' example_isolates[, c("mo", aminoglycosides())]
#'
#' # select only antibiotic columns with DDDs for oral treatment
#' example_isolates[, administrable_per_os()]
#'
#' # filter using any() or all()
#' example_isolates[any(carbapenems() == "R"), ]
#' subset(example_isolates, any(carbapenems() == "R"))
#'
#' # filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
#' example_isolates[any(carbapenems()), ]
#' example_isolates[all(carbapenems()), ]
#'
#' # filter with multiple antibiotic selectors using c()
#' example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]
#'
#' # filter + select in one go: get penicillins in carbapenem-resistant strains
#' example_isolates[any(carbapenems() == "R"), penicillins()]
#'
#' # You can combine selectors with '&' to be more specific. For example,
#' # penicillins() would select benzylpenicillin ('peni G') and
#' # administrable_per_os() would select erythromycin. Yet, when combined these
#' # drugs are both omitted since benzylpenicillin is not administrable per os
#' # and erythromycin is not a penicillin:
#' example_isolates[, penicillins() & administrable_per_os()]
#'
#' # ab_selector() applies a filter in the `antibiotics` data set and is thus
#' # very flexible. For instance, to select antibiotic columns with an oral DDD
#' # of at least 1 gram:
#' example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")]
#'
#' \donttest{ #' \donttest{
#' # dplyr ------------------------------------------------------------------- #' # dplyr -------------------------------------------------------------------
#'
#' if (require("dplyr")) {
#' example_isolates %>% select(carbapenems())
#' }
#' #'
#' if (require("dplyr")) { #' if (require("dplyr")) {
#' tibble(kefzol = random_sir(5)) %>% #' # select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
#' select(cephalosporins()) #' example_isolates %>% select(mo, aminoglycosides())
#' }
#'
#' if (require("dplyr")) {
#' # select only antibiotic columns with DDDs for oral treatment
#' example_isolates %>% select(administrable_per_os())
#' } #' }
#' #'
#' if (require("dplyr")) { #' if (require("dplyr")) {
#' # get AMR for all aminoglycosides e.g., per ward: #' # get AMR for all aminoglycosides e.g., per ward:
#' example_isolates %>% #' example_isolates %>%
#' group_by(ward) %>% #' group_by(ward) %>%
#' summarise(across(aminoglycosides(), resistance)) #' summarise(across(aminoglycosides(),
#' resistance))
#' } #' }
#' if (require("dplyr")) { #' if (require("dplyr")) {
#' # You can combine selectors with '&' to be more specific: #' # You can combine selectors with '&' to be more specific:
@@ -121,7 +93,8 @@
#' example_isolates %>% #' example_isolates %>%
#' filter(mo_genus() %in% c("Escherichia", "Klebsiella")) %>% #' filter(mo_genus() %in% c("Escherichia", "Klebsiella")) %>%
#' group_by(ward) %>% #' group_by(ward) %>%
#' summarise(across(not_intrinsic_resistant(), resistance)) #' summarise_at(not_intrinsic_resistant(),
#' resistance)
#' } #' }
#' if (require("dplyr")) { #' if (require("dplyr")) {
#' # get susceptibility for antibiotics whose name contains "trim": #' # get susceptibility for antibiotics whose name contains "trim":
@@ -187,6 +160,44 @@
#' } #' }
#' #'
#' #'
#' # base R ------------------------------------------------------------------
#'
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
#' example_isolates[, carbapenems()]
#'
#' # select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
#' example_isolates[, c("mo", aminoglycosides())]
#'
#' # select only antibiotic columns with DDDs for oral treatment
#' example_isolates[, administrable_per_os()]
#'
#' # filter using any() or all()
#' example_isolates[any(carbapenems() == "R"), ]
#' subset(example_isolates, any(carbapenems() == "R"))
#'
#' # filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
#' example_isolates[any(carbapenems()), ]
#' example_isolates[all(carbapenems()), ]
#'
#' # filter with multiple antibiotic selectors using c()
#' example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]
#'
#' # filter + select in one go: get penicillins in carbapenem-resistant strains
#' example_isolates[any(carbapenems() == "R"), penicillins()]
#'
#' # You can combine selectors with '&' to be more specific. For example,
#' # penicillins() would select benzylpenicillin ('peni G') and
#' # administrable_per_os() would select erythromycin. Yet, when combined these
#' # drugs are both omitted since benzylpenicillin is not administrable per os
#' # and erythromycin is not a penicillin:
#' example_isolates[, penicillins() & administrable_per_os()]
#'
#' # ab_selector() applies a filter in the `antibiotics` data set and is thus
#' # very flexible. For instance, to select antibiotic columns with an oral DDD
#' # of at least 1 gram:
#' example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")]
#'
#'
#' # data.table -------------------------------------------------------------- #' # data.table --------------------------------------------------------------
#' #'
#' # data.table is supported as well, just use it in the same way as with #' # data.table is supported as well, just use it in the same way as with
@@ -226,10 +237,6 @@ ab_class <- function(ab_class,
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE) 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_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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) ab_select_exec(NULL, only_sir_columns = only_sir_columns, ab_class_args = ab_class, only_treatable = only_treatable)
} }
@@ -242,10 +249,6 @@ ab_selector <- function(filter,
...) { ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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 # 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 # but it only takes a couple of milliseconds
@@ -277,10 +280,6 @@ ab_selector <- function(filter,
aminoglycosides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) { aminoglycosides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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) ab_select_exec("aminoglycosides", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
} }
@@ -288,10 +287,6 @@ aminoglycosides <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...
#' @export #' @export
aminopenicillins <- function(only_sir_columns = FALSE, ...) { aminopenicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("aminopenicillins", only_sir_columns = only_sir_columns)
} }
@@ -299,10 +294,6 @@ aminopenicillins <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
antifungals <- function(only_sir_columns = FALSE, ...) { antifungals <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("antifungals", only_sir_columns = only_sir_columns)
} }
@@ -310,10 +301,6 @@ antifungals <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
antimycobacterials <- function(only_sir_columns = FALSE, ...) { antimycobacterials <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("antimycobacterials", only_sir_columns = only_sir_columns)
} }
@@ -322,10 +309,6 @@ antimycobacterials <- function(only_sir_columns = FALSE, ...) {
betalactams <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) { betalactams <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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) ab_select_exec("betalactams", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
} }
@@ -334,10 +317,6 @@ betalactams <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
carbapenems <- 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_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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) ab_select_exec("carbapenems", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
} }
@@ -345,10 +324,6 @@ carbapenems <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
#' @export #' @export
cephalosporins <- function(only_sir_columns = FALSE, ...) { cephalosporins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins", only_sir_columns = only_sir_columns)
} }
@@ -356,10 +331,6 @@ cephalosporins <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
cephalosporins_1st <- function(only_sir_columns = FALSE, ...) { cephalosporins_1st <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins_1st", only_sir_columns = only_sir_columns)
} }
@@ -367,10 +338,6 @@ cephalosporins_1st <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
cephalosporins_2nd <- function(only_sir_columns = FALSE, ...) { cephalosporins_2nd <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins_2nd", only_sir_columns = only_sir_columns)
} }
@@ -378,10 +345,6 @@ cephalosporins_2nd <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
cephalosporins_3rd <- function(only_sir_columns = FALSE, ...) { cephalosporins_3rd <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins_3rd", only_sir_columns = only_sir_columns)
} }
@@ -389,10 +352,6 @@ cephalosporins_3rd <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
cephalosporins_4th <- function(only_sir_columns = FALSE, ...) { cephalosporins_4th <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins_4th", only_sir_columns = only_sir_columns)
} }
@@ -400,10 +359,6 @@ cephalosporins_4th <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
cephalosporins_5th <- function(only_sir_columns = FALSE, ...) { cephalosporins_5th <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("cephalosporins_5th", only_sir_columns = only_sir_columns)
} }
@@ -411,10 +366,6 @@ cephalosporins_5th <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
fluoroquinolones <- function(only_sir_columns = FALSE, ...) { fluoroquinolones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("fluoroquinolones", only_sir_columns = only_sir_columns)
} }
@@ -422,32 +373,21 @@ fluoroquinolones <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
glycopeptides <- function(only_sir_columns = FALSE, ...) { glycopeptides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("glycopeptides", only_sir_columns = only_sir_columns)
} }
#' @rdname antibiotic_class_selectors #' @rdname antibiotic_class_selectors
#' @export #' @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) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if ("only_rsi_columns" %in% names(list(...))) { meet_criteria(only_treatable, allow_class = "logical", has_length = 1)
deprecation_warning("only_rsi_columns", "only_sir_columns", is_function = FALSE) ab_select_exec("lincosamides", only_sir_columns = only_sir_columns, only_treatable = only_treatable)
only_sir_columns <- list(...)$only_rsi_columns
}
ab_select_exec("lincosamides", only_sir_columns = only_sir_columns)
} }
#' @rdname antibiotic_class_selectors #' @rdname antibiotic_class_selectors
#' @export #' @export
lipoglycopeptides <- function(only_sir_columns = FALSE, ...) { lipoglycopeptides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("lipoglycopeptides", only_sir_columns = only_sir_columns)
} }
@@ -455,21 +395,20 @@ lipoglycopeptides <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
macrolides <- function(only_sir_columns = FALSE, ...) { macrolides <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) 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 #' @rdname antibiotic_class_selectors
#' @export #' @export
oxazolidinones <- function(only_sir_columns = FALSE, ...) { oxazolidinones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("oxazolidinones", only_sir_columns = only_sir_columns)
} }
@@ -477,10 +416,6 @@ oxazolidinones <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
penicillins <- function(only_sir_columns = FALSE, ...) { penicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("penicillins", only_sir_columns = only_sir_columns)
} }
@@ -489,43 +424,34 @@ penicillins <- function(only_sir_columns = FALSE, ...) {
polymyxins <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) { polymyxins <- function(only_sir_columns = FALSE, only_treatable = TRUE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(only_treatable, 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) 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 #' @rdname antibiotic_class_selectors
#' @export #' @export
quinolones <- function(only_sir_columns = FALSE, ...) { quinolones <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) 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 #' @rdname antibiotic_class_selectors
#' @export #' @export
tetracyclines <- function(only_sir_columns = FALSE, ...) { tetracyclines <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("tetracyclines", only_sir_columns = only_sir_columns)
} }
@@ -533,10 +459,6 @@ tetracyclines <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
trimethoprims <- function(only_sir_columns = FALSE, ...) { trimethoprims <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("trimethoprims", only_sir_columns = only_sir_columns)
} }
@@ -544,10 +466,6 @@ trimethoprims <- function(only_sir_columns = FALSE, ...) {
#' @export #' @export
ureidopenicillins <- function(only_sir_columns = FALSE, ...) { ureidopenicillins <- function(only_sir_columns = FALSE, ...) {
meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1) 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) ab_select_exec("ureidopenicillins", only_sir_columns = only_sir_columns)
} }
@@ -649,10 +567,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) 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)])] agents <- ab_in_data[ab_in_data %in% names(vars_df_R[which(vars_df_R)])]
if (length(agents) > 0 && 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_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'")
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL) agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
need_name <- generalise_antibiotic_name(agents) != generalise_antibiotic_name(agents_names) need_name <- generalise_antibiotic_name(agents) != generalise_antibiotic_name(agents_names)
@@ -663,7 +581,7 @@ not_intrinsic_resistant <- function(only_sir_columns = FALSE, col_mo = NULL, ver
vector_and(agents_formatted, quotes = FALSE, sort = FALSE) vector_and(agents_formatted, quotes = FALSE, sort = FALSE)
) )
} }
vars_df_R <- names(vars_df_R)[which(!vars_df_R)] vars_df_R <- names(vars_df_R)[which(!vars_df_R)]
# find columns that are abx, but also intrinsic R # find columns that are abx, but also intrinsic R
out <- unname(intersect(ab_in_data, vars_df_R)) out <- unname(intersect(ab_in_data, vars_df_R))
@@ -687,9 +605,9 @@ ab_select_exec <- function(function_name,
# untreatable drugs # untreatable drugs
if (only_treatable == TRUE) { 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 (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_( warning_(
"in `", function_name, "()`: some drugs were ignored since they cannot be used for treating patients: ", "in `", function_name, "()`: some drugs were ignored since they cannot be used for treating patients: ",
vector_and( vector_and(
@@ -699,8 +617,7 @@ ab_select_exec <- function(function_name,
), ),
quotes = FALSE, quotes = FALSE,
sort = TRUE sort = TRUE
), ". They can be included using `", function_name, "(only_treatable = FALSE)`. ", ), ". They can be included using `", function_name, "(only_treatable = FALSE)`."
"This warning will be shown once per session."
) )
} }
ab_in_data <- ab_in_data[!names(ab_in_data) %in% untreatable] ab_in_data <- ab_in_data[!names(ab_in_data) %in% untreatable]
@@ -719,7 +636,7 @@ ab_select_exec <- function(function_name,
} else if (isTRUE(function_name == "antimycobacterials")) { } else if (isTRUE(function_name == "antimycobacterials")) {
abx <- AMR_env$AB_lookup$ab[which(AMR_env$AB_lookup$group == "Antimycobacterials")] abx <- AMR_env$AB_lookup$ab[which(AMR_env$AB_lookup$group == "Antimycobacterials")]
} else { } 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 # carbapenems() gets its codes from AMR:::AB_CARBAPENEMS
abx <- get(paste0("AB_", toupper(function_name)), envir = asNamespace("AMR")) abx <- get(paste0("AB_", toupper(function_name)), envir = asNamespace("AMR"))
# manually added codes from add_custom_antimicrobials() must also be supported # manually added codes from add_custom_antimicrobials() must also be supported
@@ -773,6 +690,16 @@ ab_select_exec <- function(function_name,
) )
} }
#' @method print ab_selector
#' @export
#' @noRd
print.ab_selector <- function(x, ...) {
warning_("It should never be needed to print an antibiotic selector class. Are you using data.table? Then add the argument `with = FALSE`, see our examples at `?ab_selector`.",
immediate = TRUE)
cat("Class 'ab_selector'\n")
print(as.character(x), quote = FALSE)
}
#' @method c ab_selector #' @method c ab_selector
#' @export #' @export
#' @noRd #' @noRd
@@ -784,10 +711,10 @@ c.ab_selector <- function(...) {
all_any_ab_selector <- function(type, ..., na.rm = TRUE) { all_any_ab_selector <- function(type, ..., na.rm = TRUE) {
cols_ab <- c(...) 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", "NI")]
if (length(result) == 0) { 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"') 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", "NI")
} }
cols_ab <- cols_ab[!cols_ab %in% result] cols_ab <- cols_ab[!cols_ab %in% result]
df <- get_current_data(arg_name = NA, call = -3) df <- get_current_data(arg_name = NA, call = -3)
@@ -896,7 +823,7 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
} }
} }
# this is `!=`, so turn around the values # this is `!=`, so turn around the values
sir <- c("S", "I", "R") sir <- c("S", "SDD", "I", "R", "NI")
e2 <- sir[sir != e2] e2 <- sir[sir != e2]
structure(all_any_ab_selector(type = type, e1, e2), structure(all_any_ab_selector(type = type, e1, e2),
class = c("ab_selector_any_all", "logical") class = c("ab_selector_any_all", "logical")
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+36 -9
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -294,7 +294,7 @@ antibiogram <- function(x,
} else if (mo_transform == "name") { } else if (mo_transform == "name") {
x$`.mo` <- mo_name(x$`.mo`, language = language) x$`.mo` <- mo_name(x$`.mo`, language = language)
} else { } 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`)] <- "(??)" x$`.mo`[is.na(x$`.mo`)] <- "(??)"
@@ -348,11 +348,11 @@ antibiogram <- function(x,
} else { } else {
# determine whether this new column should contain S, I, R, or NA # determine whether this new column should contain S, I, R, or NA
if (isTRUE(combine_SI)) { if (isTRUE(combine_SI)) {
S_values <- c("S", "I") S_values <- c("S", "SDD", "I")
} else { } else {
S_values <- "S" S_values <- "S"
} }
other_values <- setdiff(c("S", "I", "R"), S_values) other_values <- setdiff(c("S", "SDD", "I", "R", "NI"), S_values)
x_transposed <- as.list(as.data.frame(t(x[, abx, drop = FALSE]), stringsAsFactors = FALSE)) x_transposed <- as.list(as.data.frame(t(x[, abx, drop = FALSE]), stringsAsFactors = FALSE))
if (isTRUE(only_all_tested)) { 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)) 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))
@@ -392,14 +392,17 @@ antibiogram <- function(x,
} else { } else {
out$numerator <- out$S out$numerator <- out$S
} }
if (any(out$total < minimum, na.rm = TRUE)) { if (all(out$total < minimum, na.rm = TRUE)) {
warning_("All combinations had less than `minimum = ", minimum, "` results, returning an empty antibiogram")
return(as_original_data_class(data.frame(), class(out), extra_class = "antibiogram"))
} else if (any(out$total < minimum, na.rm = TRUE)) {
if (isTRUE(info)) { if (isTRUE(info)) {
message_("NOTE: ", sum(out$total < minimum, na.rm = TRUE), " combinations had less than `minimum = ", minimum, "` results and were ignored", add_fn = font_red) message_("NOTE: ", sum(out$total < minimum, na.rm = TRUE), " combinations had less than `minimum = ", minimum, "` results and were ignored", add_fn = font_red)
} }
out <- out %pm>% out <- out %pm>%
subset(total >= minimum) subset(total >= minimum)
} }
# regroup for summarising # regroup for summarising
if (isTRUE(has_syndromic_group)) { if (isTRUE(has_syndromic_group)) {
colnames(out)[1] <- "syndromic_group" colnames(out)[1] <- "syndromic_group"
@@ -409,9 +412,10 @@ antibiogram <- function(x,
out <- out %pm>% out <- out %pm>%
pm_group_by(mo, ab) pm_group_by(mo, ab)
} }
out <- out %pm>% out <- out %pm>%
pm_summarise(SI = numerator / total) pm_summarise(SI = numerator / total)
# transform names of antibiotics # transform names of antibiotics
ab_naming_function <- function(x, t, l, s) { ab_naming_function <- function(x, t, l, s) {
x <- strsplit(x, s, fixed = TRUE) x <- strsplit(x, s, fixed = TRUE)
@@ -515,6 +519,29 @@ antibiogram <- function(x,
) )
} }
# will be exported in R/zzz.R
tbl_sum.antibiogram <- function(x, ...) {
if (isTRUE(base::l10n_info()$`UTF-8`)) {
cross <- "\u00d7"
} else {
cross <- "x"
}
dims <- paste(format(NROW(x), big.mark = ","), cross, format(NCOL(x), big.mark = ","))
names(dims) <- "An Antibiogram"
dims
}
# will be exported in R/zzz.R
tbl_format_footer.antibiogram <- function(x, ...) {
footer <- NextMethod()
if (NROW(x) == 0) {
return(footer)
}
c(footer, font_subtle(paste0("# Use `plot()` or `ggplot2::autoplot()` to create a plot of this antibiogram,\n",
"# or use it directly in R Markdown or ",
font_url("https://quarto.org", "Quarto"), ", see ", word_wrap("?antibiogram"))))
}
#' @export #' @export
#' @rdname antibiogram #' @rdname antibiogram
plot.antibiogram <- function(x, ...) { plot.antibiogram <- function(x, ...) {
+15 -11
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -64,7 +64,7 @@
#' **N.B. This function requires an internet connection and only works if the following packages are installed: `curl`, `rvest`, `xml2`.** #' **N.B. This function requires an internet connection and only works if the following packages are installed: `curl`, `rvest`, `xml2`.**
#' @export #' @export
#' @rdname atc_online #' @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 #' @examples
#' \donttest{ #' \donttest{
#' if (requireNamespace("curl") && requireNamespace("rvest") && requireNamespace("xml2")) { #' if (requireNamespace("curl") && requireNamespace("rvest") && requireNamespace("xml2")) {
@@ -81,9 +81,9 @@
atc_online_property <- function(atc_code, atc_online_property <- function(atc_code,
property, property,
administration = "O", administration = "O",
url = "https://www.whocc.no/atc_ddd_index/?code=%s&showdescription=no", url = "https://atcddd.fhi.no/atc_ddd_index/?code=%s&showdescription=no",
url_vet = "https://www.whocc.no/atcvet/atcvet_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") 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(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(administration, allow_class = "character", has_length = 1)
meet_criteria(url, allow_class = "character", has_length = 1, looks_like = "https?://") 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))) { for (i in seq_len(length(atc_code))) {
progress$tick() progress$tick()
if (is.na(atc_code[i])) {
next
}
if (atc_code[i] %like% "^Q") { if (atc_code[i] %like% "^Q") {
# veterinary drugs, ATC_vet codes start with a "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))) colnames(out) <- gsub("^atc.*", "atc", tolower(colnames(out)))
if (length(out) == 0) { 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 returnvalue[i] <- NA
next next
} }
@@ -209,20 +213,20 @@ atc_online_property <- function(atc_code,
#' @rdname atc_online #' @rdname atc_online
#' @export #' @export
atc_online_groups <- function(atc_code, ...) { 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", ...) atc_online_property(atc_code = atc_code, property = "groups", ...)
} }
#' @rdname atc_online #' @rdname atc_online
#' @export #' @export
atc_online_ddd <- function(atc_code, ...) { 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", ...) atc_online_property(atc_code = atc_code, property = "ddd", ...)
} }
#' @rdname atc_online #' @rdname atc_online
#' @export #' @export
atc_online_ddd_units <- function(atc_code, ...) { 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", ...) atc_online_property(atc_code = atc_code, property = "unit", ...)
} }
+4 -4
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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. #' 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: #' @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} #' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
#' @aliases av #' @aliases av
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+6 -6
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -164,7 +164,7 @@ av_ddd <- function(x, administration = "oral", ...) {
warning_( warning_(
"in `av_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.", "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", "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 out
@@ -184,7 +184,7 @@ av_ddd_units <- function(x, administration = "oral", ...) {
warning_( warning_(
"in `av_ddd_units()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.", "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", "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 out
@@ -227,7 +227,7 @@ av_url <- function(x, open = FALSE, ...) {
av <- as.av(x = x, ...) av <- as.av(x = x, ...)
atcs <- av_atc(av, only_first = TRUE) 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_ u[is.na(atcs)] <- NA_character_
names(u) <- av_name(av) names(u) <- av_name(av)
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+17 -9
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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()]. #' @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 #' @export
#' @rdname bug_drug_combinations #' @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 #' @examples
#' # example_isolates is a data set available in the AMR package. #' # example_isolates is a data set available in the AMR package.
#' # run ?example_isolates for more info. #' # run ?example_isolates for more info.
@@ -105,8 +105,10 @@ bug_drug_combinations <- function(x,
mo = character(0), mo = character(0),
ab = character(0), ab = character(0),
S = integer(0), S = integer(0),
SDD = integer(0),
I = integer(0), I = integer(0),
R = integer(0), R = integer(0),
N = integer(0),
total = integer(0), total = integer(0),
stringsAsFactors = FALSE 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] 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 # turn and merge everything
pivot <- lapply(x_mo_filter, function(x) { pivot <- lapply(x_mo_filter, function(x) {
m <- as.matrix(table(x)) m <- as.matrix(table(as.sir(x)))
data.frame(S = m["S", ], I = m["I", ], R = m["R", ], stringsAsFactors = FALSE) data.frame(S = m["S", ], SDD = m["SDD", ], I = m["I", ], R = m["R", ], NI = m["NI", ], stringsAsFactors = FALSE)
}) })
merged <- do.call(rbind_AMR, pivot) merged <- do.call(rbind_AMR, pivot)
out_group <- data.frame( out_group <- data.frame(
mo = rep(unique_mo[i], NROW(merged)), mo = rep(unique_mo[i], NROW(merged)),
ab = rownames(merged), ab = rownames(merged),
S = merged$S, S = merged$S,
SDD = merged$SDD,
I = merged$I, I = merged$I,
R = merged$R, R = merged$R,
total = merged$S + merged$I + merged$R, NI = merged$NI,
total = merged$S + merged$SDD + merged$I + merged$R + merged$NI,
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
if (data_has_groups) { if (data_has_groups) {
@@ -203,12 +207,16 @@ format.bug_drug_combinations <- function(x,
mo = gsub("(.*)%%(.*)", "\\1", names(idx)), mo = gsub("(.*)%%(.*)", "\\1", names(idx)),
ab = gsub("(.*)%%(.*)", "\\2", names(idx)), ab = gsub("(.*)%%(.*)", "\\2", names(idx)),
S = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$S[i], na.rm = TRUE)), 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)), 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)), R = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$R[i], na.rm = TRUE)),
NI = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$NI[i], na.rm = TRUE)),
total = vapply(FUN.VALUE = double(1), idx, function(i) { total = vapply(FUN.VALUE = double(1), idx, function(i) {
sum(x$S[i], na.rm = TRUE) + sum(x$S[i], na.rm = TRUE) +
sum(x$SDD[i], na.rm = TRUE) +
sum(x$I[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$NI[i], na.rm = TRUE)
}), }),
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
@@ -223,7 +231,7 @@ format.bug_drug_combinations <- function(x,
if (combine_SI == TRUE) { if (combine_SI == TRUE) {
x$isolates <- x$R x$isolates <- x$R
} else { } else {
x$isolates <- x$R + x$I x$isolates <- x$R + x$I + x$SDD
} }
give_ab_name <- function(ab, format, language) { give_ab_name <- function(ab, format, language) {
+67 -61
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -135,62 +135,7 @@ count_resistant <- function(..., only_all_tested = FALSE) {
count_susceptible <- function(..., only_all_tested = FALSE) { count_susceptible <- function(..., only_all_tested = FALSE) {
tryCatch( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("S", "I"), 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_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"),
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
only_count = TRUE only_count = TRUE
), ),
@@ -202,7 +147,7 @@ count_SI <- function(..., only_all_tested = FALSE) {
#' @export #' @export
count_S <- function(..., only_all_tested = FALSE) { count_S <- function(..., only_all_tested = FALSE) {
if (message_not_thrown_before("count_S", entire_session = TRUE)) { 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( tryCatch(
sir_calc(..., 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 #' @rdname count
#' @export #' @export
count_all <- function(..., only_all_tested = FALSE) { count_all <- function(..., only_all_tested = FALSE) {
tryCatch( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("S", "I", "R"), ab_result = c("S", "SDD", "I", "R", "NI"),
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
only_count = TRUE only_count = TRUE
), ),
+4 -4
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -96,7 +96,7 @@
#' #'
#' #'
#' # Add Co-fluampicil, which is one of the many J01CR50 codes, see #' # 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( #' add_custom_antimicrobials(
#' data.frame( #' data.frame(
#' ab = "COFLU", #' ab = "COFLU",
+49 -26
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -30,7 +30,7 @@
#' Define Custom EUCAST Rules #' Define Custom EUCAST Rules
#' #'
#' Define custom EUCAST rules for your organisation or specific analysis and use the output of this function in [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 #' @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. #' 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: #' @section How it works:
@@ -89,11 +89,24 @@
#' #> 2 Klebsiella pneumoniae R R S #' #> 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 #' @returns A [list] containing the custom rules
#' @export #' @export
#' @examples #' @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`" "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]] result_group <- as.character(result)[[2]]
if (paste0("AB_", toupper(result_group), "S") %in% DEFINED_AB_GROUPS) { result_group<- as.character(str2lang(result_group))
# support for e.g. 'aminopenicillin' if user meant 'aminopenicillins' result_group <- result_group[result_group != "c"]
result_group <- paste0(result_group, "s") 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_agents <- result_group_agents[!is.na(result_group_agents)]
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_
)
}
stop_if( 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: \"", "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: ", 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), "." 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 <- as.character(result)[[3]]
result_value[result_value == "NA"] <- NA result_value[result_value == "NA"] <- NA
stop_ifnot( stop_ifnot(
result_value %in% c("S", "I", "R", NA), result_value %in% c("S", "SDD", "I", "R", "NI", NA),
"the resulting value of rule ", i, " must be either \"S\", \"I\", \"R\" or NA" "the resulting value of rule ", i, " must be either \"S\", \"SDD\", \"I\", \"R\", \"NI\" or NA"
) )
result_value <- as.sir(result_value) 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 out[[i]]$result_value <- result_value
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+59 -39
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -32,9 +32,9 @@
#' Two data sets containing all antibiotics/antimycotics and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antibiotics] data set. Three identifiers are included in this data set: an antibiotic ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes. #' Two data sets containing all antibiotics/antimycotics and antivirals. Use [as.ab()] or one of the [`ab_*`][ab_property()] functions to retrieve values from the [antibiotics] data set. Three identifiers are included in this data set: an antibiotic ID (`ab`, primarily used in this package) as defined by WHONET/EARS-Net, an ATC code (`atc`) as defined by the WHO, and a Compound ID (`cid`) as found in PubChem. Other properties in this data set are derived from one or more of these codes. Note that some drugs have multiple ATC codes.
#' @format #' @format
#' ### For the [antibiotics] data set: a [tibble][tibble::tibble] with `r nrow(antibiotics)` observations and `r ncol(antibiotics)` variables: #' ### For the [antibiotics] data set: a [tibble][tibble::tibble] with `r nrow(antibiotics)` observations and `r ncol(antibiotics)` variables:
#' - `ab`\cr Antibiotic ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. *This is a unique identifier.* #' - `ab`\cr Antibiotic ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.***
#' - `cid`\cr Compound ID as found in PubChem. *This is a unique identifier.* #' - `cid`\cr Compound ID as found in PubChem. ***This is a unique identifier.***
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO. *This is a unique identifier.* #' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO. ***This is a unique identifier.***
#' - `group`\cr A short and concise group name, based on WHONET and WHOCC definitions #' - `group`\cr A short and concise group name, based on WHONET and WHOCC definitions
#' - `atc`\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC, like `J01CR02` #' - `atc`\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC, like `J01CR02`
#' - `atc_group1`\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC, like `"Macrolides, lincosamides and streptogramins"` #' - `atc_group1`\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC, like `"Macrolides, lincosamides and streptogramins"`
@@ -48,10 +48,10 @@
#' - `loinc`\cr All codes associated with the name of the antimicrobial drug from `r TAXONOMY_VERSION$LOINC$citation` Use [ab_loinc()] to retrieve them quickly, see [ab_property()]. #' - `loinc`\cr All codes associated with the name of the antimicrobial drug from `r TAXONOMY_VERSION$LOINC$citation` Use [ab_loinc()] to retrieve them quickly, see [ab_property()].
#' #'
#' ### For the [antivirals] data set: a [tibble][tibble::tibble] with `r nrow(antivirals)` observations and `r ncol(antivirals)` variables: #' ### For the [antivirals] data set: a [tibble][tibble::tibble] with `r nrow(antivirals)` observations and `r ncol(antivirals)` variables:
#' - `av`\cr Antiviral ID as used in this package (such as `ACI`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. *This is a unique identifier.* Combinations are codes that contain a `+` to indicate this, such as `ATA+COBI` for atazanavir/cobicistat. #' - `av`\cr Antiviral ID as used in this package (such as `ACI`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available. ***This is a unique identifier.*** Combinations are codes that contain a `+` to indicate this, such as `ATA+COBI` for atazanavir/cobicistat.
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO. *This is a unique identifier.* #' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO. ***This is a unique identifier.***
#' - `atc`\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC #' - `atc`\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC
#' - `cid`\cr Compound ID as found in PubChem. *This is a unique identifier.* #' - `cid`\cr Compound ID as found in PubChem. ***This is a unique identifier.***
#' - `atc_group`\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC #' - `atc_group`\cr Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC
#' - `synonyms`\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID #' - `synonyms`\cr Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID
#' - `oral_ddd`\cr Defined Daily Dose (DDD), oral treatment #' - `oral_ddd`\cr Defined Daily Dose (DDD), oral treatment
@@ -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). #' 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 #' @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)`. #' * `r TAXONOMY_VERSION$LOINC$citation` Accessed from <`r TAXONOMY_VERSION$LOINC$url`> on `r documentation_date(TAXONOMY_VERSION$LOINC$accessed_date)`.
#' #'
@@ -82,35 +82,41 @@
#' @rdname antibiotics #' @rdname antibiotics
"antivirals" "antivirals"
#' Data Set with `r format(nrow(microorganisms), big.mark = " ")` Microorganisms #' Data Set with `r format(nrow(microorganisms), big.mark = " ")` Taxonomic Records of Microorganisms
#' #'
#' A data set containing the full microbial taxonomy (**last updated: `r documentation_date(max(TAXONOMY_VERSION$GBIF$accessed_date, TAXONOMY_VERSION$LPSN$accessed_date))`**) of `r nr2char(length(unique(microorganisms$kingdom[!microorganisms$kingdom %like% "unknown"])))` kingdoms from the List of Prokaryotic names with Standing in Nomenclature (LPSN) and the Global Biodiversity Information Facility (GBIF). This data set is the backbone of this `AMR` package. MO codes can be looked up using [as.mo()]. #' @description
#' A data set containing the full microbial taxonomy (**last updated: `r documentation_date(max(TAXONOMY_VERSION$GBIF$accessed_date, TAXONOMY_VERSION$LPSN$accessed_date, TAXONOMY_VERSION$MycoBank$accessed_date))`**) of `r nr2char(length(unique(microorganisms$kingdom[!microorganisms$kingdom %like% "unknown"])))` kingdoms. This data set is the backbone of this `AMR` package. MO codes can be looked up using [as.mo()] and microorganism properties can be looked up using any of the [`mo_*`][mo_property()] functions.
#'
#' This data set is carefully crafted, yet made 100% reproducible from public and authoritative taxonomic sources (using [this script](https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R)), namely: *`r TAXONOMY_VERSION$LPSN$name`* for bacteria, *`r TAXONOMY_VERSION$MycoBank$name`* for fungi, and *`r TAXONOMY_VERSION$GBIF$name`* for all others taxons.
#' @format A [tibble][tibble::tibble] with `r format(nrow(microorganisms), big.mark = " ")` observations and `r ncol(microorganisms)` variables: #' @format A [tibble][tibble::tibble] with `r format(nrow(microorganisms), big.mark = " ")` observations and `r ncol(microorganisms)` variables:
#' - `mo`\cr ID of microorganism as used by this package. *This is a unique identifier.* #' - `mo`\cr ID of microorganism as used by this package. ***This is a unique identifier.***
#' - `fullname`\cr Full name, like `"Escherichia coli"`. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon. *This is a unique identifier.* #' - `fullname`\cr Full name, like `"Escherichia coli"`. For the taxonomic ranks genus, species and subspecies, this is the 'pasted' text of genus, species, and subspecies. For all taxonomic ranks higher than genus, this is the name of the taxon. ***This is a unique identifier.***
#' - `status` \cr Status of the taxon, either `r vector_or(microorganisms$status)` #' - `status` \cr Status of the taxon, either `r vector_or(microorganisms$status)`
#' - `kingdom`, `phylum`, `class`, `order`, `family`, `genus`, `species`, `subspecies`\cr Taxonomic rank of the microorganism #' - `kingdom`, `phylum`, `class`, `order`, `family`, `genus`, `species`, `subspecies`\cr Taxonomic rank of the microorganism. Note that for fungi, *phylum* is equal to their taxonomic *division*. Also, for fungi, *subkingdom* and *subdivision* were left out since they do not occur in the bacterial taxonomy.
#' - `rank`\cr Text of the taxonomic rank of the microorganism, such as `"species"` or `"genus"` #' - `rank`\cr Text of the taxonomic rank of the microorganism, such as `"species"` or `"genus"`
#' - `ref`\cr Author(s) and year of related scientific publication. This contains only the *first surname* and year of the *latest* authors, e.g. "Wallis *et al.* 2006 *emend.* Smith and Jones 2018" becomes "Smith *et al.*, 2018". This field is directly retrieved from the source specified in the column `source`. Moreover, accents were removed to comply with CRAN that only allows ASCII characters. #' - `ref`\cr Author(s) and year of related scientific publication. This contains only the *first surname* and year of the *latest* authors, e.g. "Wallis *et al.* 2006 *emend.* Smith and Jones 2018" becomes "Smith *et al.*, 2018". This field is directly retrieved from the source specified in the column `source`. Moreover, accents were removed to comply with CRAN that only allows ASCII characters.
#' - `lpsn`\cr Identifier ('Record number') of the List of Prokaryotic names with Standing in Nomenclature (LPSN). This will be the first/highest LPSN identifier to keep one identifier per row. For example, *Acetobacter ascendens* has LPSN Record number 7864 and 11011. Only the first is available in the `microorganisms` data set.
#' - `oxygen_tolerance` \cr Oxygen tolerance, either `r vector_or(microorganisms$oxygen_tolerance)`. These data were retrieved from BacDive (see *Source*). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently `r round(length(microorganisms$oxygen_tolerance[which(!is.na(microorganisms$oxygen_tolerance))]) / nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]) * 100, 1)`% of all `r format_included_data_number(nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]))` bacteria in the data set contain an oxygen tolerance. #' - `oxygen_tolerance` \cr Oxygen tolerance, either `r vector_or(microorganisms$oxygen_tolerance)`. These data were retrieved from BacDive (see *Source*). Items that contain "likely" are missing from BacDive and were extrapolated from other species within the same genus to guess the oxygen tolerance. Currently `r round(length(microorganisms$oxygen_tolerance[which(!is.na(microorganisms$oxygen_tolerance))]) / nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]) * 100, 1)`% of all `r format_included_data_number(nrow(microorganisms[which(microorganisms$kingdom == "Bacteria"), ]))` bacteria in the data set contain an oxygen tolerance.
#' - `source`\cr Either `r vector_or(microorganisms$source)` (see *Source*)
#' - `lpsn`\cr Identifier ('Record number') of `r TAXONOMY_VERSION$LPSN$name`. This will be the first/highest LPSN identifier to keep one identifier per row. For example, *Acetobacter ascendens* has LPSN Record number 7864 and 11011. Only the first is available in the `microorganisms` data set. ***This is a unique identifier***, though available for only `r format_included_data_number(sum(!is.na(microorganisms$lpsn)))` records.
#' - `lpsn_parent`\cr LPSN identifier of the parent taxon #' - `lpsn_parent`\cr LPSN identifier of the parent taxon
#' - `lpsn_renamed_to`\cr LPSN identifier of the currently valid taxon #' - `lpsn_renamed_to`\cr LPSN identifier of the currently valid taxon
#' - `gbif`\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF) #' - `mycobank`\cr Identifier ('MycoBank #') of `r TAXONOMY_VERSION$MycoBank$name`. ***This is a unique identifier***, though available for only `r format_included_data_number(sum(!is.na(microorganisms$mycobank)))` records.
#' - `mycobank_parent`\cr MycoBank identifier of the parent taxon
#' - `mycobank_renamed_to`\cr MycoBank identifier of the currently valid taxon
#' - `gbif`\cr Identifier ('taxonID') of `r TAXONOMY_VERSION$GBIF$name`. ***This is a unique identifier***, though available for only `r format_included_data_number(sum(!is.na(microorganisms$gbif)))` records.
#' - `gbif_parent`\cr GBIF identifier of the parent taxon #' - `gbif_parent`\cr GBIF identifier of the parent taxon
#' - `gbif_renamed_to`\cr GBIF identifier of the currently valid 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 based on Bartlett *et al.* (2022, \doi{10.1099/mic.0.001269}), see [mo_matching_score()] for the full explanation
#' - `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
#' - `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()]. #' - `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 #' @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. #' Please note that entries are only based on LPSN, MycoBank, and 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.
#' #'
#' For example, *Staphylococcus pettenkoferi* was described for the first time in Diagnostic Microbiology and Infectious Disease in 2002 (\doi{10.1016/s0732-8893(02)00399-1}), but it was not before 2007 that a publication in IJSEM followed (\doi{10.1099/ijs.0.64381-0}). Consequently, the `AMR` package returns 2007 for `mo_year("S. pettenkoferi")`. #' For example, *Staphylococcus pettenkoferi* was described for the first time in Diagnostic Microbiology and Infectious Disease in 2002 (\doi{10.1016/s0732-8893(02)00399-1}), but it was not until 2007 that a publication in IJSEM followed (\doi{10.1099/ijs.0.64381-0}). Consequently, the `AMR` package returns 2007 for `mo_year("S. pettenkoferi")`.
#' #'
#' @section Included Taxa: #' @section Included Taxa:
#' Included taxonomic data are: #' Included taxonomic data from [LPSN](`r TAXONOMY_VERSION$LPSN$url`), [MycoBank](`r TAXONOMY_VERSION$MycoBank$url`), and [GBIF](`r TAXONOMY_VERSION$GBIF$url`) are:
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria")), , drop = FALSE])` (sub)species from the kingdoms of Archaea and Bacteria #' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria")), , drop = FALSE])` (sub)species from the kingdoms of Archaea and Bacteria
#' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi"), , drop = FALSE])` (sub)species from the kingdom of Fungi. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package. Only relevant fungi are covered (such as all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histoplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*). #' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi"), , drop = FALSE])` species from the kingdom of Fungi. The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package. Only relevant fungi are covered (such as all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histoplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*).
#' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Protozoa"), , drop = FALSE])` (sub)species from the kingdom of Protozoa #' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Protozoa"), , drop = FALSE])` (sub)species from the kingdom of Protozoa
#' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), , drop = FALSE])` (sub)species from `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), "genus", drop = TRUE])` other relevant genera from the kingdom of Animalia (such as *Strongyloides* and *Taenia*) #' - `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), , drop = FALSE])` (sub)species from `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Animalia"), "genus", drop = TRUE])` other relevant genera from the kingdom of Animalia (such as *Strongyloides* and *Taenia*)
#' - All `r format_included_data_number(microorganisms[which(microorganisms$status != "accepted"), , drop = FALSE])` previously accepted names of all included (sub)species (these were taxonomically renamed) #' - All `r format_included_data_number(microorganisms[which(microorganisms$status != "accepted"), , drop = FALSE])` previously accepted names of all included (sub)species (these were taxonomically renamed)
@@ -127,22 +133,28 @@
#' - 1 entry of *Moraxella* (*M. catarrhalis*), which was formally named *Branhamella catarrhalis* (Catlin, 1970) though this change was never accepted within the field of clinical microbiology #' - 1 entry of *Moraxella* (*M. catarrhalis*), which was formally named *Branhamella catarrhalis* (Catlin, 1970) though this change was never accepted within the field of clinical microbiology
#' - 8 other 'undefined' entries (unknown, unknown Gram-negatives, unknown Gram-positives, unknown yeast, unknown fungus, and unknown anaerobic Gram-pos/Gram-neg bacteria) #' - 8 other 'undefined' entries (unknown, unknown Gram-negatives, unknown Gram-positives, unknown yeast, unknown fungus, and unknown anaerobic Gram-pos/Gram-neg bacteria)
#' #'
#' The syntax used to transform the original data to a cleansed \R format, can be found here: <https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R>. #' The syntax used to transform the original data to a cleansed \R format, can be [found here](https://github.com/msberends/AMR/blob/main/data-raw/reproduction_of_microorganisms.R).
#' #'
#' ### Direct download #' ### Direct 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). #' 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).
#' @section About the Records from LPSN (see *Source*):
#' LPSN is the main source for bacteriological taxonomy of this `AMR` package.
#'
#' The List of Prokaryotic names with Standing in Nomenclature (LPSN) provides comprehensive information on the nomenclature of prokaryotes. LPSN is a free to use service founded by Jean P. Euzeby in 1997 and later on maintained by Aidan C. Parte.
#' @source #' @source
#' * `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`. #' Taxonomic entries were imported in this order of importance:
#' #' 1. `r TAXONOMY_VERSION$LPSN$name`:\cr\cr
#' * `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`. #' `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`.
#'
#' * `r TAXONOMY_VERSION$BacDive$citation` Accessed from <`r TAXONOMY_VERSION$BacDive$url`> on `r documentation_date(TAXONOMY_VERSION$BacDive$accessed_date)`.
#' #'
#' * `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`> #' 2. `r TAXONOMY_VERSION$MycoBank$name`:\cr\cr
#' `r TAXONOMY_VERSION$MycoBank$citation` Accessed from <`r TAXONOMY_VERSION$MycoBank$url`> on `r documentation_date(TAXONOMY_VERSION$MycoBank$accessed_date)`.
#'
#' 3. `r TAXONOMY_VERSION$GBIF$name`:\cr\cr
#' `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
#'
#' Furthermore, these sources were used for additional details:
#'
#' * `r TAXONOMY_VERSION$BacDive$name`:\cr\cr
#' `r TAXONOMY_VERSION$BacDive$citation` Accessed from <`r TAXONOMY_VERSION$BacDive$url`> on `r documentation_date(TAXONOMY_VERSION$BacDive$accessed_date)`.
#'
#' * `r TAXONOMY_VERSION$SNOMED$name`:\cr\cr
#' `r TAXONOMY_VERSION$SNOMED$citation` Accessed from <`r TAXONOMY_VERSION$SNOMED$url`> on `r documentation_date(TAXONOMY_VERSION$SNOMED$accessed_date)`.
#' #'
#' * Grimont *et al.* (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on *Salmonella* (WHOCC-SALM). #' * Grimont *et al.* (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on *Salmonella* (WHOCC-SALM).
#' #'
@@ -156,7 +168,7 @@
#' #'
#' A data set containing commonly used codes for microorganisms, from laboratory systems and [WHONET](https://whonet.org). Define your own with [set_mo_source()]. They will all be searched when using [as.mo()] and consequently all the [`mo_*`][mo_property()] functions. #' A data set containing commonly used codes for microorganisms, from laboratory systems and [WHONET](https://whonet.org). Define your own with [set_mo_source()]. They will all be searched when using [as.mo()] and consequently all the [`mo_*`][mo_property()] functions.
#' @format A [tibble][tibble::tibble] with `r format(nrow(microorganisms.codes), big.mark = " ")` observations and `r ncol(microorganisms.codes)` variables: #' @format A [tibble][tibble::tibble] with `r format(nrow(microorganisms.codes), big.mark = " ")` observations and `r ncol(microorganisms.codes)` variables:
#' - `code`\cr Commonly used code of a microorganism. *This is a unique identifier.* #' - `code`\cr Commonly used code of a microorganism. ***This is a unique identifier.***
#' - `mo`\cr ID of the microorganism in the [microorganisms] data set #' - `mo`\cr ID of the microorganism in the [microorganisms] data set
#' @details #' @details
#' 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). #' 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).
@@ -262,10 +274,17 @@
#' Data Set with Clinical Breakpoints for SIR Interpretation #' 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: #' @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 #' - `guideline`\cr Name of the guideline
#' - `type`\cr Breakpoint type, either `r vector_or(clinical_breakpoints$type)` #' - `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)` #' - `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" #' - `site`\cr Body site for which the breakpoint must be applied, e.g. "Oral" or "Respiratory"
#' - `mo`\cr Microbial ID, see [as.mo()] #' - `mo`\cr Microbial ID, see [as.mo()]
@@ -276,6 +295,7 @@
#' - `breakpoint_S`\cr Lowest MIC value or highest number of millimetres that leads to "S" #' - `breakpoint_S`\cr Lowest MIC value or highest number of millimetres that leads to "S"
#' - `breakpoint_R`\cr Highest MIC value or lowest number of millimetres that leads to "R" #' - `breakpoint_R`\cr Highest MIC value or lowest number of millimetres that leads to "R"
#' - `uti`\cr A [logical] value (`TRUE`/`FALSE`) to indicate whether the rule applies to a urinary tract infection (UTI) #' - `uti`\cr A [logical] value (`TRUE`/`FALSE`) to indicate whether the rule applies to a urinary tract infection (UTI)
#' - `is_SDD`\cr A [logical] value (`TRUE`/`FALSE`) to indicate whether the intermediate range between "S" and "R" should be interpreted as "SDD", instead of "I". This currently applies to `r sum(clinical_breakpoints$is_SDD)` breakpoints.
#' @details #' @details
#' ### Different types of breakpoints #' ### Different types of breakpoints
#' Supported types of breakpoints are `r vector_and(clinical_breakpoints$type, quote = FALSE)`. ECOFF (Epidemiological cut-off) values are used in antimicrobial susceptibility testing to differentiate between wild-type and non-wild-type strains of bacteria or fungi. #' Supported types of breakpoints are `r vector_and(clinical_breakpoints$type, quote = FALSE)`. ECOFF (Epidemiological cut-off) values are used in antimicrobial susceptibility testing to differentiate between wild-type and non-wild-type strains of bacteria or fungi.
@@ -283,15 +303,15 @@
#' The default is `"human"`, which can also be set with the [package option][AMR-options] [`AMR_breakpoint_type`][AMR-options]. Use [`as.sir(..., breakpoint_type = ...)`][as.sir()] to interpret raw data using a specific breakpoint type, e.g. `as.sir(..., breakpoint_type = "ECOFF")` to use ECOFFs. #' The default is `"human"`, which can also be set with the [package option][AMR-options] [`AMR_breakpoint_type`][AMR-options]. Use [`as.sir(..., breakpoint_type = ...)`][as.sir()] to interpret raw data using a specific breakpoint type, e.g. `as.sir(..., breakpoint_type = "ECOFF")` to use ECOFFs.
#' #'
#' ### Imported from WHONET #' ### Imported from WHONET
#' Clinical breakpoints in this package were validated through and imported from [WHONET](https://whonet.org), a free desktop Windows application developed and supported by the WHO Collaborating Centre for Surveillance of Antimicrobial Resistance. More can be read on [their website](https://whonet.org). The developers of WHONET and this `AMR` package have been in contact about sharing their work. We highly appreciate their development on the WHONET software. #' Clinical breakpoints in this package were validated through and imported from [WHONET](https://whonet.org), a free desktop Windows application developed and supported by the WHO Collaborating Centre for Surveillance of Antimicrobial Resistance. More can be read on [their website](https://whonet.org). The developers of WHONET and this `AMR` package have been in contact about sharing their work. We highly appreciate their great development on the WHONET software.
#' #'
#' ### Response from CLSI and EUCAST #' ### Response from CLSI and EUCAST
#' The CEO of CLSI and the chairman of EUCAST have endorsed the work and public use of this `AMR` package (and consequently the use of their breakpoints) in June 2023, when future development of distributing clinical breakpoints was discussed in a meeting between CLSI, EUCAST, the WHO, and developers of WHONET and the `AMR` package. #' The CEO of CLSI and the chairman of EUCAST have endorsed the work and public use of this `AMR` package (and consequently the use of their breakpoints) in June 2023, when future development of distributing clinical breakpoints was discussed in a meeting between CLSI, EUCAST, WHO, developers of WHONET software, and developers of this `AMR` package.
#' #'
#' ### Download #' ### 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. #' 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] #' @seealso [intrinsic_resistant]
#' @examples #' @examples
#' clinical_breakpoints #' clinical_breakpoints
+3 -8
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -165,11 +165,6 @@ pillar_shaft.disk <- function(x, ...) {
create_pillar_column(out, align = "right", width = 2) 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 #' @method print disk
#' @export #' @export
#' @noRd #' @noRd
+7 -7
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -103,7 +103,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
#' @section Antibiotics: #' @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. #' 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()` #' `r create_eucast_ab_documentation()`
#' @aliases EUCAST #' @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(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(only_sir_columns, allow_class = "logical", has_length = 1)
meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE) 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() add_MO_lookup_to_AMR_env()
@@ -463,7 +462,7 @@ eucast_rules <- function(x,
font_red(paste0( font_red(paste0(
"v", utils::packageDescription("AMR")$Version, ", ", "v", utils::packageDescription("AMR")$Version, ", ",
format(as.Date(utils::packageDescription("AMR")$Date), format = "%Y") format(as.Date(utils::packageDescription("AMR")$Date), format = "%Y")
)), "), see ?eucast_rules\n" )), "), see `?eucast_rules`\n"
)) ))
)) ))
} }
@@ -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))) # 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 eucast_rules_df <- list(...)$eucast_rules_df
} else { } 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 eucast_rules_df <- EUCAST_RULES_DF
} }
@@ -890,6 +889,7 @@ eucast_rules <- function(x,
), ),
type = "ansi" type = "ansi"
)) ))
cat("\n")
warned <- FALSE warned <- FALSE
} }
run_changes <- edit_sir( 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, et al. (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/>
#' @keywords internal
export_ncbi_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
}
}
+4 -8
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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(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(info, allow_class = "logical", has_length = 1)
meet_criteria(include_unknown, 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) meet_criteria(include_untested_sir, allow_class = "logical", has_length = 1)
# remove data.table, grouping from tibbles, etc. # remove data.table, grouping from tibbles, etc.
@@ -240,7 +236,7 @@ first_isolate <- function(x = NULL,
FUN.VALUE = logical(1), FUN.VALUE = logical(1),
X = x, X = x,
# check only first 10,000 rows # 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", "NI"), na.rm = TRUE),
USE.NAMES = FALSE USE.NAMES = FALSE
)) ))
if (method == "phenotype-based" && !any_col_contains_sir) { if (method == "phenotype-based" && !any_col_contains_sir) {
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+9 -7
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -85,16 +85,18 @@
#' summary(pca_result) #' summary(pca_result)
#' #'
#' # old base R plotting method: #' # old base R plotting method:
#' biplot(pca_result) #' biplot(pca_result, main = "Base R biplot")
#' #'
#' # new ggplot2 plotting method using this package: #' # new ggplot2 plotting method using this package:
#' if (require("ggplot2")) { #' if (require("ggplot2")) {
#' ggplot_pca(pca_result) #' ggplot_pca(pca_result) +
#' #' labs(title = "ggplot2 biplot")
#' }
#' if (require("ggplot2")) {
#' # still extendible with any ggplot2 function #' # still extendible with any ggplot2 function
#' ggplot_pca(pca_result) + #' ggplot_pca(pca_result) +
#' scale_colour_viridis_d() + #' scale_colour_viridis_d() +
#' labs(title = "Title here") #' labs(title = "ggplot2 biplot")
#' } #' }
#' } #' }
#' } #' }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+16 -14
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -274,16 +274,18 @@ get_column_abx <- function(x,
} }
if (names(out[i]) %in% names(duplicates)) { if (names(out[i]) %in% names(duplicates)) {
already_set_as <- out[unname(out) == unname(out[i])][1L] already_set_as <- out[unname(out) == unname(out[i])][1L]
warning_( if (names(out)[i] != names(already_set_as)) {
paste0( warning_(
"Column '", font_bold(out[i]), "' will not be used for ", paste0(
names(out)[i], " (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")", "Column '", font_bold(out[i]), "' will not be used for ",
", as it is already set for ", names(out)[i], " (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")",
names(already_set_as), " (", ab_name(names(already_set_as), tolower = TRUE, language = NULL), ")" ", as it is already set for ",
), names(already_set_as), " (", ab_name(names(already_set_as), tolower = TRUE, language = NULL), ")"
add_fn = font_red, ),
immediate = verbose add_fn = font_red,
) immediate = verbose
)
}
} }
} }
} }
@@ -335,7 +337,7 @@ get_ab_from_namespace <- function(x, cols_ab) {
x_new <- character() x_new <- character()
for (val in x) { for (val in x) {
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) { 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")) val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
} else if (val %in% AMR_env$AB_lookup$ab) { } else if (val %in% AMR_env$AB_lookup$ab) {
# separate drugs, such as `AMX` # separate drugs, such as `AMX`
+11 -8
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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. #' 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 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 #' @details
#' This function finds the taxonomic names and makes them italic based on the [microorganisms] data set. #' 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". #' This function also supports abbreviation of the genus if it is followed by a species, such as "E. coli" and "K. pneumoniae ozaenae".
#' @export #' @export
@@ -44,18 +44,21 @@
#' italicise_taxonomy("An overview of S. aureus isolates") #' italicise_taxonomy("An overview of S. aureus isolates")
#' #'
#' cat(italicise_taxonomy("An overview of S. aureus isolates", type = "ansi")) #' 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)) { if (missing(type)) {
type <- "markdown" type <- "markdown"
} }
meet_criteria(string, allow_class = "character") 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() add_MO_lookup_to_AMR_env()
if (type == "markdown") { if (type == "markdown") {
before <- "*" before <- "*"
after <- "*" after <- "*"
} else if (type == "html") {
before <- "<i>"
after <- "</i>"
} else if (type == "ansi") { } else if (type == "ansi") {
if (!has_colour() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) { if (!has_colour() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) {
return(string) return(string)
@@ -134,7 +137,7 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
#' @rdname italicise_taxonomy #' @rdname italicise_taxonomy
#' @export #' @export
italicize_taxonomy <- function(string, type = c("markdown", "ansi")) { italicize_taxonomy <- function(string, type = c("markdown", "ansi", "html")) {
if (missing(type)) { if (missing(type)) {
type <- "markdown" type <- "markdown"
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+7 -9
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -149,10 +149,6 @@ key_antimicrobials <- function(x = NULL,
meet_criteria(gram_positive, allow_class = "character", allow_NULL = TRUE) meet_criteria(gram_positive, allow_class = "character", allow_NULL = TRUE)
meet_criteria(antifungal, 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) 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 # force regular data.frame, not a tibble or data.table
x <- as.data.frame(x, stringsAsFactors = FALSE) x <- as.data.frame(x, stringsAsFactors = FALSE)
@@ -192,7 +188,7 @@ key_antimicrobials <- function(x = NULL,
"No columns available ", "No columns available ",
paste0("Only using ", values_new_length, " out of ", values_old_length, " defined columns ") paste0("Only using ", values_new_length, " out of ", values_old_length, " defined columns ")
), ),
"as key antimicrobials for ", name, "s. See ?key_antimicrobials." "as key antimicrobials for ", name, "s. See `?key_antimicrobials`."
) )
} }
@@ -286,6 +282,8 @@ generate_antimcrobials_string <- function(df) {
as.list(df), as.list(df),
function(x) { function(x) {
x <- toupper(as.character(x)) x <- toupper(as.character(x))
x[x == "SDD"] <- "I"
# ignore "NI" here, no use for determining first isolates
x[!x %in% c("S", "I", "R")] <- "." x[!x %in% c("S", "I", "R")] <- "."
paste(x) paste(x)
} }
@@ -316,7 +314,7 @@ antimicrobials_equal <- function(y,
val <- strsplit(val, "", fixed = TRUE)[[1L]] val <- strsplit(val, "", fixed = TRUE)[[1L]]
val.int <- rep(NA_real_, length(val)) val.int <- rep(NA_real_, length(val))
val.int[val == "S"] <- 1 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[val == "R"] <- 3
val.int val.int
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+4 -8
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -192,10 +192,6 @@ mdro <- function(x = NULL,
meet_criteria(pct_required_classes, allow_class = "numeric", has_length = 1) meet_criteria(pct_required_classes, allow_class = "numeric", has_length = 1)
meet_criteria(combine_SI, allow_class = "logical", has_length = 1) meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
meet_criteria(verbose, 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) meet_criteria(only_sir_columns, allow_class = "logical", has_length = 1)
if (!any(is_sir_eligible(x))) { if (!any(is_sir_eligible(x))) {
@@ -736,7 +732,7 @@ mdro <- function(x = NULL,
sum(vapply( sum(vapply(
FUN.VALUE = logical(1), FUN.VALUE = logical(1),
group_tbl, 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"))
)) ))
} }
) )
+5 -5
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -175,8 +175,8 @@ mean_amr_distance.data.frame <- function(x, ..., combine_SI = TRUE) {
#' @param row an index, such as a row number #' @param row an index, such as a row number
#' @export #' @export
amr_distance_from_row <- function(amr_distance, row) { amr_distance_from_row <- function(amr_distance, row) {
meet_criteria(amr_distance, allow_class = c("double", "numeric"), is_finite = TRUE) meet_criteria(amr_distance, allow_class = "numeric", is_finite = TRUE)
meet_criteria(row, allow_class = c("logical", "double", "numeric")) meet_criteria(row, allow_class = c("logical", "numeric", "integer"))
if (is.logical(row)) { if (is.logical(row)) {
row <- which(row) row <- which(row)
} }
+268 -158
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -27,48 +27,25 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ # # how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== # # ==================================================================== #
# these are allowed MIC values and will become [factor] levels # these are allowed MIC values and will become factor levels
operators <- c("<", "<=", "", ">=", ">") VALID_MIC_LEVELS <- c(
valid_mic_levels <- c( as.double(paste0("0.000", c(1:9))),
c(t(vapply( as.double(paste0("0.00", c(1:99, 1953125, 390625, 78125))),
FUN.VALUE = character(6), operators, as.double(paste0("0.0", c(1:99, 125, 128, 156, 165, 256, 512, 625, 3125, 15625))),
function(x) paste0(x, "0.000", c(1:4, 6, 8)) as.double(paste0("0.", c(1:99, 125, 128, 256, 512))),
))), 1:9, 1.5,
c(t(vapply( c(10:98)[9:98 %% 2 == TRUE],
FUN.VALUE = character(90), operators, 2^c(7:12), 192 * c(1:5), 80 * c(2:12)
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))))
)))
) )
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) #' Transform Input to Minimum Inhibitory Concentrations (MIC)
#' #'
@@ -76,6 +53,7 @@ valid_mic_levels <- c(
#' @rdname as.mic #' @rdname as.mic
#' @param x a [character] or [numeric] vector #' @param x a [character] or [numeric] vector
#' @param na.rm a [logical] indicating whether missing values should be removed #' @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 #' @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)))`). #' @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 #' #> 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). #' 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. #' 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 #' @aliases mic
#' @export #' @export
#' @seealso [as.sir()] #' @seealso [as.sir()]
@@ -136,6 +118,9 @@ valid_mic_levels <- c(
#' fivenum(mic_data) #' fivenum(mic_data)
#' quantile(mic_data) #' quantile(mic_data)
#' all(mic_data < 512) #' all(mic_data < 512)
#'
#' # rescale MICs using rescale_mic()
#' rescale_mic(mic_data, mic_range = c(4, 16))
#' #'
#' # interpret MIC values #' # interpret MIC values
#' as.sir( #' as.sir(
@@ -161,112 +146,182 @@ valid_mic_levels <- c(
#' if (require("ggplot2")) { #' if (require("ggplot2")) {
#' autoplot(mic_data, mo = "E. coli", ab = "cipro", language = "nl") # Dutch #' 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(x, allow_NA = TRUE)
meet_criteria(na.rm, allow_class = "logical", has_length = 1) meet_criteria(na.rm, allow_class = "logical", has_length = 1)
meet_criteria(keep_operators, allow_class = c("character", "logical"), is_in = c("all", "none", "edges", FALSE, TRUE), has_length = 1)
if (is.mic(x)) { if (isTRUE(keep_operators)) {
x 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 { } else {
if (is.numeric(x)) { x <- as.character(unlist(x))
x <- format(x, scientific = FALSE) }
} else { if (isTRUE(na.rm)) {
x <- as.character(unlist(x)) x <- x[!is.na(x)]
} }
if (isTRUE(na.rm)) { x <- trimws2(x)
x <- x[!is.na(x)] x[x == ""] <- NA
} if (is.null(x.bak)) {
x[trimws2(x) == ""] <- NA
x.bak <- x x.bak <- x
}
# comma to period
x <- gsub(",", ".", x, fixed = TRUE) # comma to period
# transform scientific notation x <- gsub(",", ".", x, fixed = TRUE)
x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"] <- as.double(x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"]) # transform scientific notation
# transform Unicode for >= and <= x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"] <- as.double(x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"])
x <- gsub("\u2264", "<=", x, fixed = TRUE) # transform Unicode for >= and <=
x <- gsub("\u2265", ">=", x, fixed = TRUE) x <- gsub("\u2264", "<=", x, fixed = TRUE)
# remove other invalid characters x <- gsub("\u2265", ">=", x, fixed = TRUE)
x <- gsub("[^a-zA-Z0-9.><= ]+", "", x, perl = TRUE) # remove other invalid characters
# remove space between operator and number ("<= 0.002" -> "<=0.002") x <- gsub("[^a-zA-Z0-9.><= ]+", "", x, perl = TRUE)
x <- gsub("(<|=|>) +", "\\1", x, perl = TRUE) # remove space between operator and number ("<= 0.002" -> "<=0.002")
# transform => to >= and =< to <= x <- gsub("(<|=|>) +", "\\1", x, perl = TRUE)
x <- gsub("=<", "<=", x, fixed = 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("=>", ">=", x, fixed = TRUE)
x <- gsub("([^0-9]|^)[.]", "\\10.", x, perl = TRUE) # dots without a leading zero must start with 0
# values like "<=0.2560.512" should be 0.512 x <- gsub("([^0-9]|^)[.]", "\\10.", x, perl = TRUE)
x <- gsub(".*[.].*[.]", "0.", x, perl = TRUE) # values like "<=0.2560.512" should be 0.512
# remove ending .0 x <- gsub(".*[.].*[.]", "0.", x, perl = TRUE)
x <- gsub("[.]+0$", "", x, perl = TRUE) # remove ending .0
# remove all after last digit x <- gsub("[.]+0$", "", x, perl = TRUE)
x <- gsub("[^0-9]+$", "", x, perl = TRUE) # remove all after last digit
# keep only one zero before dot x <- gsub("[^0-9]+$", "", x, perl = TRUE)
x <- gsub("0+[.]", "0.", x, perl = TRUE) # keep only one zero before dot
# starting 00 is probably 0.0 if there's no dot yet x <- gsub("0+[.]", "0.", x, perl = TRUE)
x[x %unlike% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"]) # starting 00 is probably 0.0 if there's no dot yet
# remove last zeroes x[x %unlike% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"])
x <- gsub("([.].?)0+$", "\\1", x, perl = TRUE) # remove last zeroes
x <- gsub("(.*[.])0+$", "\\10", x, perl = TRUE) x <- gsub("([.].?)0+$", "\\1", x, perl = TRUE)
# remove ending .0 again x <- gsub("(.*[.])0+$", "\\10", x, perl = TRUE)
x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"]) # remove ending .0 again
# never end with dot x[x %like% "[.]"] <- gsub("0+$", "", x[x %like% "[.]"])
x <- gsub("[.]$", "", x, perl = TRUE) # never end with dot
# trim it x <- gsub("[.]$", "", x, perl = TRUE)
x <- trimws2(x) # trim it
x <- trimws2(x)
## previously unempty values now empty - should return a warning later on
x[x.bak != "" & x == ""] <- "invalid" ## 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_before <- x[is.na(x) | x == ""] %pm>% length()
na_after <- 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>% if (na_before != na_after) {
unique() %pm>% list_missing <- x.bak[is.na(x) & !is.na(x.bak) & x.bak != ""] %pm>%
sort() %pm>% unique() %pm>%
vector_and(quotes = TRUE) sort() %pm>%
cur_col <- get_current_column() vector_and(quotes = TRUE)
warning_("in `as.mic()`: ", na_after - na_before, " result", cur_col <- get_current_column()
ifelse(na_after - na_before > 1, "s", ""), warning_("in `as.mic()`: ", na_after - na_before, " result",
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")), ifelse(na_after - na_before > 1, "s", ""),
" truncated (", ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
round(((na_after - na_before) / length(x)) * 100), " truncated (",
"%) that were invalid MICs: ", round(((na_after - na_before) / length(x)) * 100),
list_missing, "%) that were invalid MICs: ",
call = FALSE list_missing,
) call = FALSE
}
set_clean_class(factor(x, levels = valid_mic_levels, ordered = TRUE),
new_class = c("mic", "ordered", "factor")
) )
} }
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) { #' @rdname as.mic
if (!inherits(x, c("mic", "character", "factor", "numeric", "integer"))) { #' @export
return(FALSE) is.mic <- function(x) {
} inherits(x, "mic")
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 #' @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]. #' @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 #' @format NULL
#' @export #' @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") new_class = c("mic", "ordered", "factor")
) )
#' @rdname as.mic #' @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 #' @export
is.mic <- function(x) { rescale_mic <- function(x, mic_range, keep_operators = "edges", as.mic = TRUE) {
inherits(x, "mic") 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 #' @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` #' @param as.mic a [logical] to indicate whether the `mic` class should be kept - the default is `FALSE`
#' @export #' @export
droplevels.mic <- function(x, as.mic = FALSE, ...) { droplevels.mic <- function(x, as.mic = FALSE, ...) {
x <- as.mic(x) # make sure that currently implemented MIC levels are used
x <- droplevels.factor(x, ...) x <- droplevels.factor(x, ...)
if (as.mic == TRUE) { if (as.mic == TRUE) {
class(x) <- c("mic", "ordered", "factor") class(x) <- c("mic", "ordered", "factor")
@@ -295,32 +351,50 @@ droplevels.mic <- function(x, as.mic = FALSE, ...) {
x 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 # will be exported using s3_register() in R/zzz.R
pillar_shaft.mic <- function(x, ...) { 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) crude_numbers <- as.double(x)
operators <- gsub("[^<=>]+", "", as.character(x)) operators <- gsub("[^<=>]+", "", as.character(x))
operators[!is.na(operators) & operators != ""] <- font_silver(operators[!is.na(operators) & operators != ""], collapse = NULL) operators[!is.na(operators) & operators != ""] <- font_silver(operators[!is.na(operators) & operators != ""], collapse = NULL)
out <- trimws(paste0(operators, trimws(format(crude_numbers)))) out <- trimws(paste0(operators, trimws(format(crude_numbers))))
out[is.na(x)] <- font_na(NA) out[is.na(x)] <- font_na(NA)
# maketrailing zeroes almost invisible # make trailing zeroes less visible
out[out %like% "[.]"] <- gsub("([.]?0+)$", font_white("\\1"), out[out %like% "[.]"], perl = TRUE) 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)))) create_pillar_column(out, align = "right", width = max(nchar(font_stripstyle(out))))
} }
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
type_sum.mic <- function(x, ...) { 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 #' @method print mic
#' @export #' @export
#' @noRd #' @noRd
print.mic <- function(x, ...) { print.mic <- function(x, ...) {
cat("Class 'mic'", cat("Class 'mic'")
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""), if(!identical(levels(x), VALID_MIC_LEVELS)) {
"\n", cat(font_red(" with an outdated or altered structure - convert with `as.mic()` to update"))
sep = "" }
) cat("\n")
print(as.character(x), quote = FALSE) print(as.character(x), quote = FALSE)
att <- attributes(x) att <- attributes(x)
if ("na.action" %in% names(att)) { if ("na.action" %in% names(att)) {
@@ -341,22 +415,44 @@ summary.mic <- function(object, ...) {
as.matrix.mic <- function(x, ...) { as.matrix.mic <- function(x, ...) {
as.matrix(as.double(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 #' @method [ mic
#' @export #' @export
#' @noRd #' @noRd
"[.mic" <- function(x, ...) { "[.mic" <- function(x, ...) {
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(x) as.mic(y)
y
} }
#' @method [[ mic #' @method [[ mic
#' @export #' @export
#' @noRd #' @noRd
"[[.mic" <- function(x, ...) { "[[.mic" <- function(x, ...) {
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(x) as.mic(y)
y
} }
#' @method [<- mic #' @method [<- mic
#' @export #' @export
@@ -364,8 +460,7 @@ as.matrix.mic <- function(x, ...) {
"[<-.mic" <- function(i, j, ..., value) { "[<-.mic" <- function(i, j, ..., value) {
value <- as.mic(value) value <- as.mic(value)
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(i) as.mic(y)
y
} }
#' @method [[<- mic #' @method [[<- mic
#' @export #' @export
@@ -373,8 +468,7 @@ as.matrix.mic <- function(x, ...) {
"[[<-.mic" <- function(i, j, ..., value) { "[[<-.mic" <- function(i, j, ..., value) {
value <- as.mic(value) value <- as.mic(value)
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(i) as.mic(y)
y
} }
#' @method c mic #' @method c mic
#' @export #' @export
@@ -388,8 +482,7 @@ c.mic <- function(...) {
#' @noRd #' @noRd
unique.mic <- function(x, incomparables = FALSE, ...) { unique.mic <- function(x, incomparables = FALSE, ...) {
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(x) as.mic(y)
y
} }
#' @method rep mic #' @method rep mic
@@ -397,20 +490,25 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
#' @noRd #' @noRd
rep.mic <- function(x, ...) { rep.mic <- function(x, ...) {
y <- NextMethod() y <- NextMethod()
attributes(y) <- attributes(x) as.mic(y)
y
} }
#' @method sort mic #' @method sort mic
#' @export #' @export
#' @noRd #' @noRd
sort.mic <- function(x, decreasing = FALSE, ...) { 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) { if (decreasing == TRUE) {
ord <- order(-as.double(x)) x[order(-dbl)]
} else { } else {
ord <- order(as.double(x)) x[order(dbl)]
} }
x[ord]
} }
#' @method hist mic #' @method hist mic
@@ -424,6 +522,7 @@ hist.mic <- function(x, ...) {
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
get_skimmers.mic <- function(column) { get_skimmers.mic <- function(column) {
column <- as.mic(column) # make sure that currently implemented MIC levels are used
skimr::sfl( skimr::sfl(
skim_type = "mic", skim_type = "mic",
p0 = ~ stats::quantile(., probs = 0, na.rm = TRUE, names = FALSE), p0 = ~ stats::quantile(., probs = 0, na.rm = TRUE, names = FALSE),
@@ -475,12 +574,23 @@ Math.mic <- function(x, ...) {
#' @export #' @export
Ops.mic <- function(e1, e2) { Ops.mic <- function(e1, e2) {
e1_chr <- as.character(e1)
e2_chr <- character(0)
e1 <- as.double(e1) e1 <- as.double(e1)
if (!missing(e2)) { if (!missing(e2)) {
# when e1 is `!`, e2 is missing # when .Generic is `!`, e2 is missing
e2_chr <- as.character(e2)
e2 <- as.double(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) .Class <- class(e1)
NextMethod(.Generic) NextMethod(.Generic)
} }
+139 -88
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -42,13 +42,15 @@
#' @param reference_df a [data.frame] to be used for extra reference when translating `x` to a valid [`mo`]. See [set_mo_source()] and [get_mo_source()] to automate the usage of your own codes (e.g. used in your analysis or organisation). #' @param reference_df a [data.frame] to be used for extra reference when translating `x` to a valid [`mo`]. See [set_mo_source()] and [get_mo_source()] to automate the usage of your own codes (e.g. used in your analysis or organisation).
#' @param ignore_pattern a Perl-compatible [regular expression][base::regex] (case-insensitive) of which all matches in `x` must return `NA`. This can be convenient to exclude known non-relevant input and can also be set with the [package option][AMR-options] [`AMR_ignore_pattern`][AMR-options], e.g. `options(AMR_ignore_pattern = "(not reported|contaminated flora)")`. #' @param ignore_pattern a Perl-compatible [regular expression][base::regex] (case-insensitive) of which all matches in `x` must return `NA`. This can be convenient to exclude known non-relevant input and can also be set with the [package option][AMR-options] [`AMR_ignore_pattern`][AMR-options], e.g. `options(AMR_ignore_pattern = "(not reported|contaminated flora)")`.
#' @param cleaning_regex a Perl-compatible [regular expression][base::regex] (case-insensitive) to clean the input of `x`. Every matched part in `x` will be removed. At default, this is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar". The default can be set with the [package option][AMR-options] [`AMR_cleaning_regex`][AMR-options]. #' @param cleaning_regex a Perl-compatible [regular expression][base::regex] (case-insensitive) to clean the input of `x`. Every matched part in `x` will be removed. At default, this is the outcome of [mo_cleaning_regex()], which removes texts between brackets and texts such as "species" and "serovar". The default can be set with the [package option][AMR-options] [`AMR_cleaning_regex`][AMR-options].
#' @param only_fungi a [logical] to indicate if only fungi must be found, making sure that e.g. misspellings always return records from the kingdom of Fungi. This can be set globally for [all microorganism functions][mo_property()] with the [package option][AMR-options] [`AMR_only_fungi`][AMR-options], i.e. `options(AMR_only_fungi = TRUE)`.
#' @param language language to translate text like "no growth", which defaults to the system language (see [get_AMR_locale()]) #' @param language language to translate text like "no growth", which defaults to the system language (see [get_AMR_locale()])
#' @param info a [logical] to indicate if a progress bar should be printed if more than 25 items are to be coerced - the default is `TRUE` only in interactive mode #' @param info a [logical] to indicate that info must be printed, e.g. a progress bar when more than 25 items are to be coerced, or a list with old taxonomic names. The default is `TRUE` only in interactive mode.
#' @param ... other arguments passed on to functions #' @param ... other arguments passed on to functions
#' @rdname as.mo #' @rdname as.mo
#' @aliases mo #' @aliases mo
#' @details #' @details
#' A microorganism (MO) code from this package (class: [`mo`]) is human readable and typically looks like these examples: #' A microorganism (MO) code from this package (class: [`mo`]) is human-readable and typically looks like these examples:
#'
#' ``` #' ```
#' Code Full name #' Code Full name
#' --------------- -------------------------------------- #' --------------- --------------------------------------
@@ -60,49 +62,74 @@
#' | | | \---> subspecies, a 3-5 letter acronym #' | | | \---> subspecies, a 3-5 letter acronym
#' | | \----> species, a 3-6 letter acronym #' | | \----> species, a 3-6 letter acronym
#' | \----> genus, a 4-8 letter acronym #' | \----> genus, a 4-8 letter acronym
#' \----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), #' \----> kingdom: A (Archaea), AN (Animalia), B (Bacteria),
#' F (Fungi), PL (Plantae), P (Protozoa) #' C (Chromista), F (Fungi), PL (Plantae),
#' P (Protozoa)
#' ``` #' ```
#' #'
#' Values that cannot be coerced will be considered 'unknown' and will be returned as the MO code `UNKNOWN` with a warning. #' Values that cannot be coerced will be considered 'unknown' and will return the MO code `UNKNOWN` with a warning.
#' #'
#' Use the [`mo_*`][mo_property()] functions to get properties based on the returned code, see *Examples*. #' Use the [`mo_*`][mo_property()] functions to get properties based on the returned code, see *Examples*.
#' #'
#' The [as.mo()] function uses a novel [matching score algorithm][mo_matching_score()] (see *Matching Score for Microorganisms* below) to match input against the [available microbial taxonomy][microorganisms] in this package. This will lead to the effect that e.g. `"E. coli"` (a microorganism highly prevalent in humans) will return the microbial ID of *Escherichia coli* and not *Entamoeba coli* (a microorganism less prevalent in humans), although the latter would alphabetically come first. #' The [as.mo()] function uses a novel and scientifically validated (\doi{10.18637/jss.v104.i03}) matching score algorithm (see *Matching Score for Microorganisms* below) to match input against the [available microbial taxonomy][microorganisms] in this package. This implicates that e.g. `"E. coli"` (a microorganism highly prevalent in humans) will return the microbial ID of *Escherichia coli* and not *Entamoeba coli* (a microorganism less prevalent in humans), although the latter would alphabetically come first.
#'
#' With `Becker = TRUE`, the following `r length(MO_CONS[MO_CONS != "B_STPHY_CONS"])` staphylococci will be converted to the **coagulase-negative group**: `r vector_and(gsub("Staphylococcus", "S.", mo_name(MO_CONS[MO_CONS != "B_STPHY_CONS"], keep_synonyms = TRUE)), quotes = "*")`.\cr The following `r length(MO_COPS[MO_COPS != "B_STPHY_COPS"])` staphylococci will be converted to the **coagulase-positive group**: `r vector_and(gsub("Staphylococcus", "S.", mo_name(MO_COPS[MO_COPS != "B_STPHY_COPS"], keep_synonyms = TRUE)), quotes = "*")`.
#'
#' With `Lancefield = TRUE`, the following streptococci will be converted to their corresponding Lancefield group: `r vector_and(gsub("Streptococcus", "S.", paste0("*", mo_name(MO_LANCEFIELD, keep_synonyms = TRUE), "* (", mo_species(MO_LANCEFIELD, keep_synonyms = TRUE, Lancefield = TRUE), ")")), quotes = FALSE)`.
#' #'
#' ### Coping with Uncertain Results #' ### Coping with Uncertain Results
#' #'
#' Results of non-exact taxonomic input are based on their [matching score][mo_matching_score()]. The lowest allowed score can be set with the `minimum_matching_score` argument. At default this will be determined based on the character length of the input, and the [taxonomic kingdom][microorganisms] and [human pathogenicity][mo_matching_score()] of the taxonomic outcome. If values are matched with uncertainty, a message will be shown to suggest the user to evaluate the results with [mo_uncertainties()], which returns a [data.frame] with all specifications. #' Results of non-exact taxonomic input are based on their [matching score][mo_matching_score()]. The lowest allowed score can be set with the `minimum_matching_score` argument. At default this will be determined based on the character length of the input, the [taxonomic kingdom][microorganisms], and the [human pathogenicity][mo_matching_score()] of the taxonomic outcome. If values are matched with uncertainty, a message will be shown to suggest the user to inspect the results with [mo_uncertainties()], which returns a [data.frame] with all specifications.
#' #'
#' To increase the quality of matching, the `cleaning_regex` argument can be used to clean the input (i.e., `x`). This must be a [regular expression][base::regex] that matches parts of the input that should be removed before the input is matched against the [available microbial taxonomy][microorganisms]. It will be matched Perl-compatible and case-insensitive. The default value of `cleaning_regex` is the outcome of the helper function [mo_cleaning_regex()]. #' To increase the quality of matching, the `cleaning_regex` argument is used to clean the input. This must be a [regular expression][base::regex] that matches parts of the input that should be removed before the input is matched against the [available microbial taxonomy][microorganisms]. It will be matched Perl-compatible and case-insensitive. The default value of `cleaning_regex` is the outcome of the helper function [mo_cleaning_regex()].
#' #'
#' There are three helper functions that can be run after using the [as.mo()] function: #' There are three helper functions that can be run after using the [as.mo()] function:
#' - Use [mo_uncertainties()] to get a [data.frame] that prints in a pretty format with all taxonomic names that were guessed. The output contains the matching score for all matches (see *Matching Score for Microorganisms* below). #' - Use [mo_uncertainties()] to get a [data.frame] that prints in a pretty format with all taxonomic names that were guessed. The output contains the matching score for all matches (see *Matching Score for Microorganisms* below).
#' - Use [mo_failures()] to get a [character] [vector] with all values that could not be coerced to a valid value. #' - Use [mo_failures()] to get a [character] [vector] with all values that could not be coerced to a valid value.
#' - Use [mo_renamed()] to get a [data.frame] with all values that could be coerced based on old, previously accepted taxonomic names. #' - Use [mo_renamed()] to get a [data.frame] with all values that could be coerced based on old, previously accepted taxonomic names.
#' #'
#' ### Microbial Prevalence of Pathogens in Humans #' ### For Mycologists
#'
#' The [matching score algorithm][mo_matching_score()] gives precedence to bacteria over fungi. If you are only analysing fungi, be sure to use `only_fungi = TRUE`, or better yet, add this to your code and run it once every session:
#'
#' ```r
#' options(AMR_only_fungi = TRUE)
#' ```
#'
#' This will make sure that no bacteria or other 'non-fungi' will be returned by [as.mo()], or any of the [`mo_*`][mo_property()] functions.
#' #'
#' The coercion rules consider the prevalence of microorganisms in humans, which is available as the `prevalence` column in the [microorganisms] data set. The grouping into human pathogenic prevalence is explained in the section *Matching Score for Microorganisms* below. #' ### Coagulase-negative and Coagulase-positive Staphylococci
#'
#' With `Becker = TRUE`, the following staphylococci will be converted to their corresponding coagulase group:
#'
#' * Coagulase-negative: `r vector_and(gsub("Staphylococcus", "S.", mo_name(MO_CONS[MO_CONS != "B_STPHY_CONS"], keep_synonyms = TRUE)), quotes = "*")`
#' * Coagulase-positive: `r vector_and(gsub("Staphylococcus", "S.", mo_name(MO_COPS[MO_COPS != "B_STPHY_COPS"], keep_synonyms = TRUE)), quotes = "*")`
#'
#' This is based on:
#'
#' * Becker K *et al.* (2014). **Coagulase-Negative Staphylococci.** *Clin Microbiol Rev.* 27(4): 870-926; \doi{10.1128/CMR.00109-13}
#' * Becker K *et al.* (2019). **Implications of identifying the recently defined members of the *S. aureus* complex, *S. argenteus* and *S. schweitzeri*: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).** *Clin Microbiol Infect*; \doi{10.1016/j.cmi.2019.02.028}
#' * Becker K *et al.* (2020). **Emergence of coagulase-negative staphylococci.** *Expert Rev Anti Infect Ther.* 18(4):349-366; \doi{10.1080/14787210.2020.1730813}
#'
#' For newly named staphylococcal species, such as *S. brunensis* (2024) and *S. shinii* (2023), we looked up the scientific reference to make sure the species are considered for the correct coagulase group.
#'
#' ### Lancefield Groups in Streptococci
#'
#' With `Lancefield = TRUE`, the following streptococci will be converted to their corresponding Lancefield group:
#'
#' * `r paste(apply(aggregate(mo_name ~ mo_group_name, data = microorganisms.groups[microorganisms.groups$mo_group_name %like_case% "Streptococcus Group [A-Z]$", ], FUN = function(x) vector_and(gsub("Streptococcus", "S.", x, fixed = TRUE), quotes = "*", sort = TRUE)), 1, function(row) paste(row["mo_group_name"], ": ", row["mo_name"], sep = "")), collapse = "\n* ")`
#'
#' This is based on:
#'
#' * Lancefield RC (1933). **A serological differentiation of human and other groups of hemolytic streptococci.** *J Exp Med.* 57(4): 571-95; \doi{10.1084/jem.57.4.571}
#'
#' @inheritSection mo_matching_score Matching Score for Microorganisms #' @inheritSection mo_matching_score Matching Score for Microorganisms
#' #'
# (source as a section here, so it can be inherited by other man pages) # (source as a section here, so it can be inherited by other man pages)
#' @section Source: #' @section Source:
#' 1. Berends MS *et al.* (2022). **AMR: An R Package for Working with Antimicrobial Resistance Data**. *Journal of Statistical Software*, 104(3), 1-31; \doi{10.18637/jss.v104.i03} #' * Berends MS *et al.* (2022). **AMR: An R Package for Working with Antimicrobial Resistance Data**. *Journal of Statistical Software*, 104(3), 1-31; \doi{10.18637/jss.v104.i03}
#' 2. Becker K *et al.* (2014). **Coagulase-Negative Staphylococci.** *Clin Microbiol Rev.* 27(4): 870-926; \doi{10.1128/CMR.00109-13} #' * `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`.
#' 3. Becker K *et al.* (2019). **Implications of identifying the recently defined members of the *S. aureus* complex, *S. argenteus* and *S. schweitzeri*: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).** *Clin Microbiol Infect*; \doi{10.1016/j.cmi.2019.02.028} #' * `r TAXONOMY_VERSION$MycoBank$citation` Accessed from <`r TAXONOMY_VERSION$MycoBank$url`> on `r documentation_date(TAXONOMY_VERSION$MycoBank$accessed_date)`.
#' 4. Becker K *et al.* (2020). **Emergence of coagulase-negative staphylococci.** *Expert Rev Anti Infect Ther.* 18(4):349-366; \doi{10.1080/14787210.2020.1730813} #' * `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
#' 5. Lancefield RC (1933). **A serological differentiation of human and other groups of hemolytic streptococci.** *J Exp Med.* 57(4): 571-95; \doi{10.1084/jem.57.4.571} #' * `r TAXONOMY_VERSION$BacDive$citation` Accessed from <`r TAXONOMY_VERSION$BacDive$url`> on `r documentation_date(TAXONOMY_VERSION$BacDive$accessed_date)`.
#' 6. Berends MS *et al.* (2022). **Trends in Occurrence and Phenotypic Resistance of Coagulase-Negative Staphylococci (CoNS) Found in Human Blood in the Northern Netherlands between 2013 and 2019/** *Micro.rganisms* 10(9), 1801; \doi{10.3390/microorganisms10091801} #' * `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`>
#' 7. `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`. #' * Bartlett A *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
#' 8. `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
#' 9. `r TAXONOMY_VERSION$BacDive$citation` Accessed from <`r TAXONOMY_VERSION$BacDive$url`> on `r documentation_date(TAXONOMY_VERSION$BacDive$accessed_date)`.
#' 10. `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`>
#' 11. Bartlett A *et al.* (2022). **A comprehensive list of bacterial pathogens infecting humans** *Microbiology* 168:001269; \doi{10.1099/mic.0.001269}
#' @export #' @export
#' @return A [character] [vector] with additional class [`mo`] #' @return A [character] [vector] with additional class [`mo`]
#' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's. #' @seealso [microorganisms] for the [data.frame] that is being used to determine ID's.
@@ -160,6 +187,7 @@ as.mo <- function(x,
reference_df = get_mo_source(), reference_df = get_mo_source(),
ignore_pattern = getOption("AMR_ignore_pattern", NULL), ignore_pattern = getOption("AMR_ignore_pattern", NULL),
cleaning_regex = getOption("AMR_cleaning_regex", mo_cleaning_regex()), cleaning_regex = getOption("AMR_cleaning_regex", mo_cleaning_regex()),
only_fungi = getOption("AMR_only_fungi", FALSE),
language = get_AMR_locale(), language = get_AMR_locale(),
info = interactive(), info = interactive(),
...) { ...) {
@@ -171,6 +199,7 @@ as.mo <- function(x,
meet_criteria(reference_df, allow_class = "data.frame", allow_NULL = TRUE) meet_criteria(reference_df, allow_class = "data.frame", allow_NULL = TRUE)
meet_criteria(ignore_pattern, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(ignore_pattern, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(cleaning_regex, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(cleaning_regex, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(only_fungi, allow_class = "logical", has_length = 1)
language <- validate_language(language) language <- validate_language(language)
meet_criteria(info, allow_class = "logical", has_length = 1) meet_criteria(info, allow_class = "logical", has_length = 1)
@@ -224,7 +253,7 @@ as.mo <- function(x,
out[is.na(out)] <- convert_colloquial_input(x[is.na(out)]) out[is.na(out)] <- convert_colloquial_input(x[is.na(out)])
# From previous hits in this session ---- # From previous hits in this session ----
old <- out old <- out
out[is.na(out) & paste(x, minimum_matching_score) %in% AMR_env$mo_previously_coerced$x] <- AMR_env$mo_previously_coerced$mo[match(paste(x, minimum_matching_score)[is.na(out) & paste(x, minimum_matching_score) %in% AMR_env$mo_previously_coerced$x], AMR_env$mo_previously_coerced$x)] out[is.na(out) & paste(x, minimum_matching_score, only_fungi) %in% AMR_env$mo_previously_coerced$x] <- AMR_env$mo_previously_coerced$mo[match(paste(x, minimum_matching_score, only_fungi)[is.na(out) & paste(x, minimum_matching_score, only_fungi) %in% AMR_env$mo_previously_coerced$x], AMR_env$mo_previously_coerced$x)]
new <- out new <- out
if (isTRUE(info) && message_not_thrown_before("as.mo", old, new, entire_session = TRUE) && any(is.na(old) & !is.na(new), na.rm = TRUE)) { if (isTRUE(info) && message_not_thrown_before("as.mo", old, new, entire_session = TRUE) && any(is.na(old) & !is.na(new), na.rm = TRUE)) {
message_( message_(
@@ -250,11 +279,16 @@ as.mo <- function(x,
x_unique <- unique(x[is.na(out) & !is.na(x)]) x_unique <- unique(x[is.na(out) & !is.na(x)])
# set up progress bar # 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)) on.exit(close(progress))
msg <- character(0) msg <- character(0)
MO_lookup_current <- AMR_env$MO_lookup
if (isTRUE(only_fungi)) {
MO_lookup_current <- MO_lookup_current[MO_lookup_current$kingdom == "Fungi", , drop = FALSE]
}
# run it # run it
x_coerced <- vapply(FUN.VALUE = character(1), x_unique, function(x_search) { x_coerced <- vapply(FUN.VALUE = character(1), x_unique, function(x_search) {
progress$tick() progress$tick()
@@ -270,8 +304,8 @@ as.mo <- function(x,
x_search_cleaned[x_search_cleaned == toupper(x_search_cleaned)] <- x_out[x_search_cleaned == toupper(x_search_cleaned)] x_search_cleaned[x_search_cleaned == toupper(x_search_cleaned)] <- x_out[x_search_cleaned == toupper(x_search_cleaned)]
# first check if cleaning led to an exact result, case-insensitive # first check if cleaning led to an exact result, case-insensitive
if (x_out %in% AMR_env$MO_lookup$fullname_lower) { if (x_out %in% MO_lookup_current$fullname_lower) {
return(as.character(AMR_env$MO_lookup$mo[match(x_out, AMR_env$MO_lookup$fullname_lower)])) return(as.character(MO_lookup_current$mo[match(x_out, MO_lookup_current$fullname_lower)]))
} }
# input must not be too short # input must not be too short
@@ -285,44 +319,46 @@ as.mo <- function(x,
# do a pre-match on first character (and if it contains a space, first chars of first two terms) # do a pre-match on first character (and if it contains a space, first chars of first two terms)
if (length(x_parts) %in% c(2, 3)) { if (length(x_parts) %in% c(2, 3)) {
# for genus + species + subspecies # for genus + species + subspecies
if (nchar(gsub("[^a-z]", "", x_parts[1], perl = TRUE)) <= 3) { if (paste(x_parts[1:2], collapse = " ") %in% MO_lookup_current$fullname_lower) {
filtr <- which(AMR_env$MO_lookup$full_first == substr(x_parts[1], 1, 1) & filtr <- which(MO_lookup_current$fullname_lower %like% paste(x_parts[1:2], collapse = " "))
(AMR_env$MO_lookup$species_first == substr(x_parts[2], 1, 1) | } else if (nchar(gsub("[^a-z]", "", x_parts[1], perl = TRUE)) <= 3) {
AMR_env$MO_lookup$subspecies_first == substr(x_parts[2], 1, 1) | filtr <- which(MO_lookup_current$full_first == substr(x_parts[1], 1, 1) &
AMR_env$MO_lookup$subspecies_first == substr(x_parts[3], 1, 1))) (MO_lookup_current$species_first == substr(x_parts[2], 1, 1) |
MO_lookup_current$subspecies_first == substr(x_parts[2], 1, 1) |
MO_lookup_current$subspecies_first == substr(x_parts[3], 1, 1)))
} else { } else {
filtr <- which(AMR_env$MO_lookup$full_first == substr(x_parts[1], 1, 1) | filtr <- which(MO_lookup_current$full_first == substr(x_parts[1], 1, 1) |
AMR_env$MO_lookup$species_first == substr(x_parts[2], 1, 1) | MO_lookup_current$species_first == substr(x_parts[2], 1, 1) |
AMR_env$MO_lookup$subspecies_first == substr(x_parts[2], 1, 1) | MO_lookup_current$subspecies_first == substr(x_parts[2], 1, 1) |
AMR_env$MO_lookup$subspecies_first == substr(x_parts[3], 1, 1)) MO_lookup_current$subspecies_first == substr(x_parts[3], 1, 1))
} }
} else if (length(x_parts) > 3) { } else if (length(x_parts) > 3) {
first_chars <- paste0("(^| )[", paste(substr(x_parts, 1, 1), collapse = ""), "]") first_chars <- paste0("(^| )[", paste(substr(x_parts, 1, 1), collapse = ""), "]")
filtr <- which(AMR_env$MO_lookup$full_first %like_case% first_chars) filtr <- which(MO_lookup_current$full_first %like_case% first_chars)
} else if (nchar(x_out) == 3) { } else if (nchar(x_out) == 3) {
# no space and 3 characters - probably a code such as SAU or ECO # no space and 3 characters - probably a code such as SAU or ECO
msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", totitle(substr(x_out, 1, 1)), AMR_env$dots, " ", substr(x_out, 2, 3), AMR_env$dots, "\"")) msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", totitle(substr(x_out, 1, 1)), AMR_env$dots, " ", substr(x_out, 2, 3), AMR_env$dots, "\""))
filtr <- which(AMR_env$MO_lookup$fullname_lower %like_case% paste0("(^| )", substr(x_out, 1, 1), ".* ", substr(x_out, 2, 3))) filtr <- which(MO_lookup_current$fullname_lower %like_case% paste0("(^| )", substr(x_out, 1, 1), ".* ", substr(x_out, 2, 3)))
} else if (nchar(x_out) == 4) { } else if (nchar(x_out) == 4) {
# no space and 4 characters - probably a code such as STAU or ESCO # no space and 4 characters - probably a code such as STAU or ESCO
msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", totitle(substr(x_out, 1, 2)), AMR_env$dots, " ", substr(x_out, 3, 4), AMR_env$dots, "\"")) msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", totitle(substr(x_out, 1, 2)), AMR_env$dots, " ", substr(x_out, 3, 4), AMR_env$dots, "\""))
filtr <- which(AMR_env$MO_lookup$fullname_lower %like_case% paste0("(^| )", substr(x_out, 1, 2), ".* ", substr(x_out, 3, 4))) filtr <- which(MO_lookup_current$fullname_lower %like_case% paste0("(^| )", substr(x_out, 1, 2), ".* ", substr(x_out, 3, 4)))
} else if (nchar(x_out) <= 6) { } else if (nchar(x_out) <= 6) {
# no space and 5-6 characters - probably a code such as STAAUR or ESCCOL # no space and 5-6 characters - probably a code such as STAAUR or ESCCOL
first_part <- paste0(substr(x_out, 1, 2), "[a-z]*", substr(x_out, 3, 3)) first_part <- paste0(substr(x_out, 1, 2), "[a-z]*", substr(x_out, 3, 3))
second_part <- substr(x_out, 4, nchar(x_out)) second_part <- substr(x_out, 4, nchar(x_out))
msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", gsub("[a-z]*", AMR_env$dots, totitle(first_part), fixed = TRUE), " ", second_part, AMR_env$dots, "\"")) msg <<- c(msg, paste0("Input \"", x_search, "\" was assumed to be a microorganism code - tried to match on \"", gsub("[a-z]*", AMR_env$dots, totitle(first_part), fixed = TRUE), " ", second_part, AMR_env$dots, "\""))
filtr <- which(AMR_env$MO_lookup$fullname_lower %like_case% paste0("(^| )", first_part, ".* ", second_part)) filtr <- which(MO_lookup_current$fullname_lower %like_case% paste0("(^| )", first_part, ".* ", second_part))
} else { } else {
# for genus or species or subspecies # for genus or species or subspecies
filtr <- which(AMR_env$MO_lookup$full_first == substr(x_parts, 1, 1) | filtr <- which(MO_lookup_current$full_first == substr(x_parts, 1, 1) |
AMR_env$MO_lookup$species_first == substr(x_parts, 1, 1) | MO_lookup_current$species_first == substr(x_parts, 1, 1) |
AMR_env$MO_lookup$subspecies_first == substr(x_parts, 1, 1)) MO_lookup_current$subspecies_first == substr(x_parts, 1, 1))
} }
if (length(filtr) == 0) { if (length(filtr) == 0) {
mo_to_search <- AMR_env$MO_lookup$fullname mo_to_search <- MO_lookup_current$fullname
} else { } else {
mo_to_search <- AMR_env$MO_lookup$fullname[filtr] mo_to_search <- MO_lookup_current$fullname[filtr]
} }
AMR_env$mo_to_search <- mo_to_search AMR_env$mo_to_search <- mo_to_search
@@ -331,9 +367,9 @@ as.mo <- function(x,
if (is.null(minimum_matching_score)) { if (is.null(minimum_matching_score)) {
minimum_matching_score_current <- min(0.6, min(10, nchar(x_search_cleaned)) * 0.08) minimum_matching_score_current <- min(0.6, min(10, nchar(x_search_cleaned)) * 0.08)
# correct back for prevalence # correct back for prevalence
minimum_matching_score_current <- minimum_matching_score_current / AMR_env$MO_lookup$prevalence[match(mo_to_search, AMR_env$MO_lookup$fullname)] minimum_matching_score_current <- minimum_matching_score_current / MO_lookup_current$prevalence[match(mo_to_search, MO_lookup_current$fullname)]
# correct back for kingdom # correct back for kingdom
minimum_matching_score_current <- minimum_matching_score_current / AMR_env$MO_lookup$kingdom_index[match(mo_to_search, AMR_env$MO_lookup$fullname)] minimum_matching_score_current <- minimum_matching_score_current / MO_lookup_current$kingdom_index[match(mo_to_search, MO_lookup_current$fullname)]
minimum_matching_score_current <- pmax(minimum_matching_score_current, m) minimum_matching_score_current <- pmax(minimum_matching_score_current, m)
if (length(x_parts) > 1 && all(m <= 0.55, na.rm = TRUE)) { if (length(x_parts) > 1 && all(m <= 0.55, na.rm = TRUE)) {
# if the highest score is 0.5, we have nothing serious - 0.5 is the lowest for pathogenic group 1 # if the highest score is 0.5, we have nothing serious - 0.5 is the lowest for pathogenic group 1
@@ -352,7 +388,7 @@ as.mo <- function(x,
warning_("No hits found for \"", x_search, "\" with minimum_matching_score = ", ifelse(is.null(minimum_matching_score), paste0("NULL (=", round(min(minimum_matching_score_current, na.rm = TRUE), 3), ")"), minimum_matching_score), ". Try setting this value lower or even to 0.", call = FALSE) warning_("No hits found for \"", x_search, "\" with minimum_matching_score = ", ifelse(is.null(minimum_matching_score), paste0("NULL (=", round(min(minimum_matching_score_current, na.rm = TRUE), 3), ")"), minimum_matching_score), ". Try setting this value lower or even to 0.", call = FALSE)
result_mo <- NA_character_ result_mo <- NA_character_
} else { } else {
result_mo <- AMR_env$MO_lookup$mo[match(top_hits[1], AMR_env$MO_lookup$fullname)] result_mo <- MO_lookup_current$mo[match(top_hits[1], MO_lookup_current$fullname)]
AMR_env$mo_uncertainties <- rbind_AMR( AMR_env$mo_uncertainties <- rbind_AMR(
AMR_env$mo_uncertainties, AMR_env$mo_uncertainties,
data.frame( data.frame(
@@ -370,7 +406,7 @@ as.mo <- function(x,
AMR_env$mo_previously_coerced <- unique(rbind_AMR( AMR_env$mo_previously_coerced <- unique(rbind_AMR(
AMR_env$mo_previously_coerced, AMR_env$mo_previously_coerced,
data.frame( data.frame(
x = paste(x_search, minimum_matching_score), x = paste(x_search, minimum_matching_score, only_fungi),
mo = result_mo, mo = result_mo,
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
@@ -416,20 +452,10 @@ as.mo <- function(x,
} # end of loop over all yet unknowns } # end of loop over all yet unknowns
# Keep or replace synonyms ---- # Keep or replace synonyms ----
lpsn_matches <- AMR_env$MO_lookup$lpsn_renamed_to[match(out, AMR_env$MO_lookup$mo)] out_current <- synonym_mo_to_accepted_mo(out, fill_in_accepted = FALSE)
lpsn_matches[!lpsn_matches %in% AMR_env$MO_lookup$lpsn] <- NA AMR_env$mo_renamed <- list(old = out[!is.na(out_current)])
# GBIF only for non-bacteria, since we use LPSN as primary source for bacteria
# (an example is Strep anginosus, renamed according to GBIF, not according to LPSN)
gbif_matches <- AMR_env$MO_lookup$gbif_renamed_to[AMR_env$MO_lookup$kingdom != "Bacteria"][match(out, AMR_env$MO_lookup$mo[AMR_env$MO_lookup$kingdom != "Bacteria"])]
gbif_matches[!gbif_matches %in% AMR_env$MO_lookup$gbif] <- NA
AMR_env$mo_renamed <- list(
old = out[!is.na(gbif_matches) | !is.na(lpsn_matches)],
gbif_matches = gbif_matches[!is.na(gbif_matches) | !is.na(lpsn_matches)],
lpsn_matches = lpsn_matches[!is.na(gbif_matches) | !is.na(lpsn_matches)]
)
if (isFALSE(keep_synonyms)) { if (isFALSE(keep_synonyms)) {
out[which(!is.na(gbif_matches))] <- AMR_env$MO_lookup$mo[match(gbif_matches[which(!is.na(gbif_matches))], AMR_env$MO_lookup$gbif)] out[!is.na(out_current)] <- out_current[!is.na(out_current)]
out[which(!is.na(lpsn_matches))] <- AMR_env$MO_lookup$mo[match(lpsn_matches[which(!is.na(lpsn_matches))], AMR_env$MO_lookup$lpsn)]
if (isTRUE(info) && length(AMR_env$mo_renamed$old) > 0) { if (isTRUE(info) && length(AMR_env$mo_renamed$old) > 0) {
print(mo_renamed(), extra_txt = " (use `keep_synonyms = TRUE` to leave uncorrected)") print(mo_renamed(), extra_txt = " (use `keep_synonyms = TRUE` to leave uncorrected)")
} }
@@ -439,7 +465,7 @@ as.mo <- function(x,
} }
# Apply Becker ---- # Apply Becker ----
if (isTRUE(Becker) || Becker == "all") { if (!isTRUE(only_fungi) && (isTRUE(Becker) || Becker == "all")) {
# warn when species found that are not in: # warn when species found that are not in:
# - Becker et al. 2014, PMID 25278577 # - Becker et al. 2014, PMID 25278577
# - Becker et al. 2019, PMID 30872103 # - Becker et al. 2019, PMID 30872103
@@ -460,7 +486,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_CONS] <- "B_STPHY_CONS"
out[out %in% MO_COPS] <- "B_STPHY_COPS" out[out %in% MO_COPS] <- "B_STPHY_COPS"
if (Becker == "all") { if (Becker == "all") {
@@ -469,7 +495,7 @@ as.mo <- function(x,
} }
# Apply Lancefield ---- # Apply Lancefield ----
if (isTRUE(Lancefield) || Lancefield == "all") { if (!isTRUE(only_fungi) && (isTRUE(Lancefield) || Lancefield == "all")) {
# (using `%like_case%` to also match subspecies) # (using `%like_case%` to also match subspecies)
# group A - S. pyogenes # group A - S. pyogenes
@@ -567,7 +593,8 @@ mo_reset_session <- function() {
mo_cleaning_regex <- function() { mo_cleaning_regex <- function() {
parts_to_remove <- c("e?spp([^a-z]+|$)", "e?ssp([^a-z]+|$)", "e?ss([^a-z]+|$)", "e?sp([^a-z]+|$)", "e?subsp", "sube?species", "e?species", parts_to_remove <- c("e?spp([^a-z]+|$)", "e?ssp([^a-z]+|$)", "e?ss([^a-z]+|$)", "e?sp([^a-z]+|$)", "e?subsp", "sube?species", "e?species",
"biovar[a-z]*", "biotype", "serovar[a-z]*", "var([^a-z]+|$)", "serogr.?up[a-z]*", "biovar[a-z]*", "biotype", "serovar[a-z]*", "var([^a-z]+|$)", "serogr.?up[a-z]*",
"titer", "dummy", "Ig[ADEGM]") "titer", "dummy", "Ig[ADEGM]", " ?[a-z-]+[-](resistant|susceptible) ?")
paste0( paste0(
"(", "(",
"[^A-Za-z- \\(\\)\\[\\]{}]+", "[^A-Za-z- \\(\\)\\[\\]{}]+",
@@ -930,7 +957,7 @@ print.mo_uncertainties <- function(x, n = 10, ...) {
ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$status == "synonym")], ifelse(x[i, ]$keep_synonyms == FALSE & x[i, ]$mo %in% AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$status == "synonym")],
paste0( paste0(
strrep(" ", nchar(x[i, ]$original_input) + 6), strrep(" ", nchar(x[i, ]$original_input) + 6),
font_red(paste0("This old taxonomic name was converted to ", font_italic(AMR_env$MO_lookup$fullname[match(synonym_mo_to_accepted_mo(x[i, ]$mo), AMR_env$MO_lookup$mo)], collapse = NULL), " (", synonym_mo_to_accepted_mo(x[i, ]$mo), ")."), collapse = NULL) font_red(paste0("This outdated taxonomic name was converted to ", font_italic(AMR_env$MO_lookup$fullname[match(synonym_mo_to_accepted_mo(x[i, ]$mo), AMR_env$MO_lookup$mo)], collapse = NULL), " (", synonym_mo_to_accepted_mo(x[i, ]$mo), ")."), collapse = NULL)
), ),
"" ""
), ),
@@ -1038,13 +1065,14 @@ convert_colloquial_input <- function(x) {
out[x %like_case% "anaerob[a-z]+ .*gram[ -]?neg.*"] <- "B_ANAER-NEG" out[x %like_case% "anaerob[a-z]+ .*gram[ -]?neg.*"] <- "B_ANAER-NEG"
out[x %like_case% "anaerob[a-z]+ .*gram[ -]?pos.*"] <- "B_ANAER-POS" out[x %like_case% "anaerob[a-z]+ .*gram[ -]?pos.*"] <- "B_ANAER-POS"
out[is.na(out) & x %like_case% "anaerob[a-z]+ (micro)?.*organism"] <- "B_ANAER" out[is.na(out) & x %like_case% "anaerob[a-z]+ (micro)?.*organism"] <- "B_ANAER"
out[is.na(out) & x %like_case% "anaerob[a-z]+ bacter"] <- "B_ANAER"
# coryneform bacteria # coryneform bacteria
out[x %like_case% "^coryneform"] <- "B_CORYNF" out[x %like_case% "^coryneform"] <- "B_CORYNF"
# yeasts and fungi # yeasts and fungi
out[x %like_case% "^yeast?"] <- "F_YEAST" out[x %like_case% "(^| )yeast?"] <- "F_YEAST"
out[x %like_case% "^fung(us|i)"] <- "F_FUNGUS" out[x %like_case% "(^| )fung(us|i)"] <- "F_FUNGUS"
# trivial names known to the field # trivial names known to the field
out[x %like_case% "meningo[ck]o[ck]"] <- "B_NESSR_MNNG" out[x %like_case% "meningo[ck]o[ck]"] <- "B_NESSR_MNNG"
@@ -1239,29 +1267,52 @@ repair_reference_df <- function(reference_df) {
} }
get_mo_uncertainties <- function() { get_mo_uncertainties <- function() {
remember <- list(uncertainties = AMR_env$mo_uncertainties) remember <- list(uncertainties = AMR_env$mo_uncertainties,
failures = AMR_env$mo_failures)
# empty them, otherwise e.g. mo_shortname("Chlamydophila psittaci") will give 3 notes # empty them, otherwise e.g. mo_shortname("Chlamydophila psittaci") will give 3 notes
AMR_env$mo_uncertainties <- NULL AMR_env$mo_uncertainties <- NULL
AMR_env$mo_failures <- NULL
remember remember
} }
load_mo_uncertainties <- function(metadata) { load_mo_uncertainties <- function(metadata) {
AMR_env$mo_uncertainties <- metadata$uncertainties AMR_env$mo_uncertainties <- metadata$uncertainties
AMR_env$mo_failures <- metadata$failures
} }
synonym_mo_to_accepted_mo <- function(x, fill_in_accepted = FALSE) { synonym_mo_to_accepted_mo <- function(x, fill_in_accepted = FALSE, dataset = AMR_env$MO_lookup) {
x_gbif <- AMR_env$MO_lookup$gbif_renamed_to[match(x, AMR_env$MO_lookup$mo)] # `dataset` is an argument so that it can be used in the regeneration of the microorganisms data set
x_lpsn <- AMR_env$MO_lookup$lpsn_renamed_to[match(x, AMR_env$MO_lookup$mo)] if (identical(dataset, AMR_env$MO_lookup)) {
x_gbif[!x_gbif %in% AMR_env$MO_lookup$gbif] <- NA add_MO_lookup_to_AMR_env()
x_lpsn[!x_lpsn %in% AMR_env$MO_lookup$lpsn] <- NA dataset <- AMR_env$MO_lookup
out <- ifelse(is.na(x_lpsn),
AMR_env$MO_lookup$mo[match(x_gbif, AMR_env$MO_lookup$gbif)],
AMR_env$MO_lookup$mo[match(x_lpsn, AMR_env$MO_lookup$lpsn)]
)
if (isTRUE(fill_in_accepted)) {
x_accepted <- which(AMR_env$MO_lookup$status[match(x, AMR_env$MO_lookup$mo)] == "accepted")
out[x_accepted] <- x[x_accepted]
} }
out <- x
is_still_synonym <- dataset$status[match(out, dataset$mo)] == "synonym"
limit <- 0
while(any(is_still_synonym, na.rm = TRUE) && limit < 5) {
limit <- limit + 1
# make sure to get the latest name, e.g. Fusarium pulicaris robiniae was first renamed to Fusarium roseum, then to Fusarium sambucinum
# we need the MO of Fusarium pulicaris robiniae to return the MO of Fusarium sambucinum
must_be_corrected <- !is.na(is_still_synonym) & is_still_synonym
x_gbif <- dataset$gbif_renamed_to[match(out, dataset$mo)]
x_mycobank <- dataset$mycobank_renamed_to[match(out, dataset$mo)]
x_lpsn <- dataset$lpsn_renamed_to[match(out, dataset$mo)]
out[must_be_corrected & !is.na(x_gbif)] <- dataset$mo[match(x_gbif[must_be_corrected & !is.na(x_gbif)], dataset$gbif)]
out[must_be_corrected & !is.na(x_mycobank)] <- dataset$mo[match(x_mycobank[must_be_corrected & !is.na(x_mycobank)], dataset$mycobank)]
out[must_be_corrected & !is.na(x_lpsn)] <- dataset$mo[match(x_lpsn[must_be_corrected & !is.na(x_lpsn)], dataset$lpsn)]
is_still_synonym <- dataset$status[match(out, dataset$mo)] == "synonym"
}
x_no_synonym <- dataset$status[match(x, dataset$mo)] != "synonym"
out[x_no_synonym] <- NA_character_
if (isTRUE(fill_in_accepted)) {
out[!is.na(x_no_synonym) & x_no_synonym] <- x[!is.na(x_no_synonym) & x_no_synonym]
}
out[is.na(match(x, dataset$mo))] <- NA_character_
out out
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+86 -20
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -39,8 +39,8 @@
#' @details All functions will, at default, **not** keep old taxonomic properties, as synonyms are automatically replaced with the current taxonomy. Take for example *Enterobacter aerogenes*, which was initially named in 1960 but renamed to *Klebsiella aerogenes* in 2017: #' @details All functions will, at default, **not** keep old taxonomic properties, as synonyms are automatically replaced with the current taxonomy. Take for example *Enterobacter aerogenes*, which was initially named in 1960 but renamed to *Klebsiella aerogenes* in 2017:
#' - `mo_genus("Enterobacter aerogenes")` will return `"Klebsiella"` (with a note about the renaming) #' - `mo_genus("Enterobacter aerogenes")` will return `"Klebsiella"` (with a note about the renaming)
#' - `mo_genus("Enterobacter aerogenes", keep_synonyms = TRUE)` will return `"Enterobacter"` (with a once-per-session warning that the name is outdated) #' - `mo_genus("Enterobacter aerogenes", keep_synonyms = TRUE)` will return `"Enterobacter"` (with a once-per-session warning that the name is outdated)
#' - `mo_ref("Enterobacter aerogenes")` will return `"Tindall et al., 2017"` (with a note) #' - `mo_ref("Enterobacter aerogenes")` will return `"Tindall et al., 2017"` (with a note about the renaming)
#' - `mo_ref("Enterobacter aerogenes", keep_synonyms = TRUE)` will return `"Hormaeche et al., 1960"` (with a warning) #' - `mo_ref("Enterobacter aerogenes", keep_synonyms = TRUE)` will return `"Hormaeche et al., 1960"` (with a once-per-session warning that the name is outdated)
#' #'
#' The short name ([mo_shortname()]) returns the first character of the genus and the full species, such as `"E. coli"`, for species and subspecies. Exceptions are abbreviations of staphylococci (such as *"CoNS"*, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as *"GBS"*, Group B Streptococci). Please bear in mind that e.g. *E. coli* could mean *Escherichia coli* (kingdom of Bacteria) as well as *Entamoeba coli* (kingdom of Protozoa). Returning to the full name will be done using [as.mo()] internally, giving priority to bacteria and human pathogens, i.e. `"E. coli"` will be considered *Escherichia coli*. As a result, `mo_fullname(mo_shortname("Entamoeba coli"))` returns `"Escherichia coli"`. #' The short name ([mo_shortname()]) returns the first character of the genus and the full species, such as `"E. coli"`, for species and subspecies. Exceptions are abbreviations of staphylococci (such as *"CoNS"*, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as *"GBS"*, Group B Streptococci). Please bear in mind that e.g. *E. coli* could mean *Escherichia coli* (kingdom of Bacteria) as well as *Entamoeba coli* (kingdom of Protozoa). Returning to the full name will be done using [as.mo()] internally, giving priority to bacteria and human pathogens, i.e. `"E. coli"` will be considered *Escherichia coli*. As a result, `mo_fullname(mo_shortname("Entamoeba coli"))` returns `"Escherichia coli"`.
#' #'
@@ -50,15 +50,15 @@
#' #'
#' Determination of the Gram stain ([mo_gramstain()]) will be based on the taxonomic kingdom and phylum. Originally, Cavalier-Smith defined the so-called subkingdoms Negibacteria and Posibacteria (2002, [PMID 11837318](https://pubmed.ncbi.nlm.nih.gov/11837318/)), and only considered these phyla as Posibacteria: Actinobacteria, Chloroflexi, Firmicutes, and Tenericutes. These phyla were later renamed to Actinomycetota, Chloroflexota, Bacillota, and Mycoplasmatota (2021, [PMID 34694987](https://pubmed.ncbi.nlm.nih.gov/34694987/)). Bacteria in these phyla are considered Gram-positive in this `AMR` package, except for members of the class Negativicutes (within phylum Bacillota) which are Gram-negative. All other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. Functions [mo_is_gram_negative()] and [mo_is_gram_positive()] always return `TRUE` or `FALSE` (or `NA` when the input is `NA` or the MO code is `UNKNOWN`), thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria. #' Determination of the Gram stain ([mo_gramstain()]) will be based on the taxonomic kingdom and phylum. Originally, Cavalier-Smith defined the so-called subkingdoms Negibacteria and Posibacteria (2002, [PMID 11837318](https://pubmed.ncbi.nlm.nih.gov/11837318/)), and only considered these phyla as Posibacteria: Actinobacteria, Chloroflexi, Firmicutes, and Tenericutes. These phyla were later renamed to Actinomycetota, Chloroflexota, Bacillota, and Mycoplasmatota (2021, [PMID 34694987](https://pubmed.ncbi.nlm.nih.gov/34694987/)). Bacteria in these phyla are considered Gram-positive in this `AMR` package, except for members of the class Negativicutes (within phylum Bacillota) which are Gram-negative. All other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. Functions [mo_is_gram_negative()] and [mo_is_gram_positive()] always return `TRUE` or `FALSE` (or `NA` when the input is `NA` or the MO code is `UNKNOWN`), thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria.
#' #'
#' Determination of yeasts ([mo_is_yeast()]) will be based on the taxonomic kingdom and class. *Budding yeasts* are fungi of the phylum Ascomycota, class Saccharomycetes (also called Hemiascomycetes). *True yeasts* are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are member of the taxonomic class Saccharomycetes, the function will return `TRUE`. It returns `FALSE` otherwise (or `NA` when the input is `NA` or the MO code is `UNKNOWN`). #' Determination of yeasts ([mo_is_yeast()]) will be based on the taxonomic kingdom and class. *Budding yeasts* are yeasts that reproduce asexually through a process called budding, where a new cell develops from a small protrusion on the parent cell. Taxonomically, these are members of the phylum Ascomycota, class Saccharomycetes (also called Hemiascomycetes) or Pichiomycetes. *True yeasts* quite specifically refers to yeasts in the underlying order Saccharomycetales (such as *Saccharomyces cerevisiae*). Thus, for all microorganisms that are member of the taxonomic class Saccharomycetes or Pichiomycetes, the function will return `TRUE`. It returns `FALSE` otherwise (or `NA` when the input is `NA` or the MO code is `UNKNOWN`).
#' #'
#' Determination of intrinsic resistance ([mo_is_intrinsic_resistant()]) will be based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.3)`. The [mo_is_intrinsic_resistant()] function can be vectorised over both argument `x` (input for microorganisms) and `ab` (input for antibiotics). #' Determination of intrinsic resistance ([mo_is_intrinsic_resistant()]) will be based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.3)`. The [mo_is_intrinsic_resistant()] function can be vectorised over both argument `x` (input for microorganisms) and `ab` (input for antibiotics).
#' #'
#' Determination of bacterial oxygen tolerance ([mo_oxygen_tolerance()]) will be based on BacDive, see *Source*. The function [mo_is_anaerobic()] only returns `TRUE` if the oxygen tolerance is `"anaerobe"`, indicting an obligate anaerobic species or genus. It always returns `FALSE` for species outside the taxonomic kingdom of Bacteria. #' Determination of bacterial oxygen tolerance ([mo_oxygen_tolerance()]) will be based on BacDive, see *Source*. The function [mo_is_anaerobic()] only returns `TRUE` if the oxygen tolerance is `"anaerobe"`, indicting an obligate anaerobic species or genus. It always returns `FALSE` for species outside the taxonomic kingdom of Bacteria.
#' #'
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species. #' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species. [This MycoBank URL](`r TAXONOMY_VERSION$MycoBank$url`) will be used for fungi wherever available , [this LPSN URL](`r TAXONOMY_VERSION$MycoBank$url`) for bacteria wherever available, and [this GBIF link](`r TAXONOMY_VERSION$GBIF$url`) otherwise.
#' #'
#' SNOMED codes ([mo_snomed()]) are from the version of `r documentation_date(TAXONOMY_VERSION$SNOMED$accessed_date)`. See *Source* and the [microorganisms] data set for more info. #' SNOMED codes ([mo_snomed()]) was last updated on `r documentation_date(TAXONOMY_VERSION$SNOMED$accessed_date)`. See *Source* and the [microorganisms] data set for more info.
#' #'
#' Old taxonomic names (so-called 'synonyms') can be retrieved with [mo_synonyms()] (which will have the scientific reference as [name][base::names()]), the current taxonomic name can be retrieved with [mo_current()]. Both functions return full names. #' Old taxonomic names (so-called 'synonyms') can be retrieved with [mo_synonyms()] (which will have the scientific reference as [name][base::names()]), the current taxonomic name can be retrieved with [mo_current()]. Both functions return full names.
#' #'
@@ -71,8 +71,9 @@
#' @return #' @return
#' - An [integer] in case of [mo_year()] #' - An [integer] in case of [mo_year()]
#' - An [ordered factor][factor] in case of [mo_pathogenicity()] #' - An [ordered factor][factor] in case of [mo_pathogenicity()]
#' - A [list] in case of [mo_taxonomy()], [mo_synonyms()], [mo_snomed()] and [mo_info()] #' - A [list] in case of [mo_taxonomy()], [mo_synonyms()], [mo_snomed()], and [mo_info()]
#' - A named [character] in case of [mo_url()] #' - A [logical] in case of [mo_is_anaerobic()], [mo_is_gram_negative()], [mo_is_gram_positive()], [mo_is_intrinsic_resistant()], and [mo_is_yeast()]
#' - A named [character] in case of [mo_synonyms()] and [mo_url()]
#' - A [character] in all other cases #' - A [character] in all other cases
#' @export #' @export
#' @seealso Data set [microorganisms] #' @seealso Data set [microorganisms]
@@ -106,17 +107,25 @@
#' mo_rank("Klebsiella pneumoniae") #' mo_rank("Klebsiella pneumoniae")
#' mo_url("Klebsiella pneumoniae") #' mo_url("Klebsiella pneumoniae")
#' mo_is_yeast(c("Candida", "Trichophyton", "Klebsiella")) #' mo_is_yeast(c("Candida", "Trichophyton", "Klebsiella"))
#' #'
#' mo_group_members(c("Streptococcus group A",
#' "Streptococcus group C",
#' "Streptococcus group G",
#' "Streptococcus group L"))
#'
#' #'
#' # scientific reference ----------------------------------------------------- #' # scientific reference -----------------------------------------------------
#' #'
#' mo_ref("Klebsiella aerogenes") #' mo_ref("Klebsiella aerogenes")
#' mo_authors("Klebsiella aerogenes") #' mo_authors("Klebsiella aerogenes")
#' mo_year("Klebsiella aerogenes") #' mo_year("Klebsiella aerogenes")
#' mo_synonyms("Klebsiella aerogenes")
#' mo_lpsn("Klebsiella aerogenes") #' mo_lpsn("Klebsiella aerogenes")
#' mo_gbif("Klebsiella aerogenes") #' mo_gbif("Klebsiella aerogenes")
#' mo_synonyms("Klebsiella aerogenes") #' mo_mycobank("Candida albicans")
#' #' mo_mycobank("Candida krusei")
#' mo_mycobank("Candida krusei", keep_synonyms = TRUE)
#'
#' #'
#' # abbreviations known in the field ----------------------------------------- #' # abbreviations known in the field -----------------------------------------
#' #'
@@ -209,7 +218,13 @@ mo_name <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("A
#' @rdname mo_property #' @rdname mo_property
#' @export #' @export
mo_fullname <- mo_name mo_fullname <- 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_fullname")
}
mo_name(x = x, language = language, keep_synonyms = keep_synonyms, ...)
}
#' @rdname mo_property #' @rdname mo_property
#' @export #' @export
@@ -245,7 +260,7 @@ mo_shortname <- function(x, language = get_AMR_locale(), keep_synonyms = getOpti
# unknown species etc. # unknown species etc.
shortnames[shortnames %like% "unknown"] <- paste0("(", trimws2(gsub("[^a-zA-Z -]", "", shortnames[shortnames %like% "unknown"], perl = TRUE)), ")") 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_ shortnames[is.na(x.mo)] <- NA_character_
load_mo_uncertainties(metadata) load_mo_uncertainties(metadata)
@@ -538,8 +553,7 @@ mo_is_yeast <- function(x, language = get_AMR_locale(), keep_synonyms = getOptio
load_mo_uncertainties(metadata) load_mo_uncertainties(metadata)
out <- rep(FALSE, length(x)) out <- x.mo == "F_YEAST" | (x.kingdom == "Fungi" & x.class %in% c("Saccharomycetes", "Pichiomycetes"))
out[x.kingdom == "Fungi" & x.class == "Saccharomycetes"] <- TRUE
out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA
out out
} }
@@ -692,6 +706,21 @@ mo_lpsn <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("A
mo_validate(x = x, property = "lpsn", language = language, keep_synonyms = keep_synonyms, ...) mo_validate(x = x, property = "lpsn", language = language, keep_synonyms = keep_synonyms, ...)
} }
#' @rdname mo_property
#' @export
mo_mycobank <- 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_mycobank")
}
meet_criteria(x, allow_NA = TRUE)
language <- validate_language(language)
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
mo_validate(x = x, property = "mycobank", language = language, keep_synonyms = keep_synonyms, ...)
}
#' @rdname mo_property #' @rdname mo_property
#' @export #' @export
mo_gbif <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) { mo_gbif <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
@@ -791,11 +820,42 @@ mo_synonyms <- function(x, language = get_AMR_locale(), keep_synonyms = getOptio
mo_current <- function(x, language = get_AMR_locale(), ...) { mo_current <- function(x, language = get_AMR_locale(), ...) {
meet_criteria(x, allow_NA = TRUE) meet_criteria(x, allow_NA = TRUE)
language <- validate_language(language) language <- validate_language(language)
x.mo <- suppressWarnings(as.mo(x, keep_synonyms = TRUE, ...)) x.mo <- suppressWarnings(as.mo(x, keep_synonyms = TRUE, info = FALSE, ...))
out <- synonym_mo_to_accepted_mo(x.mo, fill_in_accepted = TRUE) out <- synonym_mo_to_accepted_mo(x.mo, fill_in_accepted = TRUE)
mo_name(out, language = language) 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 #' @rdname mo_property
#' @export #' @export
mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) { mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
@@ -823,7 +883,9 @@ mo_info <- function(x, language = get_AMR_locale(), keep_synonyms = getOption("A
ref = mo_ref(y, keep_synonyms = keep_synonyms), ref = mo_ref(y, keep_synonyms = keep_synonyms),
snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms)), snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms)),
lpsn = mo_lpsn(y, language = language, keep_synonyms = keep_synonyms), lpsn = mo_lpsn(y, language = language, keep_synonyms = keep_synonyms),
gbif = mo_gbif(y, language = language, keep_synonyms = keep_synonyms) mycobank = mo_mycobank(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)
) )
) )
}) })
@@ -857,19 +919,23 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), keep_synonyms =
x.rank <- AMR_env$MO_lookup$rank[match(x.mo, AMR_env$MO_lookup$mo)] x.rank <- AMR_env$MO_lookup$rank[match(x.mo, AMR_env$MO_lookup$mo)]
x.name <- AMR_env$MO_lookup$fullname[match(x.mo, AMR_env$MO_lookup$mo)] x.name <- AMR_env$MO_lookup$fullname[match(x.mo, AMR_env$MO_lookup$mo)]
x.lpsn <- AMR_env$MO_lookup$lpsn[match(x.mo, AMR_env$MO_lookup$mo)] x.lpsn <- AMR_env$MO_lookup$lpsn[match(x.mo, AMR_env$MO_lookup$mo)]
x.mycobank <- AMR_env$MO_lookup$mycobank[match(x.mo, AMR_env$MO_lookup$mo)]
x.gbif <- AMR_env$MO_lookup$gbif[match(x.mo, AMR_env$MO_lookup$mo)] x.gbif <- AMR_env$MO_lookup$gbif[match(x.mo, AMR_env$MO_lookup$mo)]
u <- character(length(x)) u <- character(length(x))
u[!is.na(x.gbif)] <- paste0(TAXONOMY_VERSION$GBIF$url, "/species/", x.gbif[!is.na(x.gbif)]) u[!is.na(x.gbif)] <- paste0(TAXONOMY_VERSION$GBIF$url, "/species/", x.gbif[!is.na(x.gbif)])
# overwrite with LPSN: # overwrite with LPSN:
u[!is.na(x.lpsn)] <- paste0(TAXONOMY_VERSION$LPSN$url, "/", x.rank[!is.na(x.lpsn)], "/", gsub(" ", "-", tolower(x.name[!is.na(x.lpsn)]), fixed = TRUE)) u[!is.na(x.lpsn)] <- paste0(TAXONOMY_VERSION$LPSN$url, "/", x.rank[!is.na(x.lpsn)], "/", gsub(" ", "-", tolower(x.name[!is.na(x.lpsn)]), fixed = TRUE))
# overwrite with MycoBank (bacteria from LPSN will not be overwritten since MycoBank has no bacteria)
u[!is.na(x.mycobank)] <- paste0(TAXONOMY_VERSION$MycoBank$url, "/mb/", gsub(" ", "%20", tolower(x.mycobank[!is.na(x.mycobank)]), fixed = TRUE))
names(u) <- x.name names(u) <- x.name
if (isTRUE(open)) { if (isTRUE(open)) {
if (length(u) > 1) { if (length(u) > 1) {
warning_("in `mo_url()`: only the first URL will be opened, as `browseURL()` only suports one string.") warning_("in `mo_url()`: only the first URL will be opened, as R's built-in function `browseURL()` only suports one string.")
} }
utils::browseURL(u[1L]) utils::browseURL(u[1L])
} }
+11 -6
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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. #' 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 #' @export
set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_source.rds")) { 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(path, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(destination, allow_class = "character", has_length = 1) 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.") stop_ifnot(destination %like% "[.]rds$", "the `destination` must be a file location with file extension .rds.")
mo_source_destination <- path.expand(destination) 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, "")) { if (is.null(path) || path %in% c(FALSE, "")) {
AMR_env$mo_source <- NULL AMR_env$mo_source <- NULL
if (file.exists(mo_source_destination)) { if (file.exists(mo_source_destination)) {
@@ -247,6 +246,12 @@ get_mo_source <- function(destination = getOption("AMR_mo_source", "~/mo_source.
} }
return(NULL) 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)) { if (is.null(AMR_env$mo_source)) {
AMR_env$mo_source <- readRDS_AMR(path.expand(destination)) AMR_env$mo_source <- readRDS_AMR(path.expand(destination))
} }
+4 -4
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -113,7 +113,7 @@ pca <- function(x,
x <- as.data.frame(new_list, stringsAsFactors = FALSE) x <- as.data.frame(new_list, stringsAsFactors = FALSE)
if (any(vapply(FUN.VALUE = logical(1), x, function(y) !is.numeric(y)))) { if (any(vapply(FUN.VALUE = logical(1), x, function(y) !is.numeric(y)))) {
warning_("in `pca()`: be sure to first calculate the resistance (or susceptibility) of variables with antimicrobial test results, since PCA works with numeric variables only. See Examples in ?pca.", call = FALSE) warning_("in `pca()`: be sure to first calculate the resistance (or susceptibility) of variables with antimicrobial test results, since PCA works with numeric variables only. See Examples in `?pca`.", call = FALSE)
} }
# set column names # set column names
+142 -56
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -29,8 +29,10 @@
#' Plotting for Classes `sir`, `mic` and `disk` #' Plotting for Classes `sir`, `mic` and `disk`
#' #'
#' @description
#' Functions to plot classes `sir`, `mic` and `disk`, with support for base \R and `ggplot2`. #' 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 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 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()] #' @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_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")
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro", language = "nl") #' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro", language = "nl")
#' #'
#'
#' # Plotting using scale_x_mic()
#' \donttest{ #' \donttest{
#' if (require("ggplot2")) { #' 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) #' autoplot(some_mic_values)
#' } #' }
#' if (require("ggplot2")) { #' if (require("ggplot2")) {
@@ -80,6 +108,59 @@
#' } #' }
NULL 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 #' @method plot mic
#' @importFrom graphics barplot axis mtext legend #' @importFrom graphics barplot axis mtext legend
#' @export #' @export
@@ -103,21 +184,18 @@ plot.mic <- function(x,
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1) meet_criteria(ylab, allow_class = "character", has_length = 1)
meet_criteria(xlab, 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) 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) { if (length(colours_SIR) == 1) {
colours_SIR <- rep(colours_SIR, 3) colours_SIR <- rep(colours_SIR, 3)
} }
main <- gsub(" +", " ", paste0(main, collapse = " ")) 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( cols_sub <- plot_colours_subtitle_guideline(
x = x, x = x,
mo = mo, mo = mo,
@@ -193,15 +271,13 @@ barplot.mic <- function(height,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE) meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE) meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1) 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) meet_criteria(expand, allow_class = "logical", has_length = 1)
main <- gsub(" +", " ", paste0(main, collapse = " ")) main <- gsub(" +", " ", paste0(main, collapse = " "))
height <- as.mic(height) # make sure that currently implemented MIC levels are used
plot( plot(
x = height, x = height,
@@ -239,10 +315,6 @@ autoplot.mic <- function(object,
meet_criteria(title, allow_class = "character", allow_NULL = TRUE) meet_criteria(title, allow_class = "character", allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1) meet_criteria(ylab, allow_class = "character", has_length = 1)
meet_criteria(xlab, 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -254,7 +326,8 @@ autoplot.mic <- function(object,
title <- gsub(" +", " ", paste0(title, collapse = " ")) 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( cols_sub <- plot_colours_subtitle_guideline(
x = x, x = x,
mo = mo, mo = mo,
@@ -290,6 +363,7 @@ autoplot.mic <- function(object,
if (any(colours_SIR %in% cols_sub$cols)) { if (any(colours_SIR %in% cols_sub$cols)) {
vals <- c( vals <- c(
"(S) Susceptible" = colours_SIR[1], "(S) Susceptible" = colours_SIR[1],
"(SDD) Susceptible dose-dependent" = colours_SIR[2],
"(I) Susceptible, incr. exp." = colours_SIR[2], "(I) Susceptible, incr. exp." = colours_SIR[2],
"(I) Intermediate" = colours_SIR[2], "(I) Intermediate" = colours_SIR[2],
"(R) Resistant" = colours_SIR[3] "(R) Resistant" = colours_SIR[3]
@@ -316,12 +390,14 @@ autoplot.mic <- function(object,
#' @rdname plot #' @rdname plot
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
fortify.mic <- function(object, ...) { fortify.mic <- function(object, ...) {
object <- as.mic(object) # make sure that currently implemented MIC levels are used
stats::setNames( stats::setNames(
as.data.frame(plot_prepare_table(object, expand = FALSE)), as.data.frame(plotrange_as_table(object, expand = FALSE)),
c("x", "y") c("x", "y")
) )
} }
#' @method plot disk #' @method plot disk
#' @export #' @export
#' @importFrom graphics barplot axis mtext legend #' @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(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE) meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1) 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -358,8 +430,7 @@ plot.disk <- function(x,
} }
main <- gsub(" +", " ", paste0(main, collapse = " ")) 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( cols_sub <- plot_colours_subtitle_guideline(
x = x, x = x,
mo = mo, mo = mo,
@@ -435,10 +506,6 @@ barplot.disk <- function(height,
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE) meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE) meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1) 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) 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(mo, allow_class = c("mo", "character"), allow_NULL = TRUE)
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE) meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
meet_criteria(guideline, allow_class = "character", has_length = 1) 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -496,7 +559,7 @@ autoplot.disk <- function(object,
title <- gsub(" +", " ", paste0(title, collapse = " ")) 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( cols_sub <- plot_colours_subtitle_guideline(
x = x, x = x,
mo = mo, mo = mo,
@@ -533,6 +596,7 @@ autoplot.disk <- function(object,
if (any(colours_SIR %in% cols_sub$cols)) { if (any(colours_SIR %in% cols_sub$cols)) {
vals <- c( vals <- c(
"(S) Susceptible" = colours_SIR[1], "(S) Susceptible" = colours_SIR[1],
"(SDD) Susceptible dose-dependent" = colours_SIR[2],
"(I) Susceptible, incr. exp." = colours_SIR[2], "(I) Susceptible, incr. exp." = colours_SIR[2],
"(I) Intermediate" = colours_SIR[2], "(I) Intermediate" = colours_SIR[2],
"(R) Resistant" = colours_SIR[3] "(R) Resistant" = colours_SIR[3]
@@ -560,7 +624,7 @@ autoplot.disk <- function(object,
# will be exported using s3_register() in R/zzz.R # will be exported using s3_register() in R/zzz.R
fortify.disk <- function(object, ...) { fortify.disk <- function(object, ...) {
stats::setNames( stats::setNames(
as.data.frame(plot_prepare_table(object, expand = FALSE)), as.data.frame(plotrange_as_table(object, expand = FALSE)),
c("x", "y") c("x", "y")
) )
} }
@@ -586,14 +650,21 @@ plot.sir <- function(x,
if (!"S" %in% data$x) { if (!"S" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "S", n = 0, s = 0, stringsAsFactors = FALSE)) 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) { if (!"I" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "I", n = 0, s = 0, stringsAsFactors = FALSE)) data <- rbind_AMR(data, data.frame(x = "I", n = 0, s = 0, stringsAsFactors = FALSE))
} }
if (!"R" %in% data$x) { if (!"R" %in% data$x) {
data <- rbind_AMR(data, data.frame(x = "R", n = 0, s = 0, stringsAsFactors = FALSE)) data <- rbind_AMR(data, data.frame(x = "R", n = 0, s = 0, stringsAsFactors = FALSE))
} }
if (!"NI" %in% data$x) {
data$x <- factor(data$x, levels = c("S", "I", "R"), ordered = TRUE) data <- rbind_AMR(data, data.frame(x = "NI", n = 0, s = 0, stringsAsFactors = FALSE))
}
data <- data[!(data$n == 0 & data$x %in% c("SDD", "I", "NI")), , drop = FALSE]
data$x <- factor(data$x, levels = intersect(unique(data$x), c("S", "SDD", "I", "R", "NI")), ordered = TRUE)
ymax <- pm_if_else(max(data$s) > 95, 105, 100) 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(xlab, allow_class = "character", has_length = 1)
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(ylab, allow_class = "character", has_length = 1) 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)) meet_criteria(colours_SIR, allow_class = "character", has_length = c(1, 3))
language <- validate_language(language) language <- validate_language(language)
meet_criteria(expand, allow_class = "logical", has_length = 1) meet_criteria(expand, allow_class = "logical", has_length = 1)
@@ -646,10 +713,15 @@ barplot.sir <- function(height,
if (length(colours_SIR) == 1) { if (length(colours_SIR) == 1) {
colours_SIR <- rep(colours_SIR, 3) 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 = " ")) main <- gsub(" +", " ", paste0(main, collapse = " "))
x <- table(height) 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", "NI") & x == 0)]
x <- x[!(names(x) %in% c("SDD", "I", "NI") & x == 0)]
# plot it
barplot(x, barplot(x,
col = colours_SIR, col = colours_SIR,
xlab = xlab, xlab = xlab,
@@ -688,15 +760,18 @@ autoplot.sir <- function(object,
} }
df <- as.data.frame(table(object), stringsAsFactors = TRUE) 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", "NI")), , drop = FALSE]
ggplot2::ggplot(df) + 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) # limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
ggplot2::scale_fill_manual( ggplot2::scale_fill_manual(
values = c( values = c(
"S" = colours_SIR[1], "S" = colours_SIR[1],
"SDD" = colours_SIR[2],
"I" = colours_SIR[2], "I" = colours_SIR[2],
"R" = colours_SIR[3] "R" = colours_SIR[3],
"NI" = "#888888"
), ),
limits = force 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)] x <- x[!is.na(x)]
stop_if(length(x) == 0, "no observations to plot", call = FALSE)
if (is.mic(x)) { if (is.mic(x)) {
x <- as.mic(x, keep_operators = keep_operators)
if (expand == TRUE) { if (expand == TRUE) {
# expand range for MIC by adding factors of 2 from lowest to highest so all MICs in between also print # expand range for MIC by adding common intermediate factors levels
valid_lvls <- levels(x) extra_range <- COMMON_MIC_VALUES[COMMON_MIC_VALUES > min(x, na.rm = TRUE) & COMMON_MIC_VALUES < max(x, na.rm = TRUE)]
extra_range <- max(x) / 2 # remove the ones that are in 25% range of user values
while (min(extra_range) / 2 > min(x)) { extra_range <- extra_range[!vapply(FUN.VALUE = logical(1), extra_range, function(r) any(abs(r - x) / x < 0.25, na.rm = TRUE))]
extra_range <- c(min(extra_range) / 2, extra_range)
}
nms <- extra_range nms <- extra_range
extra_range <- rep(0, length(extra_range)) extra_range <- rep(0, length(extra_range))
names(extra_range) <- nms names(extra_range) <- nms
x <- table(droplevels(x, as.mic = FALSE)) 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)) x <- as.table(c(x, extra_range))
} else { } else {
x <- table(droplevels(x, as.mic = FALSE)) x <- table(droplevels(x, as.mic = FALSE))
@@ -751,6 +824,15 @@ plot_prepare_table <- function(x, expand) {
as.table(x) 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) { plot_name_of_I <- function(guideline) {
if (guideline %unlike% "CLSI" && as.double(gsub("[^0-9]+", "", guideline)) >= 2019) { if (guideline %unlike% "CLSI" && as.double(gsub("[^0-9]+", "", guideline)) >= 2019) {
# interpretation since 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, ...) { 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) guideline <- get_guideline(guideline, AMR::clinical_breakpoints)
# store previous interpretations to backup # 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 <- character(length = length(sir))
cols[is.na(sir)] <- "#BEBEBE" cols[is.na(sir)] <- "#BEBEBE"
cols[sir == "S"] <- colours_SIR[1] cols[sir == "S"] <- colours_SIR[1]
cols[sir == "SDD"] <- colours_SIR[2]
cols[sir == "I"] <- colours_SIR[2] cols[sir == "I"] <- colours_SIR[2]
cols[sir == "R"] <- colours_SIR[3] cols[sir == "R"] <- colours_SIR[3]
cols[sir == "NI"] <- "#888888"
sub <- bquote(.(abname) ~ "-" ~ italic(.(moname)) ~ .(guideline_txt)) sub <- bquote(.(abname) ~ "-" ~ italic(.(moname)) ~ .(guideline_txt))
} else { } else {
cols <- "#BEBEBE" cols <- "#BEBEBE"
+20 -11
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -48,7 +48,7 @@
#' @details #' @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. #' **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. #' 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) { only_all_tested = FALSE) {
tryCatch( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("S", "I"), ab_result = c("S", "SDD", "I"),
minimum = minimum, minimum = minimum,
as_percent = as_percent, as_percent = as_percent,
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
@@ -267,7 +267,7 @@ sir_confidence_interval <- function(...,
confidence_level = 0.95, confidence_level = 0.95,
side = "both", side = "both",
collapse = FALSE) { 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", "NI"))
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE) 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(as_percent, allow_class = "logical", has_length = 1)
meet_criteria(only_all_tested, 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( n <- tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("S", "I", "R"), ab_result = c("S", "SDD", "I", "R", "NI"),
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
only_count = TRUE only_count = TRUE
), ),
@@ -294,7 +294,7 @@ sir_confidence_interval <- function(...,
# this applies the Clopper-Pearson method # this applies the Clopper-Pearson method
out <- stats::binom.test(x = x, n = n, conf.level = confidence_level)$conf.int 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")) { if (side %in% c("left", "l", "lower", "lowest", "less", "min")) {
out <- out[1] out <- out[1]
@@ -351,9 +351,12 @@ proportion_IR <- function(...,
minimum = 30, minimum = 30,
as_percent = FALSE, as_percent = FALSE,
only_all_tested = 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( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("I", "R"), ab_result = c("I", "SDD", "R"),
minimum = minimum, minimum = minimum,
as_percent = as_percent, as_percent = as_percent,
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
@@ -369,9 +372,12 @@ proportion_I <- function(...,
minimum = 30, minimum = 30,
as_percent = FALSE, as_percent = FALSE,
only_all_tested = 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( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = "I", ab_result = c("I", "SDD"),
minimum = minimum, minimum = minimum,
as_percent = as_percent, as_percent = as_percent,
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
@@ -387,9 +393,12 @@ proportion_SI <- function(...,
minimum = 30, minimum = 30,
as_percent = FALSE, as_percent = FALSE,
only_all_tested = 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( tryCatch(
sir_calc(..., sir_calc(...,
ab_result = c("S", "I"), ab_result = c("S", "I", "SDD"),
minimum = minimum, minimum = minimum,
as_percent = as_percent, as_percent = as_percent,
only_all_tested = only_all_tested, only_all_tested = only_all_tested,
+3 -7
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -83,10 +83,6 @@ random_disk <- function(size = NULL, mo = NULL, ab = NULL, ...) {
#' @export #' @export
random_sir <- function(size = NULL, prob_SIR = c(0.33, 0.33, 0.33), ...) { 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) 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) meet_criteria(prob_SIR, allow_class = c("numeric", "integer"), has_length = 3)
if (is.null(size)) { if (is.null(size)) {
size <- NROW(get_current_data(arg_name = "size", call = -3)) size <- NROW(get_current_data(arg_name = "size", call = -3))
+4 -4
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -231,7 +231,7 @@ resistance_predict <- function(x,
prediction <- predictmodel$fit prediction <- predictmodel$fit
se <- predictmodel$se.fit se <- predictmodel$se.fit
} else { } else {
stop("no valid model selected. See ?resistance_predict.") stop("no valid model selected. See `?resistance_predict`.")
} }
# prepare the output dataframe # prepare the output dataframe
+710 -295
View File
File diff suppressed because it is too large Load Diff
+24 -12
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -41,7 +41,7 @@ sir_calc <- function(...,
as_percent = FALSE, as_percent = FALSE,
only_all_tested = FALSE, only_all_tested = FALSE,
only_count = 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(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(as_percent, allow_class = "logical", has_length = 1)
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1) meet_criteria(only_all_tested, allow_class = "logical", has_length = 1)
@@ -137,11 +137,11 @@ sir_calc <- function(...,
if (isTRUE(only_all_tested)) { if (isTRUE(only_all_tested)) {
# no NAs in any column # no NAs in any column
y <- apply( y <- apply(
X = as.data.frame(lapply(x, as.integer), stringsAsFactors = FALSE), X = as.data.frame(lapply(x, as.double), stringsAsFactors = FALSE),
MARGIN = 1, MARGIN = 1,
FUN = min FUN = min
) )
numerator <- sum(as.integer(y) %in% as.integer(ab_result), na.rm = TRUE) numerator <- sum(!is.na(y) & y %in% as.double(ab_result), na.rm = TRUE)
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(anyNA(y)))) denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(anyNA(y))))
} else { } else {
# may contain NAs in any column # may contain NAs in any column
@@ -223,7 +223,7 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
combine_SI = TRUE, combine_SI = TRUE,
confidence_level = 0.95) { confidence_level = 0.95) {
meet_criteria(type, is_in = c("proportion", "count", "both"), has_length = 1) 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) meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
language <- validate_language(language) language <- validate_language(language)
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE) meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE)
@@ -249,7 +249,13 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
for (i in seq_len(ncol(data))) { for (i in seq_len(ncol(data))) {
if (is.sir(data[, i, drop = TRUE])) { if (is.sir(data[, i, drop = TRUE])) {
data[, i] <- as.character(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 +278,9 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
for (i in seq_len(ncol(.data))) { for (i in seq_len(ncol(.data))) {
values <- .data[, i, drop = TRUE] values <- .data[, i, drop = TRUE]
if (isTRUE(combine_SI)) { if (isTRUE(combine_SI)) {
values <- factor(values, levels = c("SI", "R"), ordered = TRUE) values <- factor(values, levels = c("SI", "R", "NI"), ordered = TRUE)
} else { } else {
values <- factor(values, levels = c("S", "I", "R"), ordered = TRUE) values <- factor(values, levels = c("S", "SDD", "I", "R", "NI"), ordered = TRUE)
} }
col_results <- as.data.frame(as.matrix(table(values)), stringsAsFactors = FALSE) col_results <- as.data.frame(as.matrix(table(values)), stringsAsFactors = FALSE)
col_results$interpretation <- rownames(col_results) col_results$interpretation <- rownames(col_results)
@@ -351,8 +357,14 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
} else { } else {
# don't use as.sir() here, as it would add the class 'sir' and we would like # 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 # the same data structure as output, regardless of input
out$interpretation <- factor(out$interpretation, levels = c("S", "I", "R"), ordered = TRUE) if (out$value[out$interpretation == "SDD"] > 0) {
out$interpretation <- factor(out$interpretation, levels = c("S", "SDD", "I", "R"), ordered = TRUE)
} else {
out$interpretation <- factor(out$interpretation, levels = c("S", "I", "R"), ordered = TRUE)
}
} }
out <- out[!is.na(out$interpretation), , drop = FALSE]
if (data_has_groups) { if (data_has_groups) {
# ordering by the groups and two more: "antibiotic" and "interpretation" # ordering by the groups and two more: "antibiotic" and "interpretation"
@@ -373,5 +385,5 @@ sir_calc_df <- function(type, # "proportion", "count" or "both"
rownames(out) <- NULL rownames(out) <- NULL
out <- as_original_data_class(out, class(data.bak)) # will remove tibble groups 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)))
} }
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+74 -29
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -34,7 +34,8 @@
# see https://github.com/tidyverse/dplyr/issues/5955 why this is required # 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, ...) { vec_ptype2.character.ab_selector <- function(x, y, ...) {
x x
} }
@@ -45,7 +46,8 @@ vec_cast.character.ab_selector <- function(x, to, ...) {
unclass(x) 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, ...) { vec_ptype2.logical.ab_selector_any_all <- function(x, y, ...) {
x x
} }
@@ -56,12 +58,12 @@ vec_cast.logical.ab_selector_any_all <- function(x, to, ...) {
unclass(x) unclass(x)
} }
# S3: ab # S3: ab ----
vec_ptype2.character.ab <- function(x, y, ...) { vec_ptype2.ab.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x x
} }
vec_ptype2.ab.character <- function(x, y, ...) { vec_ptype2.ab.ab <- function(x, y, ...) {
y x
} }
vec_cast.character.ab <- function(x, to, ...) { vec_cast.character.ab <- function(x, to, ...) {
as.character(x) 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)) return_after_integrity_check(x, "antimicrobial drug code", as.character(AMR_env$AB_lookup$ab))
} }
# S3: av # S3: av ----
vec_ptype2.character.av <- function(x, y, ...) { vec_ptype2.av.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x x
} }
vec_ptype2.av.character <- function(x, y, ...) { vec_ptype2.av.av <- function(x, y, ...) {
y x
} }
vec_cast.character.av <- function(x, to, ...) { vec_cast.character.av <- function(x, to, ...) {
as.character(x) 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)) return_after_integrity_check(x, "antiviral drug code", as.character(AMR_env$AV_lookup$av))
} }
# S3: mo # S3: mo ----
vec_ptype2.character.mo <- function(x, y, ...) { vec_ptype2.mo.default <- function (x, y, ..., x_arg = "", y_arg = "") {
x x
} }
vec_ptype2.mo.character <- function(x, y, ...) { vec_ptype2.mo.mo <- function(x, y, ...) {
y x
} }
vec_cast.character.mo <- function(x, to, ...) { vec_cast.character.mo <- function(x, to, ...) {
as.character(x) as.character(x)
@@ -99,12 +101,21 @@ vec_cast.mo.character <- function(x, to, ...) {
return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo)) return_after_integrity_check(x, "microorganism code", as.character(AMR_env$MO_lookup$mo))
} }
# S3: disk # S3: disk ----
vec_ptype2.integer.disk <- function(x, y, ...) { vec_ptype_full.disk <- function(x, ...) {
x "disk"
} }
vec_ptype2.disk.integer <- function(x, y, ...) { vec_ptype_abbr.disk <- function(x, ...) {
y "dsk"
}
vec_ptype2.disk.default <- function (x, y, ..., x_arg = "", y_arg = "") {
NA_disk_[0]
}
vec_ptype2.disk.disk <- function(x, y, ...) {
NA_disk_[0]
}
vec_cast.disk.disk <- function(x, to, ...) {
as.disk(x)
} }
vec_cast.integer.disk <- function(x, to, ...) { vec_cast.integer.disk <- function(x, to, ...) {
unclass(x) unclass(x)
@@ -125,29 +136,63 @@ vec_cast.disk.character <- function(x, to, ...) {
as.disk(x) 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
NA_mic_[0]
}
vec_ptype2.mic.mic <- function(x, y, ...) {
# this will make sure that currently implemented MIC levels are returned
NA_mic_[0]
}
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, ...) { vec_cast.character.mic <- function(x, to, ...) {
as.character(x) as.character(x)
} }
vec_cast.double.mic <- function(x, to, ...) { vec_cast.double.mic <- function(x, to, ...) {
as.double(x) 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, ...) { vec_cast.mic.double <- function(x, to, ...) {
as.mic(x) as.mic(x)
} }
vec_cast.mic.character <- function(x, to, ...) { vec_cast.mic.character <- function(x, to, ...) {
as.mic(x) 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, ...) { vec_math.mic <- function(.fn, x, ...) {
.fn(as.double(x), ...) .fn(as.double(x), ...)
} }
vec_arith.mic <- function(op, x, y, ...) {
# S3: sir vctrs::vec_arith(op, as.double(x), as.double(y))
vec_ptype2.character.sir <- function(x, y, ...) {
x
} }
vec_ptype2.sir.character <- function(x, y, ...) {
y # S3: sir ----
vec_ptype2.sir.default <- function (x, y, ..., x_arg = "", y_arg = "") {
NA_sir_[0]
}
vec_ptype2.sir.sir <- function(x, y, ...) {
NA_sir_[0]
}
vec_ptype2.character.sir <- function(x, y, ...) {
NA_sir_[0]
}
vec_cast.sir.sir <- function(x, to, ...) {
# this makes sure that old SIR objects (with S/I/R) are converted to the current structure (S/SDD/I/R/NI)
as.sir(x)
} }
vec_cast.character.sir <- function(x, to, ...) { vec_cast.character.sir <- function(x, to, ...) {
as.character(x) as.character(x)
+5 -5
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -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. #' 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: #' @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. #' 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. #' 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 #' @name WHOCC
#' @rdname WHOCC #' @rdname WHOCC
+11 -168
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -27,171 +27,14 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ # # how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== # # ==================================================================== #
#' Deprecated Functions # #' 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). # #' 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 # #' @keywords internal
#' @name AMR-deprecated # #' @name AMR-deprecated
#' @rdname AMR-deprecated # #' @rdname AMR-deprecated
#' @export # #' @export
NA_rsi_ <- set_clean_class(factor(NA_character_, levels = c("S", "I", "R"), ordered = TRUE), # NULL
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
deprecation_warning <- function(old = NULL, new = NULL, extra_msg = NULL, is_function = TRUE) { deprecation_warning <- function(old = NULL, new = NULL, extra_msg = NULL, is_function = TRUE) {
if (is.null(old)) { if (is.null(old)) {
+74 -48
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -58,16 +58,20 @@ AMR_env$av_previously_coerced <- data.frame(
AMR_env$sir_interpretation_history <- data.frame( AMR_env$sir_interpretation_history <- data.frame(
datetime = Sys.time()[0], datetime = Sys.time()[0],
index = integer(0), index = integer(0),
ab_user = character(0), ab_given = character(0),
mo_user = character(0), mo_given = character(0),
host_given = character(0),
ab = set_clean_class(character(0), c("ab", "character")), ab = set_clean_class(character(0), c("ab", "character")),
mo = set_clean_class(character(0), c("mo", "character")), mo = set_clean_class(character(0), c("mo", "character")),
host = character(0),
method = character(0),
input = double(0), input = double(0),
outcome = NA_sir_[0], outcome = NA_sir_[0],
method = character(0), notes = character(0),
breakpoint_S_R = character(0),
guideline = character(0), guideline = character(0),
ref_table = character(0), ref_table = character(0),
uti = logical(0),
breakpoint_S_R = character(0),
stringsAsFactors = FALSE stringsAsFactors = FALSE
) )
@@ -77,17 +81,15 @@ AMR_env$is_dark_theme <- NULL
AMR_env$chmatch <- import_fn("chmatch", "data.table", error_on_fail = FALSE) AMR_env$chmatch <- import_fn("chmatch", "data.table", error_on_fail = FALSE)
AMR_env$chin <- import_fn("%chin%", "data.table", error_on_fail = FALSE) AMR_env$chin <- import_fn("%chin%", "data.table", error_on_fail = FALSE)
# determine info icon for messages # take cli symbols and error function if available
if (pkg_is_available("cli")) { AMR_env$info_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$info %or% "i"
# let cli do the determination of supported symbols AMR_env$bullet_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$bullet %or% "*"
AMR_env$info_icon <- import_fn("symbol", "cli")$info
AMR_env$bullet_icon <- import_fn("symbol", "cli")$bullet AMR_env$cross_icon <- if (isTRUE(base::l10n_info()$`UTF-8`)) "\u00d7" else "x"
AMR_env$dots <- import_fn("symbol", "cli")$ellipsis
} else { AMR_env$dots <- import_fn("symbol", "cli", error_on_fail = FALSE)$ellipsis %or% "..."
AMR_env$info_icon <- "i" AMR_env$sup_1_icon <- import_fn("symbol", "cli", error_on_fail = FALSE)$sup_1 %or% "*"
AMR_env$bullet_icon <- "*" AMR_env$cli_abort <- import_fn("cli_abort", "cli", error_on_fail = FALSE)
AMR_env$dots <- "..."
}
.onLoad <- function(lib, pkg) { .onLoad <- function(lib, pkg) {
# Support for tibble headers (type_sum) and tibble columns content (pillar_shaft) # Support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
@@ -98,16 +100,16 @@ if (pkg_is_available("cli")) {
s3_register("pillar::pillar_shaft", "av") s3_register("pillar::pillar_shaft", "av")
s3_register("pillar::pillar_shaft", "mo") s3_register("pillar::pillar_shaft", "mo")
s3_register("pillar::pillar_shaft", "sir") 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", "mic")
s3_register("pillar::pillar_shaft", "disk") s3_register("pillar::pillar_shaft", "disk")
# no type_sum of disk, that's now in vctrs::vec_ptype_full
s3_register("pillar::type_sum", "ab") s3_register("pillar::type_sum", "ab")
s3_register("pillar::type_sum", "av") s3_register("pillar::type_sum", "av")
s3_register("pillar::type_sum", "mo") s3_register("pillar::type_sum", "mo")
s3_register("pillar::type_sum", "sir") 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", "mic")
s3_register("pillar::type_sum", "disk") s3_register("pillar::tbl_sum", "antibiogram")
s3_register("pillar::tbl_format_footer", "antibiogram")
# Support for frequency tables from the cleaner package # Support for frequency tables from the cleaner package
s3_register("cleaner::freq", "mo") s3_register("cleaner::freq", "mo")
s3_register("cleaner::freq", "sir") s3_register("cleaner::freq", "sir")
@@ -132,6 +134,7 @@ if (pkg_is_available("cli")) {
s3_register("knitr::knit_print", "antibiogram") s3_register("knitr::knit_print", "antibiogram")
s3_register("knitr::knit_print", "formatted_bug_drug_combinations") s3_register("knitr::knit_print", "formatted_bug_drug_combinations")
# Support vctrs package for use in e.g. dplyr verbs # 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: ab_selector
s3_register("vctrs::vec_ptype2", "character.ab_selector") s3_register("vctrs::vec_ptype2", "character.ab_selector")
s3_register("vctrs::vec_ptype2", "ab_selector.character") s3_register("vctrs::vec_ptype2", "ab_selector.character")
@@ -141,23 +144,26 @@ if (pkg_is_available("cli")) {
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical") s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all") s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
# S3: ab # S3: ab
s3_register("vctrs::vec_ptype2", "character.ab") s3_register("vctrs::vec_ptype2", "ab.default")
s3_register("vctrs::vec_ptype2", "ab.character") s3_register("vctrs::vec_ptype2", "ab.ab")
s3_register("vctrs::vec_cast", "character.ab") s3_register("vctrs::vec_cast", "character.ab")
s3_register("vctrs::vec_cast", "ab.character") s3_register("vctrs::vec_cast", "ab.character")
# S3: av # S3: av
s3_register("vctrs::vec_ptype2", "character.av") s3_register("vctrs::vec_ptype2", "av.default")
s3_register("vctrs::vec_ptype2", "av.character") s3_register("vctrs::vec_ptype2", "av.av")
s3_register("vctrs::vec_cast", "character.av") s3_register("vctrs::vec_cast", "character.av")
s3_register("vctrs::vec_cast", "av.character") s3_register("vctrs::vec_cast", "av.character")
# S3: mo # S3: mo
s3_register("vctrs::vec_ptype2", "character.mo") s3_register("vctrs::vec_ptype2", "mo.default")
s3_register("vctrs::vec_ptype2", "mo.character") s3_register("vctrs::vec_ptype2", "mo.mo")
s3_register("vctrs::vec_cast", "character.mo") s3_register("vctrs::vec_cast", "character.mo")
s3_register("vctrs::vec_cast", "mo.character") s3_register("vctrs::vec_cast", "mo.character")
# S3: disk # S3: disk
s3_register("vctrs::vec_ptype2", "integer.disk") s3_register("vctrs::vec_ptype_full", "disk")
s3_register("vctrs::vec_ptype2", "disk.integer") 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", "disk.disk")
s3_register("vctrs::vec_cast", "integer.disk") s3_register("vctrs::vec_cast", "integer.disk")
s3_register("vctrs::vec_cast", "disk.integer") s3_register("vctrs::vec_cast", "disk.integer")
s3_register("vctrs::vec_cast", "double.disk") s3_register("vctrs::vec_cast", "double.disk")
@@ -165,16 +171,26 @@ if (pkg_is_available("cli")) {
s3_register("vctrs::vec_cast", "character.disk") s3_register("vctrs::vec_cast", "character.disk")
s3_register("vctrs::vec_cast", "disk.character") s3_register("vctrs::vec_cast", "disk.character")
# S3: mic # 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", "character.mic")
s3_register("vctrs::vec_cast", "double.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.character")
s3_register("vctrs::vec_cast", "mic.double") 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_math", "mic")
s3_register("vctrs::vec_arith", "mic")
# S3: sir # S3: sir
s3_register("vctrs::vec_ptype2", "sir.default")
s3_register("vctrs::vec_ptype2", "sir.sir")
s3_register("vctrs::vec_ptype2", "character.sir") s3_register("vctrs::vec_ptype2", "character.sir")
s3_register("vctrs::vec_ptype2", "sir.character")
s3_register("vctrs::vec_cast", "character.sir") s3_register("vctrs::vec_cast", "character.sir")
s3_register("vctrs::vec_cast", "sir.character") s3_register("vctrs::vec_cast", "sir.character")
s3_register("vctrs::vec_cast", "sir.sir")
# if mo source exists, fire it up (see mo_source()) # if mo source exists, fire it up (see mo_source())
if (tryCatch(file.exists(getOption("AMR_mo_source", "~/mo_source.rds")), error = function(e) FALSE)) { if (tryCatch(file.exists(getOption("AMR_mo_source", "~/mo_source.rds")), error = function(e) FALSE)) {
@@ -189,31 +205,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) # 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$AB_lookup <- cbind(AMR::antibiotics, AB_LOOKUP)
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_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) { .onAttach <- function(lib, pkg) {
# if custom ab option is available, load it # if custom ab option is available, load it
if (!is.null(getOption("AMR_custom_ab")) && file.exists(getOption("AMR_custom_ab", default = ""))) { 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) if (getOption("AMR_custom_ab") %unlike% "[.]rds$") {
x <- readRDS_AMR(getOption("AMR_custom_ab")) packageStartupMessage("The file with custom antimicrobials must be an RDS file. Set the option `AMR_custom_ab` to another path.")
tryCatch( } else {
{ packageStartupMessage("Adding custom antimicrobials from '", getOption("AMR_custom_ab"), "'...", appendLF = FALSE)
suppressWarnings(suppressMessages(add_custom_antimicrobials(x))) x <- readRDS_AMR(getOption("AMR_custom_ab"))
packageStartupMessage("OK.") tryCatch(
}, {
error = function(e) packageStartupMessage("Failed: ", e$message) suppressWarnings(suppressMessages(add_custom_antimicrobials(x)))
) packageStartupMessage("OK.")
},
error = function(e) packageStartupMessage("Failed: ", e$message)
)
}
} }
# if custom mo option is available, load it # if custom mo option is available, load it
if (!is.null(getOption("AMR_custom_mo")) && file.exists(getOption("AMR_custom_mo", default = ""))) { 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) if (getOption("AMR_custom_mo") %unlike% "[.]rds$") {
x <- readRDS_AMR(getOption("AMR_custom_mo")) packageStartupMessage("The file with custom microorganisms must be an RDS file. Set the option `AMR_custom_mo` to another path.")
tryCatch( } else {
{ packageStartupMessage("Adding custom microorganisms from '", getOption("AMR_custom_mo"), "'...", appendLF = FALSE)
suppressWarnings(suppressMessages(add_custom_microorganisms(x))) x <- readRDS_AMR(getOption("AMR_custom_mo"))
packageStartupMessage("OK.") tryCatch(
}, {
error = function(e) packageStartupMessage("Failed: ", e$message) 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. 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)).
`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.
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. 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.
+32 -25
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -35,15 +35,11 @@ template:
bootswatch: "flatly" bootswatch: "flatly"
assets: "pkgdown/logos" # use logos in this folder assets: "pkgdown/logos" # use logos in this folder
bslib: bslib:
base_font: {google: "Lato"}
heading_font: {google: "Lato"}
code_font: {google: "Fira Code"} code_font: {google: "Fira Code"}
# body-text-align: "justify" # body-text-align: "justify"
line-height-base: 1.75 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 # make top bar a bit wider
navbar-padding-y: "0.5rem" navbar-padding-y: "0.5rem"
opengraph: opengraph:
@@ -174,7 +170,7 @@ reference:
- "`atc_online_property`" - "`atc_online_property`"
- "`add_custom_antimicrobials`" - "`add_custom_antimicrobials`"
- title: "Preparing data: antimicrobial resistance" - title: "Preparing data: antimicrobial results"
desc: > desc: >
With `as.mic()` and `as.disk()` you can transform your raw input to valid MIC or disk diffusion values. 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. 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`" - "`eucast_rules`"
- "`custom_eucast_rules`" - "`custom_eucast_rules`"
- title: "Analysing data: antimicrobial resistance" - title: "Analysing data"
desc: > desc: >
Use these function for the analysis part. You can use `susceptibility()` or `resistance()` on any antibiotic column. 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 With `antibiogram()`, you can generate a traditional, combined, syndromic, or weighted-incidence syndromic combination
@@ -202,15 +198,26 @@ reference:
- "`key_antimicrobials`" - "`key_antimicrobials`"
- "`mdro`" - "`mdro`"
- "`count`" - "`count`"
- "`plot`"
- "`ggplot_sir`"
- "`bug_drug_combinations`" - "`bug_drug_combinations`"
- "`antibiotic_class_selectors`" - "`antibiotic_class_selectors`"
- "`mean_amr_distance`" - "`mean_amr_distance`"
- "`resistance_predict`" - "`resistance_predict`"
- "`guess_ab_col`" - "`guess_ab_col`"
- title: "Other: AMR-specific options" - 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: "AMR-specific options"
desc: > desc: >
The AMR package is customisable, by providing settings that can be set per user or per team. For The AMR package is customisable, by providing settings that can be set per user or per team. For
example, the default interpretation guideline can be changed from EUCAST to CLSI, or a supported example, the default interpretation guideline can be changed from EUCAST to CLSI, or a supported
@@ -235,16 +242,16 @@ reference:
Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html) Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html)
for more information about how to work with functions in this package. for more information about how to work with functions in this package.
contents: contents:
- "`example_isolates`"
- "`microorganisms`" - "`microorganisms`"
- "`antibiotics`"
- "`clinical_breakpoints`"
- "`example_isolates`"
- "`microorganisms.codes`" - "`microorganisms.codes`"
- "`microorganisms.groups`" - "`microorganisms.groups`"
- "`antibiotics`"
- "`intrinsic_resistant`" - "`intrinsic_resistant`"
- "`dosage`" - "`dosage`"
- "`WHOCC`" - "`WHOCC`"
- "`example_isolates_unclean`" - "`example_isolates_unclean`"
- "`clinical_breakpoints`"
- "`WHONET`" - "`WHONET`"
- title: "Other: miscellaneous functions" - title: "Other: miscellaneous functions"
@@ -255,9 +262,9 @@ reference:
contents: contents:
- "`age_groups`" - "`age_groups`"
- "`age`" - "`age`"
- "`export_ncbi_biosample`"
- "`availability`" - "`availability`"
- "`get_AMR_locale`" - "`get_AMR_locale`"
- "`ggplot_pca`"
- "`italicise_taxonomy`" - "`italicise_taxonomy`"
- "`join`" - "`join`"
- "`like`" - "`like`"
@@ -273,10 +280,10 @@ reference:
- "`kurtosis`" - "`kurtosis`"
- "`skewness`" - "`skewness`"
- title: "Other: deprecated functions" # - title: "Other: deprecated functions"
desc: > # desc: >
These functions are deprecated, meaning that they will still # These functions are deprecated, meaning that they will still
work but show a warning with every use and will be removed # work but show a warning with every use and will be removed
in a future version. # in a future version.
contents: # contents:
- "`AMR-deprecated`" # - "`AMR-deprecated`"
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
+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
+69
View File
@@ -0,0 +1,69 @@
---
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)
# 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)
```
### 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()
```
Binary file not shown.
+3 -3
View File
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -6,9 +6,9 @@
# https://github.com/msberends/AMR # # https://github.com/msberends/AMR #
# # # #
# PLEASE CITE THIS SOFTWARE AS: # # PLEASE CITE THIS SOFTWARE AS: #
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C # # Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance # # AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Data. Journal of Statistical Software, 104(3), 1-31. # # Journal of Statistical Software, 104(3), 1-31. #
# https://doi.org/10.18637/jss.v104.i03 # # https://doi.org/10.18637/jss.v104.i03 #
# # # #
# Developed at the University of Groningen and the University Medical # # Developed at the University of Groningen and the University Medical #
@@ -28,7 +28,7 @@
# ==================================================================== # # ==================================================================== #
# Run this file to update the package using: # 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) library(dplyr, warn.conflicts = FALSE)
try(detach("package:data.table", unload = TRUE), silent = TRUE) # to prevent like() to precede over AMR::like try(detach("package:data.table", unload = TRUE), silent = TRUE) # to prevent like() to precede over AMR::like
@@ -36,12 +36,14 @@ devtools::load_all(quiet = TRUE)
suppressMessages(set_AMR_locale("English")) suppressMessages(set_AMR_locale("English"))
old_globalenv <- ls(envir = globalenv()) pre_commit_lst <- list()
# Save internal data to R/sysdata.rda ------------------------------------- # Save internal data to R/sysdata.rda -------------------------------------
usethis::ui_info(paste0("Updating internal package data"))
# See 'data-raw/eucast_rules.tsv' for the EUCAST reference file # See 'data-raw/eucast_rules.tsv' for the EUCAST reference file
EUCAST_RULES_DF <- utils::read.delim( pre_commit_lst$EUCAST_RULES_DF <- utils::read.delim(
file = "data-raw/eucast_rules.tsv", file = "data-raw/eucast_rules.tsv",
skip = 9, skip = 9,
sep = "\t", sep = "\t",
@@ -67,7 +69,7 @@ EUCAST_RULES_DF <- utils::read.delim(
mutate(reference.rule_group = as.character(reference.rule_group)) %>% mutate(reference.rule_group = as.character(reference.rule_group)) %>%
select(-sorting_rule) select(-sorting_rule)
TRANSLATIONS <- utils::read.delim( pre_commit_lst$TRANSLATIONS <- utils::read.delim(
file = "data-raw/translations.tsv", file = "data-raw/translations.tsv",
sep = "\t", sep = "\t",
stringsAsFactors = FALSE, stringsAsFactors = FALSE,
@@ -82,15 +84,15 @@ TRANSLATIONS <- utils::read.delim(
quote = "" quote = ""
) )
LANGUAGES_SUPPORTED_NAMES <- c( pre_commit_lst$LANGUAGES_SUPPORTED_NAMES <- c(
list(en = list(exonym = "English", endonym = "English")), list(en = list(exonym = "English", endonym = "English")),
lapply( lapply(
TRANSLATIONS[, which(nchar(colnames(TRANSLATIONS)) == 2), drop = FALSE], TRANSLATIONS[, which(nchar(colnames(pre_commit_lst$TRANSLATIONS)) == 2), drop = FALSE],
function(x) list(exonym = x[1], endonym = x[2]) function(x) list(exonym = x[1], endonym = x[2])
) )
) )
LANGUAGES_SUPPORTED <- names(LANGUAGES_SUPPORTED_NAMES) pre_commit_lst$LANGUAGES_SUPPORTED <- names(pre_commit_lst$LANGUAGES_SUPPORTED_NAMES)
# vectors of CoNS and CoPS, improves speed in as.mo() # vectors of CoNS and CoPS, improves speed in as.mo()
create_species_cons_cops <- function(type = c("CoNS", "CoPS")) { create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
@@ -120,7 +122,8 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
"vitulinus", "vitulus", "warneri", "xylosus", "vitulinus", "vitulus", "warneri", "xylosus",
"caledonicus", "canis", "caledonicus", "canis",
"durrellii", "lloydii", "durrellii", "lloydii",
"ratti", "taiwanensis", "veratri", "urealyticus" "ratti", "taiwanensis", "veratri", "urealyticus",
"americanisciuri", "marylandisciuri", "shinii", "brunensis"
) | ) |
# old, now renamed to S. schleiferi (but still as synonym in our data of course): # old, now renamed to S. schleiferi (but still as synonym in our data of course):
(MO_staph$species == "schleiferi" & MO_staph$subspecies %in% c("schleiferi", ""))), (MO_staph$species == "schleiferi" & MO_staph$subspecies %in% c("schleiferi", ""))),
@@ -147,108 +150,223 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
] ]
} }
} }
MO_CONS <- create_species_cons_cops("CoNS") pre_commit_lst$MO_CONS <- create_species_cons_cops("CoNS")
MO_COPS <- create_species_cons_cops("CoPS") pre_commit_lst$MO_COPS <- create_species_cons_cops("CoPS")
MO_STREP_ABCG <- AMR::microorganisms$mo[which(AMR::microorganisms$genus == "Streptococcus" & pre_commit_lst$MO_STREP_ABCG <- AMR::microorganisms$mo[which(AMR::microorganisms$genus == "Streptococcus" &
tolower(AMR::microorganisms$species) %in% c( tolower(AMR::microorganisms$species) %in% c(
"pyogenes", "agalactiae", "dysgalactiae", "equi", "canis", "pyogenes", "agalactiae", "dysgalactiae", "equi", "canis",
"group a", "group b", "group c", "group g" "group a", "group b", "group c", "group g"
))] ))]
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(_|$))")] pre_commit_lst$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( pre_commit_lst$MO_PREVALENT_GENERA <- c(
"Absidia", "Acanthamoeba", "Acremonium", "Aedes", "Alternaria", "Amoeba", "Ancylostoma", "Angiostrongylus", "Absidia",
"Anisakis", "Anopheles", "Apophysomyces", "Aspergillus", "Aureobasidium", "Basidiobolus", "Beauveria", "Acanthamoeba",
"Blastocystis", "Blastomyces", "Candida", "Capillaria", "Chaetomium", "Chrysonilia", "Cladophialophora", "Acremonium",
"Cladosporium", "Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Aedes",
"Dermatobia", "Dientamoeba", "Diphyllobothrium", "Dirofilaria", "Echinostoma", "Entamoeba", "Enterobius", "Alternaria",
"Exophiala", "Exserohilum", "Fasciola", "Fonsecaea", "Fusarium", "Giardia", "Haloarcula", "Halobacterium", "Amoeba",
"Halococcus", "Hendersonula", "Heterophyes", "Histomonas", "Histoplasma", "Hymenolepis", "Hypomyces", "Ancylostoma",
"Hysterothylacium", "Leishmania", "Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma", "Microsporidium", "Angiostrongylus",
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Necator", "Nectria", "Ochroconis", "Oesophagostomum", "Anisakis",
"Oidiodendron", "Opisthorchis", "Pediculus", "Penicillium", "Phlebotomus", "Phoma", "Pichia", "Piedraia", "Pithomyces", "Anopheles",
"Pityrosporum", "Pneumocystis", "Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus", "Apophysomyces",
"Rhodotorula", "Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Arthroderma",
"Sporobolomyces", "Stachybotrys", "Strongyloides", "Syngamus", "Taenia", "Talaromyces", "Toxocara", "Trichinella", "Aspergillus",
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Aureobasidium",
"Tritirachium", "Trombicula", "Trypanosoma", "Tunga", "Wuchereria" "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",
"Geotrichum",
"Giardia",
"Haloarcula",
"Halobacterium",
"Halococcus",
"Hansenula",
"Hendersonula",
"Heterophyes",
"Histomonas",
"Histoplasma",
"Hymenolepis",
"Hypomyces",
"Hysterothylacium",
"Kloeckera",
"Kluyveromyces",
"Kodamaea",
"Leishmania",
"Lichtheimia",
"Lodderomyces",
"Lomentospora",
"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",
"Pseudoscopulariopsis",
"Pseudoterranova",
"Pulex",
"Rhizomucor",
"Rhizopus",
"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",
"Verticillium",
"Wuchereria"
) )
# antibiotic groups # antibiotic groups
# (these will also be used for eucast_rules() and understanding data-raw/eucast_rules.tsv) # (these will also be used for eucast_rules() and understanding data-raw/eucast_rules.tsv)
globalenv_before_ab <- c(ls(envir = globalenv()), "globalenv_before_ab") pre_commit_lst$AB_AMINOGLYCOSIDES <- antibiotics %>%
AB_AMINOGLYCOSIDES <- antibiotics %>%
filter(group %like% "aminoglycoside") %>% filter(group %like% "aminoglycoside") %>%
pull(ab) pull(ab)
AB_AMINOPENICILLINS <- as.ab(c("AMP", "AMX")) pre_commit_lst$AB_AMINOPENICILLINS <- as.ab(c("AMP", "AMX"))
AB_ANTIFUNGALS <- AMR_env$AB_lookup %>% pre_commit_lst$AB_ANTIFUNGALS <- antibiotics %>%
filter(group %like% "antifungal") %>% filter(group %like% "antifungal") %>%
pull(ab) pull(ab)
AB_ANTIMYCOBACTERIALS <- AMR_env$AB_lookup %>% pre_commit_lst$AB_ANTIMYCOBACTERIALS <- antibiotics %>%
filter(group %like% "antimycobacterial") %>% filter(group %like% "antimycobacterial") %>%
pull(ab) pull(ab)
AB_CARBAPENEMS <- antibiotics %>% pre_commit_lst$AB_CARBAPENEMS <- antibiotics %>%
filter(group %like% "carbapenem") %>% filter(group %like% "carbapenem") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS <- antibiotics %>%
filter(group %like% "cephalosporin") %>% filter(group %like% "cephalosporin") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_1ST <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS_1ST <- antibiotics %>%
filter(group %like% "cephalosporin.*1") %>% filter(group %like% "cephalosporin.*1") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_2ND <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS_2ND <- antibiotics %>%
filter(group %like% "cephalosporin.*2") %>% filter(group %like% "cephalosporin.*2") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_3RD <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS_3RD <- antibiotics %>%
filter(group %like% "cephalosporin.*3") %>% filter(group %like% "cephalosporin.*3") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_4TH <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS_4TH <- antibiotics %>%
filter(group %like% "cephalosporin.*4") %>% filter(group %like% "cephalosporin.*4") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_5TH <- antibiotics %>% pre_commit_lst$AB_CEPHALOSPORINS_5TH <- antibiotics %>%
filter(group %like% "cephalosporin.*5") %>% filter(group %like% "cephalosporin.*5") %>%
pull(ab) pull(ab)
AB_CEPHALOSPORINS_EXCEPT_CAZ <- AB_CEPHALOSPORINS[AB_CEPHALOSPORINS != "CAZ"] pre_commit_lst$AB_CEPHALOSPORINS_EXCEPT_CAZ <- pre_commit_lst$AB_CEPHALOSPORINS[pre_commit_lst$AB_CEPHALOSPORINS != "CAZ"]
AB_FLUOROQUINOLONES <- antibiotics %>% pre_commit_lst$AB_FLUOROQUINOLONES <- antibiotics %>%
filter(atc_group2 %like% "fluoroquinolone" | (group %like% "quinolone" & is.na(atc_group2))) %>% filter(atc_group2 %like% "fluoroquinolone" | (group %like% "quinolone" & is.na(atc_group2))) %>%
pull(ab) pull(ab)
AB_GLYCOPEPTIDES <- antibiotics %>% pre_commit_lst$AB_GLYCOPEPTIDES <- antibiotics %>%
filter(group %like% "glycopeptide") %>% filter(group %like% "glycopeptide") %>%
pull(ab) pull(ab)
AB_LIPOGLYCOPEPTIDES <- as.ab(c("DAL", "ORI", "TLV")) # dalba/orita/tela pre_commit_lst$AB_LIPOGLYCOPEPTIDES <- as.ab(c("DAL", "ORI", "TLV")) # dalba/orita/tela
AB_GLYCOPEPTIDES_EXCEPT_LIPO <- AB_GLYCOPEPTIDES[!AB_GLYCOPEPTIDES %in% AB_LIPOGLYCOPEPTIDES] pre_commit_lst$AB_GLYCOPEPTIDES_EXCEPT_LIPO <- pre_commit_lst$AB_GLYCOPEPTIDES[!pre_commit_lst$AB_GLYCOPEPTIDES %in% pre_commit_lst$AB_LIPOGLYCOPEPTIDES]
AB_LINCOSAMIDES <- antibiotics %>% pre_commit_lst$AB_LINCOSAMIDES <- antibiotics %>%
filter(atc_group2 %like% "lincosamide" | (group %like% "lincosamide" & is.na(atc_group2))) %>% filter(atc_group2 %like% "lincosamide" | (group %like% "lincosamide" & is.na(atc_group2))) %>%
pull(ab) pull(ab)
AB_MACROLIDES <- antibiotics %>% pre_commit_lst$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) pull(ab)
AB_OXAZOLIDINONES <- antibiotics %>% pre_commit_lst$AB_NITROFURANS <- antibiotics %>%
filter(name %like% "^furaz|nitrofura" | atc_group2 %like% "nitrofuran") %>%
pull(ab)
pre_commit_lst$AB_OXAZOLIDINONES <- antibiotics %>%
filter(group %like% "oxazolidinone") %>% filter(group %like% "oxazolidinone") %>%
pull(ab) pull(ab)
AB_PENICILLINS <- antibiotics %>% pre_commit_lst$AB_PENICILLINS <- antibiotics %>%
filter(group %like% "penicillin") %>% filter(group %like% "penicillin") %>%
pull(ab) pull(ab)
AB_POLYMYXINS <- antibiotics %>% pre_commit_lst$AB_POLYMYXINS <- antibiotics %>%
filter(group %like% "polymyxin") %>% filter(group %like% "polymyxin") %>%
pull(ab) pull(ab)
AB_QUINOLONES <- antibiotics %>% pre_commit_lst$AB_QUINOLONES <- antibiotics %>%
filter(group %like% "quinolone") %>% filter(group %like% "quinolone") %>%
pull(ab) pull(ab)
AB_STREPTOGRAMINS <- antibiotics %>% pre_commit_lst$AB_RIFAMYCINS <- antibiotics %>%
filter(name %like% "Rifampi|Rifabutin|Rifapentine|rifamy") %>%
pull(ab)
pre_commit_lst$AB_STREPTOGRAMINS <- antibiotics %>%
filter(atc_group2 %like% "streptogramin") %>% filter(atc_group2 %like% "streptogramin") %>%
pull(ab) pull(ab)
AB_TETRACYCLINES <- antibiotics %>% pre_commit_lst$AB_TETRACYCLINES <- antibiotics %>%
filter(group %like% "tetracycline") %>% filter(group %like% "tetracycline") %>%
pull(ab) pull(ab)
AB_TETRACYCLINES_EXCEPT_TGC <- AB_TETRACYCLINES[AB_TETRACYCLINES != "TGC"] pre_commit_lst$AB_TETRACYCLINES_EXCEPT_TGC <- pre_commit_lst$AB_TETRACYCLINES[pre_commit_lst$AB_TETRACYCLINES != "TGC"]
AB_TRIMETHOPRIMS <- antibiotics %>% pre_commit_lst$AB_TRIMETHOPRIMS <- antibiotics %>%
filter(group %like% "trimethoprim") %>% filter(group %like% "trimethoprim") %>%
pull(ab) pull(ab)
AB_UREIDOPENICILLINS <- as.ab(c("PIP", "TZP", "AZL", "MEZ")) pre_commit_lst$AB_UREIDOPENICILLINS <- as.ab(c("PIP", "TZP", "AZL", "MEZ"))
AB_BETALACTAMS <- c(AB_PENICILLINS, AB_CEPHALOSPORINS, AB_CARBAPENEMS) pre_commit_lst$AB_BETALACTAMS <- c(pre_commit_lst$AB_PENICILLINS, pre_commit_lst$AB_CEPHALOSPORINS, pre_commit_lst$AB_CARBAPENEMS)
# this will be used for documentation: # this will be used for documentation:
DEFINED_AB_GROUPS <- ls(envir = globalenv()) pre_commit_lst$DEFINED_AB_GROUPS <- sort(names(pre_commit_lst)[names(pre_commit_lst) %like% "^AB_" & names(pre_commit_lst) != "AB_LOOKUP"])
DEFINED_AB_GROUPS <- DEFINED_AB_GROUPS[!DEFINED_AB_GROUPS %in% globalenv_before_ab]
create_AB_AV_lookup <- function(df) { create_AB_AV_lookup <- function(df) {
new_df <- df new_df <- df
new_df$generalised_name <- generalise_antibiotic_name(new_df$name) new_df$generalised_name <- generalise_antibiotic_name(new_df$name)
@@ -275,60 +393,26 @@ create_AB_AV_lookup <- function(df) {
)) ))
new_df[, colnames(new_df)[colnames(new_df) %like% "^generalised"]] new_df[, colnames(new_df)[colnames(new_df) %like% "^generalised"]]
} }
AB_LOOKUP <- create_AB_AV_lookup(AMR::antibiotics) pre_commit_lst$AB_LOOKUP <- create_AB_AV_lookup(AMR::antibiotics)
AV_LOOKUP <- create_AB_AV_lookup(AMR::antivirals) pre_commit_lst$AV_LOOKUP <- create_AB_AV_lookup(AMR::antivirals)
# Export to package as internal data ---- # Export to package as internal data ----
usethis::ui_info(paste0("Updating internal package data")) # usethis::use_data() must receive unquoted object names, which is not flexible at all.
suppressMessages(usethis::use_data(EUCAST_RULES_DF, # we'll use good old base::save() instead
TRANSLATIONS, save(list = names(pre_commit_lst),
LANGUAGES_SUPPORTED_NAMES, file = "R/sysdata.rda",
LANGUAGES_SUPPORTED, envir = as.environment(pre_commit_lst),
MO_CONS, compress = "xz",
MO_COPS, version = 2,
MO_STREP_ABCG, ascii = FALSE)
MO_LANCEFIELD, usethis::ui_done("Saved to {usethis::ui_value('R/sysdata.rda')}")
MO_PREVALENT_GENERA,
AB_LOOKUP,
AV_LOOKUP,
AB_AMINOGLYCOSIDES,
AB_AMINOPENICILLINS,
AB_ANTIFUNGALS,
AB_ANTIMYCOBACTERIALS,
AB_CARBAPENEMS,
AB_CEPHALOSPORINS,
AB_CEPHALOSPORINS_1ST,
AB_CEPHALOSPORINS_2ND,
AB_CEPHALOSPORINS_3RD,
AB_CEPHALOSPORINS_4TH,
AB_CEPHALOSPORINS_5TH,
AB_CEPHALOSPORINS_EXCEPT_CAZ,
AB_FLUOROQUINOLONES,
AB_LIPOGLYCOPEPTIDES,
AB_GLYCOPEPTIDES,
AB_GLYCOPEPTIDES_EXCEPT_LIPO,
AB_LINCOSAMIDES,
AB_MACROLIDES,
AB_OXAZOLIDINONES,
AB_PENICILLINS,
AB_POLYMYXINS,
AB_QUINOLONES,
AB_STREPTOGRAMINS,
AB_TETRACYCLINES,
AB_TETRACYCLINES_EXCEPT_TGC,
AB_TRIMETHOPRIMS,
AB_UREIDOPENICILLINS,
AB_BETALACTAMS,
DEFINED_AB_GROUPS,
internal = TRUE,
overwrite = TRUE,
version = 2,
compress = "xz"
))
# Export data sets to the repository in different formats ----------------- # Export data sets to the repository in different formats -----------------
for (pkg in c("haven", "openxlsx", "arrow")) { for (pkg in c("haven", "openxlsx2", "arrow")) {
if (!pkg %in% rownames(utils::installed.packages())) { if (!pkg %in% rownames(utils::installed.packages())) {
message("NOTE: package '", pkg, "' not installed! Ignoring export where this package is required.") message("NOTE: package '", pkg, "' not installed! Ignoring export where this package is required.")
} }
@@ -369,7 +453,7 @@ if (changed_md5(clin_break)) {
try(haven::write_xpt(clin_break, "data-raw/clinical_breakpoints.xpt"), silent = TRUE) try(haven::write_xpt(clin_break, "data-raw/clinical_breakpoints.xpt"), silent = TRUE)
try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE) try(haven::write_sav(clin_break, "data-raw/clinical_breakpoints.sav"), silent = TRUE)
try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE) try(haven::write_dta(clin_break, "data-raw/clinical_breakpoints.dta"), silent = TRUE)
try(openxlsx::write.xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(clin_break, "data-raw/clinical_breakpoints.xlsx"), silent = TRUE)
try(arrow::write_feather(clin_break, "data-raw/clinical_breakpoints.feather"), silent = TRUE) try(arrow::write_feather(clin_break, "data-raw/clinical_breakpoints.feather"), silent = TRUE)
try(arrow::write_parquet(clin_break, "data-raw/clinical_breakpoints.parquet"), silent = TRUE) try(arrow::write_parquet(clin_break, "data-raw/clinical_breakpoints.parquet"), silent = TRUE)
} }
@@ -387,7 +471,7 @@ if (changed_md5(microorganisms)) {
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE) try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
mo_all_snomed <- microorganisms %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ",")) mo_all_snomed <- microorganisms %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
try(write.table(mo_all_snomed, "data-raw/microorganisms.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE) try(write.table(mo_all_snomed, "data-raw/microorganisms.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(openxlsx::write.xlsx(mo_all_snomed, "data-raw/microorganisms.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(mo_all_snomed, "data-raw/microorganisms.xlsx"), silent = TRUE)
try(arrow::write_feather(microorganisms, "data-raw/microorganisms.feather"), silent = TRUE) try(arrow::write_feather(microorganisms, "data-raw/microorganisms.feather"), silent = TRUE)
try(arrow::write_parquet(microorganisms, "data-raw/microorganisms.parquet"), silent = TRUE) try(arrow::write_parquet(microorganisms, "data-raw/microorganisms.parquet"), silent = TRUE)
} }
@@ -400,7 +484,7 @@ if (changed_md5(microorganisms.codes)) {
try(haven::write_xpt(microorganisms.codes, "data-raw/microorganisms.codes.xpt"), silent = TRUE) try(haven::write_xpt(microorganisms.codes, "data-raw/microorganisms.codes.xpt"), silent = TRUE)
try(haven::write_sav(microorganisms.codes, "data-raw/microorganisms.codes.sav"), silent = TRUE) try(haven::write_sav(microorganisms.codes, "data-raw/microorganisms.codes.sav"), silent = TRUE)
try(haven::write_dta(microorganisms.codes, "data-raw/microorganisms.codes.dta"), silent = TRUE) try(haven::write_dta(microorganisms.codes, "data-raw/microorganisms.codes.dta"), silent = TRUE)
try(openxlsx::write.xlsx(microorganisms.codes, "data-raw/microorganisms.codes.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(microorganisms.codes, "data-raw/microorganisms.codes.xlsx"), silent = TRUE)
try(arrow::write_feather(microorganisms.codes, "data-raw/microorganisms.codes.feather"), silent = TRUE) try(arrow::write_feather(microorganisms.codes, "data-raw/microorganisms.codes.feather"), silent = TRUE)
try(arrow::write_parquet(microorganisms.codes, "data-raw/microorganisms.codes.parquet"), silent = TRUE) try(arrow::write_parquet(microorganisms.codes, "data-raw/microorganisms.codes.parquet"), silent = TRUE)
} }
@@ -413,7 +497,7 @@ if (changed_md5(microorganisms.groups)) {
try(haven::write_xpt(microorganisms.groups, "data-raw/microorganisms.groups.xpt"), silent = TRUE) try(haven::write_xpt(microorganisms.groups, "data-raw/microorganisms.groups.xpt"), silent = TRUE)
try(haven::write_sav(microorganisms.groups, "data-raw/microorganisms.groups.sav"), silent = TRUE) try(haven::write_sav(microorganisms.groups, "data-raw/microorganisms.groups.sav"), silent = TRUE)
try(haven::write_dta(microorganisms.groups, "data-raw/microorganisms.groups.dta"), silent = TRUE) try(haven::write_dta(microorganisms.groups, "data-raw/microorganisms.groups.dta"), silent = TRUE)
try(openxlsx::write.xlsx(microorganisms.groups, "data-raw/microorganisms.groups.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(microorganisms.groups, "data-raw/microorganisms.groups.xlsx"), silent = TRUE)
try(arrow::write_feather(microorganisms.groups, "data-raw/microorganisms.groups.feather"), silent = TRUE) try(arrow::write_feather(microorganisms.groups, "data-raw/microorganisms.groups.feather"), silent = TRUE)
try(arrow::write_parquet(microorganisms.groups, "data-raw/microorganisms.groups.parquet"), silent = TRUE) try(arrow::write_parquet(microorganisms.groups, "data-raw/microorganisms.groups.parquet"), silent = TRUE)
} }
@@ -428,7 +512,7 @@ if (changed_md5(ab)) {
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE) try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ",")) ab_lists <- antibiotics %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
try(write.table(ab_lists, "data-raw/antibiotics.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE) try(write.table(ab_lists, "data-raw/antibiotics.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(openxlsx::write.xlsx(ab_lists, "data-raw/antibiotics.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(ab_lists, "data-raw/antibiotics.xlsx"), silent = TRUE)
try(arrow::write_feather(antibiotics, "data-raw/antibiotics.feather"), silent = TRUE) try(arrow::write_feather(antibiotics, "data-raw/antibiotics.feather"), silent = TRUE)
try(arrow::write_parquet(antibiotics, "data-raw/antibiotics.parquet"), silent = TRUE) try(arrow::write_parquet(antibiotics, "data-raw/antibiotics.parquet"), silent = TRUE)
} }
@@ -443,7 +527,7 @@ if (changed_md5(av)) {
try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE) try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE)
av_lists <- antivirals %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ",")) av_lists <- antivirals %>% mutate_if(is.list, function(x) sapply(x, paste, collapse = ","))
try(write.table(av_lists, "data-raw/antivirals.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE) try(write.table(av_lists, "data-raw/antivirals.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
try(openxlsx::write.xlsx(av_lists, "data-raw/antivirals.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(av_lists, "data-raw/antivirals.xlsx"), silent = TRUE)
try(arrow::write_feather(antivirals, "data-raw/antivirals.feather"), silent = TRUE) try(arrow::write_feather(antivirals, "data-raw/antivirals.feather"), silent = TRUE)
try(arrow::write_parquet(antivirals, "data-raw/antivirals.parquet"), silent = TRUE) try(arrow::write_parquet(antivirals, "data-raw/antivirals.parquet"), silent = TRUE)
} }
@@ -462,7 +546,7 @@ if (changed_md5(intrinsicR)) {
try(haven::write_xpt(intrinsicR, "data-raw/intrinsic_resistant.xpt"), silent = TRUE) try(haven::write_xpt(intrinsicR, "data-raw/intrinsic_resistant.xpt"), silent = TRUE)
try(haven::write_sav(intrinsicR, "data-raw/intrinsic_resistant.sav"), silent = TRUE) try(haven::write_sav(intrinsicR, "data-raw/intrinsic_resistant.sav"), silent = TRUE)
try(haven::write_dta(intrinsicR, "data-raw/intrinsic_resistant.dta"), silent = TRUE) try(haven::write_dta(intrinsicR, "data-raw/intrinsic_resistant.dta"), silent = TRUE)
try(openxlsx::write.xlsx(intrinsicR, "data-raw/intrinsic_resistant.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(intrinsicR, "data-raw/intrinsic_resistant.xlsx"), silent = TRUE)
try(arrow::write_feather(intrinsicR, "data-raw/intrinsic_resistant.feather"), silent = TRUE) try(arrow::write_feather(intrinsicR, "data-raw/intrinsic_resistant.feather"), silent = TRUE)
try(arrow::write_parquet(intrinsicR, "data-raw/intrinsic_resistant.parquet"), silent = TRUE) try(arrow::write_parquet(intrinsicR, "data-raw/intrinsic_resistant.parquet"), silent = TRUE)
} }
@@ -475,18 +559,13 @@ if (changed_md5(dosage)) {
try(haven::write_xpt(dosage, "data-raw/dosage.xpt"), silent = TRUE) try(haven::write_xpt(dosage, "data-raw/dosage.xpt"), silent = TRUE)
try(haven::write_sav(dosage, "data-raw/dosage.sav"), silent = TRUE) try(haven::write_sav(dosage, "data-raw/dosage.sav"), silent = TRUE)
try(haven::write_dta(dosage, "data-raw/dosage.dta"), silent = TRUE) try(haven::write_dta(dosage, "data-raw/dosage.dta"), silent = TRUE)
try(openxlsx::write.xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE) try(openxlsx2::write_xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE)
try(arrow::write_feather(dosage, "data-raw/dosage.feather"), silent = TRUE) try(arrow::write_feather(dosage, "data-raw/dosage.feather"), silent = TRUE)
try(arrow::write_parquet(dosage, "data-raw/dosage.parquet"), silent = TRUE) try(arrow::write_parquet(dosage, "data-raw/dosage.parquet"), silent = TRUE)
} }
suppressMessages(reset_AMR_locale()) suppressMessages(reset_AMR_locale())
# remove leftovers from global env
current_globalenv <- ls(envir = globalenv())
rm(list = current_globalenv[!current_globalenv %in% old_globalenv])
rm(current_globalenv)
devtools::load_all(quiet = TRUE) devtools::load_all(quiet = TRUE)
suppressMessages(set_AMR_locale("English")) suppressMessages(set_AMR_locale("English"))
@@ -500,19 +579,6 @@ usethis::ui_info("Documenting package")
suppressMessages(devtools::document(quiet = TRUE)) suppressMessages(devtools::document(quiet = TRUE))
# Style pkg ---------------------------------------------------------------
if (!"styler" %in% rownames(utils::installed.packages())) {
message("Package 'styler' not installed!")
} else if (interactive()) {
# only when sourcing this file ourselves
# usethis::ui_info("Styling package")
# styler::style_pkg(
# style = styler::tidyverse_style,
# filetype = c("R", "Rmd")
# )
}
# Finished ---------------------------------------------------------------- # Finished ----------------------------------------------------------------
usethis::ui_done("All done") usethis::ui_done("All done")
suppressMessages(reset_AMR_locale()) suppressMessages(reset_AMR_locale())
+1 -1
View File
@@ -1 +1 @@
3d8c509ec95d61889cae83af43b0e6b7 5ad894790ad048110f8eb9207b89501f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+60 -58
View File
@@ -5,22 +5,23 @@
"ALS" 8954 "Aldesulfone sodium" "Other antibacterials" "J04BA03" "Drugs for treatment of lepra" "Drugs for treatment of lepra" "" "adesulfone sodium,aldapsone,aldesulfona sodica,aldesulfone,aldesulfone sodique,aldesulfone sodium,aldesulphone sodium,diamidin,diasone,diasone sodium,diazon,novotrone,sodium aldesulphone,sodium sulfoxone,sulfoxone sodium" 0.33 "g" "" "ALS" 8954 "Aldesulfone sodium" "Other antibacterials" "J04BA03" "Drugs for treatment of lepra" "Drugs for treatment of lepra" "" "adesulfone sodium,aldapsone,aldesulfona sodica,aldesulfone,aldesulfone sodique,aldesulfone sodium,aldesulphone sodium,diamidin,diasone,diasone sodium,diazon,novotrone,sodium aldesulphone,sodium sulfoxone,sulfoxone sodium" 0.33 "g" ""
"AMK" 37768 "Amikacin" "Aminoglycosides" "D06AX12,J01GB06,S01AA21" "Aminoglycoside antibacterials" "Other aminoglycosides" "ak,ami,amik,amk,an" "amicacin,amikacillin,amikacin,amikacin base,amikacin dihydrate,amikacin free base,amikacin sulfate,amikacina,amikacine,amikacinum,amikavet,amikin,amiklin,amikozit,amukin,arikace,arikayce liposomal,briclin,kaminax,lukadin,mikavir,pierami,potentox" 1 "g" "101493-5,11-7,12-5,13-3,13546-7,14-1,15098-7,17798-0,18860-7,20373-7,23624-0,25174-4,25175-1,25176-9,25177-7,25178-5,25179-3,31097-9,31098-7,31099-5,3319-1,3320-9,3321-7,35669-1,42642-9,48169-7,50802-8,50803-6,56628-1,59378-0,60564-2,60565-9,6975-7,80972-3,89484-0" "AMK" 37768 "Amikacin" "Aminoglycosides" "D06AX12,J01GB06,S01AA21" "Aminoglycoside antibacterials" "Other aminoglycosides" "ak,ami,amik,amk,an" "amicacin,amikacillin,amikacin,amikacin base,amikacin dihydrate,amikacin free base,amikacin sulfate,amikacina,amikacine,amikacinum,amikavet,amikin,amiklin,amikozit,amukin,arikace,arikayce liposomal,briclin,kaminax,lukadin,mikavir,pierami,potentox" 1 "g" "101493-5,11-7,12-5,13-3,13546-7,14-1,15098-7,17798-0,18860-7,20373-7,23624-0,25174-4,25175-1,25176-9,25177-7,25178-5,25179-3,31097-9,31098-7,31099-5,3319-1,3320-9,3321-7,35669-1,42642-9,48169-7,50802-8,50803-6,56628-1,59378-0,60564-2,60565-9,6975-7,80972-3,89484-0"
"AKF" "Amikacin/fosfomycin" "Aminoglycosides" "NA" "" "" "" "AKF" "Amikacin/fosfomycin" "Aminoglycosides" "NA" "" "" ""
"AMO" 54260 "Amorolfine" "Antifungals/antimycotics" "D01AE16" "Antifungals for topical use" "Other antifungals for topical use" "amor" "amorolfina,amorolfine,amorolfinum,loceryl" ""
"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" "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" "" "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" "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" "" "" "AMH" "Amphotericin B-high" "Antifungals/antimycotics" "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" "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" "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" "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" "" "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" "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" "" "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" "" "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" "" "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" "" "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" "" "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" "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 +31,7 @@
"AZA" "Aztreonam/avibactam" "Beta-lactams/penicillins" "NA" "" "" "" "AZA" "Aztreonam/avibactam" "Beta-lactams/penicillins" "NA" "" "" ""
"ANC" "Aztreonam/nacubactam" "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" "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" "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" "" "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" "" "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 +76,10 @@
"CPI" 5486182 "Cefetamet pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefetamet pivoxyl,globocef" "" "CPI" 5486182 "Cefetamet pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefetamet pivoxyl,globocef" ""
"CCL" 71719688 "Cefetecol" "Cephalosporins (4th gen.)" "NA" "cefcatacol" "cefetecol,cefetecol anhydrous" "" "CCL" 71719688 "Cefetecol" "Cephalosporins (4th gen.)" "NA" "cefcatacol" "cefetecol,cefetecol anhydrous" ""
"CZL" 193956 "Cefetrizole" "Cephalosporins (unclassified gen.)" "NA" "" "cefetrizole,cefetrizolum" "" "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" "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" "" "" "" "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" "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" "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" "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 +94,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" "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" "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" "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" "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" "" "" "FOX1" "Cefoxitin screening" "Cephalosporins (2nd gen.)" "NA" "cfsc" "" ""
"ZOP" 9571080 "Cefozopran" "Cephalosporins (4th gen.)" "J01DE03" "" "cefozopran" 4 "g" "100045-4,53820-7" "ZOP" 9571080 "Cefozopran" "Cephalosporins (4th gen.)" "J01DE03" "" "cefozopran" 4 "g" "100045-4,53820-7"
@@ -104,7 +105,7 @@
"CPX" 6526396 "Cefpodoxime proxetil" "Cephalosporins (3rd gen.)" "NA" "" "cefodox,cefoprox,cefpodoxime proxetil,cepodem,orelox,orelox paed,otreon,podomexef,simplicef,vantin" "" "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" "" "" "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" "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" "" "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" "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" "" "CSU" 68718 "Cefsumide" "Cephalosporins (unclassified gen.)" "NA" "" "cefsulmid,cefsumide,cefsumido,cefsumidum" ""
@@ -117,12 +118,12 @@
"CPL" 5362114 "Cefteram pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefteram pivoxil,cefterampivoxil,tomiron" "" "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" "" "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" "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" "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" "" "" "" "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" "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" "" "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" "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" "" "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" "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 +138,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" "" "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" "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" "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" "" "" "" "CIM" "Ciprofloxacin/metronidazole" "Quinolones" "J01RA10" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIO" "Ciprofloxacin/ornidazole" "Other antibacterials" "J01RA12" "Combinations of antibacterials" "Combinations of antibacterials" "" "" "" "CIO" "Ciprofloxacin/ornidazole" "Quinolones" "J01RA12" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"CIT" "Ciprofloxacin/tinidazole" "Other antibacterials" "J01RA11" "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" "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" "" "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" "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" "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" "clin inducible,clinda inducible,clindamycin 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" "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" "" "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" "" "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 +156,32 @@
"COP" "Colistin/polysorbate" "Other antibacterials" "NA" "" "" "" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "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" "" "ENV" 135565326 "Enviomycin" "Antimycobacterials" "J04AB06" "tuberactinomycin" "enviomicina,enviomycin,enviomycina,enviomycinum,tuberactin" 1 "g" ""
"EPE" "Eperozolid" "Other antibacterials" "NA" "" "" "" "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" "" "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" "" "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" "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" "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" "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" "" "" "" "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" "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" "" "" "" "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" "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" "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 +189,23 @@
"FLA" 46783781 "Flavomycin" "Other antibacterials" "NA" "" "flavophospholipol,moenomycin complex" "" "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" "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" "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" "" "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" "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" "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" "" "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" "" "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" "" "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" "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" "" "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" "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" "" "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" "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" "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" "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" "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" "" "GEP" 25101874 "Gepotidacin" "Other antibacterials" "NA" "" "gepotidacin" ""
@@ -213,11 +215,11 @@
"HCH" 11979956 "Hachimycin" "Antifungals/antimycotics" "D01AA03,G01AA06,J02AA02" "Antimycotics for systemic use" "Antibiotics" "" "cabimicina,hachimicina,hachimycin,hachimycine,hachimycinum,trichomycinum,trichonat" "" "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" "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" "" "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" "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" "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" "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" "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" "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" "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 +231,8 @@
"KAH" "Kanamycin-high" "Aminoglycosides" "NA" "k_h,kahl" "" "18936-5,7023-5,7024-3" "KAH" "Kanamycin-high" "Aminoglycosides" "NA" "k_h,kahl" "" "18936-5,7023-5,7024-3"
"KAC" "Kanamycin/cephalexin" "Aminoglycosides" "NA" "" "" "" "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" "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" "" "KIT" "Kitasamycin" "Macrolides/lincosamides" "QJ01FA93" "leucomycin" "jomybel,josacine,josamicina,josamycin,josamycine,josamycinum" ""
"LAS" 5360807 "Lasalocid" "Other antibacterials" "NA" "" "avatec,lasalocid,lasalocid a,lasalocide,lasalocide a,lasalocido,lasalocidum" "87598-9" "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" "" "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" "" "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" "LMU" 25185057 "Lefamulin" "Other antibacterials" "J01XX12" "" "lefamulin,xenleta" "85425-7,99281-8"
@@ -247,7 +249,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" "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" "" "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" "" "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" "" "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" "" "" "" "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" "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 +281,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" "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" "" "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" "" "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" "" "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" "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" "" "NIC" 9507 "Nicarbazin" "Other antibacterials" "NA" "" "nicarb,nicarbasin,nicarbazin,nicarbazine,nicoxin,nicrazin,nicrazine,nirazin" ""
"NIF" 71946 "Nifuroquine" "Quinolones" "NA" "" "abimasten,nifuroquina,nifuroquine,nifuroquinum,quinaldofur" "" "NIF" 71946 "Nifuroquine" "Quinolones" "NA" "" "abimasten,nifuroquina,nifuroquine,nifuroquinum,quinaldofur" ""
@@ -294,24 +296,24 @@
"NME" "Norfloxacin/metronidazole" "Other antibacterials" "J01RA14" "Combinations of antibacterials" "Combinations of antibacterials" "" "" "" "NME" "Norfloxacin/metronidazole" "Other antibacterials" "J01RA14" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"NTI" "Norfloxacin/tinidazole" "Other antibacterials" "J01RA13" "Combinations of antibacterials" "Combinations of antibacterials" "" "" "" "NTI" "Norfloxacin/tinidazole" "Other antibacterials" "J01RA13" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
"NVA" 10419027 "Norvancomycin" "Glycopeptides" "NA" "" "norvancomycin" "" "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" "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" "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" "" "" "" "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" "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" "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" "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" "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" "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" "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" "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" "" "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" "" "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" "" "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" "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" "" "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" "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 +332,7 @@
"PIS" "Piperacillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" "54197-9,54198-7,54199-5,55704-1" "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" "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" "" "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" "" "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" "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" "" "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 +340,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" "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" "" "" "" "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" "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" "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" "" "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" "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" "" "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 +351,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" "" "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" "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" "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" "" "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" "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" "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" "" "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" "" "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" "" "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" "" "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" "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 +366,7 @@
"RFI" "Rifampicin/isoniazid" "Antimycobacterials" "J04AM02" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "rifinah,rimactazid" "" "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" "" "" "" "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" "" "" "" "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" "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" "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" "" "RIT" 65633 "Ritipenem" "Carbapenems" "NA" "" "ritipenem" ""
@@ -374,8 +376,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" "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" "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" "" "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" "SAL" 3085092 "Salinomycin" "Other antibacterials" "QP51BB01" "" "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" "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" "" "SRC" 54681908 "Sarecycline" "Tetracyclines" "J01AA14" "Tetracyclines" "Tetracyclines" "" "sarecycline,seysara" 0.1 "g" ""
"SRX" 9933415 "Sarmoxicillin" "Beta-lactams/penicillins" "NA" "" "sarmoxicillin" "" "SRX" 9933415 "Sarmoxicillin" "Beta-lactams/penicillins" "NA" "" "sarmoxicillin" ""
"SEC" 71815 "Secnidazole" "Other antibacterials" "P01AB07" "" "flagentyl,secnidal,secnidazol,secnidazole,secnidazolum,secnil,sindose,solosec" 2 "g" "" "SEC" 71815 "Secnidazole" "Other antibacterials" "P01AB07" "" "flagentyl,secnidal,secnidazol,secnidazole,secnidazolum,secnil,sindose,solosec" 2 "g" ""
@@ -395,7 +397,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" "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" "" "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" "" "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" "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" "" "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" "" "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 +434,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" "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" "" "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" "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" "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" "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" "" "" "" "TCM" "Teicoplanin-macromethod" "Glycopeptides" "NA" "" "" ""
@@ -450,29 +452,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" "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" "" "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" "" "" "" "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" "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" "" "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" "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" "" "TBQ" 65592 "Tilbroquinol" "Quinolones" "P01AA05" "" "tilbroquinol,tilbroquinolum" ""
"TIP" 24860548 "Tildipirosin" "Macrolides/lincosamides" "NA" "" "tildipirosin,zuprevo" "100060-3,88375-1,88377-7" "TIP" 24860548 "Tildipirosin" "Macrolides/lincosamides" "QJ01FA96" "" "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" "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" "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" "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" "" "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" "" "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" "" "TXC" 65788 "Tioxacin" "Quinolones" "NA" "" "tioxacin,tioxacine,tioxacino,tioxacinum,tioxic acid" ""
"TIZ" 394397 "Tizoxanide" "Other antibacterials" "NA" "" "ntzdes" "73585-2,73607-4,73629-8" "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" "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" "" "" "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" "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" "SXT" 358641 "Trimethoprim/sulfamethoxazole" "Trimethoprims" "J01EE01" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "cot,cotrim,sxt,t/s,tms,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" "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" "" "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" "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" "TUL" 9832301 "Tulathromycin" "Macrolides/lincosamides" "QJ01FA94" "" "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" "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" "NA" "tvn" "tylvalosin" "101526-2,87586-4" "TYL1" 6441094 "Tylvalosin" "Macrolides/lincosamides" "QJ01FA92" "tvn" "tylvalosin" "101526-2,87586-4"
"PRU1" 124225 "Ulifloxacin (Prulifloxacin)" "Other antibacterials" "NA" "" "ulifloxacin" "" "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" "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" "" "" "" "VAM" "Vancomycin-macromethod" "Glycopeptides" "NA" "" "" ""
Binary file not shown.
Binary file not shown.
+8937 -2341
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1 +1 @@
c4a5519e0ecc74220fc768e944a372f7 c79b6e112dc3ab478b990f0689b685b6
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: # 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 # 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'. # 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 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 # 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 <<<<< # >>>>> 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) library(AMR)
# we need J01, J02 and J04 (J03 does not exist) # 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) complete_vector <- character(0)
for (Jxx in c("J01", "J02", "J04")) { for (Jxx in c("J01", "J02", "J04")) {
site <- gsub("{code}", Jxx, url, fixed = TRUE) site <- gsub("{code}", Jxx, url, fixed = TRUE)
+1 -1
View File
@@ -1 +1 @@
032dfd1b044cc838f0915b0eef919471 e8c57a559ad846e72c700c88929e880d

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