mirror of
https://github.com/msberends/AMR.git
synced 2026-09-26 00:58:23 +02:00
Compare commits
55
Commits
v1.8.2
..
6017f81e74
+44
-13
@@ -1,5 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
echo "Running pre-commit hook..."
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -7,11 +36,11 @@ if command -v Rscript > /dev/null; then
|
||||
if [ "$(Rscript -e 'cat(all(c('"'pkgload'"', '"'devtools'"', '"'dplyr'"', '"'styler'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
|
||||
Rscript -e "source('data-raw/_pre_commit_hook.R')"
|
||||
currentpkg=`Rscript -e "cat(pkgload::pkg_name())"`
|
||||
echo "-> Adding all files in folders 'data-raw', 'inst', 'man', and 'R' to this git commit"
|
||||
echo "-> Adding all files in 'data-raw' to this commit"
|
||||
git add data-raw/*
|
||||
git add inst/*
|
||||
git add man/*
|
||||
git add R/*
|
||||
git add R/sysdata.rda
|
||||
git add NAMESPACE
|
||||
else
|
||||
echo "- R package 'pkgload', 'devtools', 'dplyr', or 'styler' not installed!"
|
||||
currentpkg="your"
|
||||
@@ -24,36 +53,38 @@ echo ""
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating semantic versioning and date..."
|
||||
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
|
||||
echo ">> - no git tags found, create one in this format: 'v(x).(y).(z)'!"
|
||||
currenttag="0.0.1"
|
||||
currentcommit=`git rev-list --count HEAD`
|
||||
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}..HEAD`
|
||||
currentcommit=`git rev-list --count ${currenttagfull}..${defaultbranch}`
|
||||
if (( "$currentcommit" == 0 )); then
|
||||
# tag is new, so this must become the version number
|
||||
currentversion="$currenttag"
|
||||
fi
|
||||
echo ">> - latest tag is '${currenttagfull}', with ${currentcommit} previous commits"
|
||||
echo "- latest tag is '${currenttagfull}', with ${currentcommit} previous commits in ${defaultbranch}"
|
||||
fi
|
||||
if [ "$currentversion" = "" ]; then
|
||||
# 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
|
||||
fi
|
||||
echo ">> - ${currentpkg} pkg version set to ${currentversion}"
|
||||
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 DESCRIPTION"
|
||||
echo "- updated DESCRIPTION"
|
||||
# remove leftover on macOS
|
||||
rm -f DESCRIPTION--
|
||||
# add to commit
|
||||
@@ -65,12 +96,12 @@ if [ -e "NEWS.md" ]; then
|
||||
currentpkg=""
|
||||
fi
|
||||
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
|
||||
echo ">> - updated NEWS.md"
|
||||
echo "- updated NEWS.md"
|
||||
# remove leftover on macOS
|
||||
rm -f NEWS.md--
|
||||
# add to commit
|
||||
git add NEWS.md
|
||||
else
|
||||
echo ">> - no NEWS.md found!"
|
||||
echo "- no NEWS.md found!"
|
||||
fi
|
||||
echo ">> "
|
||||
echo ""
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -27,14 +31,17 @@ on:
|
||||
pull_request:
|
||||
# run in each PR in this repo
|
||||
branches: '**'
|
||||
push:
|
||||
branches: '**'
|
||||
schedule:
|
||||
# run a schedule everyday at 1 AM.
|
||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
name: R-code-check-PR
|
||||
name: check-current
|
||||
|
||||
jobs:
|
||||
R-code-check-PR:
|
||||
# do not run if we are the authors - the other checks will already run
|
||||
if: ${{ github.event.comment.author_association != 'MEMBER' && github.event.comment.author_association != 'OWNER' }}
|
||||
|
||||
R-code-check:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
continue-on-error: ${{ matrix.config.allowfail }}
|
||||
@@ -45,17 +52,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {os: macOS-latest, r: 'devel', allowfail: true}
|
||||
- {os: macOS-latest, r: 'devel', allowfail: false}
|
||||
- {os: macOS-latest, r: 'release', allowfail: false}
|
||||
- {os: ubuntu-latest, r: 'devel', allowfail: true}
|
||||
- {os: ubuntu-latest, r: 'devel', allowfail: false}
|
||||
- {os: ubuntu-latest, r: 'release', allowfail: false}
|
||||
- {os: windows-latest, r: 'devel', allowfail: true}
|
||||
- {os: windows-latest, r: 'devel', allowfail: false}
|
||||
- {os: windows-latest, r: 'release', allowfail: false}
|
||||
|
||||
env:
|
||||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||
R_KEEP_PKG_SOURCE: yes
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -65,7 +72,7 @@ jobs:
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
# use RStudio Package Manager to quickly install packages
|
||||
use-public-rspm: true
|
||||
use-public-rspm: true
|
||||
|
||||
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||
with:
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -32,12 +36,12 @@ on:
|
||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
name: R-code-check
|
||||
name: check-old
|
||||
|
||||
jobs:
|
||||
R-code-check:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
|
||||
|
||||
continue-on-error: ${{ matrix.config.allowfail }}
|
||||
|
||||
name: ${{ matrix.config.os }} (R-${{ matrix.config.r }})
|
||||
@@ -46,25 +50,20 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# test all systems against all released versions of R >= 3.0, we support them all!
|
||||
- {os: macOS-latest, r: 'devel', allowfail: true}
|
||||
- {os: macOS-latest, r: '4.2', allowfail: false}
|
||||
# test all old versions of R >= 3.0, we support them all!
|
||||
# (for R-release and R-devel, see check-current.yaml)
|
||||
- {os: macOS-latest, r: '4.1', allowfail: false}
|
||||
- {os: macOS-latest, r: '4.0', allowfail: false}
|
||||
- {os: macOS-latest, r: '3.6', allowfail: false}
|
||||
- {os: ubuntu-22.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '4.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.5', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
# R 3.5 returns a strange GC error when running examples, omit the checks for that
|
||||
- {os: ubuntu-22.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: ubuntu-22.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {os: windows-latest, r: 'devel', allowfail: true}
|
||||
- {os: windows-latest, r: '4.2', allowfail: false}
|
||||
- {os: windows-latest, r: '4.1', allowfail: false}
|
||||
- {os: windows-latest, r: '4.0', allowfail: false}
|
||||
- {os: windows-latest, r: '3.6', allowfail: false}
|
||||
@@ -72,14 +71,14 @@ jobs:
|
||||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
||||
RSPM: ${{ matrix.config.rspm }}
|
||||
R_REPOSITORIES: "https://cran.rstudio.com"
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: r-lib/actions/setup-r@v2
|
||||
with:
|
||||
r-version: ${{ matrix.config.r }}
|
||||
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@v2
|
||||
|
||||
- name: Install Linux dependencies
|
||||
@@ -89,7 +88,7 @@ jobs:
|
||||
# as of May 2021: https://sysreqs.r-hub.io/pkg/AMR,R,cleaner,curl,dplyr,ggplot2,knitr,microbenchmark,pillar,readxl,rmarkdown,rstudioapi,rvest,skimr,tidyr,tinytest,xml2,backports,crayon,rlang,vctrs,evaluate,highr,markdown,stringr,yaml,xfun,cli,ellipsis,fansi,lifecycle,utf8,glue,mime,magrittr,stringi,generics,R6,tibble,tidyselect,pkgconfig,purrr,digest,gtable,isoband,MASS,mgcv,scales,withr,nlme,Matrix,farver,labeling,munsell,RColorBrewer,viridisLite,lattice,colorspace,gridtext,Rcpp,RCurl,png,jpeg,bitops,cellranger,progress,rematch,hms,prettyunits,htmltools,jsonlite,tinytex,base64enc,httr,selectr,openssl,askpass,sys,repr,cpp11
|
||||
run: |
|
||||
sudo apt install -y libssl-dev libxml2-dev libcurl4-openssl-dev
|
||||
|
||||
|
||||
- name: Restore cached R packages
|
||||
# this step will add the step 'Post Restore cached R packages' on a succesful run
|
||||
uses: actions/cache@v2
|
||||
@@ -102,7 +101,7 @@ jobs:
|
||||
run: |
|
||||
Rscript -e "source('data-raw/_install_deps.R')"
|
||||
shell: bash
|
||||
|
||||
|
||||
- name: Show session info
|
||||
if: always()
|
||||
run: |
|
||||
@@ -110,7 +109,7 @@ jobs:
|
||||
utils::sessionInfo()
|
||||
as.data.frame(utils::installed.packages())[, "Version", drop = FALSE]
|
||||
shell: Rscript {0}
|
||||
|
||||
|
||||
- name: Remove vignettes on R without knitr support
|
||||
if: matrix.config.r == '3.0' || matrix.config.r == '3.1' || matrix.config.r == '3.2' || matrix.config.r == '3.3'
|
||||
# writing to DESCRIPTION2 and then moving to DESCRIPTION is required for R <= 3.3 as writeLines() cannot overwrite
|
||||
@@ -153,7 +152,8 @@ jobs:
|
||||
|
||||
- name: Upload artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts-${{ matrix.config.os }}-r${{ matrix.config.r }}
|
||||
path: /home/runner/work/AMR.Rcheck
|
||||
path: ${{ github.workspace }}.Rcheck
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -52,5 +56,16 @@ jobs:
|
||||
extra-packages: any::lintr
|
||||
|
||||
- name: Lint
|
||||
run: lintr::lint_package(linters = lintr::with_defaults(line_length_linter = NULL, trailing_whitespace_linter = NULL, object_name_linter = NULL, cyclocomp_linter = NULL, object_length_linter = lintr::object_length_linter(length = 50L)), exclusions = list("R/aa_helper_pm_functions.R"))
|
||||
run: |
|
||||
# old: lintr::lint_package(linters = lintr::with_defaults(line_length_linter = NULL, trailing_whitespace_linter = NULL, object_name_linter = NULL, cyclocomp_linter = NULL, object_length_linter = lintr::object_length_linter(length = 50L)), exclusions = list("R/aa_helper_pm_functions.R"))
|
||||
# now get ALL linters, not just default ones
|
||||
linters <- ls(envir = asNamespace("lintr"), pattern = "_linter$")
|
||||
# lose deprecated
|
||||
linters <- linters[!grepl("^(closed_curly|open_curly|paren_brace|semicolon_terminator)_linter$", linters)]
|
||||
# and the ones we find unnnecessary
|
||||
linters <- linters[!grepl("^(extraction_operator|implicit_integer|line_length|object_name|nonportable_path|is)_linter$", linters)]
|
||||
# put the functions in a list
|
||||
linters <- lapply(linters, function(l) eval(parse(text = paste0("lintr::", l, "()")), envir = asNamespace("lintr")))
|
||||
# run them all!
|
||||
lintr::lint_package(linters = linters, exclusions = list("R/aa_helper_pm_functions.R"))
|
||||
shell: Rscript {0}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -38,15 +42,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
# Set up R (current stable version) and developer tools
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# this is to keep timestamps, the default fetch-depth: 1 gets the timestamps of the moment of cloning
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Preserve timestamps
|
||||
run: |
|
||||
sudo apt install git-restore-mtime
|
||||
git restore-mtime
|
||||
|
||||
- uses: r-lib/actions/setup-pandoc@v2
|
||||
|
||||
- name: Set up R
|
||||
uses: r-lib/actions/setup-r@v2
|
||||
with:
|
||||
r-version: "release"
|
||||
# use RStudio Package Manager (RSPM) to quickly install packages
|
||||
use-public-rspm: true
|
||||
r-version: "release"
|
||||
# use RStudio Package Manager (RSPM) to quickly install packages
|
||||
use-public-rspm: true
|
||||
|
||||
- name: Set up R dependencies
|
||||
uses: r-lib/actions/setup-r-dependencies@v2
|
||||
with:
|
||||
|
||||
@@ -23,3 +23,5 @@ PackageCheckArgs: --no-build-vignettes --as-cran
|
||||
PackageRoxygenize: rd,collate,namespace
|
||||
|
||||
UseNativePipeOperator: No
|
||||
|
||||
SpellingDictionary: en_GB
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
Version: 1.8.1
|
||||
Date: 2022-03-16 18:22:51 UTC
|
||||
SHA: 7b0f1596bd65fbb72681a7e3a6a7e4e469a891e8
|
||||
Version: 1.8.2
|
||||
Date: 2022-09-27 12:18:42 UTC
|
||||
SHA: ccb09706e4f168ab6133de3d2294bcaeed0d3fc8
|
||||
|
||||
+30
-27
@@ -1,40 +1,43 @@
|
||||
Package: AMR
|
||||
Version: 1.8.1.9049
|
||||
Date: 2022-09-01
|
||||
Version: 1.8.2.9054
|
||||
Date: 2022-11-28
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
using evidence-based methods and reliable reference data such as LPSN
|
||||
<doi:10.1099/ijsem.0.004332>.
|
||||
data analysis and to work with microbial and antimicrobial properties by
|
||||
using evidence-based methods, as described in <doi:10.18637/jss.v104.i03>.
|
||||
Authors@R: c(
|
||||
person(family = "Berends", c("Matthijs", "S."), role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7620-1800"), email = "m.berends@certe.nl"),
|
||||
person(family = "Luz", c("Christian", "F."), role = c("aut", "ctb"), comment = c(ORCID = "0000-0001-5809-5995")),
|
||||
person(family = "Souverein", c("Dennis"), role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-0455-0336")),
|
||||
person(family = "Hassing", c("Erwin", "E.", "A."), role = c("aut", "ctb")),
|
||||
person(family = "Albers", c("Casper", "J."), role = "ths", comment = c(ORCID = "0000-0002-9213-6743")),
|
||||
person(family = "Dutey-Magni", c("Peter"), role = "ctb", comment = c(ORCID = "0000-0002-8942-9836")),
|
||||
person(family = "Fonville", c("Judith", "M."), role = "ctb"),
|
||||
person(family = "Friedrich", c("Alex", "W."), role = "ths", comment = c(ORCID = "0000-0003-4881-038X")),
|
||||
person(family = "Glasner", c("Corinna"), role = "ths", comment = c(ORCID = "0000-0003-1241-1328")),
|
||||
person(family = "Hazenberg", c("Eric", "H.", "L.", "C.", "M."), role = "ctb"),
|
||||
person(family = "Knight", c("Gwen"), role = "ctb", comment = c(ORCID = "0000-0002-7263-9896")),
|
||||
person(family = "Lenglet", c("Annick"), role = "ctb", comment = c(ORCID = "0000-0003-2013-8405")),
|
||||
person(family = "Meijer", c("Bart", "C."), role = "ctb"),
|
||||
person(family = "Mykhailenko", c("Dmytro"), role = "ctb"),
|
||||
person(family = "Mymrikov", c("Anton"), role = "ctb"),
|
||||
person(family = "Ny", c("Sofia"), role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
|
||||
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 = "Underwood", c("Anthony"), role = "ctb", comment = c(ORCID = "0000-0002-8547-4277")))
|
||||
person(family = "Berends", c("Matthijs", "S."), role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7620-1800"), email = "m.berends@certe.nl"),
|
||||
person(family = "Luz", c("Christian", "F."), role = c("aut", "ctb"), comment = c(ORCID = "0000-0001-5809-5995")),
|
||||
person(family = "Souverein", c("Dennis"), role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-0455-0336")),
|
||||
person(family = "Hassing", c("Erwin", "E.", "A."), role = c("aut", "ctb")),
|
||||
person(family = "Albers", c("Casper", "J."), role = "ths", comment = c(ORCID = "0000-0002-9213-6743")),
|
||||
person(family = "Dutey-Magni", c("Peter"), role = "ctb", comment = c(ORCID = "0000-0002-8942-9836")),
|
||||
person(family = "Fonville", c("Judith", "M."), role = "ctb"),
|
||||
person(family = "Friedrich", c("Alex", "W."), role = "ths", comment = c(ORCID = "0000-0003-4881-038X")),
|
||||
person(family = "Glasner", c("Corinna"), role = "ths", comment = c(ORCID = "0000-0003-1241-1328")),
|
||||
person(family = "Hazenberg", c("Eric", "H.", "L.", "C.", "M."), role = "ctb"),
|
||||
person(family = "Knight", c("Gwen"), role = "ctb", comment = c(ORCID = "0000-0002-7263-9896")),
|
||||
person(family = "Lenglet", c("Annick"), role = "ctb", comment = c(ORCID = "0000-0003-2013-8405")),
|
||||
person(family = "Meijer", c("Bart", "C."), role = "ctb"),
|
||||
person(family = "Mykhailenko", c("Dmytro"), role = "ctb"),
|
||||
person(family = "Mymrikov", c("Anton"), role = "ctb"),
|
||||
person(family = "Ny", c("Sofia"), role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
|
||||
person(family = "Salm", c("Jonas"), 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 = "Underwood", c("Anthony"), role = "ctb", comment = c(ORCID = "0000-0002-8547-4277")))
|
||||
Depends: R (>= 3.0.0)
|
||||
Enhances:
|
||||
cleaner,
|
||||
skimr,
|
||||
ggplot2,
|
||||
janitor,
|
||||
skimr,
|
||||
tibble,
|
||||
tidyselect
|
||||
tidyselect,
|
||||
tsibble
|
||||
Suggests:
|
||||
curl,
|
||||
data.table,
|
||||
dplyr,
|
||||
knitr,
|
||||
progress,
|
||||
@@ -49,5 +52,5 @@ BugReports: https://github.com/msberends/AMR/issues
|
||||
License: GPL-2 | file LICENSE
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
RoxygenNote: 7.2.1
|
||||
RoxygenNote: 7.2.2
|
||||
Roxygen: list(markdown = TRUE)
|
||||
|
||||
@@ -18,19 +18,23 @@ S3method("==",mic)
|
||||
S3method(">",mic)
|
||||
S3method(">=",mic)
|
||||
S3method("[",ab)
|
||||
S3method("[",av)
|
||||
S3method("[",disk)
|
||||
S3method("[",mic)
|
||||
S3method("[",mo)
|
||||
S3method("[<-",ab)
|
||||
S3method("[<-",av)
|
||||
S3method("[<-",disk)
|
||||
S3method("[<-",mic)
|
||||
S3method("[<-",mo)
|
||||
S3method("[<-",rsi)
|
||||
S3method("[[",ab)
|
||||
S3method("[[",av)
|
||||
S3method("[[",disk)
|
||||
S3method("[[",mic)
|
||||
S3method("[[",mo)
|
||||
S3method("[[<-",ab)
|
||||
S3method("[[<-",av)
|
||||
S3method("[[<-",disk)
|
||||
S3method("[[<-",mic)
|
||||
S3method("[[<-",mo)
|
||||
@@ -48,6 +52,7 @@ S3method(any,ab_selector)
|
||||
S3method(any,ab_selector_any_all)
|
||||
S3method(any,mic)
|
||||
S3method(as.data.frame,ab)
|
||||
S3method(as.data.frame,av)
|
||||
S3method(as.data.frame,mo)
|
||||
S3method(as.double,mic)
|
||||
S3method(as.list,custom_eucast_rules)
|
||||
@@ -67,6 +72,7 @@ S3method(barplot,mic)
|
||||
S3method(barplot,rsi)
|
||||
S3method(c,ab)
|
||||
S3method(c,ab_selector)
|
||||
S3method(c,av)
|
||||
S3method(c,custom_eucast_rules)
|
||||
S3method(c,custom_mdro_guideline)
|
||||
S3method(c,disk)
|
||||
@@ -113,8 +119,8 @@ S3method(plot,mic)
|
||||
S3method(plot,resistance_predict)
|
||||
S3method(plot,rsi)
|
||||
S3method(print,ab)
|
||||
S3method(print,av)
|
||||
S3method(print,bug_drug_combinations)
|
||||
S3method(print,catalogue_of_life_version)
|
||||
S3method(print,custom_eucast_rules)
|
||||
S3method(print,custom_mdro_guideline)
|
||||
S3method(print,disk)
|
||||
@@ -128,6 +134,7 @@ S3method(prod,mic)
|
||||
S3method(quantile,mic)
|
||||
S3method(range,mic)
|
||||
S3method(rep,ab)
|
||||
S3method(rep,av)
|
||||
S3method(rep,disk)
|
||||
S3method(rep,mic)
|
||||
S3method(rep,mo)
|
||||
@@ -154,6 +161,7 @@ S3method(tanpi,mic)
|
||||
S3method(trigamma,mic)
|
||||
S3method(trunc,mic)
|
||||
S3method(unique,ab)
|
||||
S3method(unique,av)
|
||||
S3method(unique,disk)
|
||||
S3method(unique,mic)
|
||||
S3method(unique,mo)
|
||||
@@ -182,6 +190,7 @@ export(ab_selector)
|
||||
export(ab_synonyms)
|
||||
export(ab_tradenames)
|
||||
export(ab_url)
|
||||
export(add_custom_antimicrobials)
|
||||
export(administrable_iv)
|
||||
export(administrable_per_os)
|
||||
export(age)
|
||||
@@ -189,11 +198,13 @@ export(age_groups)
|
||||
export(all_antimicrobials)
|
||||
export(aminoglycosides)
|
||||
export(aminopenicillins)
|
||||
export(amr_distance_from_row)
|
||||
export(anti_join_microorganisms)
|
||||
export(antifungals)
|
||||
export(antimicrobials_equal)
|
||||
export(antimycobacterials)
|
||||
export(as.ab)
|
||||
export(as.av)
|
||||
export(as.disk)
|
||||
export(as.mic)
|
||||
export(as.mo)
|
||||
@@ -202,18 +213,31 @@ export(atc_online_ddd)
|
||||
export(atc_online_ddd_units)
|
||||
export(atc_online_groups)
|
||||
export(atc_online_property)
|
||||
export(av_atc)
|
||||
export(av_cid)
|
||||
export(av_ddd)
|
||||
export(av_ddd_units)
|
||||
export(av_from_text)
|
||||
export(av_group)
|
||||
export(av_info)
|
||||
export(av_loinc)
|
||||
export(av_name)
|
||||
export(av_property)
|
||||
export(av_synonyms)
|
||||
export(av_tradenames)
|
||||
export(av_url)
|
||||
export(availability)
|
||||
export(betalactams)
|
||||
export(brmo)
|
||||
export(bug_drug_combinations)
|
||||
export(carbapenems)
|
||||
export(catalogue_of_life_version)
|
||||
export(cephalosporins)
|
||||
export(cephalosporins_1st)
|
||||
export(cephalosporins_2nd)
|
||||
export(cephalosporins_3rd)
|
||||
export(cephalosporins_4th)
|
||||
export(cephalosporins_5th)
|
||||
export(clear_custom_antimicrobials)
|
||||
export(count_I)
|
||||
export(count_IR)
|
||||
export(count_R)
|
||||
@@ -225,7 +249,6 @@ export(count_resistant)
|
||||
export(count_susceptible)
|
||||
export(custom_eucast_rules)
|
||||
export(custom_mdro_guideline)
|
||||
export(distance_from_row)
|
||||
export(eucast_dosage)
|
||||
export(eucast_exceptional_phenotypes)
|
||||
export(eucast_rules)
|
||||
@@ -246,6 +269,7 @@ export(glycopeptides)
|
||||
export(guess_ab_col)
|
||||
export(inner_join_microorganisms)
|
||||
export(is.ab)
|
||||
export(is.av)
|
||||
export(is.disk)
|
||||
export(is.mic)
|
||||
export(is.mo)
|
||||
@@ -268,10 +292,13 @@ export(mdro)
|
||||
export(mean_amr_distance)
|
||||
export(mo_authors)
|
||||
export(mo_class)
|
||||
export(mo_cleaning_regex)
|
||||
export(mo_current)
|
||||
export(mo_domain)
|
||||
export(mo_failures)
|
||||
export(mo_family)
|
||||
export(mo_fullname)
|
||||
export(mo_gbif)
|
||||
export(mo_genus)
|
||||
export(mo_gramstain)
|
||||
export(mo_info)
|
||||
@@ -289,9 +316,11 @@ export(mo_property)
|
||||
export(mo_rank)
|
||||
export(mo_ref)
|
||||
export(mo_renamed)
|
||||
export(mo_reset_session)
|
||||
export(mo_shortname)
|
||||
export(mo_snomed)
|
||||
export(mo_species)
|
||||
export(mo_status)
|
||||
export(mo_subspecies)
|
||||
export(mo_synonyms)
|
||||
export(mo_taxonomy)
|
||||
@@ -320,6 +349,7 @@ export(reset_AMR_locale)
|
||||
export(resistance)
|
||||
export(resistance_predict)
|
||||
export(right_join_microorganisms)
|
||||
export(rsi_confidence_interval)
|
||||
export(rsi_df)
|
||||
export(rsi_interpretation_history)
|
||||
export(rsi_predict)
|
||||
|
||||
+36
-20
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -26,6 +30,12 @@
|
||||
# add new version numbers here, and add the rules themselves to "data-raw/eucast_rules.tsv" and rsi_translation
|
||||
# (sourcing "data-raw/_pre_commit_hook.R" will process the TSV file)
|
||||
EUCAST_VERSION_BREAKPOINTS <- list(
|
||||
"12.0" = list(
|
||||
version_txt = "v12.0",
|
||||
year = 2022,
|
||||
title = "'EUCAST Clinical Breakpoint Tables'",
|
||||
url = "https://www.eucast.org/clinical_breakpoints/"
|
||||
),
|
||||
"11.0" = list(
|
||||
version_txt = "v11.0",
|
||||
year = 2021,
|
||||
@@ -60,21 +70,27 @@ EUCAST_VERSION_EXPERT_RULES <- list(
|
||||
)
|
||||
)
|
||||
|
||||
SNOMED_VERSION <- list(
|
||||
title = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS)",
|
||||
current_source = "US Edition of SNOMED CT from 1 September 2020",
|
||||
current_version = 12,
|
||||
current_oid = "2.16.840.1.114222.4.11.1009",
|
||||
value_set_name = "Microorganism",
|
||||
url = "https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009"
|
||||
)
|
||||
|
||||
CATALOGUE_OF_LIFE <- list(
|
||||
year = 2019,
|
||||
version = "Catalogue of Life: {year} Annual Checklist",
|
||||
url_CoL = "http://www.catalogueoflife.org",
|
||||
url_LPSN = "https://lpsn.dsmz.de",
|
||||
yearmonth_LPSN = "5 October 2021"
|
||||
TAXONOMY_VERSION <- list(
|
||||
GBIF = list(
|
||||
accessed_date = as.Date("2022-09-12"),
|
||||
citation = "GBIF Secretariat (November 26, 2021). GBIF Backbone Taxonomy. Checklist dataset \\doi{10.15468/39omei}.",
|
||||
url = "https://www.gbif.org"
|
||||
),
|
||||
LPSN = list(
|
||||
accessed_date = as.Date("2022-09-12"),
|
||||
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"
|
||||
),
|
||||
SNOMED = list(
|
||||
accessed_date = as.Date("2021-07-01"),
|
||||
citation = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12).",
|
||||
url = "https://phinvads.cdc.gov"
|
||||
),
|
||||
LOINC = list(
|
||||
accessed_date = as.Date("2022-10-30"),
|
||||
citation = "Logical Observation Identifiers Names and Codes (LOINC), Version 2.73 (8 August, 2022).",
|
||||
url = "https://loinc.org"
|
||||
)
|
||||
)
|
||||
|
||||
globalVariables(c(
|
||||
@@ -89,6 +105,8 @@ globalVariables(c(
|
||||
"atc_group1",
|
||||
"atc_group2",
|
||||
"base_ab",
|
||||
"ci_min",
|
||||
"ci_max",
|
||||
"code",
|
||||
"cols",
|
||||
"count",
|
||||
@@ -117,7 +135,6 @@ globalVariables(c(
|
||||
"microorganism",
|
||||
"microorganisms",
|
||||
"microorganisms.codes",
|
||||
"microorganisms.old",
|
||||
"mo",
|
||||
"name",
|
||||
"new",
|
||||
@@ -138,7 +155,6 @@ globalVariables(c(
|
||||
"se_max",
|
||||
"se_min",
|
||||
"species",
|
||||
"species_id",
|
||||
"total",
|
||||
"txt",
|
||||
"type",
|
||||
|
||||
+275
-243
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -81,7 +85,7 @@ where <- function(fn) {
|
||||
quick_case_when <- function(...) {
|
||||
fs <- list(...)
|
||||
lapply(fs, function(x) {
|
||||
if (class(x) != "formula") {
|
||||
if (!inherits(x, "formula")) {
|
||||
stop("`case_when()` requires formula inputs.")
|
||||
}
|
||||
})
|
||||
@@ -208,63 +212,6 @@ addin_insert_like <- function() {
|
||||
}
|
||||
}
|
||||
|
||||
check_dataset_integrity <- function() {
|
||||
# check if user overwrote our data sets in their global environment
|
||||
data_in_pkg <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE]
|
||||
data_in_globalenv <- ls(envir = globalenv())
|
||||
overwritten <- data_in_pkg[data_in_pkg %in% data_in_globalenv]
|
||||
# exception for example_isolates
|
||||
overwritten <- overwritten[overwritten %unlike% "example_isolates"]
|
||||
if (length(overwritten) > 0) {
|
||||
if (length(overwritten) > 1) {
|
||||
plural <- c("s are", "", "s")
|
||||
} else {
|
||||
plural <- c(" is", "s", "")
|
||||
}
|
||||
if (message_not_thrown_before("check_dataset_integrity", overwritten)) {
|
||||
warning_(
|
||||
"The following data set", plural[1],
|
||||
" overwritten by your global environment and prevent", plural[2],
|
||||
" the AMR package from working correctly: ",
|
||||
vector_and(overwritten, quotes = "'"),
|
||||
".\nPlease rename your object", plural[3], "."
|
||||
)
|
||||
}
|
||||
}
|
||||
# check if other packages did not overwrite our data sets
|
||||
valid_microorganisms <- TRUE
|
||||
valid_antibiotics <- TRUE
|
||||
tryCatch(
|
||||
{
|
||||
valid_microorganisms <- all(c(
|
||||
"mo", "fullname", "kingdom", "phylum",
|
||||
"class", "order", "family", "genus",
|
||||
"species", "subspecies", "rank",
|
||||
"species_id", "source", "ref", "prevalence"
|
||||
) %in% colnames(microorganisms),
|
||||
na.rm = TRUE
|
||||
)
|
||||
valid_antibiotics <- all(c(
|
||||
"ab", "atc", "cid", "name", "group",
|
||||
"atc_group1", "atc_group2", "abbreviations",
|
||||
"synonyms", "oral_ddd", "oral_units",
|
||||
"iv_ddd", "iv_units", "loinc"
|
||||
) %in% colnames(antibiotics),
|
||||
na.rm = TRUE
|
||||
)
|
||||
},
|
||||
error = function(e) {
|
||||
# package not yet loaded
|
||||
require("AMR")
|
||||
}
|
||||
)
|
||||
stop_if(
|
||||
!valid_microorganisms | !valid_antibiotics,
|
||||
"the data set `microorganisms` or `antibiotics` was overwritten in your environment because another package with the same object name(s) was loaded _after_ the AMR package, preventing the AMR package from working correctly. Please load the AMR package last."
|
||||
)
|
||||
invisible(TRUE)
|
||||
}
|
||||
|
||||
search_type_in_df <- function(x, type, info = TRUE) {
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(type, allow_class = "character", has_length = 1)
|
||||
@@ -279,10 +226,10 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
# -- mo
|
||||
if (type == "mo") {
|
||||
if (any(vapply(FUN.VALUE = logical(1), x, is.mo))) {
|
||||
# take first <mo> column
|
||||
# take first 'mo' column
|
||||
found <- colnames(x)[vapply(FUN.VALUE = logical(1), x, is.mo)]
|
||||
} else if ("mo" %in% colnames_formatted &
|
||||
suppressWarnings(all(x$mo %in% c(NA, microorganisms$mo)))) {
|
||||
} else if ("mo" %in% colnames_formatted &&
|
||||
suppressWarnings(all(x$mo %in% c(NA, AMR::microorganisms$mo)))) {
|
||||
found <- "mo"
|
||||
} else if (any(colnames_formatted %like_case% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$")) {
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(mo|microorganism|organism|bacteria|ba[ck]terie)s?$"])
|
||||
@@ -303,7 +250,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
if (any(colnames_formatted %like_case% "^(specimen date|specimen_date|spec_date)")) {
|
||||
# WHONET support
|
||||
found <- sort(colnames(x)[colnames_formatted %like_case% "^(specimen date|specimen_date|spec_date)"])
|
||||
if (!any(class(pm_pull(x, found)) %in% c("Date", "POSIXct"))) {
|
||||
if (!inherits(pm_pull(x, found), c("Date", "POSIXct"))) {
|
||||
stop(font_red(paste0(
|
||||
"Found column '", font_bold(found), "' to be used as input for `col_", type,
|
||||
"`, but this column contains no valid dates. Transform its values to valid dates first."
|
||||
@@ -357,7 +304,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
|
||||
found <- found[1]
|
||||
|
||||
if (!is.null(found) & info == TRUE) {
|
||||
if (!is.null(found) && isTRUE(info)) {
|
||||
if (message_not_thrown_before("search_in_type", type)) {
|
||||
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
|
||||
if (type %in% c("keyantibiotics", "keyantimicrobials", "specimen")) {
|
||||
@@ -372,7 +319,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
is_valid_regex <- function(x) {
|
||||
regex_at_all <- tryCatch(vapply(
|
||||
FUN.VALUE = logical(1),
|
||||
X = strsplit(x, ""),
|
||||
X = strsplit(x, "", fixed = TRUE),
|
||||
FUN = function(y) {
|
||||
any(y %in% c(
|
||||
"$", "(", ")", "*", "+", "-",
|
||||
@@ -390,9 +337,7 @@ is_valid_regex <- function(x) {
|
||||
FUN.VALUE = logical(1),
|
||||
X = x,
|
||||
FUN = function(y) {
|
||||
!"try-error" %in% class(try(grepl(y, "", perl = TRUE),
|
||||
silent = TRUE
|
||||
))
|
||||
!inherits(try(grepl(y, "", perl = TRUE), silent = TRUE), "try-error")
|
||||
},
|
||||
USE.NAMES = FALSE
|
||||
)
|
||||
@@ -400,23 +345,17 @@ is_valid_regex <- function(x) {
|
||||
}
|
||||
|
||||
stop_ifnot_installed <- function(package) {
|
||||
# no "utils::installed.packages()" since it requires non-staged install since R 3.6.0
|
||||
# https://developer.r-project.org/Blog/public/2019/02/14/staged-install/index.html
|
||||
vapply(FUN.VALUE = character(1), package, function(pkg) {
|
||||
tryCatch(get(".packageName", envir = asNamespace(pkg)),
|
||||
error = function(e) {
|
||||
if (pkg == "rstudioapi") {
|
||||
stop("This function only works in RStudio when using R >= 3.2.", call. = FALSE)
|
||||
} else if (pkg != "base") {
|
||||
stop("This requires the '", pkg, "' package.",
|
||||
"\nTry to install it with: install.packages(\"", pkg, "\")",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
}
|
||||
installed <- vapply(FUN.VALUE = logical(1), package, requireNamespace, quietly = TRUE)
|
||||
if (any(!installed) && any(package == "rstudioapi")) {
|
||||
stop("This function only works in RStudio when using R >= 3.2.", call. = FALSE)
|
||||
} else if (any(!installed)) {
|
||||
stop("This requires the ", vector_and(package[!installed]), " package.",
|
||||
"\nTry to install with install.packages().",
|
||||
call. = FALSE
|
||||
)
|
||||
})
|
||||
return(invisible())
|
||||
} else {
|
||||
return(invisible())
|
||||
}
|
||||
}
|
||||
|
||||
pkg_is_available <- function(pkg, also_load = TRUE, min_version = NULL) {
|
||||
@@ -464,14 +403,14 @@ word_wrap <- function(...,
|
||||
msg <- paste0(c(...), collapse = "")
|
||||
|
||||
if (isTRUE(as_note)) {
|
||||
msg <- paste0(pkg_env$info_icon, " ", gsub("^note:? ?", "", msg, ignore.case = TRUE))
|
||||
msg <- paste0(AMR_env$info_icon, " ", gsub("^note:? ?", "", msg, ignore.case = TRUE))
|
||||
}
|
||||
|
||||
if (msg %like% "\n") {
|
||||
# run word_wraps() over every line here, bind them and return again
|
||||
return(paste0(vapply(
|
||||
FUN.VALUE = character(1),
|
||||
trimws(unlist(strsplit(msg, "\n")), which = "right"),
|
||||
trimws(unlist(strsplit(msg, "\n", fixed = TRUE)), which = "right"),
|
||||
word_wrap,
|
||||
add_fn = add_fn,
|
||||
as_note = FALSE,
|
||||
@@ -497,12 +436,12 @@ word_wrap <- function(...,
|
||||
msg_stripped_wrapped <- paste0(unlist(strsplit(msg_stripped_wrapped, "(\n|\\*\\|\\*)")),
|
||||
collapse = "\n"
|
||||
)
|
||||
msg_stripped_spaces <- which(unlist(strsplit(msg_stripped, "")) == " ")
|
||||
msg_stripped_wrapped_spaces <- which(unlist(strsplit(msg_stripped_wrapped, "")) != "\n")
|
||||
msg_stripped_spaces <- which(unlist(strsplit(msg_stripped, "", fixed = TRUE)) == " ")
|
||||
msg_stripped_wrapped_spaces <- which(unlist(strsplit(msg_stripped_wrapped, "", fixed = TRUE)) != "\n")
|
||||
# so these are the indices of spaces that need to be replaced
|
||||
replace_spaces <- which(!msg_stripped_spaces %in% msg_stripped_wrapped_spaces)
|
||||
# put it together
|
||||
msg <- unlist(strsplit(msg, " "))
|
||||
msg <- unlist(strsplit(msg, " ", fixed = TRUE))
|
||||
msg[replace_spaces] <- paste0(msg[replace_spaces], "\n")
|
||||
# add space around operators again
|
||||
msg <- gsub(paste0(ops, ops), "\\1 \\2", msg, perl = TRUE)
|
||||
@@ -530,10 +469,13 @@ word_wrap <- function(...,
|
||||
}
|
||||
|
||||
# format backticks
|
||||
msg <- gsub("(`.+?`)", font_grey_bg("\\1"), msg)
|
||||
msg <- gsub("`(.+?)`", font_grey_bg("\\1"), msg)
|
||||
|
||||
# clean introduced whitespace between fullstops
|
||||
msg <- gsub("[.] +[.]", "..", msg)
|
||||
# remove extra space that was introduced (e.g. "Smith et al., 2022")
|
||||
msg <- gsub(". ,", ".,", msg, fixed = TRUE)
|
||||
msg <- gsub("[ ,", "[,", msg, fixed = TRUE)
|
||||
|
||||
msg
|
||||
}
|
||||
@@ -608,17 +550,14 @@ stop_ifnot <- function(expr, ..., call = TRUE) {
|
||||
}
|
||||
|
||||
"%or%" <- function(x, y) {
|
||||
if (is.null(x) | is.null(y)) {
|
||||
if (is.null(x) || is.null(y)) {
|
||||
if (is.null(x)) {
|
||||
return(y)
|
||||
} else {
|
||||
return(x)
|
||||
}
|
||||
}
|
||||
ifelse(!is.na(x),
|
||||
x,
|
||||
ifelse(!is.na(y), y, NA)
|
||||
)
|
||||
ifelse(is.na(x), y, x)
|
||||
}
|
||||
|
||||
return_after_integrity_check <- function(value, type, check_vector) {
|
||||
@@ -654,15 +593,35 @@ dataset_UTF8_to_ASCII <- function(df) {
|
||||
import_fn("as_tibble", "tibble")(df)
|
||||
}
|
||||
|
||||
documentation_date <- function(d) {
|
||||
paste0(trimws(format(d, "%e")), " ", month.name[as.integer(format(d, "%m"))], ", ", format(d, "%Y"))
|
||||
}
|
||||
|
||||
format_included_data_number <- function(data) {
|
||||
if (is.data.frame(data)) {
|
||||
n <- nrow(data)
|
||||
} else {
|
||||
n <- length(unique(data))
|
||||
}
|
||||
if (n > 10000) {
|
||||
rounder <- -3 # round on thousands
|
||||
} else if (n > 1000) {
|
||||
rounder <- -2 # round on hundreds
|
||||
} else {
|
||||
rounder <- -1 # round on tens
|
||||
}
|
||||
paste0("~", format(round(n, rounder), decimal.mark = ".", big.mark = ","))
|
||||
}
|
||||
|
||||
# for eucast_rules() and mdro(), creates markdown output with URLs and names
|
||||
create_eucast_ab_documentation <- function() {
|
||||
x <- trimws(unique(toupper(unlist(strsplit(EUCAST_RULES_DF$then_change_these_antibiotics, ",")))))
|
||||
x <- trimws(unique(toupper(unlist(strsplit(EUCAST_RULES_DF$then_change_these_antibiotics, ",", fixed = TRUE)))))
|
||||
ab <- character()
|
||||
for (val in x) {
|
||||
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) {
|
||||
# antibiotic group names, as defined in data-raw/_pre_commit_hook.R, such as `CARBAPENEMS`
|
||||
val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
|
||||
} else if (val %in% AB_lookup$ab) {
|
||||
} else if (val %in% AMR_env$AB_lookup$ab) {
|
||||
# separate drugs, such as `AMX`
|
||||
val <- as.ab(val)
|
||||
} else {
|
||||
@@ -706,7 +665,7 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
|
||||
return(paste0(quotes, v, quotes))
|
||||
}
|
||||
if (identical(v, c("I", "R", "S"))) {
|
||||
# class <rsi> should be sorted like this
|
||||
# class 'rsi' should be sorted like this
|
||||
v <- c("R", "S", "I")
|
||||
}
|
||||
# all commas except for last item, so will become '"val1", "val2", "val3" or "val4"'
|
||||
@@ -731,7 +690,8 @@ format_class <- function(class, plural = FALSE) {
|
||||
class[class %in% c("number", "whole number")] <- "(whole) number"
|
||||
}
|
||||
class[class == "character"] <- "text string"
|
||||
class[class %in% c("Date", "POSIXt")] <- "date"
|
||||
class[class == "Date"] <- "date"
|
||||
class[class %in% c("POSIXt", "POSIXct", "POSIXlt")] <- "date/time"
|
||||
class[class != class.bak] <- paste0(
|
||||
ifelse(plural, "", "a "),
|
||||
class[class != class.bak],
|
||||
@@ -777,14 +737,14 @@ meet_criteria <- function(object,
|
||||
|
||||
# if object is missing, or another error:
|
||||
tryCatch(invisible(object),
|
||||
error = function(e) pkg_env$meet_criteria_error_txt <- e$message
|
||||
error = function(e) AMR_env$meet_criteria_error_txt <- e$message
|
||||
)
|
||||
if (!is.null(pkg_env$meet_criteria_error_txt)) {
|
||||
error_txt <- pkg_env$meet_criteria_error_txt
|
||||
pkg_env$meet_criteria_error_txt <- NULL
|
||||
if (!is.null(AMR_env$meet_criteria_error_txt)) {
|
||||
error_txt <- AMR_env$meet_criteria_error_txt
|
||||
AMR_env$meet_criteria_error_txt <- NULL
|
||||
stop(error_txt, call. = FALSE) # don't use stop_() here, our pkg may not be loaded yet
|
||||
}
|
||||
pkg_env$meet_criteria_error_txt <- NULL
|
||||
AMR_env$meet_criteria_error_txt <- NULL
|
||||
|
||||
if (is.null(object)) {
|
||||
stop_if(allow_NULL == FALSE, "argument `", obj_name, "` must not be NULL", call = call_depth)
|
||||
@@ -895,7 +855,8 @@ get_current_data <- function(arg_name, call) {
|
||||
}
|
||||
# try dplyr::cur_data_all() first to support dplyr groups
|
||||
# only useful for e.g. dplyr::filter(), dplyr::mutate() and dplyr::summarise()
|
||||
# not useful (throws error) with e.g. dplyr::select() - but that will be caught later in this function
|
||||
# not useful (throws error) with e.g. dplyr::select(), dplyr::across(), or dplyr::vars(),
|
||||
# but that will be caught later on in this function
|
||||
cur_data_all <- import_fn("cur_data_all", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_data_all)) {
|
||||
out <- tryCatch(cur_data_all(), error = function(e) NULL)
|
||||
@@ -920,6 +881,10 @@ get_current_data <- function(arg_name, call) {
|
||||
# an element `x` will be in the environment for only cols, e.g. `example_isolates[, carbapenems()]`
|
||||
return(env$x)
|
||||
}
|
||||
} else if (!is.null(names(env)) && all(c(".tbl", ".vars", ".cols") %in% names(env), na.rm = TRUE) && valid_df(env$`.tbl`)) {
|
||||
# an element `.tbl` will be in the environment when using scoped dplyr variants, with or without `dplyr::vars()`
|
||||
# (e.g. `dplyr::summarise_at()` or `dplyr::mutate_at()`)
|
||||
return(env$`.tbl`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,11 +964,11 @@ unique_call_id <- function(entire_session = FALSE, match_fn = NULL) {
|
||||
# combination of environment ID (such as "0x7fed4ee8c848")
|
||||
# and relevant system call (where 'match_fn' is being called in)
|
||||
calls <- sys.calls()
|
||||
if (!identical(Sys.getenv("R_RUN_TINYTEST"), "true") &&
|
||||
!any(as.character(calls[[1]]) %like_case% "run_test_dir|run_test_file|test_all|tinytest|test_package|testthat")) {
|
||||
in_test <- any(as.character(calls[[1]]) %like_case% "run_test_dir|run_test_file|test_all|tinytest|test_package|testthat", na.rm = TRUE)
|
||||
if (!isTRUE(in_test)) {
|
||||
for (i in seq_len(length(calls))) {
|
||||
call_clean <- gsub("[^a-zA-Z0-9_().-]", "", as.character(calls[[i]]), perl = TRUE)
|
||||
if (any(call_clean %like% paste0(match_fn, "\\("), na.rm = TRUE)) {
|
||||
if (match_fn %in% call_clean || any(call_clean %like% paste0(match_fn, "\\("), na.rm = TRUE)) {
|
||||
return(c(
|
||||
envir = gsub("<environment: (.*)>", "\\1", utils::capture.output(sys.frames()[[1]]), perl = TRUE),
|
||||
call = paste0(deparse(calls[[i]]), collapse = "")
|
||||
@@ -1012,8 +977,8 @@ unique_call_id <- function(entire_session = FALSE, match_fn = NULL) {
|
||||
}
|
||||
}
|
||||
c(
|
||||
envir = paste0(sample(c(c(0:9), letters[1:6]), size = 32, replace = TRUE), collapse = ""),
|
||||
call = paste0(sample(c(c(0:9), letters[1:6]), size = 32, replace = TRUE), collapse = "")
|
||||
envir = paste0(sample(c(0:9, letters[1:6]), size = 32, replace = TRUE), collapse = ""),
|
||||
call = paste0(sample(c(0:9, letters[1:6]), size = 32, replace = TRUE), collapse = "")
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1024,10 +989,10 @@ unique_call_id <- function(entire_session = FALSE, match_fn = NULL) {
|
||||
message_not_thrown_before <- function(fn, ..., entire_session = FALSE) {
|
||||
# this is to prevent that messages/notes will be printed for every dplyr group or more than once per session
|
||||
# e.g. this would show a msg 4 times: example_isolates %>% group_by(ward) %>% filter(mo_is_gram_negative())
|
||||
salt <- gsub("[^a-zA-Z0-9|_-]", "?", paste(c(...), sep = "|", collapse = "|"), perl = TRUE)
|
||||
not_thrown_before <- is.null(pkg_env[[paste0("thrown_msg.", fn, ".", salt)]]) ||
|
||||
salt <- gsub("[^a-zA-Z0-9|_-]", "?", substr(paste(c(...), sep = "|", collapse = "|"), 1, 512), perl = TRUE)
|
||||
not_thrown_before <- is.null(AMR_env[[paste0("thrown_msg.", fn, ".", salt)]]) ||
|
||||
!identical(
|
||||
pkg_env[[paste0("thrown_msg.", fn, ".", salt)]],
|
||||
AMR_env[[paste0("thrown_msg.", fn, ".", salt)]],
|
||||
unique_call_id(
|
||||
entire_session = entire_session,
|
||||
match_fn = fn
|
||||
@@ -1038,7 +1003,7 @@ message_not_thrown_before <- function(fn, ..., entire_session = FALSE) {
|
||||
assign(
|
||||
x = paste0("thrown_msg.", fn, ".", salt),
|
||||
value = unique_call_id(entire_session = entire_session, match_fn = fn),
|
||||
envir = pkg_env
|
||||
envir = AMR_env
|
||||
)
|
||||
}
|
||||
not_thrown_before
|
||||
@@ -1100,7 +1065,10 @@ has_colour <- function() {
|
||||
|
||||
# set colours if console has_colour()
|
||||
try_colour <- function(..., before, after, collapse = " ") {
|
||||
txt <- paste0(unlist(list(...)), collapse = collapse)
|
||||
if (length(c(...)) == 0) {
|
||||
return(character(0))
|
||||
}
|
||||
txt <- paste0(c(...), collapse = collapse)
|
||||
if (isTRUE(has_colour())) {
|
||||
if (is.null(collapse)) {
|
||||
paste0(before, txt, after, collapse = NULL)
|
||||
@@ -1111,11 +1079,16 @@ try_colour <- function(..., before, after, collapse = " ") {
|
||||
txt
|
||||
}
|
||||
}
|
||||
is_dark <- function() {
|
||||
if (is.null(AMR_env$is_dark_theme)) {
|
||||
AMR_env$is_dark_theme <- tryCatch(isTRUE(getExportedValue("getThemeInfo", ns = asNamespace("rstudioapi"))()$dark), error = function(e) FALSE)
|
||||
}
|
||||
isTRUE(AMR_env$is_dark_theme)
|
||||
}
|
||||
font_black <- function(..., collapse = " ") {
|
||||
before <- "\033[38;5;232m"
|
||||
after <- "\033[39m"
|
||||
theme_info <- import_fn("getThemeInfo", "rstudioapi", error_on_fail = FALSE)
|
||||
if (!is.null(theme_info) && isTRUE(theme_info()$dark)) {
|
||||
if (is_dark()) {
|
||||
# white
|
||||
before <- "\033[37m"
|
||||
after <- "\033[39m"
|
||||
@@ -1125,8 +1098,7 @@ font_black <- function(..., collapse = " ") {
|
||||
font_white <- function(..., collapse = " ") {
|
||||
before <- "\033[37m"
|
||||
after <- "\033[39m"
|
||||
theme_info <- import_fn("getThemeInfo", "rstudioapi", error_on_fail = FALSE)
|
||||
if (!is.null(theme_info) && isTRUE(theme_info()$dark)) {
|
||||
if (is_dark()) {
|
||||
# black
|
||||
before <- "\033[38;5;232m"
|
||||
after <- "\033[39m"
|
||||
@@ -1158,7 +1130,7 @@ font_grey <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[38;5;249m", after = "\033[39m", collapse = collapse)
|
||||
}
|
||||
font_grey_bg <- function(..., collapse = " ") {
|
||||
if (tryCatch(import_fn("getThemeInfo", "rstudioapi", error_on_fail = FALSE)()$dark, error = function(e) FALSE)) {
|
||||
if (is_dark()) {
|
||||
# similar to HTML #444444
|
||||
try_colour(..., before = "\033[48;5;238m", after = "\033[49m", collapse = collapse)
|
||||
} else {
|
||||
@@ -1166,26 +1138,26 @@ font_grey_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[48;5;255m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
}
|
||||
font_green_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[42m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_R_bg <- function(..., collapse = " ") {
|
||||
# ED553B
|
||||
try_colour(..., before = "\033[48;5;203m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_S_bg <- function(..., collapse = " ") {
|
||||
# 3CAEA3
|
||||
try_colour(..., before = "\033[48;5;79m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rsi_I_bg <- function(..., collapse = " ") {
|
||||
# F6D55C
|
||||
try_colour(..., before = "\033[48;5;222m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_red_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[41m", after = "\033[49m", collapse = collapse)
|
||||
# this is #ed553b (picked to be colourblind-safe with other RSI colours)
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;203m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_orange_bg <- function(..., collapse = " ") {
|
||||
# this is #f6d55c (picked to be colourblind-safe with other RSI colours)
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;222m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_yellow_bg <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[43m", after = "\033[49m", collapse = collapse)
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;228m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_green_bg <- function(..., collapse = " ") {
|
||||
# this is #3caea3 (picked to be colourblind-safe with other RSI colours)
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;79m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_purple_bg <- function(..., collapse = " ") {
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;89m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_rose_bg <- function(..., collapse = " ") {
|
||||
try_colour(font_black(..., collapse = collapse), before = "\033[48;5;217m", after = "\033[49m", collapse = collapse)
|
||||
}
|
||||
font_na <- function(..., collapse = " ") {
|
||||
font_red(..., collapse = collapse)
|
||||
@@ -1199,13 +1171,24 @@ font_italic <- function(..., collapse = " ") {
|
||||
font_underline <- function(..., collapse = " ") {
|
||||
try_colour(..., before = "\033[4m", after = "\033[24m", collapse = collapse)
|
||||
}
|
||||
font_url <- function(url, txt = url) {
|
||||
if (tryCatch(isTRUE(getExportedValue("ansi_has_hyperlink_support", ns = asNamespace("cli"))()), error = function(e) FALSE)) {
|
||||
paste0("\033]8;;", url, "\a", txt, "\033]8;;\a")
|
||||
} else {
|
||||
url
|
||||
}
|
||||
}
|
||||
font_stripstyle <- function(x) {
|
||||
# remove URLs
|
||||
x <- gsub("\033]8;;(.*?)\a.*?\033]8;;\a", "\\1", x)
|
||||
# from crayon:::ansi_regex
|
||||
gsub("(?:(?:\\x{001b}\\[)|\\x{009b})(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\\x{001b}[A-M]", "", x, perl = TRUE)
|
||||
x <- gsub("(?:(?:\\x{001b}\\[)|\\x{009b})(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\\x{001b}[A-M]", "", x, perl = TRUE)
|
||||
x
|
||||
}
|
||||
|
||||
progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
if (print == FALSE || n < n_min) {
|
||||
# create fake/empty object
|
||||
pb <- list()
|
||||
pb$tick <- function() {
|
||||
invisible()
|
||||
@@ -1215,16 +1198,17 @@ progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
}
|
||||
set_clean_class(pb, new_class = "txtProgressBar")
|
||||
} else if (n >= n_min) {
|
||||
# rely on the progress package if it is available - it has a more verbose output
|
||||
# use `progress`, which also has a timer
|
||||
progress_bar <- import_fn("progress_bar", "progress", error_on_fail = FALSE)
|
||||
if (!is.null(progress_bar)) {
|
||||
# so we use progress::progress_bar
|
||||
# a close() method was also added, see below this function
|
||||
pb <- progress_bar$new(
|
||||
format = "[:bar] :percent (:current/:total)",
|
||||
format = "[:bar] :percent (:current/:total,:eta)",
|
||||
total = n
|
||||
)
|
||||
} else {
|
||||
# use base R
|
||||
pb <- utils::txtProgressBar(max = n, style = 3)
|
||||
pb$tick <- function() {
|
||||
pb$up(pb$getVal() + 1)
|
||||
@@ -1238,6 +1222,7 @@ progress_ticker <- function(n = 1, n_min = 0, print = TRUE, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
close.progress_bar <- function(con, ...) {
|
||||
# for progress::progress_bar$new()
|
||||
con$terminate()
|
||||
}
|
||||
|
||||
@@ -1281,61 +1266,21 @@ as_original_data_class <- function(df, old_class = NULL) {
|
||||
fn <- import_fn("as_tsibble", "tsibble")
|
||||
} else if ("data.table" %in% old_class && pkg_is_available("data.table", also_load = FALSE)) {
|
||||
fn <- import_fn("as.data.table", "data.table")
|
||||
} else if ("tabyl" %in% old_class && pkg_is_available("janitor", also_load = FALSE)) {
|
||||
fn <- import_fn("as_tabyl", "janitor")
|
||||
} else {
|
||||
fn <- base::as.data.frame
|
||||
}
|
||||
fn(df)
|
||||
}
|
||||
|
||||
# copied from vctrs::s3_register by their permission:
|
||||
# https://github.com/r-lib/vctrs/blob/05968ce8e669f73213e3e894b5f4424af4f46316/R/register-s3.R
|
||||
s3_register <- function(generic, class, method = NULL) {
|
||||
stopifnot(is.character(generic), length(generic) == 1)
|
||||
stopifnot(is.character(class), length(class) == 1)
|
||||
pieces <- strsplit(generic, "::")[[1]]
|
||||
stopifnot(length(pieces) == 2)
|
||||
package <- pieces[[1]]
|
||||
generic <- pieces[[2]]
|
||||
caller <- parent.frame()
|
||||
get_method_env <- function() {
|
||||
top <- topenv(caller)
|
||||
if (isNamespace(top)) {
|
||||
asNamespace(environmentName(top))
|
||||
} else {
|
||||
caller
|
||||
}
|
||||
}
|
||||
get_method <- function(method, env) {
|
||||
if (is.null(method)) {
|
||||
get(paste0(generic, ".", class), envir = get_method_env())
|
||||
} else {
|
||||
method
|
||||
}
|
||||
}
|
||||
method_fn <- get_method(method)
|
||||
stopifnot(is.function(method_fn))
|
||||
setHook(packageEvent(package, "onLoad"), function(...) {
|
||||
ns <- asNamespace(package)
|
||||
method_fn <- get_method(method)
|
||||
registerS3method(generic, class, method_fn, envir = ns)
|
||||
})
|
||||
if (!isNamespaceLoaded(package)) {
|
||||
return(invisible())
|
||||
}
|
||||
envir <- asNamespace(package)
|
||||
if (exists(generic, envir)) {
|
||||
registerS3method(generic, class, method_fn, envir = envir)
|
||||
}
|
||||
invisible()
|
||||
}
|
||||
|
||||
# works exactly like round(), but rounds `round2(44.55, 1)` to 44.6 instead of 44.5
|
||||
# and adds decimal zeroes until `digits` is reached when force_zero = TRUE
|
||||
round2 <- function(x, digits = 1, force_zero = TRUE) {
|
||||
x <- as.double(x)
|
||||
# https://stackoverflow.com/a/12688836/4575331
|
||||
val <- (trunc((abs(x) * 10^digits) + 0.5) / 10^digits) * sign(x)
|
||||
if (digits > 0 & force_zero == TRUE) {
|
||||
if (digits > 0 && force_zero == TRUE) {
|
||||
values_trans <- val[val != as.integer(val) & !is.na(val)]
|
||||
val[val != as.integer(val) & !is.na(val)] <- paste0(
|
||||
values_trans,
|
||||
@@ -1425,74 +1370,161 @@ percentage <- function(x, digits = NULL, ...) {
|
||||
)
|
||||
}
|
||||
|
||||
time_start_tracking <- function() {
|
||||
pkg_env$time_start <- round(as.double(Sys.time()) * 1000)
|
||||
trimws2 <- function(..., whitespace = "[\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u200C\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]") {
|
||||
# this is even faster than trimws() itself which sets " \t\n\r".
|
||||
trimws(..., whitespace = whitespace)
|
||||
}
|
||||
|
||||
time_track <- function(name = NULL) {
|
||||
paste("(until now:", trimws(round(as.double(Sys.time()) * 1000) - pkg_env$time_start), "ms)")
|
||||
}
|
||||
# Faster data.table implementations ----
|
||||
|
||||
# prevent dependency on package 'backports' ----
|
||||
# these functions were not available in previous versions of R (last checked: R 4.1.0)
|
||||
# see here for the full list: https://github.com/r-lib/backports
|
||||
strrep <- function(x, times) {
|
||||
x <- as.character(x)
|
||||
if (length(x) == 0L) {
|
||||
return(x)
|
||||
match <- function(x, table, ...) {
|
||||
chmatch <- import_fn("chmatch", "data.table", error_on_fail = FALSE)
|
||||
if (!is.null(chmatch) && is.character(x) && is.character(table)) {
|
||||
# data.table::chmatch() is 35% faster than base::match() for character
|
||||
chmatch(x, table, ...)
|
||||
} else {
|
||||
base::match(x, table, ...)
|
||||
}
|
||||
unlist(.mapply(function(x, times) {
|
||||
if (is.na(x) || is.na(times)) {
|
||||
return(NA_character_)
|
||||
}
|
||||
if (times <= 0L) {
|
||||
return("")
|
||||
}
|
||||
paste0(replicate(times, x), collapse = "")
|
||||
}, list(x = x, times = times), MoreArgs = list()), use.names = FALSE)
|
||||
}
|
||||
trimws <- function(x, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") {
|
||||
which <- match.arg(which)
|
||||
mysub <- function(re, x) sub(re, "", x, perl = TRUE)
|
||||
switch(which,
|
||||
left = mysub(paste0("^", whitespace, "+"), x),
|
||||
right = mysub(paste0(whitespace, "+$"), x),
|
||||
both = mysub(paste0(whitespace, "+$"), mysub(paste0("^", whitespace, "+"), x))
|
||||
)
|
||||
}
|
||||
isFALSE <- function(x) {
|
||||
is.logical(x) && length(x) == 1L && !is.na(x) && !x
|
||||
}
|
||||
deparse1 <- function(expr, collapse = " ", width.cutoff = 500L, ...) {
|
||||
paste(deparse(expr, width.cutoff, ...), collapse = collapse)
|
||||
}
|
||||
file.size <- function(...) {
|
||||
file.info(...)$size
|
||||
}
|
||||
file.mtime <- function(...) {
|
||||
file.info(...)$mtime
|
||||
}
|
||||
str2lang <- function(s) {
|
||||
stopifnot(length(s) == 1L)
|
||||
ex <- parse(text = s, keep.source = FALSE)
|
||||
stopifnot(length(ex) == 1L)
|
||||
ex[[1L]]
|
||||
}
|
||||
isNamespaceLoaded <- function(pkg) {
|
||||
pkg %in% loadedNamespaces()
|
||||
}
|
||||
lengths <- function(x, use.names = TRUE) {
|
||||
vapply(x, length, FUN.VALUE = NA_integer_, USE.NAMES = use.names)
|
||||
`%in%` <- function(x, table) {
|
||||
chin <- import_fn("%chin%", "data.table", error_on_fail = FALSE)
|
||||
if (!is.null(chin) && is.character(x) && is.character(table)) {
|
||||
# data.table::`%chin%`() is 20-50% faster than base::`%in%`() for character
|
||||
chin(x, table)
|
||||
} else {
|
||||
base::`%in%`(x, table)
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "3.1") {
|
||||
# nolint start
|
||||
|
||||
# Register S3 methods ----
|
||||
# copied from vctrs::s3_register by their permission:
|
||||
# https://github.com/r-lib/vctrs/blob/05968ce8e669f73213e3e894b5f4424af4f46316/R/register-s3.R
|
||||
s3_register <- function(generic, class, method = NULL) {
|
||||
stopifnot(is.character(generic), length(generic) == 1)
|
||||
stopifnot(is.character(class), length(class) == 1)
|
||||
pieces <- strsplit(generic, "::")[[1]]
|
||||
stopifnot(length(pieces) == 2)
|
||||
package <- pieces[[1]]
|
||||
generic <- pieces[[2]]
|
||||
caller <- parent.frame()
|
||||
get_method_env <- function() {
|
||||
top <- topenv(caller)
|
||||
if (isNamespace(top)) {
|
||||
asNamespace(environmentName(top))
|
||||
} else {
|
||||
caller
|
||||
}
|
||||
}
|
||||
get_method <- function(method, env) {
|
||||
if (is.null(method)) {
|
||||
get(paste0(generic, ".", class), envir = get_method_env())
|
||||
} else {
|
||||
method
|
||||
}
|
||||
}
|
||||
method_fn <- get_method(method)
|
||||
stopifnot(is.function(method_fn))
|
||||
setHook(packageEvent(package, "onLoad"), function(...) {
|
||||
ns <- asNamespace(package)
|
||||
method_fn <- get_method(method)
|
||||
registerS3method(generic, class, method_fn, envir = ns)
|
||||
})
|
||||
if (!isNamespaceLoaded(package)) {
|
||||
return(invisible())
|
||||
}
|
||||
envir <- asNamespace(package)
|
||||
if (exists(generic, envir)) {
|
||||
registerS3method(generic, class, method_fn, envir = envir)
|
||||
}
|
||||
invisible()
|
||||
}
|
||||
|
||||
|
||||
# Support old R versions ----
|
||||
# these functions were not available in previous versions of R
|
||||
# see here for the full list: https://github.com/r-lib/backports
|
||||
if (getRversion() < "3.1.0") {
|
||||
# R-3.0 does not contain these functions, set them here to prevent installation failure
|
||||
# (required for extension of the <mic> class)
|
||||
# (required for extension of the 'mic' class)
|
||||
cospi <- function(...) 1
|
||||
sinpi <- function(...) 1
|
||||
tanpi <- function(...) 1
|
||||
}
|
||||
dir.exists <- function(paths) {
|
||||
x <- base::file.info(paths)$isdir
|
||||
!is.na(x) & x
|
||||
|
||||
if (getRversion() < "3.2.0") {
|
||||
anyNA <- function(x, recursive = FALSE) {
|
||||
if (isTRUE(recursive) && (is.list(x) || is.pairlist(x))) {
|
||||
return(any(rapply(x, anyNA, how = "unlist", recursive = FALSE)))
|
||||
}
|
||||
any(is.na(x))
|
||||
}
|
||||
dir.exists <- function(paths) {
|
||||
x <- base::file.info(paths)$isdir
|
||||
!is.na(x) & x
|
||||
}
|
||||
file.size <- function(...) {
|
||||
file.info(...)$size
|
||||
}
|
||||
file.mtime <- function(...) {
|
||||
file.info(...)$mtime
|
||||
}
|
||||
isNamespaceLoaded <- function(pkg) {
|
||||
pkg %in% loadedNamespaces()
|
||||
}
|
||||
lengths <- function(x, use.names = TRUE) {
|
||||
vapply(x, length, FUN.VALUE = NA_integer_, USE.NAMES = use.names)
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "3.3.0") {
|
||||
strrep <- function(x, times) {
|
||||
x <- as.character(x)
|
||||
if (length(x) == 0L) {
|
||||
return(x)
|
||||
}
|
||||
unlist(.mapply(function(x, times) {
|
||||
if (is.na(x) || is.na(times)) {
|
||||
return(NA_character_)
|
||||
}
|
||||
if (times <= 0L) {
|
||||
return("")
|
||||
}
|
||||
paste0(replicate(times, x), collapse = "")
|
||||
}, list(x = x, times = times), MoreArgs = list()), use.names = FALSE)
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "3.5.0") {
|
||||
isFALSE <- function(x) {
|
||||
is.logical(x) && length(x) == 1L && !is.na(x) && !x
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "3.6.0") {
|
||||
str2lang <- function(s) {
|
||||
stopifnot(length(s) == 1L)
|
||||
ex <- parse(text = s, keep.source = FALSE)
|
||||
stopifnot(length(ex) == 1L)
|
||||
ex[[1L]]
|
||||
}
|
||||
# trims() was introduced in 3.3.0, but its argument `whitespace` only in 3.6.0
|
||||
trimws <- function(x, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") {
|
||||
which <- match.arg(which)
|
||||
mysub <- function(re, x) sub(re, "", x, perl = TRUE)
|
||||
switch(which,
|
||||
left = mysub(paste0("^", whitespace, "+"), x),
|
||||
right = mysub(paste0(whitespace, "+$"), x),
|
||||
both = mysub(paste0(whitespace, "+$"), mysub(paste0("^", whitespace, "+"), x))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (getRversion() < "4.0.0") {
|
||||
deparse1 <- function(expr, collapse = " ", width.cutoff = 500L, ...) {
|
||||
paste(deparse(expr, width.cutoff, ...), collapse = collapse)
|
||||
}
|
||||
}
|
||||
|
||||
# nolint end
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -25,9 +29,9 @@
|
||||
|
||||
#' Transform Input to an Antibiotic ID
|
||||
#'
|
||||
#' Use this function to determine the antibiotic code of one or more antibiotics. The data set [antibiotics] will be searched for abbreviations, official names and synonyms (brand names).
|
||||
#' Use this function to determine the antibiotic drug code of one or more antibiotics. The data set [antibiotics] will be searched for abbreviations, official names and synonyms (brand names).
|
||||
#' @param x a [character] vector to determine to antibiotic ID
|
||||
#' @param flag_multiple_results a [logical] to indicate whether a note should be printed to the console that probably more than one antibiotic code or name can be retrieved from a single input value.
|
||||
#' @param flag_multiple_results a [logical] to indicate whether a note should be printed to the console that probably more than one antibiotic drug code or name can be retrieved from a single input value.
|
||||
#' @param info a [logical] to indicate whether a progress bar should be printed, defaults to `TRUE` only in interactive mode
|
||||
#' @param ... arguments passed on to internal functions
|
||||
#' @rdname as.ab
|
||||
@@ -43,7 +47,9 @@
|
||||
#'
|
||||
#' Use the [`ab_*`][ab_property()] functions to get properties based on the returned antibiotic ID, see *Examples*.
|
||||
#'
|
||||
#' Note: the [as.ab()] and [`ab_*`][ab_property()] functions may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.
|
||||
#' Note: the [as.ab()] and [`ab_*`][ab_property()] functions may use very long regular expression to match brand names of antimicrobial drugs. This may fail on some systems.
|
||||
#'
|
||||
#' You can add your own manual codes to be considered by [as.ab()] and all [`ab_*`][ab_property()] functions, see [add_custom_antimicrobials()].
|
||||
#' @section Source:
|
||||
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
|
||||
#'
|
||||
@@ -76,14 +82,15 @@
|
||||
#'
|
||||
#' # use ab_* functions to get a specific properties (see ?ab_property);
|
||||
#' # they use as.ab() internally:
|
||||
#' ab_name("J01FA01") # "Erythromycin"
|
||||
#' ab_name("eryt") # "Erythromycin"
|
||||
#' ab_name("J01FA01")
|
||||
#' ab_name("eryt")
|
||||
#'
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#'
|
||||
#' # you can quickly rename <rsi> columns using dplyr >= 1.0.0:
|
||||
#' # you can quickly rename 'rsi' columns using set_ab_names() with dplyr:
|
||||
#' example_isolates %>%
|
||||
#' rename_with(as.ab, where(is.rsi))
|
||||
#' set_ab_names(where(is.rsi), property = "atc")
|
||||
#' }
|
||||
#' }
|
||||
as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
@@ -91,12 +98,10 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
meet_criteria(flag_multiple_results, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
if (is.ab(x)) {
|
||||
return(x)
|
||||
}
|
||||
if (all(x %in% c(AB_lookup$ab, NA))) {
|
||||
if (all(x %in% c(AMR_env$AB_lookup$ab, NA))) {
|
||||
# all valid AB codes, but not yet right class
|
||||
return(set_clean_class(x,
|
||||
new_class = c("ab", "character")
|
||||
@@ -109,7 +114,6 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
x_bak <- x
|
||||
x <- toupper(x)
|
||||
x_nonNA <- x[!is.na(x)]
|
||||
|
||||
# remove diacritics
|
||||
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
|
||||
@@ -128,13 +132,13 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
x_unknown_ATCs <- character(0)
|
||||
|
||||
note_if_more_than_one_found <- function(found, index, from_text) {
|
||||
if (initial_search == TRUE & isTRUE(length(from_text) > 1)) {
|
||||
if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) {
|
||||
abnames <- ab_name(from_text, tolower = TRUE, initial_search = FALSE)
|
||||
if (ab_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") {
|
||||
abnames <- abnames[!abnames %in% c("clavulanic acid", "avibactam")]
|
||||
}
|
||||
if (length(abnames) > 1) {
|
||||
message_(
|
||||
warning_(
|
||||
"More than one result was found for item ", index, ": ",
|
||||
vector_and(abnames, quotes = FALSE)
|
||||
)
|
||||
@@ -144,41 +148,47 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
}
|
||||
|
||||
# Fill in names, AB codes, CID codes and ATC codes directly (`x` is already clean and uppercase)
|
||||
known_names <- x %in% AB_lookup$generalised_name
|
||||
x_new[known_names] <- AB_lookup$ab[match(x[known_names], AB_lookup$generalised_name)]
|
||||
known_codes_ab <- x %in% AB_lookup$ab
|
||||
known_codes_atc <- vapply(FUN.VALUE = logical(1), x, function(x_) x_ %in% unlist(AB_lookup$atc), USE.NAMES = FALSE)
|
||||
known_codes_cid <- x %in% AB_lookup$cid
|
||||
x_new[known_codes_ab] <- AB_lookup$ab[match(x[known_codes_ab], AB_lookup$ab)]
|
||||
x_new[known_codes_atc] <- AB_lookup$ab[vapply(
|
||||
known_names <- x %in% AMR_env$AB_lookup$generalised_name
|
||||
x_new[known_names] <- AMR_env$AB_lookup$ab[match(x[known_names], AMR_env$AB_lookup$generalised_name)]
|
||||
known_codes_ab <- x %in% AMR_env$AB_lookup$ab
|
||||
known_codes_atc <- vapply(FUN.VALUE = logical(1), x, function(x_) x_ %in% unlist(AMR_env$AB_lookup$atc), USE.NAMES = FALSE)
|
||||
known_codes_cid <- x %in% AMR_env$AB_lookup$cid
|
||||
x_new[known_codes_ab] <- AMR_env$AB_lookup$ab[match(x[known_codes_ab], AMR_env$AB_lookup$ab)]
|
||||
x_new[known_codes_atc] <- AMR_env$AB_lookup$ab[vapply(
|
||||
FUN.VALUE = integer(1),
|
||||
x[known_codes_atc],
|
||||
function(x_) {
|
||||
which(vapply(
|
||||
FUN.VALUE = logical(1),
|
||||
AB_lookup$atc,
|
||||
AMR_env$AB_lookup$atc,
|
||||
function(atc) x_ %in% atc
|
||||
))[1L]
|
||||
},
|
||||
USE.NAMES = FALSE
|
||||
)]
|
||||
x_new[known_codes_cid] <- AB_lookup$ab[match(x[known_codes_cid], AB_lookup$cid)]
|
||||
already_known <- known_names | known_codes_ab | known_codes_atc | known_codes_cid
|
||||
x_new[known_codes_cid] <- AMR_env$AB_lookup$ab[match(x[known_codes_cid], AMR_env$AB_lookup$cid)]
|
||||
previously_coerced <- x %in% AMR_env$ab_previously_coerced$x
|
||||
x_new[previously_coerced & is.na(x_new)] <- AMR_env$ab_previously_coerced$ab[match(x[is.na(x_new) & x %in% AMR_env$ab_previously_coerced$x], AMR_env$ab_previously_coerced$x)]
|
||||
already_known <- known_names | known_codes_ab | known_codes_atc | known_codes_cid | previously_coerced
|
||||
|
||||
if (initial_search == TRUE & sum(already_known) < length(x)) {
|
||||
# fix for NAs
|
||||
x_new[is.na(x)] <- NA
|
||||
already_known[is.na(x)] <- FALSE
|
||||
|
||||
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
|
||||
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
|
||||
on.exit(close(progress))
|
||||
}
|
||||
|
||||
for (i in which(!already_known)) {
|
||||
if (initial_search == TRUE) {
|
||||
if (isTRUE(initial_search)) {
|
||||
progress$tick()
|
||||
}
|
||||
|
||||
if (is.na(x[i]) | is.null(x[i])) {
|
||||
if (is.na(x[i]) || is.null(x[i])) {
|
||||
next
|
||||
}
|
||||
if (identical(x[i], "") |
|
||||
if (identical(x[i], "") ||
|
||||
# prevent "bacteria" from coercing to TMP, since Bacterial is a brand name of it:
|
||||
identical(tolower(x[i]), "bacteria")) {
|
||||
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
|
||||
@@ -208,10 +218,10 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
# exact LOINC code
|
||||
loinc_found <- unlist(lapply(
|
||||
AB_lookup$generalised_loinc,
|
||||
AMR_env$AB_lookup$generalised_loinc,
|
||||
function(s) x[i] %in% s
|
||||
))
|
||||
found <- antibiotics$ab[loinc_found == TRUE]
|
||||
found <- AMR_env$AB_lookup$ab[loinc_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
@@ -219,10 +229,10 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
# exact synonym
|
||||
synonym_found <- unlist(lapply(
|
||||
AB_lookup$generalised_synonyms,
|
||||
AMR_env$AB_lookup$generalised_synonyms,
|
||||
function(s) x[i] %in% s
|
||||
))
|
||||
found <- antibiotics$ab[synonym_found == TRUE]
|
||||
found <- AMR_env$AB_lookup$ab[synonym_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
@@ -230,11 +240,11 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
# exact abbreviation
|
||||
abbr_found <- unlist(lapply(
|
||||
AB_lookup$generalised_abbreviations,
|
||||
AMR_env$AB_lookup$generalised_abbreviations,
|
||||
# require at least 2 characters for abbreviations
|
||||
function(s) x[i] %in% s & nchar(x[i]) >= 2
|
||||
function(s) x[i] %in% s && nchar(x[i]) >= 2
|
||||
))
|
||||
found <- antibiotics$ab[abbr_found == TRUE]
|
||||
found <- AMR_env$AB_lookup$ab[abbr_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
@@ -242,9 +252,9 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
# length of input is quite long, and Levenshtein distance is only max 2
|
||||
if (nchar(x[i]) >= 10) {
|
||||
levenshtein <- as.double(utils::adist(x[i], AB_lookup$generalised_name))
|
||||
levenshtein <- as.double(utils::adist(x[i], AMR_env$AB_lookup$generalised_name))
|
||||
if (any(levenshtein <= 2)) {
|
||||
found <- AB_lookup$ab[which(levenshtein <= 2)]
|
||||
found <- AMR_env$AB_lookup$ab[which(levenshtein <= 2)]
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
@@ -281,24 +291,24 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
}
|
||||
|
||||
# try if name starts with it
|
||||
found <- antibiotics[which(AB_lookup$generalised_name %like% paste0("^", x_spelling)), "ab", drop = TRUE]
|
||||
found <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$generalised_name %like% paste0("^", x_spelling)), "ab", drop = TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
# try if name ends with it
|
||||
found <- antibiotics[which(AB_lookup$generalised_name %like% paste0(x_spelling, "$")), "ab", drop = TRUE]
|
||||
if (nchar(x[i]) >= 4 & length(found) > 0) {
|
||||
found <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$generalised_name %like% paste0(x_spelling, "$")), "ab", drop = TRUE]
|
||||
if (nchar(x[i]) >= 4 && length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# and try if any synonym starts with it
|
||||
synonym_found <- unlist(lapply(
|
||||
AB_lookup$generalised_synonyms,
|
||||
AMR_env$AB_lookup$generalised_synonyms,
|
||||
function(s) any(s %like% paste0("^", x_spelling))
|
||||
))
|
||||
found <- antibiotics$ab[synonym_found == TRUE]
|
||||
found <- AMR_env$AB_lookup$ab[synonym_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
@@ -306,22 +316,22 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
|
||||
# INITIAL SEARCH - More uncertain results ----
|
||||
|
||||
if (initial_search == TRUE && fast_mode == FALSE) {
|
||||
if (isTRUE(initial_search) && fast_mode == FALSE) {
|
||||
# only run on first try
|
||||
|
||||
# try by removing all spaces
|
||||
if (x[i] %like% " ") {
|
||||
found <- suppressWarnings(as.ab(gsub(" +", "", x[i], perl = TRUE), initial_search = FALSE))
|
||||
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)
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# 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))
|
||||
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)
|
||||
next
|
||||
}
|
||||
@@ -477,10 +487,24 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
|
||||
}
|
||||
|
||||
if (initial_search == TRUE & sum(already_known) < length(x)) {
|
||||
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
|
||||
close(progress)
|
||||
}
|
||||
|
||||
# save to package env to save time for next time
|
||||
if (isTRUE(initial_search)) {
|
||||
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_env$ab_previously_coerced,
|
||||
data.frame(
|
||||
x = x,
|
||||
ab = x_new,
|
||||
x_bak = x_bak[match(x, x_bak_clean)],
|
||||
stringsAsFactors = FALSE
|
||||
),
|
||||
stringsAsFactors = FALSE
|
||||
))
|
||||
}
|
||||
|
||||
# take failed ATC codes apart from rest
|
||||
if (length(x_unknown_ATCs) > 0 && fast_mode == FALSE) {
|
||||
warning_(
|
||||
@@ -489,7 +513,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
)
|
||||
}
|
||||
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
|
||||
|
||||
x_unknown <- c(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))])
|
||||
if (length(x_unknown) > 0 && fast_mode == FALSE) {
|
||||
warning_(
|
||||
"in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ",
|
||||
@@ -529,7 +554,7 @@ type_sum.ab <- function(x, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.ab <- function(x, ...) {
|
||||
cat("Class <ab>\n")
|
||||
cat("Class 'ab'\n")
|
||||
print(as.character(x), quote = FALSE)
|
||||
}
|
||||
|
||||
@@ -566,7 +591,7 @@ as.data.frame.ab <- function(x, ...) {
|
||||
"[<-.ab" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
|
||||
return_after_integrity_check(y, "antimicrobial drug code", AMR_env$AB_lookup$ab)
|
||||
}
|
||||
#' @method [[<- ab
|
||||
#' @export
|
||||
@@ -574,7 +599,7 @@ as.data.frame.ab <- function(x, ...) {
|
||||
"[[<-.ab" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
|
||||
return_after_integrity_check(y, "antimicrobial drug code", AMR_env$AB_lookup$ab)
|
||||
}
|
||||
#' @method c ab
|
||||
#' @export
|
||||
@@ -583,7 +608,7 @@ c.ab <- function(...) {
|
||||
x <- list(...)[[1L]]
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
return_after_integrity_check(y, "antimicrobial code", antibiotics$ab)
|
||||
return_after_integrity_check(y, "antimicrobial drug code", AMR_env$AB_lookup$ab)
|
||||
}
|
||||
|
||||
#' @method unique ab
|
||||
@@ -625,3 +650,20 @@ generalise_antibiotic_name <- function(x) {
|
||||
x <- gsub("(/| AND | WITH | W/|[+]|[-])+", " ", x, perl = TRUE)
|
||||
x
|
||||
}
|
||||
|
||||
get_translate_ab <- function(translate_ab) {
|
||||
translate_ab <- as.character(translate_ab)[1L]
|
||||
if (translate_ab %in% c("TRUE", "official")) {
|
||||
return("name")
|
||||
} else if (translate_ab %in% c(NA_character_, "FALSE")) {
|
||||
return(FALSE)
|
||||
} else {
|
||||
translate_ab <- tolower(translate_ab)
|
||||
stop_ifnot(translate_ab %in% colnames(AMR::antibiotics),
|
||||
"invalid value for 'translate_ab', this must be a column name of the antibiotics data set\n",
|
||||
"or TRUE (equals 'name') or FALSE to not translate at all.",
|
||||
call = FALSE
|
||||
)
|
||||
translate_ab
|
||||
}
|
||||
}
|
||||
|
||||
+20
-16
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -33,16 +37,16 @@
|
||||
#' @param thorough_search a [logical] to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to `TRUE` will take considerably more time than when using `FALSE`. At default, it will turn `TRUE` when all input elements contain a maximum of three words.
|
||||
#' @param info a [logical] to indicate whether a progress bar should be printed, defaults to `TRUE` only in interactive mode
|
||||
#' @param ... arguments passed on to [as.ab()]
|
||||
#' @details This function is also internally used by [as.ab()], although it then only searches for the first drug name and will throw a note if more drug names could have been returned. Note: the [as.ab()] function may use very long regular expression to match brand names of antimicrobial agents. This may fail on some systems.
|
||||
#' @details This function is also internally used by [as.ab()], although it then only searches for the first drug name and will throw a note if more drug names could have been returned. Note: the [as.ab()] function may use very long regular expression to match brand names of antimicrobial drugs. This may fail on some systems.
|
||||
#'
|
||||
#' ## Argument `type`
|
||||
#' ### Argument `type`
|
||||
#' At default, the function will search for antimicrobial drug names. All text elements will be searched for official names, ATC codes and brand names. As it uses [as.ab()] internally, it will correct for misspelling.
|
||||
#'
|
||||
#' With `type = "dose"` (or similar, like "dosing", "doses"), all text elements will be searched for [numeric] values that are higher than 100 and do not resemble years. The output will be [numeric]. It supports any unit (g, mg, IE, etc.) and multiple values in one clinical text, see *Examples*.
|
||||
#'
|
||||
#' With `type = "administration"` (or abbreviations, like "admin", "adm"), all text elements will be searched for a form of drug administration. It supports the following forms (including common abbreviations): buccal, implant, inhalation, instillation, intravenous, nasal, oral, parenteral, rectal, sublingual, transdermal and vaginal. Abbreviations for oral (such as 'po', 'per os') will become "oral", all values for intravenous (such as 'iv', 'intraven') will become "iv". It supports multiple values in one clinical text, see *Examples*.
|
||||
#'
|
||||
#' ## Argument `collapse`
|
||||
#' ### Argument `collapse`
|
||||
#' Without using `collapse`, this function will return a [list]. This can be convenient to use e.g. inside a `mutate()`):\cr
|
||||
#' `df %>% mutate(abx = ab_from_text(clinical_text))`
|
||||
#'
|
||||
@@ -55,7 +59,7 @@
|
||||
#' @examples
|
||||
#' # mind the bad spelling of amoxicillin in this line,
|
||||
#' # straight from a true health care record:
|
||||
#' ab_from_text("28/03/2020 regular amoxicilliin 500mg po tds")
|
||||
#' ab_from_text("28/03/2020 regular amoxicilliin 500mg po tid")
|
||||
#'
|
||||
#' ab_from_text("500 mg amoxi po and 400mg cipro iv")
|
||||
#' ab_from_text("500 mg amoxi po and 400mg cipro iv", type = "dose")
|
||||
@@ -110,7 +114,7 @@ ab_from_text <- function(text,
|
||||
meet_criteria(thorough_search, allow_class = "logical", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
type <- tolower(trimws(type))
|
||||
type <- tolower(trimws2(type))
|
||||
|
||||
text <- tolower(as.character(text))
|
||||
text_split_all <- strsplit(text, "[ ;.,:\\|]")
|
||||
@@ -120,21 +124,21 @@ ab_from_text <- function(text,
|
||||
if (type %like% "(drug|ab|anti)") {
|
||||
translate_ab <- get_translate_ab(translate_ab)
|
||||
|
||||
if (isTRUE(thorough_search) |
|
||||
(isTRUE(is.null(thorough_search)) & max(vapply(FUN.VALUE = double(1), text_split_all, length), na.rm = TRUE) <= 3)) {
|
||||
if (isTRUE(thorough_search) ||
|
||||
(isTRUE(is.null(thorough_search)) && max(vapply(FUN.VALUE = double(1), text_split_all, length), na.rm = TRUE) <= 3)) {
|
||||
text_split_all <- text_split_all[nchar(text_split_all) >= 4 & grepl("[a-z]+", text_split_all)]
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
progress$tick()
|
||||
suppressWarnings(
|
||||
out <- as.ab(text_split, ...)
|
||||
as.ab(text_split, ...)
|
||||
)
|
||||
})
|
||||
} else {
|
||||
# no thorough search
|
||||
abbr <- unlist(antibiotics$abbreviations)
|
||||
abbr <- unlist(AMR::antibiotics$abbreviations)
|
||||
abbr <- abbr[nchar(abbr) >= 4]
|
||||
names_atc <- substr(c(antibiotics$name, antibiotics$atc), 1, 5)
|
||||
synonyms <- unlist(antibiotics$synonyms)
|
||||
names_atc <- substr(c(AMR::antibiotics$name, AMR::antibiotics$atc), 1, 5)
|
||||
synonyms <- unlist(AMR::antibiotics$synonyms)
|
||||
synonyms <- synonyms[nchar(synonyms) >= 4]
|
||||
# regular expression must not be too long, so split synonyms in two:
|
||||
synonyms_part1 <- synonyms[seq_len(0.5 * length(synonyms))]
|
||||
@@ -149,7 +153,7 @@ ab_from_text <- function(text,
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
progress$tick()
|
||||
suppressWarnings(
|
||||
out <- as.ab(
|
||||
as.ab(
|
||||
unique(c(
|
||||
text_split[text_split %like_case% to_regex(abbr)],
|
||||
text_split[text_split %like_case% to_regex(names_atc)],
|
||||
@@ -176,7 +180,7 @@ ab_from_text <- function(text,
|
||||
}
|
||||
})
|
||||
} else if (type %like% "dos") {
|
||||
text_split_all <- strsplit(text, " ")
|
||||
text_split_all <- strsplit(text, " ", fixed = TRUE)
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
text_split <- text_split[text_split %like% "^[0-9]{2,}(/[0-9]+)?[a-z]*$"]
|
||||
# only left part of "/", like 500 in "500/125"
|
||||
|
||||
+55
-68
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -26,7 +30,7 @@
|
||||
#' Get Properties of an Antibiotic
|
||||
#'
|
||||
#' Use these functions to return a specific property of an antibiotic from the [antibiotics] data set. All input values will be evaluated internally with [as.ab()].
|
||||
#' @param x any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param x any (vector of) text that can be coerced to a valid antibiotic drug code with [as.ab()]
|
||||
#' @param tolower a [logical] to indicate whether the first [character] of every output should be transformed to a lower case [character]. This will lead to e.g. "polymyxin B" and not "polymyxin b".
|
||||
#' @param property one of the column names of one of the [antibiotics] data set: `vector_or(colnames(antibiotics), sort = FALSE)`.
|
||||
#' @param language language of the returned text, defaults to system language (see [get_AMR_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation.
|
||||
@@ -55,38 +59,35 @@
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @examples
|
||||
#' # all properties:
|
||||
#' ab_name("AMX") # "Amoxicillin"
|
||||
#' ab_atc("AMX") # "J01CA04" (ATC code from the WHO)
|
||||
#' ab_cid("AMX") # 33613 (Compound ID from PubChem)
|
||||
#' ab_synonyms("AMX") # a list with brand names of amoxicillin
|
||||
#' ab_tradenames("AMX") # same
|
||||
#' ab_group("AMX") # "Beta-lactams/penicillins"
|
||||
#' ab_atc_group1("AMX") # "Beta-lactam antibacterials, penicillins"
|
||||
#' ab_atc_group2("AMX") # "Penicillins with extended spectrum"
|
||||
#' ab_url("AMX") # link to the official WHO page
|
||||
#' ab_name("AMX")
|
||||
#' ab_atc("AMX")
|
||||
#' ab_cid("AMX")
|
||||
#' ab_synonyms("AMX")
|
||||
#' ab_tradenames("AMX")
|
||||
#' ab_group("AMX")
|
||||
#' ab_atc_group1("AMX")
|
||||
#' ab_atc_group2("AMX")
|
||||
#' ab_url("AMX")
|
||||
#'
|
||||
#' # smart lowercase tranformation
|
||||
#' ab_name(x = c("AMC", "PLB")) # "Amoxicillin/clavulanic acid" "Polymyxin B"
|
||||
#' ab_name(
|
||||
#' x = c("AMC", "PLB"),
|
||||
#' tolower = TRUE
|
||||
#' ) # "amoxicillin/clavulanic acid" "polymyxin B"
|
||||
#' ab_name(x = c("AMC", "PLB"))
|
||||
#' ab_name(x = c("AMC", "PLB"), tolower = TRUE)
|
||||
#'
|
||||
#' # defined daily doses (DDD)
|
||||
#' ab_ddd("AMX", "oral") # 1.5
|
||||
#' ab_ddd_units("AMX", "oral") # "g"
|
||||
#' ab_ddd("AMX", "iv") # 3
|
||||
#' ab_ddd_units("AMX", "iv") # "g"
|
||||
#' ab_ddd("AMX", "oral")
|
||||
#' ab_ddd_units("AMX", "oral")
|
||||
#' ab_ddd("AMX", "iv")
|
||||
#' ab_ddd_units("AMX", "iv")
|
||||
#'
|
||||
#' ab_info("AMX") # all properties as a list
|
||||
#'
|
||||
#' # all ab_* functions use as.ab() internally, so you can go from 'any' to 'any':
|
||||
#' ab_atc("AMP") # ATC code of AMP (ampicillin)
|
||||
#' ab_group("J01CA01") # Drug group of ampicillins ATC code
|
||||
#' ab_loinc("ampicillin") # LOINC codes of ampicillin
|
||||
#' ab_name("21066-6") # "Ampicillin" (using LOINC)
|
||||
#' ab_name(6249) # "Ampicillin" (using CID)
|
||||
#' ab_name("J01CA01") # "Ampicillin" (using ATC)
|
||||
#' ab_atc("AMP")
|
||||
#' ab_group("J01CA01")
|
||||
#' ab_loinc("ampicillin")
|
||||
#' ab_name("21066-6")
|
||||
#' ab_name(6249)
|
||||
#' ab_name("J01CA01")
|
||||
#'
|
||||
#' # spelling from different languages and dyslexia are no problem
|
||||
#' ab_atc("ceftriaxon")
|
||||
@@ -125,7 +126,7 @@
|
||||
#' }
|
||||
ab_name <- function(x, language = get_AMR_locale(), tolower = FALSE, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(tolower, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- translate_into_language(ab_validate(x = x, property = "name", ...), language = language, only_affect_ab_names = TRUE)
|
||||
@@ -168,7 +169,7 @@ ab_tradenames <- function(x, ...) {
|
||||
#' @export
|
||||
ab_group <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
translate_into_language(ab_validate(x = x, property = "group", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
@@ -208,7 +209,7 @@ ab_atc <- function(x, only_first = FALSE, ...) {
|
||||
#' @export
|
||||
ab_atc_group1 <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
translate_into_language(ab_validate(x = x, property = "atc_group1", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ ab_atc_group1 <- function(x, language = get_AMR_locale(), ...) {
|
||||
#' @export
|
||||
ab_atc_group2 <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
translate_into_language(ab_validate(x = x, property = "atc_group2", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
@@ -240,20 +241,7 @@ ab_ddd <- function(x, administration = "oral", ...) {
|
||||
meet_criteria(administration, is_in = c("oral", "iv"), has_length = 1)
|
||||
|
||||
x <- as.ab(x, ...)
|
||||
ddd_prop <- administration
|
||||
# old behaviour
|
||||
units <- list(...)$units
|
||||
if (!is.null(units) && isTRUE(units)) {
|
||||
if (message_not_thrown_before("ab_ddd", entire_session = TRUE)) {
|
||||
warning_(
|
||||
"in `ab_ddd()`: using `ab_ddd(..., units = TRUE)` is deprecated, use `ab_ddd_units()` to retrieve units instead.",
|
||||
"This warning will be shown once per session."
|
||||
)
|
||||
}
|
||||
ddd_prop <- paste0(ddd_prop, "_units")
|
||||
} else {
|
||||
ddd_prop <- paste0(ddd_prop, "_ddd")
|
||||
}
|
||||
ddd_prop <- paste0(administration, "_ddd")
|
||||
out <- ab_validate(x = x, property = ddd_prop)
|
||||
|
||||
if (any(ab_name(x, language = NULL) %like% "/" & is.na(out))) {
|
||||
@@ -273,23 +261,24 @@ ab_ddd_units <- function(x, administration = "oral", ...) {
|
||||
meet_criteria(administration, is_in = c("oral", "iv"), has_length = 1)
|
||||
|
||||
x <- as.ab(x, ...)
|
||||
if (any(ab_name(x, language = NULL) %like% "/")) {
|
||||
ddd_prop <- paste0(administration, "_units")
|
||||
out <- ab_validate(x = x, property = ddd_prop)
|
||||
|
||||
if (any(ab_name(x, language = NULL) %like% "/" & is.na(out))) {
|
||||
warning_(
|
||||
"in `ab_ddd_units()`: DDDs of 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",
|
||||
"www.whocc.no/ddd/list_of_ddds_combined_products/"
|
||||
)
|
||||
}
|
||||
|
||||
ddd_prop <- paste0(administration, "_units")
|
||||
ab_validate(x = x, property = ddd_prop)
|
||||
out
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
#' @export
|
||||
ab_info <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
|
||||
x <- as.ab(x, ...)
|
||||
list(
|
||||
@@ -334,7 +323,7 @@ ab_url <- function(x, open = FALSE, ...) {
|
||||
}
|
||||
|
||||
if (open == TRUE) {
|
||||
if (length(u) > 1 & !is.na(u[1L])) {
|
||||
if (length(u) > 1 && !is.na(u[1L])) {
|
||||
warning_("in `ab_url()`: only the first URL will be opened, as `browseURL()` only suports one string.")
|
||||
}
|
||||
if (!is.na(u[1L])) {
|
||||
@@ -348,7 +337,7 @@ ab_url <- function(x, open = FALSE, ...) {
|
||||
#' @export
|
||||
ab_property <- function(x, property = "name", language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(property, is_in = colnames(antibiotics), has_length = 1)
|
||||
meet_criteria(property, is_in = colnames(AMR::antibiotics), has_length = 1)
|
||||
meet_criteria(language, is_in = c(LANGUAGES_SUPPORTED, ""), has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
|
||||
translate_into_language(ab_validate(x = x, property = property, ...), language = language)
|
||||
}
|
||||
@@ -358,8 +347,8 @@ ab_property <- function(x, property = "name", language = get_AMR_locale(), ...)
|
||||
#' @export
|
||||
set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale(), snake_case = NULL) {
|
||||
meet_criteria(data, allow_class = c("data.frame", "character"))
|
||||
meet_criteria(property, is_in = colnames(antibiotics), has_length = 1, ignore.case = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(property, is_in = colnames(AMR::antibiotics), has_length = 1, ignore.case = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(snake_case, allow_class = "logical", has_length = 1, allow_NULL = TRUE)
|
||||
|
||||
x_deparsed <- deparse(substitute(data))
|
||||
@@ -389,7 +378,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
return(data)
|
||||
}
|
||||
} else {
|
||||
# quickly get antibiotic codes
|
||||
# quickly get antibiotic drug codes
|
||||
vars_ab <- as.ab(data, fast_mode = TRUE)
|
||||
vars <- data[!is.na(vars_ab)]
|
||||
}
|
||||
@@ -422,7 +411,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
x <- tolower(gsub("[^a-zA-Z0-9]+", "_", x))
|
||||
}
|
||||
|
||||
if (any(duplicated(x))) {
|
||||
if (anyDuplicated(x)) {
|
||||
# very hacky way of adding the index to each duplicate
|
||||
# so "Amoxicillin", "Amoxicillin", "Amoxicillin"
|
||||
# will be "Amoxicillin", "Amoxicillin_2", "Amoxicillin_3"
|
||||
@@ -433,7 +422,7 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
if (length(dups) > 1) {
|
||||
# there are duplicates
|
||||
dup_add_int <- dups[2:length(dups)]
|
||||
x[dup_add_int] <<- paste0(x[dup_add_int], "_", c(2:length(dups)))
|
||||
x[dup_add_int] <<- paste0(x[dup_add_int], "_", 2:length(dups))
|
||||
}
|
||||
}
|
||||
))
|
||||
@@ -448,24 +437,22 @@ set_ab_names <- function(data, ..., property = "name", language = get_AMR_locale
|
||||
}
|
||||
|
||||
ab_validate <- function(x, property, ...) {
|
||||
check_dataset_integrity()
|
||||
|
||||
if (tryCatch(all(x[!is.na(x)] %in% AB_lookup$ab), error = function(e) FALSE)) {
|
||||
# special case for ab_* functions where class is already <ab>
|
||||
x <- AB_lookup[match(x, AB_lookup$ab), property, drop = TRUE]
|
||||
if (tryCatch(all(x[!is.na(x)] %in% AMR_env$AB_lookup$ab), error = function(e) FALSE)) {
|
||||
# special case for ab_* functions where class is already 'ab'
|
||||
x <- AMR_env$AB_lookup[match(x, AMR_env$AB_lookup$ab), property, drop = TRUE]
|
||||
} else {
|
||||
# try to catch an error when inputting an invalid argument
|
||||
# so the 'call.' can be set to FALSE
|
||||
tryCatch(x[1L] %in% antibiotics[1, property, drop = TRUE],
|
||||
tryCatch(x[1L] %in% AMR_env$AB_lookup[1, property, drop = TRUE],
|
||||
error = function(e) stop(e$message, call. = FALSE)
|
||||
)
|
||||
|
||||
if (!all(x %in% AB_lookup[, property, drop = TRUE])) {
|
||||
if (!all(x %in% AMR_env$AB_lookup[, property, drop = TRUE])) {
|
||||
x <- as.ab(x, ...)
|
||||
if (all(is.na(x)) && is.list(AB_lookup[, property, drop = TRUE])) {
|
||||
if (all(is.na(x)) && is.list(AMR_env$AB_lookup[, property, drop = TRUE])) {
|
||||
x <- rep(NA_character_, length(x))
|
||||
} else {
|
||||
x <- AB_lookup[match(x, AB_lookup$ab), property, drop = TRUE]
|
||||
x <- AMR_env$AB_lookup[match(x, AMR_env$AB_lookup$ab), property, drop = TRUE]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+62
-37
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -25,11 +29,11 @@
|
||||
|
||||
#' Antibiotic Selectors
|
||||
#'
|
||||
#' These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group, without the need to define the columns or antibiotic abbreviations. In short, if you have a column name that resembles an antimicrobial agent, it will be picked up by any of these functions that matches its pharmaceutical class: "cefazolin", "CZO" and "J01DB04" will all be picked up by [cephalosporins()].
|
||||
#' These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class or group, without the need to define the columns or antibiotic abbreviations. In short, if you have a column name that resembles an antimicrobial drug, it will be picked up by any of these functions that matches its pharmaceutical class: "cefazolin", "CZO" and "J01DB04" will all be picked up by [cephalosporins()].
|
||||
#' @param ab_class an antimicrobial class or a part of it, such as `"carba"` and `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||
#' @param filter an [expression] to be evaluated in the [antibiotics] data set, such as `name %like% "trim"`
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||
#' @param only_treatable a [logical] to indicate whether agents that are only for laboratory tests should be excluded (defaults to `TRUE`), such as gentamicin-high (`GEH`) and imipenem/EDTA (`IPE`)
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `rsi` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||
#' @param only_treatable a [logical] to indicate whether antimicrobial drugs should be excluded that are only for laboratory tests (defaults to `TRUE`), such as gentamicin-high (`GEH`) and imipenem/EDTA (`IPE`)
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
#' @details
|
||||
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers][tidyselect::language] such as [`everything()`][tidyselect::everything()], but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
|
||||
@@ -212,7 +216,7 @@ ab_selector <- function(filter,
|
||||
sort = FALSE, fn = "ab_selector"
|
||||
)
|
||||
call <- substitute(filter)
|
||||
agents <- tryCatch(AMR::antibiotics[which(eval(call, envir = AMR::antibiotics)), "ab", drop = TRUE],
|
||||
agents <- tryCatch(AMR_env$AB_lookup[which(eval(call, envir = AMR_env$AB_lookup)), "ab", drop = TRUE],
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
)
|
||||
agents <- ab_in_data[ab_in_data %in% agents]
|
||||
@@ -420,8 +424,8 @@ administrable_per_os <- function(only_rsi_columns = FALSE, ...) {
|
||||
info = FALSE, only_rsi_columns = only_rsi_columns,
|
||||
sort = FALSE, fn = "administrable_per_os"
|
||||
)
|
||||
agents_all <- antibiotics[which(!is.na(antibiotics$oral_ddd)), "ab", drop = TRUE]
|
||||
agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$oral_ddd)), "ab", drop = TRUE]
|
||||
agents_all <- AMR_env$AB_lookup[which(!is.na(AMR_env$AB_lookup$oral_ddd)), "ab", drop = TRUE]
|
||||
agents <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$ab %in% ab_in_data & !is.na(AMR_env$AB_lookup$oral_ddd)), "ab", drop = TRUE]
|
||||
agents <- ab_in_data[ab_in_data %in% agents]
|
||||
message_agent_names(
|
||||
function_name = "administrable_per_os",
|
||||
@@ -458,8 +462,8 @@ administrable_iv <- function(only_rsi_columns = FALSE, ...) {
|
||||
info = FALSE, only_rsi_columns = only_rsi_columns,
|
||||
sort = FALSE, fn = "administrable_iv"
|
||||
)
|
||||
agents_all <- antibiotics[which(!is.na(antibiotics$iv_ddd)), "ab", drop = TRUE]
|
||||
agents <- antibiotics[which(antibiotics$ab %in% ab_in_data & !is.na(antibiotics$iv_ddd)), "ab", drop = TRUE]
|
||||
agents_all <- AMR_env$AB_lookup[which(!is.na(AMR_env$AB_lookup$iv_ddd)), "ab", drop = TRUE]
|
||||
agents <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$ab %in% ab_in_data & !is.na(AMR_env$AB_lookup$iv_ddd)), "ab", drop = TRUE]
|
||||
agents <- ab_in_data[ab_in_data %in% agents]
|
||||
message_agent_names(
|
||||
function_name = "administrable_iv",
|
||||
@@ -537,13 +541,14 @@ ab_select_exec <- function(function_name,
|
||||
info = FALSE, only_rsi_columns = only_rsi_columns,
|
||||
sort = FALSE, fn = function_name
|
||||
)
|
||||
|
||||
# untreatable drugs
|
||||
if (only_treatable == TRUE) {
|
||||
untreatable <- antibiotics[which(antibiotics$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
|
||||
untreatable <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$name %like% "-high|EDTA|polysorbate|macromethod|screening|/nacubactam"), "ab", drop = TRUE]
|
||||
if (any(untreatable %in% names(ab_in_data))) {
|
||||
if (message_not_thrown_before(function_name, "ab_class", "untreatable", entire_session = TRUE)) {
|
||||
warning_(
|
||||
"in `", function_name, "()`: some agents 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(ab_name(names(ab_in_data)[names(ab_in_data) %in% untreatable],
|
||||
language = NULL,
|
||||
tolower = TRUE
|
||||
@@ -559,15 +564,35 @@ ab_select_exec <- function(function_name,
|
||||
}
|
||||
|
||||
if (length(ab_in_data) == 0) {
|
||||
message_("No antimicrobial agents found in the data.")
|
||||
message_("No antimicrobial drugs found in the data.")
|
||||
return(NULL)
|
||||
}
|
||||
|
||||
if (is.null(ab_class_args)) {
|
||||
# their upper case equivalent are vectors with class <ab>, created in data-raw/_pre_commit_hook.R
|
||||
# carbapenems() gets its codes from AMR:::AB_CARBAPENEMS
|
||||
abx <- get(paste0("AB_", toupper(function_name)), envir = asNamespace("AMR"))
|
||||
ab_group <- function_name
|
||||
if (is.null(ab_class_args) || isTRUE(function_name %in% c("antifungals", "antimycobacterials"))) {
|
||||
ab_group <- NULL
|
||||
if (isTRUE(function_name == "antifungals")) {
|
||||
abx <- AMR_env$AB_lookup$ab[which(AMR_env$AB_lookup$group == "Antifungals")]
|
||||
} else if (isTRUE(function_name == "antimycobacterials")) {
|
||||
abx <- AMR_env$AB_lookup$ab[which(AMR_env$AB_lookup$group == "Antimycobacterials")]
|
||||
} else {
|
||||
# their upper case equivalent are vectors with class 'ab', created in data-raw/_pre_commit_hook.R
|
||||
# carbapenems() gets its codes from AMR:::AB_CARBAPENEMS
|
||||
abx <- get(paste0("AB_", toupper(function_name)), envir = asNamespace("AMR"))
|
||||
# manually added codes from add_custom_antimicrobials() must also be supported
|
||||
if (length(AMR_env$custom_ab_codes) > 0) {
|
||||
custom_ab <- AMR_env$AB_lookup[which(AMR_env$AB_lookup$ab %in% AMR_env$custom_ab_codes), ]
|
||||
check_string <- paste0(custom_ab$group, custom_ab$atc_group1, custom_ab$atc_group2)
|
||||
if (function_name == "betalactams") {
|
||||
find_group <- "beta-lactams"
|
||||
} else if (function_name %like% "cephalosporins_") {
|
||||
find_group <- gsub("_(.*)$", paste0(" (\\1 gen.)"), function_name)
|
||||
} else {
|
||||
find_group <- function_name
|
||||
}
|
||||
abx <- c(abx, custom_ab$ab[which(check_string %like% find_group)])
|
||||
}
|
||||
ab_group <- function_name
|
||||
}
|
||||
examples <- paste0(" (such as ", vector_or(ab_name(sample(abx, size = min(2, length(abx)), replace = FALSE),
|
||||
tolower = TRUE,
|
||||
language = NULL
|
||||
@@ -577,7 +602,7 @@ ab_select_exec <- function(function_name,
|
||||
} else {
|
||||
# this for the 'manual' ab_class() function
|
||||
abx <- subset(
|
||||
AB_lookup,
|
||||
AMR_env$AB_lookup,
|
||||
group %like% ab_class_args |
|
||||
atc_group1 %like% ab_class_args |
|
||||
atc_group2 %like% ab_class_args
|
||||
@@ -660,7 +685,7 @@ all.ab_selector_any_all <- function(..., na.rm = FALSE) {
|
||||
# e.g., example_isolates %>% filter(all(carbapenems() == "R"))
|
||||
# so just return the vector as is, only correcting for na.rm
|
||||
out <- unclass(c(...))
|
||||
if (na.rm == TRUE) {
|
||||
if (isTRUE(na.rm)) {
|
||||
out <- out[!is.na(out)]
|
||||
}
|
||||
out
|
||||
@@ -674,7 +699,7 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
|
||||
# e.g., example_isolates %>% filter(any(carbapenems() == "R"))
|
||||
# so just return the vector as is, only correcting for na.rm
|
||||
out <- unclass(c(...))
|
||||
if (na.rm == TRUE) {
|
||||
if (isTRUE(na.rm)) {
|
||||
out <- out[!is.na(out)]
|
||||
}
|
||||
out
|
||||
@@ -755,19 +780,19 @@ any.ab_selector_any_all <- function(..., na.rm = FALSE) {
|
||||
}
|
||||
|
||||
is_any <- function(el1) {
|
||||
syscalls <- paste0(trimws(deparse(sys.calls())), collapse = " ")
|
||||
syscalls <- paste0(trimws2(deparse(sys.calls())), collapse = " ")
|
||||
el1 <- gsub("(.*),.*", "\\1", el1)
|
||||
syscalls %like% paste0("[^_a-zA-Z0-9]any\\(", "(c\\()?", el1)
|
||||
}
|
||||
is_all <- function(el1) {
|
||||
syscalls <- paste0(trimws(deparse(sys.calls())), collapse = " ")
|
||||
syscalls <- paste0(trimws2(deparse(sys.calls())), collapse = " ")
|
||||
el1 <- gsub("(.*),.*", "\\1", el1)
|
||||
syscalls %like% paste0("[^_a-zA-Z0-9]all\\(", "(c\\()?", el1)
|
||||
}
|
||||
|
||||
find_ab_group <- function(ab_class_args) {
|
||||
ab_class_args <- gsub("[^a-zA-Z0-9]", ".*", ab_class_args)
|
||||
AB_lookup %pm>%
|
||||
AMR_env$AB_lookup %pm>%
|
||||
subset(group %like% ab_class_args |
|
||||
atc_group1 %like% ab_class_args |
|
||||
atc_group2 %like% ab_class_args) %pm>%
|
||||
@@ -782,16 +807,16 @@ find_ab_names <- function(ab_group, n = 3) {
|
||||
ab_group <- gsub("[^a-zA-Z|0-9]", ".*", ab_group)
|
||||
|
||||
# try popular first, they have DDDs
|
||||
drugs <- antibiotics[which((!is.na(antibiotics$iv_ddd) | !is.na(antibiotics$oral_ddd)) &
|
||||
antibiotics$name %unlike% " " &
|
||||
antibiotics$group %like% ab_group &
|
||||
antibiotics$ab %unlike% "[0-9]$"), ]$name
|
||||
drugs <- AMR_env$AB_lookup[which((!is.na(AMR_env$AB_lookup$iv_ddd) | !is.na(AMR_env$AB_lookup$oral_ddd)) &
|
||||
AMR_env$AB_lookup$name %unlike% " " &
|
||||
AMR_env$AB_lookup$group %like% ab_group &
|
||||
AMR_env$AB_lookup$ab %unlike% "[0-9]$"), ]$name
|
||||
if (length(drugs) < n) {
|
||||
# now try it all
|
||||
drugs <- antibiotics[which((antibiotics$group %like% ab_group |
|
||||
antibiotics$atc_group1 %like% ab_group |
|
||||
antibiotics$atc_group2 %like% ab_group) &
|
||||
antibiotics$ab %unlike% "[0-9]$"), ]$name
|
||||
drugs <- AMR_env$AB_lookup[which((AMR_env$AB_lookup$group %like% ab_group |
|
||||
AMR_env$AB_lookup$atc_group1 %like% ab_group |
|
||||
AMR_env$AB_lookup$atc_group2 %like% ab_group) &
|
||||
AMR_env$AB_lookup$ab %unlike% "[0-9]$"), ]$name
|
||||
}
|
||||
if (length(drugs) == 0) {
|
||||
return("??")
|
||||
@@ -808,13 +833,13 @@ message_agent_names <- function(function_name, agents, ab_group = NULL, examples
|
||||
if (message_not_thrown_before(function_name, sort(agents))) {
|
||||
if (length(agents) == 0) {
|
||||
if (is.null(ab_group)) {
|
||||
message_("For `", function_name, "()` no antimicrobial agents found", examples, ".")
|
||||
message_("For `", function_name, "()` no antimicrobial drugs found", examples, ".")
|
||||
} else if (ab_group == "administrable_per_os") {
|
||||
message_("No orally administrable agents found", examples, ".")
|
||||
message_("No orally administrable drugs found", examples, ".")
|
||||
} else if (ab_group == "administrable_iv") {
|
||||
message_("No IV administrable agents found", examples, ".")
|
||||
message_("No IV administrable drugs found", examples, ".")
|
||||
} else {
|
||||
message_("No antimicrobial agents of class '", ab_group, "' found", examples, ".")
|
||||
message_("No antimicrobial drugs of class '", ab_group, "' found", examples, ".")
|
||||
}
|
||||
} else {
|
||||
agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'")
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Add Custom Antimicrobials to This Package
|
||||
#'
|
||||
#' With [add_custom_antimicrobials()] you can add your own custom antimicrobial drug codes to the `AMR` package.
|
||||
#' @param x a [data.frame] resembling the [antibiotics] data set, at least containing columns "ab" and "name"
|
||||
#' @details Due to how \R works, the [add_custom_antimicrobials()] function has to be run in every \R session - added antimicrobials are not stored between sessions and are thus lost when \R is exited. It is possible to save the antimicrobial additions to your `.Rprofile` file to circumvent this, although this requires to load the `AMR` package at every start-up:
|
||||
#'
|
||||
#' ```r
|
||||
#' # Open .Rprofile file
|
||||
#' utils::file.edit("~/.Rprofile")
|
||||
#'
|
||||
#' # Add custom antibiotic drug codes:
|
||||
#' library(AMR)
|
||||
#' add_custom_antimicrobials(
|
||||
#' data.frame(ab = "TESTAB",
|
||||
#' name = "Test Antibiotic",
|
||||
#' group = "Test Group")
|
||||
#' )
|
||||
#' ```
|
||||
#'
|
||||
#' Use [clear_custom_antimicrobials()] to clear the previously added antimicrobials.
|
||||
#' @rdname add_custom_antimicrobials
|
||||
#' @export
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#'
|
||||
#' # returns NA and throws a warning (which is now suppressed):
|
||||
#' suppressWarnings(
|
||||
#' as.ab("testab")
|
||||
#' )
|
||||
#'
|
||||
#' # now add a custom entry - it will be considered by as.ab() and
|
||||
#' # all ab_*() functions
|
||||
#' add_custom_antimicrobials(
|
||||
#' data.frame(
|
||||
#' ab = "TESTAB",
|
||||
#' name = "Test Antibiotic",
|
||||
#' # you can add any property present in the
|
||||
#' # 'antibiotics' data set, such as 'group':
|
||||
#' group = "Test Group"
|
||||
#' )
|
||||
#' )
|
||||
#'
|
||||
#' # "testab" is now a new antibiotic:
|
||||
#' as.ab("testab")
|
||||
#' ab_name("testab")
|
||||
#' ab_group("testab")
|
||||
#'
|
||||
#' ab_info("testab")
|
||||
#'
|
||||
#'
|
||||
#' # Add Co-fluampicil, which is one of the many J01CR50 codes, see
|
||||
#' # https://www.whocc.no/ddd/list_of_ddds_combined_products/
|
||||
#' add_custom_antimicrobials(
|
||||
#' data.frame(
|
||||
#' ab = "COFLU",
|
||||
#' name = "Co-fluampicil",
|
||||
#' atc = "J01CR50",
|
||||
#' group = "Beta-lactams/penicillines"
|
||||
#' )
|
||||
#' )
|
||||
#' ab_atc("Co-fluampicil")
|
||||
#' ab_name("J01CR50")
|
||||
#'
|
||||
#' # even antibiotic selectors work
|
||||
#' x <- data.frame(
|
||||
#' random_column = "some value",
|
||||
#' coflu = as.rsi("S"),
|
||||
#' ampicillin = as.rsi("R")
|
||||
#' )
|
||||
#' x
|
||||
#' x[, betalactams()]
|
||||
#' }
|
||||
add_custom_antimicrobials <- function(x) {
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
stop_ifnot(
|
||||
all(c("ab", "name") %in% colnames(x)),
|
||||
"`x` must contain columns \"ab\" and \"name\"."
|
||||
)
|
||||
stop_if(
|
||||
any(x$ab %in% AMR_env$AB_lookup$ab),
|
||||
"Antimicrobial drug code(s) ", vector_and(x$ab[x$ab %in% AMR_env$AB_lookup$ab]), " already exist in the internal `antibiotics` data set."
|
||||
)
|
||||
|
||||
x <- x[, colnames(AMR_env$AB_lookup)[colnames(AMR_env$AB_lookup) %in% colnames(x)], drop = FALSE]
|
||||
x$generalised_name <- generalise_antibiotic_name(x$name)
|
||||
x$generalised_all <- as.list(x$generalised_name)
|
||||
if ("atc" %in% colnames(x)) {
|
||||
x$atc <- as.list(x$atc)
|
||||
}
|
||||
if ("loinc" %in% colnames(x)) {
|
||||
x$loinc <- as.list(x$loinc)
|
||||
}
|
||||
AMR_env$custom_ab_codes <- c(AMR_env$custom_ab_codes, x$ab)
|
||||
class(AMR_env$AB_lookup$ab) <- "character"
|
||||
|
||||
new_df <- AMR_env$AB_lookup[0, , drop = FALSE][seq_len(NROW(x)), , drop = FALSE]
|
||||
rownames(new_df) <- NULL
|
||||
list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list)
|
||||
for (l in which(list_cols)) {
|
||||
# prevent binding NULLs in lists, replace with NA
|
||||
new_df[, l] <- as.list(NA_character_)
|
||||
}
|
||||
for (col in colnames(x)) {
|
||||
# assign new values
|
||||
new_df[, col] <- x[, col, drop = TRUE]
|
||||
}
|
||||
AMR_env$AB_lookup <- unique(rbind(AMR_env$AB_lookup, new_df))
|
||||
class(AMR_env$AB_lookup$ab) <- c("ab", "character")
|
||||
message_("Added ", nr2char(nrow(x)), " record", ifelse(nrow(x) > 1, "s", ""), " to the internal `antibiotics` data set.")
|
||||
}
|
||||
|
||||
#' @rdname add_custom_antimicrobials
|
||||
#' @export
|
||||
clear_custom_antimicrobials <- function() {
|
||||
AMR_env$AB_lookup <- create_AB_lookup()
|
||||
AMR_env$custom_ab_codes <- character(0)
|
||||
message_("Custom antimicrobials cleared.")
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -139,7 +143,6 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#' @return Ordered [factor]
|
||||
#' @seealso To determine ages, based on one or more reference dates, use the [age()] function.
|
||||
#' @export
|
||||
|
||||
#' @examples
|
||||
#' ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
|
||||
#'
|
||||
@@ -163,7 +166,7 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # resistance of ciprofloxacin per age group
|
||||
#' if (require("dplyr")) {
|
||||
#' if (require("dplyr") && require("ggplot2")) {
|
||||
#' example_isolates %>%
|
||||
#' filter_first_isolate() %>%
|
||||
#' filter(mo == as.mo("Escherichia coli")) %>%
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -25,17 +29,20 @@
|
||||
|
||||
#' The `AMR` Package
|
||||
#'
|
||||
#' @description
|
||||
#' Welcome to the `AMR` package.
|
||||
#' @details
|
||||
#'
|
||||
#' `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.
|
||||
#'
|
||||
#' After installing this package, \R knows `r format_included_data_number(microorganisms)` distinct microbial species and all `r format_included_data_number(rbind(antibiotics[, "atc", drop = FALSE], antivirals[, "atc", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
#' This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||
#'
|
||||
#' After installing this package, \R knows `r format_included_data_number(microorganisms)` distinct microbial species and all `r format_included_data_number(rbind(antibiotics[, "name", drop = FALSE], antivirals[, "name", drop = FALSE]))` antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
#'
|
||||
#' This package is fully independent of any other \R package and works on Windows, macOS and Linux with all versions of \R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This \R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
#'
|
||||
#' This package can be used for:
|
||||
#' - Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the Catalogue of Life and List of Prokaryotic names with Standing in Nomenclature
|
||||
#' - Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines
|
||||
#' - Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature (LPSN) and the Global Biodiversity Information Facility (GBIF)
|
||||
#' - Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline from the last 10 years
|
||||
#' - Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records
|
||||
#' - Determining first isolates to be used for AMR data analysis
|
||||
#' - Calculating antimicrobial resistance
|
||||
@@ -53,21 +60,17 @@
|
||||
#'
|
||||
#' @section Reference Data Publicly Available:
|
||||
#' All data sets in this `AMR` package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. 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 Contact Us:
|
||||
#' For suggestions, comments or questions, please contact us via:
|
||||
#' @source
|
||||
#' To cite AMR in publications use:
|
||||
#'
|
||||
#' Dr. Matthijs S. Berends \cr
|
||||
#' m.s.berends \[at\] umcg \[dot\] nl \cr
|
||||
#' University of Groningen
|
||||
#' Department of Medical Microbiology and Infection Prevention \cr
|
||||
#' University Medical Center Groningen \cr
|
||||
#' Post Office Box 30001 \cr
|
||||
#' 9700 RB Groningen \cr
|
||||
#' The Netherlands
|
||||
#' <https://msberends.github.io/AMR/>
|
||||
#' Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C (2022). "AMR: An R Package for Working with Antimicrobial Resistance Data." _Journal of Statistical Software_, *104*(3), 1-31. \doi{10.18637/jss.v104.i03}.
|
||||
#'
|
||||
#' If you have found a bug, please file a new issue at: \cr
|
||||
#' <https://github.com/msberends/AMR/issues>
|
||||
#' A BibTeX entry for LaTeX users is:
|
||||
#'
|
||||
#' \preformatted{
|
||||
#' `r format(citation("AMR"), style = "bib")`
|
||||
#' }
|
||||
#' @name AMR
|
||||
#' @keywords internal
|
||||
#' @rdname AMR
|
||||
NULL
|
||||
"_PACKAGE"
|
||||
|
||||
+10
-8
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -94,9 +98,7 @@ atc_online_property <- function(atc_code,
|
||||
html_text <- import_fn("html_text", "rvest")
|
||||
read_html <- import_fn("read_html", "xml2")
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
if (!all(atc_code %in% unlist(antibiotics$atc))) {
|
||||
if (!all(atc_code %in% unlist(AMR::antibiotics$atc))) {
|
||||
atc_code <- as.character(ab_atc(atc_code, only_first = TRUE))
|
||||
}
|
||||
|
||||
@@ -183,7 +185,7 @@ atc_online_property <- function(atc_code,
|
||||
# ATC and name are only in first row
|
||||
returnvalue[i] <- out[1, property, drop = TRUE]
|
||||
} else {
|
||||
if (!"adm.r" %in% colnames(out) | is.na(out[1, "adm.r", drop = TRUE])) {
|
||||
if (!"adm.r" %in% colnames(out) || is.na(out[1, "adm.r", drop = TRUE])) {
|
||||
returnvalue[i] <- NA
|
||||
next
|
||||
} else {
|
||||
@@ -197,7 +199,7 @@ atc_online_property <- function(atc_code,
|
||||
}
|
||||
}
|
||||
|
||||
if (property == "groups" & length(returnvalue) == 1) {
|
||||
if (property == "groups" && length(returnvalue) == 1) {
|
||||
returnvalue <- returnvalue[[1]]
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,613 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Transform Input to an Antiviral Drug ID
|
||||
#'
|
||||
#' Use this function to determine the antiviral drug code of one or more antiviral drugs. The data set [antivirals] will be searched for abbreviations, official names and synonyms (brand names).
|
||||
#' @param x a [character] vector to determine to antiviral drug ID
|
||||
#' @param flag_multiple_results a [logical] to indicate whether a note should be printed to the console that probably more than one antiviral drug code or name can be retrieved from a single input value.
|
||||
#' @param info a [logical] to indicate whether a progress bar should be printed, defaults to `TRUE` only in interactive mode
|
||||
#' @param ... arguments passed on to internal functions
|
||||
#' @rdname as.av
|
||||
#' @inheritSection WHOCC WHOCC
|
||||
#' @details All entries in the [antivirals] data set have three different identifiers: a human readable EARS-Net code (column `ab`, used by ECDC and WHONET), an ATC code (column `atc`, used by WHO), and a CID code (column `cid`, Compound ID, used by PubChem). The data set contains more than 5,000 official brand names from many different countries, as found in PubChem. Not that some drugs contain multiple ATC codes.
|
||||
#'
|
||||
#' All these properties will be searched for the user input. The [as.av()] can correct for different forms of misspelling:
|
||||
#'
|
||||
#' * Wrong spelling of drug names (such as "acyclovir"), which corrects for most audible similarities such as f/ph, x/ks, c/z/s, t/th, etc.
|
||||
#' * Too few or too many vowels or consonants
|
||||
#' * Switching two characters (such as "aycclovir", often the case in clinical data, when doctors typed too fast)
|
||||
#' * Digitalised paper records, leaving artefacts like 0/o/O (zero and O's), B/8, n/r, etc.
|
||||
#'
|
||||
#' Use the [`av_*`][av_property()] functions to get properties based on the returned antiviral drug ID, see *Examples*.
|
||||
#'
|
||||
#' Note: the [as.av()] and [`av_*`][av_property()] functions may use very long regular expression to match brand names of antimicrobial drugs. This may fail on some systems.
|
||||
#' @section Source:
|
||||
#' World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
|
||||
#'
|
||||
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
|
||||
#' @aliases av
|
||||
#' @return A [character] [vector] with additional class [`ab`]
|
||||
#' @seealso
|
||||
#' * [antivirals] for the [data.frame] that is being used to determine ATCs
|
||||
#' * [av_from_text()] for a function to retrieve antimicrobial drugs from clinical text (from health care records)
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # these examples all return "ACI", the ID of aciclovir:
|
||||
#' as.av("J05AB01")
|
||||
#' as.av("J 05 AB 01")
|
||||
#' as.av("Aciclovir")
|
||||
#' as.av("aciclo")
|
||||
#' as.av(" aciclo 123")
|
||||
#' as.av("ACICL")
|
||||
#' as.av("ACI")
|
||||
#' as.av("Virorax") # trade name
|
||||
#' as.av("Zovirax") # trade name
|
||||
#'
|
||||
#' as.av("acyklofir") # severe spelling error, yet works
|
||||
#'
|
||||
#' # use av_* functions to get a specific properties (see ?av_property);
|
||||
#' # they use as.av() internally:
|
||||
#' av_name("J05AB01")
|
||||
#' av_name("acicl")
|
||||
as.av <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
meet_criteria(x, allow_class = c("character", "numeric", "integer", "factor"), allow_NA = TRUE)
|
||||
meet_criteria(flag_multiple_results, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (is.av(x)) {
|
||||
return(x)
|
||||
}
|
||||
if (all(x %in% c(AMR_env$AV_lookup$av, NA))) {
|
||||
# all valid AB codes, but not yet right class
|
||||
return(set_clean_class(x,
|
||||
new_class = c("av", "character")
|
||||
))
|
||||
}
|
||||
|
||||
initial_search <- is.null(list(...)$initial_search)
|
||||
already_regex <- isTRUE(list(...)$already_regex)
|
||||
fast_mode <- isTRUE(list(...)$fast_mode)
|
||||
|
||||
x_bak <- x
|
||||
x <- toupper(x)
|
||||
|
||||
# remove diacritics
|
||||
x <- iconv(x, from = "UTF-8", to = "ASCII//TRANSLIT")
|
||||
x <- gsub('"', "", x, fixed = TRUE)
|
||||
x <- gsub("(specimen|specimen date|specimen_date|spec_date|gender|^dates?$)", "", x, ignore.case = TRUE, perl = TRUE)
|
||||
x_bak_clean <- x
|
||||
if (already_regex == FALSE) {
|
||||
x_bak_clean <- generalise_antibiotic_name(x_bak_clean)
|
||||
}
|
||||
|
||||
x <- unique(x_bak_clean) # this means that every x is in fact generalise_antibiotic_name(x)
|
||||
x_new <- rep(NA_character_, length(x))
|
||||
x_unknown <- character(0)
|
||||
x_unknown_ATCs <- character(0)
|
||||
|
||||
note_if_more_than_one_found <- function(found, index, from_text) {
|
||||
if (isTRUE(initial_search) && isTRUE(length(from_text) > 1)) {
|
||||
avnames <- av_name(from_text, tolower = TRUE, initial_search = FALSE)
|
||||
if (av_name(found[1L], language = NULL) %like% "(clavulanic acid|avibactam)") {
|
||||
avnames <- avnames[!avnames %in% c("clavulanic acid", "avibactam")]
|
||||
}
|
||||
if (length(avnames) > 1) {
|
||||
warning_(
|
||||
"More than one result was found for item ", index, ": ",
|
||||
vector_and(avnames, quotes = FALSE)
|
||||
)
|
||||
}
|
||||
}
|
||||
found[1L]
|
||||
}
|
||||
|
||||
# Fill in names, AB codes, CID codes and ATC codes directly (`x` is already clean and uppercase)
|
||||
known_names <- x %in% AMR_env$AV_lookup$generalised_name
|
||||
x_new[known_names] <- AMR_env$AV_lookup$av[match(x[known_names], AMR_env$AV_lookup$generalised_name)]
|
||||
known_codes_av <- x %in% AMR_env$AV_lookup$av
|
||||
known_codes_atc <- vapply(FUN.VALUE = logical(1), x, function(x_) x_ %in% unlist(AMR_env$AV_lookup$atc), USE.NAMES = FALSE)
|
||||
known_codes_cid <- x %in% AMR_env$AV_lookup$cid
|
||||
x_new[known_codes_av] <- AMR_env$AV_lookup$av[match(x[known_codes_av], AMR_env$AV_lookup$av)]
|
||||
x_new[known_codes_atc] <- AMR_env$AV_lookup$av[vapply(
|
||||
FUN.VALUE = integer(1),
|
||||
x[known_codes_atc],
|
||||
function(x_) {
|
||||
which(vapply(
|
||||
FUN.VALUE = logical(1),
|
||||
AMR_env$AV_lookup$atc,
|
||||
function(atc) x_ %in% atc
|
||||
))[1L]
|
||||
},
|
||||
USE.NAMES = FALSE
|
||||
)]
|
||||
x_new[known_codes_cid] <- AMR_env$AV_lookup$av[match(x[known_codes_cid], AMR_env$AV_lookup$cid)]
|
||||
previously_coerced <- x %in% AMR_env$av_previously_coerced$x
|
||||
x_new[previously_coerced & is.na(x_new)] <- AMR_env$av_previously_coerced$av[match(x[is.na(x_new) & x %in% AMR_env$av_previously_coerced$x], AMR_env$av_previously_coerced$x)]
|
||||
already_known <- known_names | known_codes_av | known_codes_atc | known_codes_cid | previously_coerced
|
||||
|
||||
# fix for NAs
|
||||
x_new[is.na(x)] <- NA
|
||||
already_known[is.na(x)] <- FALSE
|
||||
|
||||
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
|
||||
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
|
||||
on.exit(close(progress))
|
||||
}
|
||||
|
||||
for (i in which(!already_known)) {
|
||||
if (isTRUE(initial_search)) {
|
||||
progress$tick()
|
||||
}
|
||||
|
||||
if (is.na(x[i]) || is.null(x[i])) {
|
||||
next
|
||||
}
|
||||
if (identical(x[i], "") ||
|
||||
# prevent "bacteria" from coercing to TMP, since Bacterial is a brand name of it:
|
||||
identical(tolower(x[i]), "bacteria")) {
|
||||
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
|
||||
next
|
||||
}
|
||||
if (x[i] %like_case% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]") {
|
||||
# seems an ATC code, but the available ones are in `already_known`, so:
|
||||
x_unknown <- c(x_unknown, x[i])
|
||||
x_unknown_ATCs <- c(x_unknown_ATCs, x[i])
|
||||
x_new[i] <- NA_character_
|
||||
next
|
||||
}
|
||||
|
||||
if (fast_mode == FALSE && flag_multiple_results == TRUE && x[i] %like% "[ ]") {
|
||||
from_text <- tryCatch(suppressWarnings(av_from_text(x[i], initial_search = FALSE, translate_av = FALSE)[[1]]),
|
||||
error = function(e) character(0)
|
||||
)
|
||||
} else {
|
||||
from_text <- character(0)
|
||||
}
|
||||
|
||||
# old code for phenoxymethylpenicillin (Peni V)
|
||||
if (x[i] == "PNV") {
|
||||
x_new[i] <- "PHN"
|
||||
next
|
||||
}
|
||||
|
||||
# exact LOINC code
|
||||
loinc_found <- unlist(lapply(
|
||||
AMR_env$AV_lookup$generalised_loinc,
|
||||
function(s) x[i] %in% s
|
||||
))
|
||||
found <- AMR_env$AV_lookup$av[loinc_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# exact synonym
|
||||
synonym_found <- unlist(lapply(
|
||||
AMR_env$AV_lookup$generalised_synonyms,
|
||||
function(s) x[i] %in% s
|
||||
))
|
||||
found <- AMR_env$AV_lookup$av[synonym_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# length of input is quite long, and Levenshtein distance is only max 2
|
||||
if (nchar(x[i]) >= 10) {
|
||||
levenshtein <- as.double(utils::adist(x[i], AMR_env$AV_lookup$generalised_name))
|
||||
if (any(levenshtein <= 2)) {
|
||||
found <- AMR_env$AV_lookup$av[which(levenshtein <= 2)]
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# allow characters that resemble others, but only continue when having more than 3 characters
|
||||
if (nchar(x[i]) <= 3) {
|
||||
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
|
||||
next
|
||||
}
|
||||
x_spelling <- x[i]
|
||||
if (already_regex == FALSE) {
|
||||
x_spelling <- gsub("[IY]+", "[IY]+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("(C|K|Q|QU|S|Z|X|KS)+", "(C|K|Q|QU|S|Z|X|KS)+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("(PH|F|V)+", "(PH|F|V)+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("(TH|T)+", "(TH|T)+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("A+", "A+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("E+", "E+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("O+", "O+", x_spelling, perl = TRUE)
|
||||
# allow any ending of -in/-ine and -im/-ime
|
||||
x_spelling <- gsub("(\\[IY\\]\\+(N|M)|\\[IY\\]\\+(N|M)E\\+?)$", "[IY]+(N|M)E*", x_spelling, perl = TRUE)
|
||||
# allow any ending of -ol/-ole
|
||||
x_spelling <- gsub("(O\\+L|O\\+LE\\+)$", "O+LE*", x_spelling, perl = TRUE)
|
||||
# allow any ending of -on/-one
|
||||
x_spelling <- gsub("(O\\+N|O\\+NE\\+)$", "O+NE*", x_spelling, perl = TRUE)
|
||||
# replace multiple same characters to single one with '+', like "ll" -> "l+"
|
||||
x_spelling <- gsub("(.)\\1+", "\\1+", x_spelling, perl = TRUE)
|
||||
# replace spaces and slashes with a possibility on both
|
||||
x_spelling <- gsub("[ /]", "( .*|.*/)", x_spelling, perl = TRUE)
|
||||
# correct for digital reading text (OCR)
|
||||
x_spelling <- gsub("[NRD8B]", "[NRD8B]", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("(O|0)", "(O|0)+", x_spelling, perl = TRUE)
|
||||
x_spelling <- gsub("++", "+", x_spelling, fixed = TRUE)
|
||||
}
|
||||
|
||||
# try if name starts with it
|
||||
found <- AMR_env$AV_lookup[which(AMR_env$AV_lookup$generalised_name %like% paste0("^", x_spelling)), "av", drop = TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
# try if name ends with it
|
||||
found <- AMR_env$AV_lookup[which(AMR_env$AV_lookup$generalised_name %like% paste0(x_spelling, "$")), "av", drop = TRUE]
|
||||
if (nchar(x[i]) >= 4 && length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# and try if any synonym starts with it
|
||||
synonym_found <- unlist(lapply(
|
||||
AMR_env$AV_lookup$generalised_synonyms,
|
||||
function(s) any(s %like% paste0("^", x_spelling))
|
||||
))
|
||||
found <- AMR_env$AV_lookup$av[synonym_found == TRUE]
|
||||
if (length(found) > 0) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# INITIAL SEARCH - More uncertain results ----
|
||||
|
||||
if (isTRUE(initial_search) && fast_mode == FALSE) {
|
||||
# only run on first try
|
||||
|
||||
# try by removing all spaces
|
||||
if (x[i] %like% " ") {
|
||||
found <- suppressWarnings(as.av(gsub(" +", "", x[i], perl = TRUE), initial_search = FALSE))
|
||||
if (length(found) > 0 && !is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# try by removing all spaces and numbers
|
||||
if (x[i] %like% " " || x[i] %like% "[0-9]") {
|
||||
found <- suppressWarnings(as.av(gsub("[ 0-9]", "", x[i], perl = TRUE), initial_search = FALSE))
|
||||
if (length(found) > 0 && !is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# transform back from other languages and try again
|
||||
x_translated <- paste(lapply(
|
||||
strsplit(x[i], "[^A-Z0-9]"),
|
||||
function(y) {
|
||||
for (i in seq_len(length(y))) {
|
||||
for (lang in LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]) {
|
||||
y[i] <- ifelse(tolower(y[i]) %in% tolower(TRANSLATIONS[, lang, drop = TRUE]),
|
||||
TRANSLATIONS[which(tolower(TRANSLATIONS[, lang, drop = TRUE]) == tolower(y[i]) &
|
||||
!isFALSE(TRANSLATIONS$fixed)), "pattern"],
|
||||
y[i]
|
||||
)
|
||||
}
|
||||
}
|
||||
generalise_antibiotic_name(y)
|
||||
}
|
||||
)[[1]],
|
||||
collapse = "/"
|
||||
)
|
||||
x_translated_guess <- suppressWarnings(as.av(x_translated, initial_search = FALSE))
|
||||
if (!is.na(x_translated_guess)) {
|
||||
x_new[i] <- x_translated_guess
|
||||
next
|
||||
}
|
||||
|
||||
# now also try to coerce brandname combinations like "Amoxy/clavulanic acid"
|
||||
x_translated <- paste(lapply(
|
||||
strsplit(x_translated, "[^A-Z0-9 ]"),
|
||||
function(y) {
|
||||
for (i in seq_len(length(y))) {
|
||||
y_name <- suppressWarnings(av_name(y[i], language = NULL, initial_search = FALSE))
|
||||
y[i] <- ifelse(!is.na(y_name),
|
||||
y_name,
|
||||
y[i]
|
||||
)
|
||||
}
|
||||
generalise_antibiotic_name(y)
|
||||
}
|
||||
)[[1]],
|
||||
collapse = "/"
|
||||
)
|
||||
x_translated_guess <- suppressWarnings(as.av(x_translated, initial_search = FALSE))
|
||||
if (!is.na(x_translated_guess)) {
|
||||
x_new[i] <- x_translated_guess
|
||||
next
|
||||
}
|
||||
|
||||
# try by removing all trailing capitals
|
||||
if (x[i] %like_case% "[a-z]+[A-Z]+$") {
|
||||
found <- suppressWarnings(as.av(gsub("[A-Z]+$", "", x[i], perl = TRUE), initial_search = FALSE))
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# keep only letters
|
||||
found <- suppressWarnings(as.av(gsub("[^A-Z]", "", x[i], perl = TRUE), initial_search = FALSE))
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# try from a bigger text, like from a health care record, see ?av_from_text
|
||||
# already calculated above if flag_multiple_results = TRUE
|
||||
if (flag_multiple_results == TRUE) {
|
||||
found <- from_text[1L]
|
||||
} else {
|
||||
found <- tryCatch(suppressWarnings(av_from_text(x[i], initial_search = FALSE, translate_av = FALSE)[[1]][1L]),
|
||||
error = function(e) NA_character_
|
||||
)
|
||||
}
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# first 5
|
||||
found <- suppressWarnings(as.av(substr(x[i], 1, 5), initial_search = FALSE))
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# make all consonants facultative
|
||||
search_str <- gsub("([BCDFGHJKLMNPQRSTVWXZ])", "\\1*", x[i], perl = TRUE)
|
||||
found <- suppressWarnings(as.av(search_str, initial_search = FALSE, already_regex = TRUE))
|
||||
# keep at least 4 normal characters
|
||||
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 4) {
|
||||
found <- NA
|
||||
}
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# make all vowels facultative
|
||||
search_str <- gsub("([AEIOUY])", "\\1*", x[i], perl = TRUE)
|
||||
found <- suppressWarnings(as.av(search_str, initial_search = FALSE, already_regex = TRUE))
|
||||
# keep at least 5 normal characters
|
||||
if (nchar(gsub(".\\*", "", search_str, perl = TRUE)) < 5) {
|
||||
found <- NA
|
||||
}
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# allow misspelling of vowels
|
||||
x_spelling <- gsub("A+", "[AEIOU]+", x_spelling, fixed = TRUE)
|
||||
x_spelling <- gsub("E+", "[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("U+", "[AEIOU]+", x_spelling, fixed = TRUE)
|
||||
found <- suppressWarnings(as.av(x_spelling, initial_search = FALSE, already_regex = TRUE))
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
# try with switched character, like "mreopenem"
|
||||
for (j in seq_len(nchar(x[i]))) {
|
||||
x_switched <- paste0(
|
||||
# beginning part:
|
||||
substr(x[i], 1, j - 1),
|
||||
# here is the switching of 2 characters:
|
||||
substr(x[i], j + 1, j + 1),
|
||||
substr(x[i], j, j),
|
||||
# ending part:
|
||||
substr(x[i], j + 2, nchar(x[i]))
|
||||
)
|
||||
found <- suppressWarnings(as.av(x_switched, initial_search = FALSE))
|
||||
if (!is.na(found)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!is.na(found)) {
|
||||
x_new[i] <- found[1L]
|
||||
next
|
||||
}
|
||||
} # end of initial_search = TRUE
|
||||
|
||||
# not found
|
||||
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
|
||||
}
|
||||
|
||||
if (isTRUE(initial_search) && sum(already_known) < length(x)) {
|
||||
close(progress)
|
||||
}
|
||||
|
||||
# save to package env to save time for next time
|
||||
if (isTRUE(initial_search)) {
|
||||
AMR_env$av_previously_coerced <- AMR_env$av_previously_coerced[which(!AMR_env$av_previously_coerced$x %in% x), , drop = FALSE]
|
||||
AMR_env$av_previously_coerced <- unique(rbind(AMR_env$av_previously_coerced,
|
||||
data.frame(
|
||||
x = x,
|
||||
av = x_new,
|
||||
x_bak = x_bak[match(x, x_bak_clean)],
|
||||
stringsAsFactors = FALSE
|
||||
),
|
||||
stringsAsFactors = FALSE
|
||||
))
|
||||
}
|
||||
|
||||
# take failed ATC codes apart from rest
|
||||
if (length(x_unknown_ATCs) > 0 && fast_mode == FALSE) {
|
||||
warning_(
|
||||
"in `as.av()`: these ATC codes are not (yet) in the antivirals data set: ",
|
||||
vector_and(x_unknown_ATCs), "."
|
||||
)
|
||||
}
|
||||
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
|
||||
x_unknown <- c(x_unknown,
|
||||
AMR_env$av_previously_coerced$x_bak[which(AMR_env$av_previously_coerced$x %in% x & is.na(AMR_env$av_previously_coerced$av))])
|
||||
if (length(x_unknown) > 0 && fast_mode == FALSE) {
|
||||
warning_(
|
||||
"in `as.av()`: these values could not be coerced to a valid antiviral drug ID: ",
|
||||
vector_and(x_unknown), "."
|
||||
)
|
||||
}
|
||||
|
||||
x_result <- x_new[match(x_bak_clean, x)]
|
||||
if (length(x_result) == 0) {
|
||||
x_result <- NA_character_
|
||||
}
|
||||
|
||||
set_clean_class(x_result,
|
||||
new_class = c("av", "character")
|
||||
)
|
||||
}
|
||||
|
||||
#' @rdname as.av
|
||||
#' @export
|
||||
is.av <- function(x) {
|
||||
inherits(x, "av")
|
||||
}
|
||||
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
pillar_shaft.av <- function(x, ...) {
|
||||
out <- trimws(format(x))
|
||||
out[!is.na(x)] <- gsub("+", font_subtle("+"), out[!is.na(x)], fixed = TRUE)
|
||||
out[is.na(x)] <- font_na(NA)
|
||||
create_pillar_column(out, align = "left", min_width = 4)
|
||||
}
|
||||
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
type_sum.av <- function(x, ...) {
|
||||
"av"
|
||||
}
|
||||
|
||||
#' @method print av
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.av <- function(x, ...) {
|
||||
cat("Class 'av'\n")
|
||||
print(as.character(x), quote = FALSE)
|
||||
}
|
||||
|
||||
#' @method as.data.frame av
|
||||
#' @export
|
||||
#' @noRd
|
||||
as.data.frame.av <- function(x, ...) {
|
||||
nm <- deparse1(substitute(x))
|
||||
if (!"nm" %in% names(list(...))) {
|
||||
as.data.frame.vector(as.av(x), ..., nm = nm)
|
||||
} else {
|
||||
as.data.frame.vector(as.av(x), ...)
|
||||
}
|
||||
}
|
||||
#' @method [ av
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[.av" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @method [[ av
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[.av" <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
#' @method [<- av
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[<-.av" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
return_after_integrity_check(y, "antiviral drug code", AMR_env$AV_lookup$av)
|
||||
}
|
||||
#' @method [[<- av
|
||||
#' @export
|
||||
#' @noRd
|
||||
"[[<-.av" <- function(i, j, ..., value) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(i)
|
||||
return_after_integrity_check(y, "antiviral drug code", AMR_env$AV_lookup$av)
|
||||
}
|
||||
#' @method c av
|
||||
#' @export
|
||||
#' @noRd
|
||||
c.av <- function(...) {
|
||||
x <- list(...)[[1L]]
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
return_after_integrity_check(y, "antiviral drug code", AMR_env$AV_lookup$av)
|
||||
}
|
||||
|
||||
#' @method unique av
|
||||
#' @export
|
||||
#' @noRd
|
||||
unique.av <- function(x, incomparables = FALSE, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
|
||||
#' @method rep av
|
||||
#' @export
|
||||
#' @noRd
|
||||
rep.av <- function(x, ...) {
|
||||
y <- NextMethod()
|
||||
attributes(y) <- attributes(x)
|
||||
y
|
||||
}
|
||||
|
||||
get_translate_av <- function(translate_av) {
|
||||
translate_av <- as.character(translate_av)[1L]
|
||||
if (translate_av %in% c("TRUE", "official")) {
|
||||
return("name")
|
||||
} else if (translate_av %in% c(NA_character_, "FALSE")) {
|
||||
return(FALSE)
|
||||
} else {
|
||||
translate_av <- tolower(translate_av)
|
||||
stop_ifnot(translate_av %in% colnames(AMR::antivirals),
|
||||
"invalid value for 'translate_av', this must be a column name of the antivirals data set\n",
|
||||
"or TRUE (equals 'name') or FALSE to not translate at all.",
|
||||
call = FALSE
|
||||
)
|
||||
translate_av
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Retrieve Antiviral Drug Names and Doses from Clinical Text
|
||||
#'
|
||||
#' Use this function on e.g. clinical texts from health care records. It returns a [list] with all antiviral drugs, doses and forms of administration found in the texts.
|
||||
#' @param text text to analyse
|
||||
#' @param type type of property to search for, either `"drug"`, `"dose"` or `"administration"`, see *Examples*
|
||||
#' @param collapse a [character] to pass on to `paste(, collapse = ...)` to only return one [character] per element of `text`, see *Examples*
|
||||
#' @param translate_av if `type = "drug"`: a column name of the [antivirals] data set to translate the antibiotic abbreviations to, using [av_property()]. Defaults to `FALSE`. Using `TRUE` is equal to using "name".
|
||||
#' @param thorough_search a [logical] to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to `TRUE` will take considerably more time than when using `FALSE`. At default, it will turn `TRUE` when all input elements contain a maximum of three words.
|
||||
#' @param info a [logical] to indicate whether a progress bar should be printed, defaults to `TRUE` only in interactive mode
|
||||
#' @param ... arguments passed on to [as.av()]
|
||||
#' @details This function is also internally used by [as.av()], although it then only searches for the first drug name and will throw a note if more drug names could have been returned. Note: the [as.av()] function may use very long regular expression to match brand names of antiviral drugs. This may fail on some systems.
|
||||
#'
|
||||
#' ### Argument `type`
|
||||
#' At default, the function will search for antiviral drug names. All text elements will be searched for official names, ATC codes and brand names. As it uses [as.av()] internally, it will correct for misspelling.
|
||||
#'
|
||||
#' With `type = "dose"` (or similar, like "dosing", "doses"), all text elements will be searched for [numeric] values that are higher than 100 and do not resemble years. The output will be [numeric]. It supports any unit (g, mg, IE, etc.) and multiple values in one clinical text, see *Examples*.
|
||||
#'
|
||||
#' With `type = "administration"` (or abbreviations, like "admin", "adm"), all text elements will be searched for a form of drug administration. It supports the following forms (including common abbreviations): buccal, implant, inhalation, instillation, intravenous, nasal, oral, parenteral, rectal, sublingual, transdermal and vaginal. Abbreviations for oral (such as 'po', 'per os') will become "oral", all values for intravenous (such as 'iv', 'intraven') will become "iv". It supports multiple values in one clinical text, see *Examples*.
|
||||
#'
|
||||
#' ### Argument `collapse`
|
||||
#' Without using `collapse`, this function will return a [list]. This can be convenient to use e.g. inside a `mutate()`):\cr
|
||||
#' `df %>% mutate(avx = av_from_text(clinical_text))`
|
||||
#'
|
||||
#' The returned AV codes can be transformed to official names, groups, etc. with all [`av_*`][av_property()] functions such as [av_name()] and [av_group()], or by using the `translate_av` argument.
|
||||
#'
|
||||
#' With using `collapse`, this function will return a [character]:\cr
|
||||
#' `df %>% mutate(avx = av_from_text(clinical_text, collapse = "|"))`
|
||||
#' @export
|
||||
#' @return A [list], or a [character] if `collapse` is not `NULL`
|
||||
#' @examples
|
||||
#' av_from_text("28/03/2020 valaciclovir po tid")
|
||||
#' av_from_text("28/03/2020 valaciclovir po tid", type = "admin")
|
||||
av_from_text <- function(text,
|
||||
type = c("drug", "dose", "administration"),
|
||||
collapse = NULL,
|
||||
translate_av = FALSE,
|
||||
thorough_search = NULL,
|
||||
info = interactive(),
|
||||
...) {
|
||||
if (missing(type)) {
|
||||
type <- type[1L]
|
||||
}
|
||||
|
||||
meet_criteria(text)
|
||||
meet_criteria(type, allow_class = "character", has_length = 1)
|
||||
meet_criteria(collapse, has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(translate_av, allow_NULL = FALSE) # get_translate_av() will be more informative about what's allowed
|
||||
meet_criteria(thorough_search, allow_class = "logical", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
type <- tolower(trimws2(type))
|
||||
|
||||
text <- tolower(as.character(text))
|
||||
text_split_all <- strsplit(text, "[ ;.,:\\|]")
|
||||
progress <- progress_ticker(n = length(text_split_all), n_min = 5, print = info)
|
||||
on.exit(close(progress))
|
||||
|
||||
if (type %like% "(drug|ab|anti)") {
|
||||
translate_av <- get_translate_av(translate_av)
|
||||
|
||||
if (isTRUE(thorough_search) ||
|
||||
(isTRUE(is.null(thorough_search)) && max(vapply(FUN.VALUE = double(1), text_split_all, length), na.rm = TRUE) <= 3)) {
|
||||
text_split_all <- text_split_all[nchar(text_split_all) >= 4 & grepl("[a-z]+", text_split_all)]
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
progress$tick()
|
||||
suppressWarnings(
|
||||
as.av(text_split, ...)
|
||||
)
|
||||
})
|
||||
} else {
|
||||
# no thorough search
|
||||
names_atc <- substr(c(AMR::antivirals$name, AMR::antivirals$atc), 1, 5)
|
||||
synonyms <- unlist(AMR::antivirals$synonyms)
|
||||
synonyms <- synonyms[nchar(synonyms) >= 4]
|
||||
# regular expression must not be too long, so split synonyms in two:
|
||||
synonyms_part1 <- synonyms[seq_len(0.5 * length(synonyms))]
|
||||
synonyms_part2 <- synonyms[!synonyms %in% synonyms_part1]
|
||||
to_regex <- function(x) {
|
||||
paste0(
|
||||
"^(",
|
||||
paste0(unique(gsub("[^a-z0-9]+", "", sort(tolower(x)))), collapse = "|"),
|
||||
").*"
|
||||
)
|
||||
}
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
progress$tick()
|
||||
suppressWarnings(
|
||||
as.av(
|
||||
unique(c(
|
||||
text_split[text_split %like_case% to_regex(names_atc)],
|
||||
text_split[text_split %like_case% to_regex(synonyms_part1)],
|
||||
text_split[text_split %like_case% to_regex(synonyms_part2)]
|
||||
)),
|
||||
...
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
close(progress)
|
||||
|
||||
result <- lapply(result, function(out) {
|
||||
out <- out[!is.na(out)]
|
||||
if (length(out) == 0) {
|
||||
as.av(NA)
|
||||
} else {
|
||||
if (!isFALSE(translate_av)) {
|
||||
out <- av_property(out, property = translate_av, initial_search = FALSE)
|
||||
}
|
||||
out
|
||||
}
|
||||
})
|
||||
} else if (type %like% "dos") {
|
||||
text_split_all <- strsplit(text, " ", fixed = TRUE)
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
text_split <- text_split[text_split %like% "^[0-9]{2,}(/[0-9]+)?[a-z]*$"]
|
||||
# only left part of "/", like 500 in "500/125"
|
||||
text_split <- gsub("/.*", "", text_split)
|
||||
text_split <- gsub(",", ".", text_split, fixed = TRUE) # foreign system using comma as decimal sep
|
||||
text_split <- as.double(gsub("[^0-9.]", "", text_split))
|
||||
# minimal 100 units/mg and no years that unlikely doses
|
||||
text_split <- text_split[text_split >= 100 & !text_split %in% c(1951:1999, 2001:2049)]
|
||||
|
||||
if (length(text_split) > 0) {
|
||||
text_split
|
||||
} else {
|
||||
NA_real_
|
||||
}
|
||||
})
|
||||
} else if (type %like% "adm") {
|
||||
result <- lapply(text_split_all, function(text_split) {
|
||||
text_split <- text_split[text_split %like% "(^iv$|intraven|^po$|per os|oral|implant|inhal|instill|nasal|paren|rectal|sublingual|buccal|trans.*dermal|vaginal)"]
|
||||
if (length(text_split) > 0) {
|
||||
text_split <- gsub("(^po$|.*per os.*)", "oral", text_split)
|
||||
text_split <- gsub("(^iv$|.*intraven.*)", "iv", text_split)
|
||||
text_split
|
||||
} else {
|
||||
NA_character_
|
||||
}
|
||||
})
|
||||
} else {
|
||||
stop_("`type` must be either 'drug', 'dose' or 'administration'")
|
||||
}
|
||||
|
||||
# collapse text if needed
|
||||
if (!is.null(collapse)) {
|
||||
result <- vapply(FUN.VALUE = character(1), result, function(x) {
|
||||
if (length(x) == 1 & all(is.na(x))) {
|
||||
NA_character_
|
||||
} else {
|
||||
paste0(x, collapse = collapse)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Get Properties of an Antiviral Drug
|
||||
#'
|
||||
#' Use these functions to return a specific property of an antiviral drug from the [antivirals] data set. All input values will be evaluated internally with [as.av()].
|
||||
#' @param x any (vector of) text that can be coerced to a valid antiviral drug code with [as.av()]
|
||||
#' @param tolower a [logical] to indicate whether the first [character] of every output should be transformed to a lower case [character].
|
||||
#' @param property one of the column names of one of the [antivirals] data set: `vector_or(colnames(antivirals), sort = FALSE)`.
|
||||
#' @param language language of the returned text, defaults to system language (see [get_AMR_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation.
|
||||
#' @param administration way of administration, either `"oral"` or `"iv"`
|
||||
#' @param open browse the URL using [utils::browseURL()]
|
||||
#' @param ... other arguments passed on to [as.av()]
|
||||
#' @details All output [will be translated][translate] where possible.
|
||||
#'
|
||||
#' The function [av_url()] will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.
|
||||
#' @inheritSection as.av Source
|
||||
#' @rdname av_property
|
||||
#' @name av_property
|
||||
#' @return
|
||||
#' - An [integer] in case of [av_cid()]
|
||||
#' - A named [list] in case of [av_info()] and multiple [av_atc()]/[av_synonyms()]/[av_tradenames()]
|
||||
#' - A [double] in case of [av_ddd()]
|
||||
#' - A [character] in all other cases
|
||||
#' @export
|
||||
#' @seealso [antivirals]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @examples
|
||||
#' # all properties:
|
||||
#' av_name("ACI")
|
||||
#' av_atc("ACI")
|
||||
#' av_cid("ACI")
|
||||
#' av_synonyms("ACI")
|
||||
#' av_tradenames("ACI")
|
||||
#' av_group("ACI")
|
||||
#' av_url("ACI")
|
||||
#'
|
||||
#' # smart lowercase tranformation
|
||||
#' av_name(x = c("ACI", "VALA"))
|
||||
#' av_name(x = c("ACI", "VALA"), tolower = TRUE)
|
||||
#'
|
||||
#' # defined daily doses (DDD)
|
||||
#' av_ddd("ACI", "oral")
|
||||
#' av_ddd_units("ACI", "oral")
|
||||
#' av_ddd("ACI", "iv")
|
||||
#' av_ddd_units("ACI", "iv")
|
||||
#'
|
||||
#' av_info("ACI") # all properties as a list
|
||||
#'
|
||||
#' # all av_* functions use as.av() internally, so you can go from 'any' to 'any':
|
||||
#' av_atc("ACI")
|
||||
#' av_group("J05AB01")
|
||||
#' av_loinc("abacavir")
|
||||
#' av_name("29113-8")
|
||||
#' av_name(135398513)
|
||||
#' av_name("J05AB01")
|
||||
av_name <- function(x, language = get_AMR_locale(), tolower = FALSE, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(tolower, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- translate_into_language(av_validate(x = x, property = "name", ...), language = language, only_affect_ab_names = TRUE)
|
||||
if (tolower == TRUE) {
|
||||
# use perl to only transform the first character
|
||||
# as we want "polymyxin B", not "polymyxin b"
|
||||
x <- gsub("^([A-Z])", "\\L\\1", x, perl = TRUE)
|
||||
}
|
||||
x
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_cid <- function(x, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
av_validate(x = x, property = "cid", ...)
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_synonyms <- function(x, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
syns <- av_validate(x = x, property = "synonyms", ...)
|
||||
names(syns) <- x
|
||||
if (length(syns) == 1) {
|
||||
unname(unlist(syns))
|
||||
} else {
|
||||
syns
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_tradenames <- function(x, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
av_synonyms(x, ...)
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_group <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
translate_into_language(av_validate(x = x, property = "atc_group", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_atc <- function(x, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
# ATCs in the antivirals data set are not a list
|
||||
av_validate(x = x, property = "atc", ...)
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_loinc <- function(x, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
loincs <- av_validate(x = x, property = "loinc", ...)
|
||||
names(loincs) <- x
|
||||
if (length(loincs) == 1) {
|
||||
unname(unlist(loincs))
|
||||
} else {
|
||||
loincs
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_ddd <- function(x, administration = "oral", ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(administration, is_in = c("oral", "iv"), has_length = 1)
|
||||
|
||||
x <- as.av(x, ...)
|
||||
ddd_prop <- paste0(administration, "_ddd")
|
||||
out <- av_validate(x = x, property = ddd_prop)
|
||||
|
||||
if (any(av_name(x, language = NULL) %like% "/" & is.na(out))) {
|
||||
warning_(
|
||||
"in `av_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
|
||||
"Please refer to the WHOCC website:\n",
|
||||
"www.whocc.no/ddd/list_of_ddds_combined_products/"
|
||||
)
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_ddd_units <- function(x, administration = "oral", ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(administration, is_in = c("oral", "iv"), has_length = 1)
|
||||
|
||||
x <- as.av(x, ...)
|
||||
ddd_prop <- paste0(administration, "_units")
|
||||
out <- av_validate(x = x, property = ddd_prop)
|
||||
|
||||
if (any(av_name(x, language = NULL) %like% "/" & is.na(out))) {
|
||||
warning_(
|
||||
"in `av_ddd_units()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.",
|
||||
"Please refer to the WHOCC website:\n",
|
||||
"www.whocc.no/ddd/list_of_ddds_combined_products/"
|
||||
)
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_info <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
|
||||
x <- as.av(x, ...)
|
||||
list(
|
||||
av = as.character(x),
|
||||
cid = av_cid(x),
|
||||
name = av_name(x, language = language),
|
||||
group = av_group(x, language = language),
|
||||
atc = av_atc(x),
|
||||
tradenames = av_tradenames(x),
|
||||
loinc = av_loinc(x),
|
||||
ddd = list(
|
||||
oral = list(
|
||||
amount = av_ddd(x, administration = "oral"),
|
||||
units = av_ddd_units(x, administration = "oral")
|
||||
),
|
||||
iv = list(
|
||||
amount = av_ddd(x, administration = "iv"),
|
||||
units = av_ddd_units(x, administration = "iv")
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_url <- function(x, open = FALSE, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(open, allow_class = "logical", has_length = 1)
|
||||
|
||||
av <- as.av(x = x, ...)
|
||||
atcs <- av_atc(av, only_first = TRUE)
|
||||
u <- paste0("https://www.whocc.no/atc_ddd_index/?code=", atcs, "&showdescription=no")
|
||||
u[is.na(atcs)] <- NA_character_
|
||||
names(u) <- av_name(av)
|
||||
|
||||
NAs <- av_name(av, tolower = TRUE, language = NULL)[!is.na(av) & is.na(atcs)]
|
||||
if (length(NAs) > 0) {
|
||||
warning_("in `av_url()`: no ATC code available for ", vector_and(NAs, quotes = FALSE), ".")
|
||||
}
|
||||
|
||||
if (open == TRUE) {
|
||||
if (length(u) > 1 && !is.na(u[1L])) {
|
||||
warning_("in `av_url()`: only the first URL will be opened, as `browseURL()` only suports one string.")
|
||||
}
|
||||
if (!is.na(u[1L])) {
|
||||
utils::browseURL(u[1L])
|
||||
}
|
||||
}
|
||||
u
|
||||
}
|
||||
|
||||
#' @rdname av_property
|
||||
#' @export
|
||||
av_property <- function(x, property = "name", language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(property, is_in = colnames(AMR::antivirals), has_length = 1)
|
||||
meet_criteria(language, is_in = c(LANGUAGES_SUPPORTED, ""), has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
|
||||
translate_into_language(av_validate(x = x, property = property, ...), language = language)
|
||||
}
|
||||
|
||||
av_validate <- function(x, property, ...) {
|
||||
if (tryCatch(all(x[!is.na(x)] %in% AMR_env$AV_lookup$av), error = function(e) FALSE)) {
|
||||
# special case for av_* functions where class is already 'av'
|
||||
x <- AMR_env$AV_lookup[match(x, AMR_env$AV_lookup$av), property, drop = TRUE]
|
||||
} else {
|
||||
# try to catch an error when inputting an invalid argument
|
||||
# so the 'call.' can be set to FALSE
|
||||
tryCatch(x[1L] %in% AMR_env$AV_lookup[1, property, drop = TRUE],
|
||||
error = function(e) stop(e$message, call. = FALSE)
|
||||
)
|
||||
|
||||
if (!all(x %in% AMR_env$AV_lookup[, property, drop = TRUE])) {
|
||||
x <- as.av(x, ...)
|
||||
if (all(is.na(x)) && is.list(AMR_env$AV_lookup[, property, drop = TRUE])) {
|
||||
x <- rep(NA_character_, length(x))
|
||||
} else {
|
||||
x <- AMR_env$AV_lookup[match(x, AMR_env$AV_lookup$av), property, drop = TRUE]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (property == "av") {
|
||||
return(set_clean_class(x, new_class = c("av", "character")))
|
||||
} else if (property == "cid") {
|
||||
return(as.integer(x))
|
||||
} else if (property %like% "ddd") {
|
||||
return(as.double(x))
|
||||
} else {
|
||||
x[is.na(x)] <- NA
|
||||
return(x)
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
+23
-22
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -27,7 +31,7 @@
|
||||
#'
|
||||
#' Determine antimicrobial resistance (AMR) of all bug-drug combinations in your data set where at least 30 (default) isolates are available per species. Use [format()] on the result to prettify it to a publishable/printable format, see *Examples*.
|
||||
#' @inheritParams eucast_rules
|
||||
#' @param combine_IR a [logical] to indicate whether values R and I should be summed
|
||||
#' @param combine_SI a [logical] to indicate whether values S and I should be summed, so resistance will be based on only R, defaults to `TRUE`
|
||||
#' @param add_ab_group a [logical] to indicate where the group of the antimicrobials must be included as a first column
|
||||
#' @param remove_intrinsic_resistant [logical] to indicate that rows and columns with 100% resistance for all tested antimicrobials must be removed from the table
|
||||
#' @param FUN the function to call on the `mo` column to transform the microorganism codes, defaults to [mo_shortname()]
|
||||
@@ -35,11 +39,10 @@
|
||||
#' @param ... arguments passed on to `FUN`
|
||||
#' @inheritParams rsi_df
|
||||
#' @inheritParams base::formatC
|
||||
#' @details The function [format()] calculates the resistance per bug-drug combination. Use `combine_IR = FALSE` (default) to test R vs. S+I and `combine_IR = TRUE` to test R+I vs. S.
|
||||
#' @details The function [format()] calculates the resistance per bug-drug combination. Use `combine_SI = TRUE` (default) to test R vs. S+I and `combine_SI = FALSE` to test R+I vs. S.
|
||||
#' @export
|
||||
#' @rdname bug_drug_combinations
|
||||
#' @return The function [bug_drug_combinations()] returns a [data.frame] with columns "mo", "ab", "S", "I", "R" and "total".
|
||||
#' @source \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' x <- bug_drug_combinations(example_isolates)
|
||||
@@ -170,7 +173,6 @@ format.bug_drug_combinations <- function(x,
|
||||
language = get_AMR_locale(),
|
||||
minimum = 30,
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE,
|
||||
add_ab_group = TRUE,
|
||||
remove_intrinsic_resistant = FALSE,
|
||||
decimal.mark = getOption("OutDec"),
|
||||
@@ -178,10 +180,9 @@ format.bug_drug_combinations <- function(x,
|
||||
...) {
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(add_ab_group, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(remove_intrinsic_resistant, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(decimal.mark, allow_class = "character", has_length = 1)
|
||||
@@ -196,10 +197,10 @@ format.bug_drug_combinations <- function(x,
|
||||
x <- data.frame(
|
||||
mo = gsub("(.*)%%(.*)", "\\1", names(idx)),
|
||||
ab = gsub("(.*)%%(.*)", "\\2", names(idx)),
|
||||
S = sapply(idx, function(i) sum(x$S[i], na.rm = TRUE)),
|
||||
I = sapply(idx, function(i) sum(x$I[i], na.rm = TRUE)),
|
||||
R = sapply(idx, function(i) sum(x$R[i], na.rm = TRUE)),
|
||||
total = sapply(idx, function(i) {
|
||||
S = vapply(FUN.VALUE = double(1), idx, function(i) sum(x$S[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)),
|
||||
total = vapply(FUN.VALUE = double(1), idx, function(i) {
|
||||
sum(x$S[i], na.rm = TRUE) +
|
||||
sum(x$I[i], na.rm = TRUE) +
|
||||
sum(x$R[i], na.rm = TRUE)
|
||||
@@ -214,7 +215,7 @@ format.bug_drug_combinations <- function(x,
|
||||
if (remove_intrinsic_resistant == TRUE) {
|
||||
x <- subset(x, R != total)
|
||||
}
|
||||
if (combine_SI == TRUE | combine_IR == FALSE) {
|
||||
if (combine_SI == TRUE) {
|
||||
x$isolates <- x$R
|
||||
} else {
|
||||
x$isolates <- x$R + x$I
|
||||
@@ -224,13 +225,13 @@ format.bug_drug_combinations <- function(x,
|
||||
format <- tolower(format)
|
||||
ab_txt <- rep(format, length(ab))
|
||||
for (i in seq_len(length(ab_txt))) {
|
||||
ab_txt[i] <- gsub("ab", as.character(as.ab(ab[i])), ab_txt[i])
|
||||
ab_txt[i] <- gsub("cid", ab_cid(ab[i]), ab_txt[i])
|
||||
ab_txt[i] <- gsub("group", ab_group(ab[i], language = language), ab_txt[i])
|
||||
ab_txt[i] <- gsub("atc_group1", ab_atc_group1(ab[i], language = language), ab_txt[i])
|
||||
ab_txt[i] <- gsub("atc_group2", ab_atc_group2(ab[i], language = language), ab_txt[i])
|
||||
ab_txt[i] <- gsub("atc", ab_atc(ab[i], only_first = TRUE), ab_txt[i])
|
||||
ab_txt[i] <- gsub("name", ab_name(ab[i], language = language), ab_txt[i])
|
||||
ab_txt[i] <- gsub("ab", as.character(as.ab(ab[i])), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("cid", ab_cid(ab[i]), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("group", ab_group(ab[i], language = language), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("atc_group1", ab_atc_group1(ab[i], language = language), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("atc_group2", ab_atc_group2(ab[i], language = language), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("atc", ab_atc(ab[i], only_first = TRUE), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i] <- gsub("name", ab_name(ab[i], language = language), ab_txt[i], fixed = TRUE)
|
||||
ab_txt[i]
|
||||
}
|
||||
ab_txt
|
||||
@@ -317,7 +318,7 @@ format.bug_drug_combinations <- function(x,
|
||||
}
|
||||
|
||||
if (remove_intrinsic_resistant == TRUE) {
|
||||
y <- y[, !vapply(FUN.VALUE = logical(1), y, function(col) all(col %like% "100", na.rm = TRUE) & !any(is.na(col))), drop = FALSE]
|
||||
y <- y[, !vapply(FUN.VALUE = logical(1), y, function(col) all(col %like% "100", na.rm = TRUE) & !anyNA(col)), drop = FALSE]
|
||||
}
|
||||
|
||||
rownames(y) <- NULL
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
format_included_data_number <- function(data) {
|
||||
if (is.data.frame(data)) {
|
||||
n <- nrow(data)
|
||||
} else {
|
||||
n <- length(unique(data))
|
||||
}
|
||||
if (n > 10000) {
|
||||
rounder <- -3 # round on thousands
|
||||
} else if (n > 1000) {
|
||||
rounder <- -2 # round on hundreds
|
||||
} else {
|
||||
rounder <- -1 # round on tens
|
||||
}
|
||||
paste0("~", format(round(n, rounder), decimal.mark = ".", big.mark = ","))
|
||||
}
|
||||
|
||||
#' The Catalogue of Life
|
||||
#'
|
||||
#' This package contains the complete taxonomic tree (last updated: `r CATALOGUE_OF_LIFE$yearmonth_LPSN`) of almost all microorganisms from the authoritative and comprehensive Catalogue of Life (CoL), supplemented with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN).
|
||||
#' @section Catalogue of Life:
|
||||
#' \if{html}{\figure{logo_col.png}{options: height="40" style=margin-bottom:"5"} \cr}
|
||||
#' This package contains the complete taxonomic tree of almost all microorganisms (`r format_included_data_number(microorganisms)` species) from the authoritative and comprehensive Catalogue of Life (CoL, <http://www.catalogueoflife.org>). The CoL is the most comprehensive and authoritative global index of species currently available. Nonetheless, we supplemented the CoL data with data from the List of Prokaryotic names with Standing in Nomenclature (LPSN, [lpsn.dsmz.de](https://lpsn.dsmz.de)). This supplementation is needed until the [CoL+ project](https://github.com/CatalogueOfLife/general) is finished, which we await.
|
||||
#'
|
||||
#' [Click here][catalogue_of_life] for more information about the included taxa. Check which versions of the CoL and LPSN were included in this package with [catalogue_of_life_version()].
|
||||
#' @section Included Taxa:
|
||||
#' Included are:
|
||||
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom %in% c("Archeae", "Bacteria", "Chromista", "Protozoa")), , drop = FALSE])` (sub)species from the kingdoms of Archaea, Bacteria, Chromista and Protozoa
|
||||
#' - All `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), , drop = FALSE])` (sub)species from these orders of the kingdom of Fungi: Eurotiales, Microascales, Mucorales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales, as well as `r format_included_data_number(microorganisms[which(microorganisms$kingdom == "Fungi" & !microorganisms$order %in% c("Eurotiales", "Microascales", "Mucorales", "Onygenales", "Pneumocystales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales")), ])` other fungal (sub)species. 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 and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (such as all species of *Aspergillus*, *Candida*, *Cryptococcus*, *Histplasma*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*).
|
||||
#' - All `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.old)` previously accepted names of all included (sub)species (these were taxonomically renamed)
|
||||
#' - The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
|
||||
#' - The responsible author(s) and year of scientific publication
|
||||
#'
|
||||
#' The Catalogue of Life (<http://www.catalogueoflife.org>) is the most comprehensive and authoritative global index of species currently available. It holds essential information on the names, relationships and distributions of over 1.9 million species. The Catalogue of Life is used to support the major biodiversity and conservation information services such as the Global Biodiversity Information Facility (GBIF), Encyclopedia of Life (EoL) and the International Union for Conservation of Nature Red List. It is recognised by the Convention on Biological Diversity as a significant component of the Global Taxonomy Initiative and a contribution to Target 1 of the Global Strategy for Plant Conservation.
|
||||
#'
|
||||
#' 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>.
|
||||
#' @name catalogue_of_life
|
||||
#' @rdname catalogue_of_life
|
||||
#' @seealso Data set [microorganisms] for the actual data. \cr
|
||||
#' Function [as.mo()] to use the data for intelligent determination of microorganisms.
|
||||
#' @examples
|
||||
#' # Get version info of included data set
|
||||
#' catalogue_of_life_version()
|
||||
#'
|
||||
#'
|
||||
#' # Get a note when a species was renamed
|
||||
#' mo_shortname("Chlamydophila psittaci")
|
||||
#'
|
||||
#' # Get any property from the entire taxonomic tree for all included species
|
||||
#' mo_class("Escherichia coli")
|
||||
#'
|
||||
#' mo_family("Escherichia coli")
|
||||
#'
|
||||
#' mo_gramstain("Escherichia coli") # based on kingdom and phylum, see ?mo_gramstain
|
||||
#'
|
||||
#' mo_ref("Escherichia coli")
|
||||
#'
|
||||
#' # Do not get mistaken - this package is about microorganisms
|
||||
#' mo_kingdom("C. elegans")
|
||||
#' mo_name("C. elegans")
|
||||
NULL
|
||||
|
||||
#' Version info of included Catalogue of Life
|
||||
#'
|
||||
#' This function returns information about the included data from the Catalogue of Life.
|
||||
#' @seealso [microorganisms]
|
||||
#' @details For LPSN, see [microorganisms].
|
||||
#' @return a [list], which prints in pretty format
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @export
|
||||
catalogue_of_life_version <- function() {
|
||||
check_dataset_integrity()
|
||||
|
||||
# see the `CATALOGUE_OF_LIFE` list in R/globals.R
|
||||
lst <- list(
|
||||
CoL =
|
||||
list(
|
||||
version = gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$version, fixed = TRUE),
|
||||
url = gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$url_CoL, fixed = TRUE),
|
||||
n = nrow(pm_filter(microorganisms, source == "CoL"))
|
||||
),
|
||||
LPSN =
|
||||
list(
|
||||
version = "List of Prokaryotic names with Standing in Nomenclature",
|
||||
url = CATALOGUE_OF_LIFE$url_LPSN,
|
||||
yearmonth = CATALOGUE_OF_LIFE$yearmonth_LPSN,
|
||||
n = nrow(pm_filter(microorganisms, source == "LPSN"))
|
||||
),
|
||||
total_included =
|
||||
list(
|
||||
n_total_species = nrow(microorganisms),
|
||||
n_total_synonyms = nrow(microorganisms.old)
|
||||
)
|
||||
)
|
||||
|
||||
set_clean_class(lst,
|
||||
new_class = c("catalogue_of_life_version", "list")
|
||||
)
|
||||
}
|
||||
|
||||
#' @method print catalogue_of_life_version
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.catalogue_of_life_version <- function(x, ...) {
|
||||
cat(paste0(
|
||||
font_bold("Included in this AMR package (v", utils::packageDescription("AMR")$Version, ") are:\n\n", collapse = ""),
|
||||
font_underline(x$CoL$version), "\n",
|
||||
" Available at: ", font_blue(x$CoL$url), "\n",
|
||||
" Number of included microbial species: ", format(x$CoL$n, big.mark = ","), "\n",
|
||||
font_underline(paste0(
|
||||
x$LPSN$version, " (",
|
||||
x$LPSN$yearmonth, ")"
|
||||
)), "\n",
|
||||
" Available at: ", font_blue(x$LPSN$url), "\n",
|
||||
" Number of included bacterial species: ", format(x$LPSN$n, big.mark = ","), "\n\n",
|
||||
"=> Total number of species included: ", format(x$total_included$n_total_species, big.mark = ","), "\n",
|
||||
"=> Total number of synonyms included: ", format(x$total_included$n_total_synonyms, big.mark = ","), "\n\n",
|
||||
"See for more info ", font_grey_bg("`?microorganisms`"), " and ", font_grey_bg("`?catalogue_of_life`"), ".\n"
|
||||
))
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -122,7 +126,7 @@ count_resistant <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -135,7 +139,7 @@ count_susceptible <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -148,7 +152,7 @@ count_R <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -164,7 +168,7 @@ count_IR <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -177,7 +181,7 @@ count_I <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -190,7 +194,7 @@ count_SI <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -206,7 +210,7 @@ count_S <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -219,7 +223,7 @@ count_all <- function(..., only_all_tested = FALSE) {
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -232,8 +236,7 @@ n_rsi <- count_all
|
||||
count_df <- function(data,
|
||||
translate_ab = "name",
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE) {
|
||||
combine_SI = TRUE) {
|
||||
tryCatch(
|
||||
rsi_calc_df(
|
||||
type = "count",
|
||||
@@ -241,9 +244,8 @@ count_df <- function(data,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
combine_SI_missing = missing(combine_SI)
|
||||
confidence_level = 0.95 # doesn't matter, will be removed
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc_df(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
+52
-30
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -35,43 +39,59 @@
|
||||
#'
|
||||
#' If you are familiar with the [`case_when()`][dplyr::case_when()] function of the `dplyr` package, you will recognise the input method to set your own rules. Rules must be set using what \R considers to be the 'formula notation'. The rule itself is written *before* the tilde (`~`) and the consequence of the rule is written *after* the tilde:
|
||||
#'
|
||||
#' ```{r}
|
||||
#' ```r
|
||||
#' x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S",
|
||||
#' TZP == "R" ~ aminopenicillins == "R")
|
||||
#' ```
|
||||
#'
|
||||
#' These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:
|
||||
#'
|
||||
#' ```{r}
|
||||
#' ```r
|
||||
#' x
|
||||
#' #> A set of custom EUCAST rules:
|
||||
#' #>
|
||||
#' #> 1. If TZP is "S" then set to S :
|
||||
#' #> amoxicillin (AMX), ampicillin (AMP)
|
||||
#' #>
|
||||
#' #> 2. If TZP is "R" then set to R :
|
||||
#' #> amoxicillin (AMX), ampicillin (AMP)
|
||||
#' ```
|
||||
#'
|
||||
#' The rules (the part *before* the tilde, in above example `TZP == "S"` and `TZP == "R"`) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column `TZP` must exist. We will create a sample data set and test the rules set:
|
||||
#'
|
||||
#' ```{r}
|
||||
#' ```r
|
||||
#' df <- data.frame(mo = c("Escherichia coli", "Klebsiella pneumoniae"),
|
||||
#' TZP = as.rsi("R"),
|
||||
#' ampi = as.rsi("S"),
|
||||
#' cipro = as.rsi("S"))
|
||||
#' df
|
||||
#' #> mo TZP ampi cipro
|
||||
#' #> 1 Escherichia coli R S S
|
||||
#' #> 2 Klebsiella pneumoniae R S S
|
||||
#'
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = x, info = FALSE)
|
||||
#' #> mo TZP ampi cipro
|
||||
#' #> 1 Escherichia coli R R S
|
||||
#' #> 2 Klebsiella pneumoniae R R S
|
||||
#' ```
|
||||
#'
|
||||
#' ### Using taxonomic properties in rules
|
||||
#'
|
||||
#' There is one exception in variables used for the rules: all column names of the [microorganisms] data set can also be used, but do not have to exist in the data set. These column names are: `r vector_and(colnames(microorganisms), sort = FALSE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
|
||||
#'
|
||||
#' ```{r}
|
||||
#' ```r
|
||||
#' y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
|
||||
#' TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
|
||||
#'
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = y, info = FALSE)
|
||||
#' #> mo TZP ampi cipro
|
||||
#' #> 1 Escherichia coli R S S
|
||||
#' #> 2 Klebsiella pneumoniae R R S
|
||||
#' ```
|
||||
#'
|
||||
#' ### Usage of antibiotic group names
|
||||
#'
|
||||
#' 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 agents that will be matched when running the rule.
|
||||
#' 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.
|
||||
#'
|
||||
#' `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
|
||||
@@ -154,8 +174,8 @@ custom_eucast_rules <- function(...) {
|
||||
|
||||
stop_if(
|
||||
any(is.na(result_group)),
|
||||
"this result of rule ", i, " could not be translated to a single antimicrobial agent/group: \"",
|
||||
as.character(result)[[2]], "\".\n\nThe input can be a name or code of an antimicrobial agent, or be one of: ",
|
||||
"this result of rule ", i, " could not be translated to a single antimicrobial drug/group: \"",
|
||||
as.character(result)[[2]], "\".\n\nThe input can be a name or code of an antimicrobial drug, or be one of: ",
|
||||
vector_or(tolower(gsub("AB_", "", DEFINED_AB_GROUPS)), quotes = FALSE), "."
|
||||
)
|
||||
result_value <- as.character(result)[[3]]
|
||||
@@ -207,11 +227,11 @@ print.custom_eucast_rules <- function(x, ...) {
|
||||
if (is.na(rule$result_value)) {
|
||||
val <- font_red("<NA>")
|
||||
} else if (rule$result_value == "R") {
|
||||
val <- font_rsi_R_bg(font_black(" R "))
|
||||
val <- font_red_bg(" R ")
|
||||
} else if (rule$result_value == "S") {
|
||||
val <- font_rsi_S_bg(font_black(" S "))
|
||||
val <- font_green_bg(" S ")
|
||||
} else {
|
||||
val <- font_rsi_I_bg(font_black(" I "))
|
||||
val <- font_orange_bg(" I ")
|
||||
}
|
||||
agents <- paste0(
|
||||
font_blue(ab_name(rule$result_group, language = NULL, tolower = TRUE),
|
||||
@@ -233,24 +253,26 @@ print.custom_eucast_rules <- function(x, ...) {
|
||||
}
|
||||
|
||||
format_custom_query_rule <- function(query, colours = has_colour()) {
|
||||
query <- gsub(" & ", font_black(font_bold(" and ")), query, fixed = TRUE)
|
||||
query <- gsub(" | ", font_black(" or "), query, fixed = TRUE)
|
||||
query <- gsub(" + ", font_black(" plus "), query, fixed = TRUE)
|
||||
query <- gsub(" - ", font_black(" minus "), query, fixed = TRUE)
|
||||
query <- gsub(" / ", font_black(" divided by "), query, fixed = TRUE)
|
||||
query <- gsub(" * ", font_black(" times "), query, fixed = TRUE)
|
||||
query <- gsub(" == ", font_black(" is "), query, fixed = TRUE)
|
||||
query <- gsub(" > ", font_black(" is higher than "), query, fixed = TRUE)
|
||||
query <- gsub(" < ", font_black(" is lower than "), query, fixed = TRUE)
|
||||
query <- gsub(" >= ", font_black(" is higher than or equal to "), query, fixed = TRUE)
|
||||
query <- gsub(" <= ", font_black(" is lower than or equal to "), query, fixed = TRUE)
|
||||
query <- gsub(" ^ ", font_black(" to the power of "), query, fixed = TRUE)
|
||||
query <- gsub(" %in% ", font_black(" is one of "), query, fixed = TRUE)
|
||||
query <- gsub(" %like% ", font_black(" resembles "), query, fixed = TRUE)
|
||||
# font_black() is a bit expensive so do it once:
|
||||
txt <- font_black("{text}")
|
||||
query <- gsub(" & ", sub("{text}", font_bold(" and "), txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" | ", sub("{text}", " or ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" + ", sub("{text}", " plus ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" - ", sub("{text}", " minus ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" / ", sub("{text}", " divided by ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" * ", sub("{text}", " times ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" == ", sub("{text}", " is ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" > ", sub("{text}", " is higher than ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" < ", sub("{text}", " is lower than ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" >= ", sub("{text}", " is higher than or equal to ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" <= ", sub("{text}", " is lower than or equal to ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" ^ ", sub("{text}", " to the power of ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" %in% ", sub("{text}", " is one of ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
query <- gsub(" %like% ", sub("{text}", " resembles ", txt, fixed = TRUE), query, fixed = TRUE)
|
||||
if (colours == TRUE) {
|
||||
query <- gsub('"R"', font_rsi_R_bg(font_black(" R ")), query, fixed = TRUE)
|
||||
query <- gsub('"S"', font_rsi_S_bg(font_black(" S ")), query, fixed = TRUE)
|
||||
query <- gsub('"I"', font_rsi_I_bg(font_black(" I ")), query, fixed = TRUE)
|
||||
query <- gsub('"R"', font_red_bg(" R "), query, fixed = TRUE)
|
||||
query <- gsub('"S"', font_green_bg(" S "), query, fixed = TRUE)
|
||||
query <- gsub('"I"', font_orange_bg(" I "), query, fixed = TRUE)
|
||||
}
|
||||
# replace the black colour 'stops' with blue colour 'starts'
|
||||
query <- gsub("\033[39m", "\033[34m", as.character(query), fixed = TRUE)
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -27,7 +31,7 @@
|
||||
#'
|
||||
#' 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
|
||||
#' ## 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
|
||||
#' - `cid`\cr Compound ID as found in PubChem
|
||||
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO
|
||||
@@ -41,27 +45,33 @@
|
||||
#' - `oral_units`\cr Units of `oral_ddd`
|
||||
#' - `iv_ddd`\cr Defined Daily Dose (DDD), parenteral (intravenous) treatment, currently available for `r sum(!is.na(antibiotics$iv_ddd))` drugs
|
||||
#' - `iv_units`\cr Units of `iv_ddd`
|
||||
#' - `loinc`\cr All LOINC codes (Logical Observation Identifiers Names and Codes) associated with the name of the antimicrobial agent. Use [ab_loinc()] to retrieve them quickly, see [ab_property()].
|
||||
#' - `loinc`\cr All LOINC codes (Logical Observation Identifiers Names and Codes) associated with the name of the antimicrobial drug. 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 Antibiotic ID as used in this package (such as `AMC`), using the official EARS-Net (European Antimicrobial Resistance Surveillance Network) codes where available
|
||||
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO
|
||||
#' - `atc`\cr ATC codes (Anatomical Therapeutic Chemical) as defined by the WHOCC
|
||||
#' - `cid`\cr Compound ID as found in PubChem
|
||||
#' - `name`\cr Official name as used by WHONET/EARS-Net or the WHO
|
||||
#' - `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
|
||||
#' - `oral_ddd`\cr Defined Daily Dose (DDD), oral treatment
|
||||
#' - `oral_units`\cr Units of `oral_ddd`
|
||||
#' - `iv_ddd`\cr Defined Daily Dose (DDD), parenteral treatment
|
||||
#' - `iv_units`\cr Units of `iv_ddd`
|
||||
#' - `loinc`\cr All LOINC codes (Logical Observation Identifiers Names and Codes) associated with the name of the antimicrobial drug.
|
||||
#' @details Properties that are based on an ATC code are only available when an ATC is available. These properties are: `atc_group1`, `atc_group2`, `oral_ddd`, `oral_units`, `iv_ddd` and `iv_units`.
|
||||
#'
|
||||
#' Synonyms (i.e. trade names) were derived from the Compound ID (`cid`) and consequently only available where a CID is available.
|
||||
#' Synonyms (i.e. trade names) were derived from the PubChem Compound ID (column `cid`) and consequently only available where a CID is available.
|
||||
#'
|
||||
#' ## Direct download
|
||||
#' ### Direct download
|
||||
#' Like all data sets in this package, these data sets are publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit [our website for the download links](https://msberends.github.io/AMR/articles/datasets.html). The actual files are of course available on [our GitHub repository](https://github.com/msberends/AMR/tree/main/data-raw).
|
||||
#' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): <https://www.whocc.no/atc_ddd_index/>
|
||||
#' @source
|
||||
#'
|
||||
#' * World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): <https://www.whocc.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)`.
|
||||
#'
|
||||
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: <https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
|
||||
#' * European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: <https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
|
||||
#' @inheritSection WHOCC WHOCC
|
||||
#' @seealso [microorganisms], [intrinsic_resistant]
|
||||
#' @examples
|
||||
@@ -74,81 +84,67 @@
|
||||
|
||||
#' Data Set with `r format(nrow(microorganisms), big.mark = ",")` Microorganisms
|
||||
#'
|
||||
#' A data set containing the full microbial taxonomy (**last updated: `r CATALOGUE_OF_LIFE$yearmonth_LPSN`**) of `r nr2char(length(unique(microorganisms$kingdom[!microorganisms$kingdom %like% "unknown"])))` kingdoms from the Catalogue of Life (CoL) and the List of Prokaryotic names with Standing in Nomenclature (LPSN). MO codes can be looked up using [as.mo()].
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' 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()].
|
||||
#' @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
|
||||
#' - `fullname`\cr Full name, like `"Escherichia coli"`
|
||||
#' - `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.
|
||||
#' - `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
|
||||
#' - `rank`\cr Text of the taxonomic rank of the microorganism, like `"species"` or `"genus"`
|
||||
#' - `ref`\cr Author(s) and year of concerning scientific publication
|
||||
#' - `species_id`\cr ID of the species as used by the Catalogue of Life
|
||||
#' - `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, e.g. "V`r "\u00e1\u0148ov\u00e1"`" becomes "Vanova".
|
||||
#' - `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.
|
||||
#' - `lpsn_parent`\cr LPSN identifier of the parent taxon
|
||||
#' - `lpsn_renamed_to`\cr LPSN identifier of the currently valid taxon
|
||||
#' - `gbif`\cr Identifier ('taxonID') of the Global Biodiversity Information Facility (GBIF)
|
||||
#' - `gbif_parent`\cr GBIF identifier of the parent taxon
|
||||
#' - `gbif_renamed_to`\cr GBIF identifier of the currently valid taxon
|
||||
#' - `source`\cr Either `r vector_or(microorganisms$source)` (see *Source*)
|
||||
#' - `prevalence`\cr Prevalence of the microorganism, see [as.mo()]
|
||||
#' - `snomed`\cr Systematized Nomenclature of Medicine (SNOMED) code of the microorganism, according to the `r SNOMED_VERSION$current_source` (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
|
||||
#' Please note that entries are only based on the Catalogue of Life and the LPSN (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 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.
|
||||
#'
|
||||
#' 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")`.
|
||||
#'
|
||||
#' ## Manual additions
|
||||
#' @section Included Taxa:
|
||||
#' Included taxonomic data 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
|
||||
#' - `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 == "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*)
|
||||
#' - 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)
|
||||
#' - The complete taxonomic tree of all included (sub)species: from kingdom to subspecies
|
||||
#' - The identifier of the parent taxons
|
||||
#' - The year and first author of the related scientific publication
|
||||
#'
|
||||
#' ### Manual additions
|
||||
#' For convenience, some entries were added manually:
|
||||
#'
|
||||
#' - 11 entries of *Streptococcus* (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
|
||||
#' - 2 entries of *Staphylococcus* (coagulase-negative (CoNS) and coagulase-positive (CoPS))
|
||||
#' - 3 entries of *Trichomonas* (*T. vaginalis*, and its family and genus)
|
||||
#' - 4 entries of *Toxoplasma* (*T. gondii*, and its order, family and genus)
|
||||
#' - 1 entry of *Candida* (*C. krusei*), that is not (yet) in the Catalogue of Life
|
||||
#' - 1 entry of *Blastocystis* (*B. hominis*), although it officially does not exist (Noel *et al.* 2005, PMID 15634993)
|
||||
#' - 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
|
||||
#' - 5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)
|
||||
#' - 6 families under the Enterobacterales order, according to Adeolu *et al.* (2016, PMID 27620848), that are not (yet) in the Catalogue of Life
|
||||
#' - 6 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast, unknown fungus, and unknown anaerobic bacteria)
|
||||
#'
|
||||
#' ## Direct download
|
||||
#' 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
|
||||
#' 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.
|
||||
#'
|
||||
#' As of February 2020, the regularly augmented LPSN database at DSMZ is the basis of the new LPSN service. The new database was implemented for the Type-Strain Genome Server and augmented in 2018 to store all kinds of nomenclatural information. Data from the previous version of LPSN and from the Prokaryotic Nomenclature Up-to-date (PNU) service were imported into the new system. PNU had been established in 1993 as a service of the Leibniz Institute DSMZ, and was curated by Norbert Weiss, Manfred Kracht and Dorothea Gleim.
|
||||
#' @source
|
||||
#' `r gsub("{year}", CATALOGUE_OF_LIFE$year, CATALOGUE_OF_LIFE$version, fixed = TRUE)` as currently implemented in this `AMR` package:
|
||||
#' * `r TAXONOMY_VERSION$LPSN$citation` Accessed from <`r TAXONOMY_VERSION$LPSN$url`> on `r documentation_date(TAXONOMY_VERSION$LPSN$accessed_date)`.
|
||||
#'
|
||||
#' * Annual Checklist (public online taxonomic database), <http://www.catalogueoflife.org>
|
||||
#' * `r TAXONOMY_VERSION$GBIF$citation` Accessed from <`r TAXONOMY_VERSION$GBIF$url`> on `r documentation_date(TAXONOMY_VERSION$GBIF$accessed_date)`.
|
||||
#'
|
||||
#' List of Prokaryotic names with Standing in Nomenclature (`r CATALOGUE_OF_LIFE$yearmonth_LPSN`) as currently implemented in this `AMR` package:
|
||||
#'
|
||||
#' * Parte, A.C., Sarda Carbasse, J., Meier-Kolthoff, J.P., Reimer, L.C. and Goker, M. (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}
|
||||
#' * Parte, A.C. (2018). LPSN - List of Prokaryotic names with Standing in Nomenclature (bacterio.net), 20 years on. International Journal of Systematic and Evolutionary Microbiology, 68, 1825-1829; \doi{10.1099/ijsem.0.002786}
|
||||
#' * Parte, A.C. (2014). LPSN - List of Prokaryotic names with Standing in Nomenclature. Nucleic Acids Research, 42, Issue D1, D613-D616; \doi{10.1093/nar/gkt1111}
|
||||
#' * Euzeby, J.P. (1997). List of Bacterial Names with Standing in Nomenclature: a Folder Available on the Internet. International Journal of Systematic Bacteriology, 47, 590-592; \doi{10.1099/00207713-47-2-590}
|
||||
#'
|
||||
#' `r SNOMED_VERSION$current_source` as currently implemented in this `AMR` package:
|
||||
#'
|
||||
#' * Retrieved from the `r SNOMED_VERSION$title`, OID `r SNOMED_VERSION$current_oid`, version `r SNOMED_VERSION$current_version`; url: <`r SNOMED_VERSION$url`>
|
||||
#' * `r TAXONOMY_VERSION$SNOMED$citation` URL: <`r TAXONOMY_VERSION$SNOMED$url`>
|
||||
#' @seealso [as.mo()], [mo_property()], [microorganisms.codes], [intrinsic_resistant]
|
||||
#' @examples
|
||||
#' microorganisms
|
||||
"microorganisms"
|
||||
|
||||
#' Data Set with Previously Accepted Taxonomic Names
|
||||
#'
|
||||
#' A data set containing old (previously valid or accepted) taxonomic names according to the Catalogue of Life. This data set is used internally by [as.mo()].
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A [tibble][tibble::tibble] with `r format(nrow(microorganisms.old), big.mark = ",")` observations and `r ncol(microorganisms.old)` variables:
|
||||
#' - `fullname`\cr Old full taxonomic name of the microorganism
|
||||
#' - `fullname_new`\cr New full taxonomic name of the microorganism
|
||||
#' - `ref`\cr Author(s) and year of concerning scientific publication
|
||||
#' - `prevalence`\cr Prevalence of the microorganism, see [as.mo()]
|
||||
#' @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).
|
||||
#' @source Catalogue of Life: Annual Checklist (public online taxonomic database), <http://www.catalogueoflife.org> (check included annual version with [catalogue_of_life_version()]).
|
||||
#'
|
||||
#' Parte, A.C. (2018). LPSN - List of Prokaryotic names with Standing in Nomenclature (bacterio.net), 20 years on. International Journal of Systematic and Evolutionary Microbiology, 68, 1825-1829; \doi{10.1099/ijsem.0.002786}
|
||||
#' @seealso [as.mo()] [mo_property()] [microorganisms]
|
||||
#' @examples
|
||||
#' microorganisms.old
|
||||
"microorganisms.old"
|
||||
|
||||
#' Data Set with `r format(nrow(microorganisms.codes), big.mark = ",")` Common Microorganism Codes
|
||||
#'
|
||||
#' A data set containing commonly used codes for microorganisms, from laboratory systems and WHONET. Define your own with [set_mo_source()]. They will all be searched when using [as.mo()] and consequently all the [`mo_*`][mo_property()] functions.
|
||||
@@ -157,7 +153,6 @@
|
||||
#' - `mo`\cr ID of the microorganism in the [microorganisms] data set
|
||||
#' @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).
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @seealso [as.mo()] [microorganisms]
|
||||
#' @examples
|
||||
#' microorganisms.codes
|
||||
@@ -264,7 +259,7 @@
|
||||
#' @details
|
||||
#' This data set is based on `r format_eucast_version_nr(3.3)`.
|
||||
#'
|
||||
#' ## 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).
|
||||
#'
|
||||
#' 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.
|
||||
@@ -277,7 +272,7 @@
|
||||
#' EUCAST breakpoints used in this package are based on the dosages in this data set. They can be retrieved with [eucast_dosage()].
|
||||
#' @format A [tibble][tibble::tibble] with `r format(nrow(dosage), big.mark = ",")` observations and `r ncol(dosage)` 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
|
||||
#' - `name`\cr Official name of the antimicrobial agent as used by WHONET/EARS-Net or the WHO
|
||||
#' - `name`\cr Official name of the antimicrobial drug as used by WHONET/EARS-Net or the WHO
|
||||
#' - `type`\cr Type of the dosage, either `r vector_or(dosage$type)`
|
||||
#' - `dose`\cr Dose, such as "2 g" or "25 mg/kg"
|
||||
#' - `dose_times`\cr Number of times a dose must be administered
|
||||
@@ -286,9 +281,9 @@
|
||||
#' - `original_txt`\cr Original text in the PDF file of EUCAST
|
||||
#' - `eucast_version`\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply
|
||||
#' @details
|
||||
#' This data set is based on `r format_eucast_version_nr(11.0)`.
|
||||
#' This data set is based on `r format_eucast_version_nr(12.0)` and `r format_eucast_version_nr(11.0)`.
|
||||
#'
|
||||
#' ## 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).
|
||||
#' @examples
|
||||
#' dosage
|
||||
|
||||
+7
-3
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -30,6 +34,8 @@
|
||||
#' @param x vector
|
||||
#' @param na.rm a [logical] indicating whether missing values should be removed
|
||||
#' @details Interpret disk values as RSI values with [as.rsi()]. It supports guidelines from EUCAST and CLSI.
|
||||
#'
|
||||
#' Disk diffusion growth zone sizes must be between 6 and 50 millimetres. Values higher than 50 but lower than 100 will be maximised to 50. All others input values outside the 6-50 range will return `NA`.
|
||||
#' @return An [integer] with additional class [`disk`]
|
||||
#' @aliases disk
|
||||
#' @export
|
||||
@@ -69,17 +75,17 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
|
||||
if (!is.disk(x)) {
|
||||
x <- unlist(x)
|
||||
if (na.rm == TRUE) {
|
||||
if (isTRUE(na.rm)) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
x[trimws(x) == ""] <- NA
|
||||
x[trimws2(x) == ""] <- NA
|
||||
x.bak <- x
|
||||
|
||||
na_before <- length(x[is.na(x)])
|
||||
|
||||
# heavily based on cleaner::clean_double():
|
||||
clean_double2 <- function(x, remove = "[^0-9.,-]", fixed = FALSE) {
|
||||
x <- gsub(",", ".", x)
|
||||
x <- gsub(",", ".", x, fixed = TRUE)
|
||||
# remove ending dot/comma
|
||||
x <- gsub("[,.]$", "", x)
|
||||
# only keep last dot/comma
|
||||
@@ -103,7 +109,8 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
x <- as.integer(ceiling(clean_double2(x)))
|
||||
|
||||
# disks can never be less than 6 mm (size of smallest disk) or more than 50 mm
|
||||
x[x < 6 | x > 50] <- NA_integer_
|
||||
x[x < 6 | x > 99] <- NA_integer_
|
||||
x[x > 50] <- 50L
|
||||
na_after <- length(x[is.na(x)])
|
||||
|
||||
if (na_before != na_after) {
|
||||
@@ -111,11 +118,15 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
unique() %pm>%
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_(
|
||||
"in `as.disk()`: ", na_after - na_before, " results truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid disk zones: ",
|
||||
list_missing
|
||||
cur_col <- get_current_column()
|
||||
warning_("in `as.disk()`: ", na_after - na_before, " result",
|
||||
ifelse(na_after - na_before > 1, "s", ""),
|
||||
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
|
||||
" truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid disk zones: ",
|
||||
list_missing,
|
||||
call = FALSE
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -131,11 +142,11 @@ all_valid_disks <- function(x) {
|
||||
x_disk <- tryCatch(suppressWarnings(as.disk(x[!is.na(x)])),
|
||||
error = function(e) NA
|
||||
)
|
||||
!any(is.na(x_disk)) && !all(is.na(x))
|
||||
!anyNA(x_disk) && !all(is.na(x))
|
||||
}
|
||||
|
||||
#' @rdname as.disk
|
||||
#' @details `NA_disk_` is a missing value of the new `<disk>` class.
|
||||
#' @details `NA_disk_` is a missing value of the new `disk` class.
|
||||
#' @export
|
||||
NA_disk_ <- set_clean_class(as.integer(NA_real_),
|
||||
new_class = c("disk", "integer")
|
||||
@@ -163,7 +174,7 @@ type_sum.disk <- function(x, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.disk <- function(x, ...) {
|
||||
cat("Class <disk>\n")
|
||||
cat("Class 'disk'\n")
|
||||
print(as.integer(x), quote = FALSE)
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
+73
-74
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -46,14 +50,13 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
vector_and(txt, quotes = FALSE)
|
||||
}
|
||||
|
||||
#' Apply EUCAST Rules
|
||||
#'
|
||||
#' @description
|
||||
#' Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, <https://eucast.org>), see *Source*. Use [eucast_dosage()] to get a [data.frame] with advised dosages of a certain bug-drug combination, which is based on the [dosage] data set.
|
||||
#' Apply rules for clinical breakpoints and intrinsic resistance as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, <https://www.eucast.org>), see *Source*. Use [eucast_dosage()] to get a [data.frame] with advised dosages of a certain bug-drug combination, which is based on the [dosage] data set.
|
||||
#'
|
||||
#' To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see *Details*.
|
||||
#' @param x a data set with antibiotic columns, such as `amox`, `AMX` and `AMC`
|
||||
@@ -62,32 +65,31 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' @param verbose a [logical] to turn Verbose mode on and off (default is off). In Verbose mode, the function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way. Using Verbose mode takes a lot more time.
|
||||
#' @param version_breakpoints the version number to use for the EUCAST Clinical Breakpoints guideline. Can be either `r vector_or(names(EUCAST_VERSION_BREAKPOINTS), reverse = TRUE)`.
|
||||
#' @param version_expertrules the version number to use for the EUCAST Expert Rules and Intrinsic Resistance guideline. Can be either `r vector_or(names(EUCAST_VERSION_EXPERT_RULES), reverse = TRUE)`.
|
||||
#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2` and higher; these version of '*EUCAST Expert Rules on Enterobacterales*' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three agents. A value of `NA` (the default) for this argument will remove results for these three agents, while e.g. a value of `"R"` will make the results for these agents resistant. Use `NULL` or `FALSE` to not alter results for these three agents of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(EUCAST_RULES_DF[which(EUCAST_RULES_DF$reference.version %in% c(3.2, 3.3) & EUCAST_RULES_DF$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ampc_cephalosporin_resistance a [character] value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to `NA`. Currently only works when `version_expertrules` is `3.2` and higher; these version of '*EUCAST Expert Rules on Enterobacterales*' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three drugs. A value of `NA` (the default) for this argument will remove results for these three drugs, while e.g. a value of `"R"` will make the results for these drugs resistant. Use `NULL` or `FALSE` to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using `TRUE` is equal to using `"R"`. \cr For *EUCAST Expert Rules* v3.2, this rule applies to: `r vector_and(gsub("[^a-zA-Z ]+", "", unlist(strsplit(EUCAST_RULES_DF[which(EUCAST_RULES_DF$reference.version %in% c(3.2, 3.3) & EUCAST_RULES_DF$reference.rule %like% "ampc"), "this_value"][1], "|", fixed = TRUE))), quotes = "*")`.
|
||||
#' @param ... column name of an antibiotic, see section *Antibiotics* below
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic drug code with [as.ab()]
|
||||
#' @param administration route of administration, either `r vector_or(dosage$administration)`
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only antibiotic columns must be detected that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only antibiotic columns must be detected that were transformed to class `rsi` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param custom_rules custom rules to apply, created with [custom_eucast_rules()]
|
||||
#' @inheritParams first_isolate
|
||||
#' @details
|
||||
#' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr
|
||||
#' **Note:** When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance. \cr
|
||||
#'
|
||||
#' The file containing all EUCAST rules is located here: <https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv>. **Note:** Old taxonomic names are replaced with the current taxonomy where applicable. For example, *Ochrobactrum anthropi* was renamed to *Brucella anthropi* in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The file used as input for this `AMR` package contains the taxonomy updated until [`r CATALOGUE_OF_LIFE$yearmonth_LPSN`][catalogue_of_life()].
|
||||
#' The file containing all EUCAST rules is located here: <https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv>. **Note:** Old taxonomic names are replaced with the current taxonomy where applicable. For example, *Ochrobactrum anthropi* was renamed to *Brucella anthropi* in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The `AMR` package contains the full microbial taxonomy updated until `r documentation_date(max(TAXONOMY_VERSION$GBIF$accessed_date, TAXONOMY_VERSION$LPSN$accessed_date))`, see [microorganisms].
|
||||
#'
|
||||
#' ## Custom Rules
|
||||
#' ### Custom Rules
|
||||
#'
|
||||
#' Custom rules can be created using [custom_eucast_rules()], e.g.:
|
||||
#'
|
||||
#' ```{r}
|
||||
#' ```r
|
||||
#' x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
|
||||
#' AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I")
|
||||
#'
|
||||
#' eucast_rules(example_isolates, rules = "custom", custom_rules = x, info = FALSE)
|
||||
#' eucast_rules(example_isolates, rules = "custom", custom_rules = x)
|
||||
#' ```
|
||||
#'
|
||||
#'
|
||||
#' ## 'Other' Rules
|
||||
#' ### 'Other' Rules
|
||||
#'
|
||||
#' Before further processing, two non-EUCAST rules about drug combinations can be applied to improve the efficacy of the EUCAST rules, and the reliability of your data (analysis). These rules are:
|
||||
#'
|
||||
@@ -118,7 +120,6 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' - EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 11.0, 2021. [(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_11.0_Breakpoint_Tables.xlsx)
|
||||
#' - EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 12.0, 2022. [(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_12.0_Breakpoint_Tables.xlsx)
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' a <- data.frame(
|
||||
@@ -164,7 +165,7 @@ eucast_rules <- function(x,
|
||||
info = interactive(),
|
||||
rules = getOption("AMR_eucastrules", default = c("breakpoints", "expert")),
|
||||
verbose = FALSE,
|
||||
version_breakpoints = 11.0,
|
||||
version_breakpoints = 12.0,
|
||||
version_expertrules = 3.3,
|
||||
ampc_cephalosporin_resistance = NA,
|
||||
only_rsi_columns = FALSE,
|
||||
@@ -181,13 +182,13 @@ eucast_rules <- function(x,
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(custom_rules, allow_class = "custom_eucast_rules", allow_NULL = TRUE)
|
||||
|
||||
if ("custom" %in% rules & is.null(custom_rules)) {
|
||||
if ("custom" %in% rules && is.null(custom_rules)) {
|
||||
warning_("in `eucast_rules()`: no custom rules were set with the `custom_rules` argument",
|
||||
immediate = TRUE
|
||||
)
|
||||
rules <- rules[rules != "custom"]
|
||||
if (length(rules) == 0) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_("No other rules were set, returning original data", add_fn = font_red, as_note = FALSE)
|
||||
}
|
||||
return(x)
|
||||
@@ -199,17 +200,15 @@ eucast_rules <- function(x,
|
||||
x_deparsed <- "your_data"
|
||||
}
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
breakpoints_info <- EUCAST_VERSION_BREAKPOINTS[[which(as.double(names(EUCAST_VERSION_BREAKPOINTS)) == version_breakpoints)]]
|
||||
expertrules_info <- EUCAST_VERSION_EXPERT_RULES[[which(as.double(names(EUCAST_VERSION_EXPERT_RULES)) == version_expertrules)]]
|
||||
|
||||
# support old setting (until AMR v1.3.0)
|
||||
if (missing(rules) & !is.null(getOption("AMR.eucast_rules", default = NULL))) {
|
||||
if (missing(rules) && !is.null(getOption("AMR.eucast_rules", default = NULL))) {
|
||||
rules <- getOption("AMR.eucast_rules")
|
||||
}
|
||||
|
||||
if (interactive() & verbose == TRUE & info == TRUE) {
|
||||
if (interactive() && isTRUE(verbose) && isTRUE(info)) {
|
||||
txt <- paste0(
|
||||
"WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way.",
|
||||
"\n\nThis may overwrite your existing data if you use e.g.:",
|
||||
@@ -248,9 +247,9 @@ eucast_rules <- function(x,
|
||||
cat(font_subtle(" (no changes)\n"))
|
||||
} else {
|
||||
# opening
|
||||
if (n_added > 0 & n_changed == 0) {
|
||||
if (n_added > 0 && n_changed == 0) {
|
||||
cat(font_green(" ("))
|
||||
} else if (n_added == 0 & n_changed > 0) {
|
||||
} else if (n_added == 0 && n_changed > 0) {
|
||||
cat(font_blue(" ("))
|
||||
} else {
|
||||
cat(font_grey(" ("))
|
||||
@@ -264,7 +263,7 @@ eucast_rules <- function(x,
|
||||
}
|
||||
}
|
||||
# separator
|
||||
if (n_added > 0 & n_changed > 0) {
|
||||
if (n_added > 0 && n_changed > 0) {
|
||||
cat(font_grey(", "))
|
||||
}
|
||||
# changes
|
||||
@@ -276,9 +275,9 @@ eucast_rules <- function(x,
|
||||
}
|
||||
}
|
||||
# closing
|
||||
if (n_added > 0 & n_changed == 0) {
|
||||
if (n_added > 0 && n_changed == 0) {
|
||||
cat(font_green(")\n"))
|
||||
} else if (n_added == 0 & n_changed > 0) {
|
||||
} else if (n_added == 0 && n_changed > 0) {
|
||||
cat(font_blue(")\n"))
|
||||
} else {
|
||||
cat(font_grey(")\n"))
|
||||
@@ -315,16 +314,16 @@ eucast_rules <- function(x,
|
||||
...
|
||||
)
|
||||
|
||||
if (!"AMP" %in% names(cols_ab) & "AMX" %in% names(cols_ab)) {
|
||||
if (!"AMP" %in% names(cols_ab) && "AMX" %in% names(cols_ab)) {
|
||||
# ampicillin column is missing, but amoxicillin is available
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_("Using column '", cols_ab[names(cols_ab) == "AMX"], "' as input for ampicillin since many EUCAST rules depend on it.")
|
||||
}
|
||||
cols_ab <- c(cols_ab, c(AMP = unname(cols_ab[names(cols_ab) == "AMX"])))
|
||||
}
|
||||
|
||||
# data preparation ----
|
||||
if (info == TRUE & NROW(x) > 10000) {
|
||||
if (isTRUE(info) && NROW(x) > 10000) {
|
||||
message_("Preparing data...", appendLF = FALSE, as_note = FALSE)
|
||||
}
|
||||
|
||||
@@ -333,8 +332,8 @@ eucast_rules <- function(x,
|
||||
x <- x %pm>%
|
||||
strsplit(",") %pm>%
|
||||
unlist() %pm>%
|
||||
trimws() %pm>%
|
||||
vapply(FUN.VALUE = character(1), function(x) if (x %in% antibiotics$ab) ab_name(x, language = NULL, tolower = TRUE, fast_mode = TRUE) else x) %pm>%
|
||||
trimws2() %pm>%
|
||||
vapply(FUN.VALUE = character(1), function(x) if (x %in% AMR::antibiotics$ab) ab_name(x, language = NULL, tolower = TRUE, fast_mode = TRUE) else x) %pm>%
|
||||
sort() %pm>%
|
||||
paste(collapse = ", ")
|
||||
x <- gsub("_", " ", x, fixed = TRUE)
|
||||
@@ -344,8 +343,8 @@ eucast_rules <- function(x,
|
||||
x
|
||||
}
|
||||
format_antibiotic_names <- function(ab_names, ab_results) {
|
||||
ab_names <- trimws(unlist(strsplit(ab_names, ",")))
|
||||
ab_results <- trimws(unlist(strsplit(ab_results, ",")))
|
||||
ab_names <- trimws2(unlist(strsplit(ab_names, ",")))
|
||||
ab_results <- trimws2(unlist(strsplit(ab_results, ",")))
|
||||
if (length(ab_results) == 1) {
|
||||
if (length(ab_names) == 1) {
|
||||
# like FOX S
|
||||
@@ -423,25 +422,25 @@ eucast_rules <- function(x,
|
||||
# big speed gain! only analyse unique rows:
|
||||
pm_distinct(`.rowid`, .keep_all = TRUE) %pm>%
|
||||
as.data.frame(stringsAsFactors = FALSE)
|
||||
x[, col_mo] <- as.mo(as.character(x[, col_mo, drop = TRUE]))
|
||||
x[, col_mo] <- as.mo(as.character(x[, col_mo, drop = TRUE]), info = info)
|
||||
# rename col_mo to prevent interference with joined columns
|
||||
colnames(x)[colnames(x) == col_mo] <- ".col_mo"
|
||||
col_mo <- ".col_mo"
|
||||
# join to microorganisms data set
|
||||
x <- left_join_microorganisms(x, by = col_mo, suffix = c("_oldcols", ""))
|
||||
x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL)
|
||||
x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL, info = FALSE)
|
||||
x$genus_species <- trimws(paste(x$genus, x$species))
|
||||
if (info == TRUE & NROW(x) > 10000) {
|
||||
if (isTRUE(info) && NROW(x) > 10000) {
|
||||
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
|
||||
}
|
||||
|
||||
if (any(x$genus == "Staphylococcus", na.rm = TRUE)) {
|
||||
all_staph <- MO_lookup[which(MO_lookup$genus == "Staphylococcus"), , drop = FALSE]
|
||||
all_staph$CNS_CPS <- suppressWarnings(mo_name(all_staph$mo, Becker = "all", language = NULL))
|
||||
all_staph <- AMR_env$MO_lookup[which(AMR_env$MO_lookup$genus == "Staphylococcus"), , drop = FALSE]
|
||||
all_staph$CNS_CPS <- suppressWarnings(mo_name(all_staph$mo, Becker = "all", language = NULL, info = FALSE))
|
||||
}
|
||||
if (any(x$genus == "Streptococcus", na.rm = TRUE)) {
|
||||
all_strep <- MO_lookup[which(MO_lookup$genus == "Streptococcus"), , drop = FALSE]
|
||||
all_strep$Lancefield <- suppressWarnings(mo_name(all_strep$mo, Lancefield = TRUE, language = NULL))
|
||||
all_strep <- AMR_env$MO_lookup[which(AMR_env$MO_lookup$genus == "Streptococcus"), , drop = FALSE]
|
||||
all_strep$Lancefield <- suppressWarnings(mo_name(all_strep$mo, Lancefield = TRUE, language = NULL, info = FALSE))
|
||||
}
|
||||
|
||||
n_added <- 0
|
||||
@@ -449,7 +448,7 @@ eucast_rules <- function(x,
|
||||
|
||||
# Other rules: enzyme inhibitors ------------------------------------------
|
||||
if (any(c("all", "other") %in% rules)) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\n")
|
||||
cat(word_wrap(
|
||||
font_bold(paste0(
|
||||
@@ -461,10 +460,10 @@ eucast_rules <- function(x,
|
||||
))
|
||||
))
|
||||
}
|
||||
ab_enzyme <- subset(antibiotics, name %like% "/")[, c("ab", "name"), drop = FALSE]
|
||||
ab_enzyme <- subset(AMR::antibiotics, name %like% "/")[, c("ab", "name"), drop = FALSE]
|
||||
colnames(ab_enzyme) <- c("enzyme_ab", "enzyme_name")
|
||||
ab_enzyme$base_name <- gsub("^([a-zA-Z0-9]+).*", "\\1", ab_enzyme$enzyme_name)
|
||||
ab_enzyme$base_ab <- antibiotics[match(ab_enzyme$base_name, antibiotics$name), "ab", drop = TRUE]
|
||||
ab_enzyme$base_ab <- AMR::antibiotics[match(ab_enzyme$base_name, AMR::antibiotics$name), "ab", drop = TRUE]
|
||||
ab_enzyme <- subset(ab_enzyme, !is.na(base_ab))
|
||||
# make ampicillin and amoxicillin interchangable
|
||||
ampi <- subset(ab_enzyme, base_ab == "AMX")
|
||||
@@ -488,7 +487,7 @@ eucast_rules <- function(x,
|
||||
ab_enzyme$base_name[i], " ('", font_bold(col_base), "') = R if ",
|
||||
tolower(ab_enzyme$enzyme_name[i]), " ('", font_bold(col_enzyme), "') = R"
|
||||
)
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat(word_wrap(rule_current,
|
||||
width = getOption("width") - 30,
|
||||
extra_indent = 6
|
||||
@@ -515,7 +514,7 @@ eucast_rules <- function(x,
|
||||
x <- run_changes$output
|
||||
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
|
||||
# Print number of new changes
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
# print only on last one of rules in this group
|
||||
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
|
||||
# and reset counters
|
||||
@@ -529,7 +528,7 @@ eucast_rules <- function(x,
|
||||
tolower(ab_enzyme$base_name[i]), " ('", font_bold(col_base), "') = S"
|
||||
)
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat(word_wrap(rule_current,
|
||||
width = getOption("width") - 30,
|
||||
extra_indent = 6
|
||||
@@ -556,7 +555,7 @@ eucast_rules <- function(x,
|
||||
x <- run_changes$output
|
||||
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
|
||||
# Print number of new changes
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
# print only on last one of rules in this group
|
||||
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
|
||||
# and reset counters
|
||||
@@ -566,14 +565,14 @@ eucast_rules <- function(x,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\n")
|
||||
message_("Skipping inheritance rules defined by this AMR package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R. Add \"other\" or \"all\" to the `rules` argument to apply those rules.")
|
||||
}
|
||||
}
|
||||
|
||||
if (!any(c("all", "custom") %in% rules) & !is.null(custom_rules)) {
|
||||
if (info == TRUE) {
|
||||
if (!any(c("all", "custom") %in% rules) && !is.null(custom_rules)) {
|
||||
if (isTRUE(info)) {
|
||||
message_("Skipping custom EUCAST rules, since the `rules` argument does not contain \"custom\".")
|
||||
}
|
||||
custom_rules <- NULL
|
||||
@@ -627,14 +626,14 @@ eucast_rules <- function(x,
|
||||
rule_group_previous <- eucast_rules_df[max(1, i - 1), "reference.rule_group", drop = TRUE]
|
||||
rule_group_current <- eucast_rules_df[i, "reference.rule_group", drop = TRUE]
|
||||
# don't apply rules if user doesn't want to apply them
|
||||
if (rule_group_current %like% "breakpoint" & !any(c("all", "breakpoints") %in% rules)) {
|
||||
if (rule_group_current %like% "breakpoint" && !any(c("all", "breakpoints") %in% rules)) {
|
||||
next
|
||||
}
|
||||
if (rule_group_current %like% "expert" & !any(c("all", "expert") %in% rules)) {
|
||||
if (rule_group_current %like% "expert" && !any(c("all", "expert") %in% rules)) {
|
||||
next
|
||||
}
|
||||
|
||||
if (isFALSE(info) | isFALSE(verbose)) {
|
||||
if (isFALSE(info) || isFALSE(verbose)) {
|
||||
rule_text <- ""
|
||||
} else {
|
||||
if (is.na(eucast_rules_df[i, "and_these_antibiotics", drop = TRUE])) {
|
||||
@@ -658,9 +657,9 @@ eucast_rules <- function(x,
|
||||
rule_next <- ""
|
||||
}
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
# Print EUCAST intro ------------------------------------------------------
|
||||
if (rule_group_current %unlike% "other" & eucast_notification_shown == FALSE) {
|
||||
if (rule_group_current %unlike% "other" && eucast_notification_shown == FALSE) {
|
||||
cat(
|
||||
paste0(
|
||||
"\n", font_grey(strrep("-", 0.95 * options()$width)), "\n",
|
||||
@@ -782,7 +781,7 @@ eucast_rules <- function(x,
|
||||
)
|
||||
} else {
|
||||
source_antibiotics <- get_ab_from_namespace(source_antibiotics, cols_ab)
|
||||
if (length(source_value) == 1 & length(source_antibiotics) > 1) {
|
||||
if (length(source_value) == 1 && length(source_antibiotics) > 1) {
|
||||
source_value <- rep(source_value, length(source_antibiotics))
|
||||
}
|
||||
if (length(source_antibiotics) == 0) {
|
||||
@@ -839,7 +838,7 @@ eucast_rules <- function(x,
|
||||
x <- run_changes$output
|
||||
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
|
||||
# Print number of new changes ---------------------------------------------
|
||||
if (info == TRUE & rule_next != rule_current) {
|
||||
if (isTRUE(info) && rule_next != rule_current) {
|
||||
# print only on last one of rules in this group
|
||||
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
|
||||
# and reset counters
|
||||
@@ -850,7 +849,7 @@ eucast_rules <- function(x,
|
||||
|
||||
# Apply custom rules ----
|
||||
if (!is.null(custom_rules)) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\n")
|
||||
cat(font_bold("Custom EUCAST rules, set by user"), "\n")
|
||||
}
|
||||
@@ -869,7 +868,7 @@ eucast_rules <- function(x,
|
||||
format_custom_query_rule(rule$query, colours = FALSE), ": ",
|
||||
get_antibiotic_names(cols)
|
||||
)
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
# print rule
|
||||
cat(italicise_taxonomy(word_wrap(format_custom_query_rule(rule$query, colours = FALSE),
|
||||
width = getOption("width") - 30,
|
||||
@@ -905,7 +904,7 @@ eucast_rules <- function(x,
|
||||
x <- run_changes$output
|
||||
warn_lacking_rsi_class <- c(warn_lacking_rsi_class, run_changes$rsi_warn)
|
||||
# Print number of new changes ---------------------------------------------
|
||||
if (info == TRUE & rule_next != rule_current) {
|
||||
if (isTRUE(info) && rule_next != rule_current) {
|
||||
# print only on last one of rules in this group
|
||||
txt_ok(n_added = n_added, n_changed = n_changed, warned = warned)
|
||||
# and reset counters
|
||||
@@ -916,7 +915,7 @@ eucast_rules <- function(x,
|
||||
}
|
||||
|
||||
# Print overview ----------------------------------------------------------
|
||||
if (info == TRUE | verbose == TRUE) {
|
||||
if (isTRUE(info) || isTRUE(verbose)) {
|
||||
verbose_info <- x.bak %pm>%
|
||||
pm_mutate(row = pm_row_number()) %pm>%
|
||||
pm_select(`.rowid`, row) %pm>%
|
||||
@@ -930,8 +929,8 @@ eucast_rules <- function(x,
|
||||
rownames(verbose_info) <- NULL
|
||||
}
|
||||
|
||||
if (info == TRUE) {
|
||||
if (verbose == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
if (isTRUE(verbose)) {
|
||||
wouldve <- "would have "
|
||||
} else {
|
||||
wouldve <- ""
|
||||
@@ -1011,9 +1010,9 @@ eucast_rules <- function(x,
|
||||
|
||||
cat(paste0(font_grey(strrep("-", 0.95 * options()$width)), "\n"))
|
||||
|
||||
if (verbose == FALSE & total_n_added + total_n_changed > 0) {
|
||||
if (isFALSE(verbose) && total_n_added + total_n_changed > 0) {
|
||||
cat("\n", word_wrap("Use ", font_bold("eucast_rules(..., verbose = TRUE)"), " (on your original data) to get a data.frame with all specified edits instead."), "\n\n", sep = "")
|
||||
} else if (verbose == TRUE) {
|
||||
} else if (isTRUE(verbose)) {
|
||||
cat("\n", word_wrap("Used 'Verbose mode' (", font_bold("verbose = TRUE"), "), which returns a data.frame with all specified edits.\nUse ", font_bold("verbose = FALSE"), " to apply the rules on your data."), "\n\n", sep = "")
|
||||
}
|
||||
}
|
||||
@@ -1024,7 +1023,7 @@ eucast_rules <- function(x,
|
||||
warn_lacking_rsi_class <- warn_lacking_rsi_class[order(colnames(x.bak))]
|
||||
warn_lacking_rsi_class <- warn_lacking_rsi_class[!is.na(warn_lacking_rsi_class)]
|
||||
warning_(
|
||||
"in `eucast_rules()`: not all columns with antimicrobial results are of class <rsi>. Transform them on beforehand, with e.g.:\n",
|
||||
"in `eucast_rules()`: not all columns with antimicrobial results are of class 'rsi'. Transform them on beforehand, with e.g.:\n",
|
||||
" - ", x_deparsed, " %>% as.rsi(", ifelse(length(warn_lacking_rsi_class) == 1,
|
||||
warn_lacking_rsi_class,
|
||||
paste0(warn_lacking_rsi_class[1], ":", warn_lacking_rsi_class[length(warn_lacking_rsi_class)])
|
||||
@@ -1035,7 +1034,7 @@ eucast_rules <- function(x,
|
||||
}
|
||||
|
||||
# Return data set ---------------------------------------------------------
|
||||
if (verbose == TRUE) {
|
||||
if (isTRUE(verbose)) {
|
||||
as_original_data_class(verbose_info, old_attributes$class)
|
||||
} else {
|
||||
# x was analysed with only unique rows, so join everything together again
|
||||
@@ -1073,16 +1072,16 @@ edit_rsi <- function(x,
|
||||
)
|
||||
|
||||
txt_error <- function() {
|
||||
if (info == TRUE) cat("", font_red_bg(font_white(" ERROR ")), "\n\n")
|
||||
if (isTRUE(info)) cat("", font_red_bg(" ERROR "), "\n\n")
|
||||
}
|
||||
txt_warning <- function() {
|
||||
if (warned == FALSE) {
|
||||
if (info == TRUE) cat(" ", font_rsi_I_bg(" WARNING "), sep = "")
|
||||
if (isTRUE(info)) cat(" ", font_orange_bg(" WARNING "), sep = "")
|
||||
}
|
||||
warned <<- TRUE
|
||||
}
|
||||
|
||||
if (length(rows) > 0 & length(cols) > 0) {
|
||||
if (length(rows) > 0 && length(cols) > 0) {
|
||||
new_edits <- x
|
||||
if (any(!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi), na.rm = TRUE)) {
|
||||
track_changes$rsi_warn <- cols[!vapply(FUN.VALUE = logical(1), x[, cols, drop = FALSE], is.rsi)]
|
||||
@@ -1128,7 +1127,7 @@ edit_rsi <- function(x,
|
||||
)
|
||||
|
||||
track_changes$output <- new_edits
|
||||
if ((info == TRUE | verbose == TRUE) && !isTRUE(all.equal(x, track_changes$output))) {
|
||||
if ((isTRUE(info) || isTRUE(verbose)) && !isTRUE(all.equal(x, track_changes$output))) {
|
||||
get_original_rows <- function(rowids) {
|
||||
as.integer(rownames(original_data[which(original_data$.rowid %in% rowids), , drop = FALSE]))
|
||||
}
|
||||
@@ -1174,12 +1173,12 @@ edit_rsi <- function(x,
|
||||
|
||||
#' @rdname eucast_rules
|
||||
#' @export
|
||||
eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 11.0) {
|
||||
eucast_dosage <- function(ab, administration = "iv", version_breakpoints = 12.0) {
|
||||
meet_criteria(ab, allow_class = c("character", "numeric", "integer", "factor"))
|
||||
meet_criteria(administration, allow_class = "character", is_in = dosage$administration[!is.na(dosage$administration)], has_length = 1)
|
||||
meet_criteria(version_breakpoints, allow_class = c("numeric", "integer"), has_length = 1, is_in = as.double(names(EUCAST_VERSION_BREAKPOINTS)))
|
||||
|
||||
# show used version_breakpoints number once per session (pkg_env will reload every session)
|
||||
# show used version_breakpoints number once per session (AMR_env will reload every session)
|
||||
if (message_not_thrown_before("eucast_dosage", "v", gsub("[^0-9]", "", version_breakpoints), entire_session = TRUE)) {
|
||||
message_(
|
||||
"Dosages for antimicrobial drugs, as meant for ",
|
||||
|
||||
+29
-41
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -44,7 +48,7 @@
|
||||
#' @param points_threshold minimum number of points to require before differences in the antibiogram will lead to inclusion of an isolate when `type = "points"`, see *Details*
|
||||
#' @param info a [logical] to indicate info should be printed, defaults to `TRUE` only in interactive mode
|
||||
#' @param include_unknown a [logical] to indicate whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate.
|
||||
#' @param include_untested_rsi a [logical] to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use `include_untested_rsi = FALSE` to always return `FALSE` for such rows. This checks the data set for columns of class `<rsi>` and consequently requires transforming columns with antibiotic results using [as.rsi()] first.
|
||||
#' @param include_untested_rsi a [logical] to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use `include_untested_rsi = FALSE` to always return `FALSE` for such rows. This checks the data set for columns of class `rsi` and consequently requires transforming columns with antibiotic results using [as.rsi()] first.
|
||||
#' @param ... arguments passed on to [first_isolate()] when using [filter_first_isolate()], otherwise arguments passed on to [key_antimicrobials()] (such as `universal`, `gram_negative`, `gram_positive`)
|
||||
#' @details
|
||||
#' To conduct epidemiological analyses on antimicrobial resistance data, only so-called first isolates should be included to prevent overestimation and underestimation of antimicrobial resistance. Different methods can be used to do so, see below.
|
||||
@@ -55,7 +59,7 @@
|
||||
#'
|
||||
#' All isolates with a microbial ID of `NA` will be excluded as first isolate.
|
||||
#'
|
||||
#' ## Different methods
|
||||
#' ### Different methods
|
||||
#'
|
||||
#' According to Hindler *et al.* (2007, \doi{10.1086/511864}), there are different methods (algorithms) to select first isolates with increasing reliability: isolate-based, patient-based, episode-based and phenotype-based. All methods select on a combination of the taxonomic genus and species (not subspecies).
|
||||
#'
|
||||
@@ -103,14 +107,14 @@
|
||||
#'
|
||||
#' 1. Using `type = "points"` and argument `points_threshold` (default)
|
||||
#'
|
||||
#' This method weighs *all* antimicrobial agents available in the data set. Any difference from I to S or R (or vice versa) counts as `0.5` points, a difference from S to R (or vice versa) counts as `1` point. When the sum of points exceeds `points_threshold`, which defaults to `2`, an isolate will be selected as a first weighted isolate.
|
||||
#' This method weighs *all* antimicrobial drugs available in the data set. Any difference from I to S or R (or vice versa) counts as `0.5` points, a difference from S to R (or vice versa) counts as `1` point. When the sum of points exceeds `points_threshold`, which defaults to `2`, an isolate will be selected as a first weighted isolate.
|
||||
#'
|
||||
#' All antimicrobials are internally selected using the [all_antimicrobials()] function. The output of this function does not need to be passed to the [first_isolate()] function.
|
||||
#'
|
||||
#'
|
||||
#' 2. Using `type = "keyantimicrobials"` and argument `ignore_I`
|
||||
#'
|
||||
#' This method only weighs specific antimicrobial agents, called *key antimicrobials*. Any difference from S to R (or vice versa) in these key antimicrobials will select an isolate as a first weighted isolate. With `ignore_I = FALSE`, also differences from I to S or R (or vice versa) will lead to this.
|
||||
#' This method only weighs specific antimicrobial drugs, called *key antimicrobials*. Any difference from S to R (or vice versa) in these key antimicrobials will select an isolate as a first weighted isolate. With `ignore_I = FALSE`, also differences from I to S or R (or vice versa) will lead to this.
|
||||
#'
|
||||
#' Key antimicrobials are internally selected using the [key_antimicrobials()] function, but can also be added manually as a variable to the data and set in the `col_keyantimicrobials` argument. Another option is to pass the output of the [key_antimicrobials()] function directly to the `col_keyantimicrobials` argument.
|
||||
#'
|
||||
@@ -122,7 +126,7 @@
|
||||
#' @return A [logical] vector
|
||||
#' @source Methodology of this function is strictly based on:
|
||||
#'
|
||||
#' - **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition**, 2014, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' - **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition**, 2022, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#'
|
||||
#' - Hindler JF and Stelling J (2007). **Analysis and Presentation of Cumulative Antibiograms: A New Consensus Guideline from the Clinical and Laboratory Standards Institute.** Clinical Infectious Diseases, 44(6), 867-873. \doi{10.1086/511864}
|
||||
#' @examples
|
||||
@@ -174,18 +178,6 @@ first_isolate <- function(x = NULL,
|
||||
include_unknown = FALSE,
|
||||
include_untested_rsi = TRUE,
|
||||
...) {
|
||||
dots <- unlist(list(...))
|
||||
if (length(dots) != 0) {
|
||||
# backwards compatibility with old arguments
|
||||
dots.names <- names(dots)
|
||||
if ("filter_specimen" %in% dots.names) {
|
||||
specimen_group <- dots[which(dots.names == "filter_specimen")]
|
||||
}
|
||||
if ("col_keyantibiotics" %in% dots.names) {
|
||||
col_keyantimicrobials <- dots[which(dots.names == "col_keyantibiotics")]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null_or_grouped_tbl(x)) {
|
||||
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
|
||||
# is also fix for using a grouped df as input (a dot as first argument)
|
||||
@@ -248,10 +240,10 @@ first_isolate <- function(x = NULL,
|
||||
FUN = function(x) any(as.character(x[1:10000]) %in% c("R", "S", "I"), na.rm = TRUE),
|
||||
USE.NAMES = FALSE
|
||||
))
|
||||
if (method == "phenotype-based" & !any_col_contains_rsi) {
|
||||
if (method == "phenotype-based" && !any_col_contains_rsi) {
|
||||
method <- "episode-based"
|
||||
}
|
||||
if (info == TRUE & message_not_thrown_before("first_isolate", "method")) {
|
||||
if (isTRUE(info) && message_not_thrown_before("first_isolate", "method")) {
|
||||
message_(paste0(
|
||||
"Determining first isolates ",
|
||||
ifelse(method %in% c("episode-based", "phenotype-based"),
|
||||
@@ -288,14 +280,14 @@ first_isolate <- function(x = NULL,
|
||||
} else if (method == "episode-based") {
|
||||
col_keyantimicrobials <- NULL
|
||||
} else if (method == "phenotype-based") {
|
||||
if (missing(type) & !is.null(col_keyantimicrobials)) {
|
||||
if (missing(type) && !is.null(col_keyantimicrobials)) {
|
||||
# type = "points" is default, but not set explicitly, while col_keyantimicrobials is
|
||||
type <- "keyantimicrobials"
|
||||
}
|
||||
if (type == "points") {
|
||||
x$keyantimicrobials <- all_antimicrobials(x, only_rsi_columns = FALSE)
|
||||
col_keyantimicrobials <- "keyantimicrobials"
|
||||
} else if (type == "keyantimicrobials" & is.null(col_keyantimicrobials)) {
|
||||
} else if (type == "keyantimicrobials" && is.null(col_keyantimicrobials)) {
|
||||
col_keyantimicrobials <- search_type_in_df(x = x, type = "keyantimicrobials", info = info)
|
||||
if (is.null(col_keyantimicrobials)) {
|
||||
# still not found as a column, create it ourselves
|
||||
@@ -325,7 +317,7 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
|
||||
# -- specimen
|
||||
if (is.null(col_specimen) & !is.null(specimen_group)) {
|
||||
if (is.null(col_specimen) && !is.null(specimen_group)) {
|
||||
col_specimen <- search_type_in_df(x = x, type = "specimen", info = info)
|
||||
}
|
||||
|
||||
@@ -361,7 +353,7 @@ first_isolate <- function(x = NULL,
|
||||
testcodes_exclude <- NULL
|
||||
}
|
||||
# remove testcodes
|
||||
if (!is.null(testcodes_exclude) & info == TRUE & message_not_thrown_before("first_isolate", "excludingtestcodes")) {
|
||||
if (!is.null(testcodes_exclude) && isTRUE(info) && message_not_thrown_before("first_isolate", "excludingtestcodes")) {
|
||||
message_("Excluding test codes: ", vector_and(testcodes_exclude, quotes = TRUE),
|
||||
add_fn = font_black,
|
||||
as_note = FALSE
|
||||
@@ -375,7 +367,7 @@ first_isolate <- function(x = NULL,
|
||||
# filter on specimen group and keyantibiotics when they are filled in
|
||||
if (!is.null(specimen_group)) {
|
||||
check_columns_existance(col_specimen, x)
|
||||
if (info == TRUE & message_not_thrown_before("first_isolate", "excludingspecimen")) {
|
||||
if (isTRUE(info) && message_not_thrown_before("first_isolate", "excludingspecimen")) {
|
||||
message_("Excluding other than specimen group '", specimen_group, "'",
|
||||
add_fn = font_black,
|
||||
as_note = FALSE
|
||||
@@ -418,8 +410,8 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
|
||||
# speed up - return immediately if obvious
|
||||
if (abs(row.start) == Inf | abs(row.end) == Inf) {
|
||||
if (info == TRUE) {
|
||||
if (abs(row.start) == Inf || abs(row.end) == Inf) {
|
||||
if (isTRUE(info)) {
|
||||
message_("=> Found ", font_bold("no isolates"),
|
||||
add_fn = font_black,
|
||||
as_note = FALSE
|
||||
@@ -428,7 +420,7 @@ first_isolate <- function(x = NULL,
|
||||
return(rep(FALSE, nrow(x)))
|
||||
}
|
||||
if (row.start == row.end) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_("=> Found ", font_bold("1 first isolate"), ", as the data only contained 1 row",
|
||||
add_fn = font_black,
|
||||
as_note = FALSE
|
||||
@@ -437,7 +429,7 @@ first_isolate <- function(x = NULL,
|
||||
return(TRUE)
|
||||
}
|
||||
if (length(c(row.start:row.end)) == pm_n_distinct(x[c(row.start:row.end), col_mo, drop = TRUE])) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_("=> Found ", font_bold(paste(length(c(row.start:row.end)), "first isolates")),
|
||||
", as all isolates were different microbial species",
|
||||
add_fn = font_black,
|
||||
@@ -455,7 +447,7 @@ first_isolate <- function(x = NULL,
|
||||
|
||||
# Analysis of first isolate ----
|
||||
if (!is.null(col_keyantimicrobials)) {
|
||||
if (info == TRUE & message_not_thrown_before("first_isolate", "type")) {
|
||||
if (isTRUE(info) && message_not_thrown_before("first_isolate", "type")) {
|
||||
if (type == "keyantimicrobials") {
|
||||
message_("Basing inclusion on key antimicrobials, ",
|
||||
ifelse(ignore_I == FALSE, "not ", ""),
|
||||
@@ -474,11 +466,7 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
}
|
||||
|
||||
x$other_pat_or_mo <- ifelse(x$newvar_patient_id == pm_lag(x$newvar_patient_id) &
|
||||
x$newvar_genus_species == pm_lag(x$newvar_genus_species),
|
||||
FALSE,
|
||||
TRUE
|
||||
)
|
||||
x$other_pat_or_mo <- !(x$newvar_patient_id == pm_lag(x$newvar_patient_id) & x$newvar_genus_species == pm_lag(x$newvar_genus_species))
|
||||
|
||||
x$episode_group <- paste(x$newvar_patient_id, x$newvar_genus_species)
|
||||
x$more_than_episode_ago <- unlist(lapply(split(
|
||||
@@ -545,7 +533,7 @@ first_isolate <- function(x = NULL,
|
||||
decimal.mark <- getOption("OutDec")
|
||||
big.mark <- ifelse(decimal.mark != ",", ",", ".")
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
# print group name if used in dplyr::group_by()
|
||||
cur_group <- import_fn("cur_group", "dplyr", error_on_fail = FALSE)
|
||||
if (!is.null(cur_group)) {
|
||||
@@ -570,7 +558,7 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
|
||||
# handle empty microorganisms
|
||||
if (any(x$newvar_mo == "UNKNOWN", na.rm = TRUE) & info == TRUE) {
|
||||
if (any(x$newvar_mo == "UNKNOWN", na.rm = TRUE) && isTRUE(info)) {
|
||||
message_(
|
||||
ifelse(include_unknown == TRUE, "Included ", "Excluded "),
|
||||
format(sum(x$newvar_mo == "UNKNOWN", na.rm = TRUE),
|
||||
@@ -582,7 +570,7 @@ first_isolate <- function(x = NULL,
|
||||
x[which(x$newvar_mo == "UNKNOWN"), "newvar_first_isolate"] <- include_unknown
|
||||
|
||||
# exclude all NAs
|
||||
if (any(is.na(x$newvar_mo)) & info == TRUE) {
|
||||
if (anyNA(x$newvar_mo) && isTRUE(info)) {
|
||||
message_(
|
||||
"Excluded ", format(sum(is.na(x$newvar_mo), na.rm = TRUE),
|
||||
decimal.mark = decimal.mark, big.mark = big.mark
|
||||
@@ -606,7 +594,7 @@ first_isolate <- function(x = NULL,
|
||||
x <- x[order(x$newvar_row_index), , drop = FALSE]
|
||||
rownames(x) <- NULL
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
n_found <- sum(x$newvar_first_isolate, na.rm = TRUE)
|
||||
p_found_total <- percentage(n_found / nrow(x[which(!is.na(x$newvar_mo)), , drop = FALSE]), digits = 1)
|
||||
p_found_scope <- percentage(n_found / scope.size, digits = 1)
|
||||
|
||||
+11
-7
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -37,14 +41,14 @@
|
||||
#'
|
||||
#' In the goodness-of-fit case simulation is done by random sampling from the discrete distribution specified by `p`, each sample being of size `n = sum(x)`. This simulation is done in \R and may be slow.
|
||||
#'
|
||||
#' ## *G*-test Of Goodness-of-Fit (Likelihood Ratio Test)
|
||||
#' ### *G*-test Of Goodness-of-Fit (Likelihood Ratio Test)
|
||||
#' Use the *G*-test of goodness-of-fit when you have one nominal variable with two or more values (such as male and female, or red, pink and white flowers). You compare the observed counts of numbers of observations in each category with the expected counts, which you calculate using some kind of theoretical expectation (such as a 1:1 sex ratio or a 1:2:1 ratio in a genetic cross).
|
||||
#'
|
||||
#' If the expected number of observations in any category is too small, the *G*-test may give inaccurate results, and you should use an exact test instead ([fisher.test()]).
|
||||
#'
|
||||
#' The *G*-test of goodness-of-fit is an alternative to the chi-square test of goodness-of-fit ([chisq.test()]); each of these tests has some advantages and some disadvantages, and the results of the two tests are usually very similar.
|
||||
#'
|
||||
#' ## *G*-test of Independence
|
||||
#' ### *G*-test of Independence
|
||||
#' Use the *G*-test of independence when you have two nominal variables, each with two or more possible values. You want to know whether the proportions for one variable are different among values of the other variable.
|
||||
#'
|
||||
#' It is also possible to do a *G*-test of independence with more than two nominal variables. For example, Jackson et al. (2013) also had data for children under 3, so you could do an analysis of old vs. young, thigh vs. arm, and reaction vs. no reaction, all analyzed together.
|
||||
@@ -53,7 +57,7 @@
|
||||
#'
|
||||
#' The *G*-test of independence is an alternative to the chi-square test of independence ([chisq.test()]), and they will give approximately the same results.
|
||||
#'
|
||||
#' ## How the Test Works
|
||||
#' ### How the Test Works
|
||||
#' Unlike the exact test of goodness-of-fit ([fisher.test()]), the *G*-test does not directly calculate the probability of obtaining the observed results or something more extreme. Instead, like almost all statistical tests, the *G*-test has an intermediate step; it uses the data to calculate a test statistic that measures how far the observed data are from the null expectation. You then use a mathematical relationship, in this case the chi-square distribution, to estimate the probability of obtaining that value of the test statistic.
|
||||
#'
|
||||
#' The *G*-test uses the log of the ratio of two likelihoods as the test statistic, which is why it is also called a likelihood ratio test or log-likelihood ratio test. The formula to calculate a *G*-statistic is:
|
||||
@@ -149,7 +153,7 @@ g.test <- function(x,
|
||||
paste(DNAME2, collapse = "\n")
|
||||
)
|
||||
}
|
||||
if (any(x < 0) || any(is.na((x)))) { # this last one was anyNA, but only introduced in R 3.1.0
|
||||
if (any(x < 0) || anyNA(x)) {
|
||||
stop("all entries of 'x' must be nonnegative and finite")
|
||||
}
|
||||
if ((n <- sum(x)) == 0) {
|
||||
|
||||
+14
-8
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -74,7 +78,7 @@
|
||||
#' filter(n() >= 30) %>% # filter on only 30 results per group
|
||||
#' summarise_if(is.rsi, resistance) # then get resistance of all drugs
|
||||
#'
|
||||
#' # now conduct PCA for certain antimicrobial agents
|
||||
#' # now conduct PCA for certain antimicrobial drugs
|
||||
#' pca_result <- resistance_data %>%
|
||||
#' pca(AMC, CXM, CTX, CAZ, GEN, TOB, TMP, SXT)
|
||||
#'
|
||||
@@ -82,10 +86,12 @@
|
||||
#'
|
||||
#' # old base R plotting method:
|
||||
#' biplot(pca_result)
|
||||
#' # new ggplot2 plotting method using this package:
|
||||
#' ggplot_pca(pca_result)
|
||||
#'
|
||||
#' # new ggplot2 plotting method using this package:
|
||||
#' if (require("ggplot2")) {
|
||||
#' ggplot_pca(pca_result)
|
||||
#'
|
||||
#' # still extendible with any ggplot2 function
|
||||
#' ggplot_pca(pca_result) +
|
||||
#' scale_colour_viridis_d() +
|
||||
#' labs(title = "Title here")
|
||||
@@ -232,7 +238,7 @@ ggplot_pca <- function(x,
|
||||
}
|
||||
|
||||
# Overlay a concentration ellipse if there are groups
|
||||
if (!is.null(df.u$groups) & !is.null(ell) & isTRUE(ellipse)) {
|
||||
if (!is.null(df.u$groups) && !is.null(ell) && isTRUE(ellipse)) {
|
||||
g <- g + ggplot2::geom_path(
|
||||
data = ell,
|
||||
ggplot2::aes(colour = groups, group = groups),
|
||||
@@ -319,7 +325,7 @@ pca_calculations <- function(pca_model,
|
||||
error = function(e) NULL
|
||||
)
|
||||
}
|
||||
if (!is.null(groups) & is.null(labels)) {
|
||||
if (!is.null(groups) && is.null(labels)) {
|
||||
# turn them around
|
||||
labels <- groups
|
||||
groups <- NULL
|
||||
|
||||
+14
-19
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -48,7 +52,7 @@
|
||||
#' @param ... other arguments passed on to [geom_rsi()] or, in case of [scale_rsi_colours()], named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See *Examples*.
|
||||
#' @details At default, the names of antibiotics will be shown on the plots using [ab_name()]. This can be set with the `translate_ab` argument. See [count_df()].
|
||||
#'
|
||||
#' ## The Functions
|
||||
#' ### The Functions
|
||||
#' [geom_rsi()] will take any variable from the data that has an [`rsi`] class (created with [as.rsi()]) using [rsi_df()] and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
||||
#'
|
||||
#' [facet_rsi()] creates 2d plots (at default based on S/I/R) using [ggplot2::facet_wrap()].
|
||||
@@ -179,7 +183,6 @@ ggplot_rsi <- function(data,
|
||||
limits = NULL,
|
||||
translate_ab = "name",
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE,
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
nrow = NULL,
|
||||
@@ -209,9 +212,8 @@ ggplot_rsi <- function(data,
|
||||
meet_criteria(limits, allow_class = c("numeric", "integer"), has_length = 2, allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(nrow, allow_class = c("numeric", "integer"), has_length = 1, allow_NULL = TRUE, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(colours, allow_class = c("character", "logical"))
|
||||
meet_criteria(datalabels, allow_class = "logical", has_length = 1)
|
||||
@@ -250,7 +252,7 @@ ggplot_rsi <- function(data,
|
||||
geom_rsi(
|
||||
position = position, x = x, fill = fill, translate_ab = translate_ab,
|
||||
minimum = minimum, language = language,
|
||||
combine_SI = combine_SI, combine_IR = combine_IR, ...
|
||||
combine_SI = combine_SI, ...
|
||||
) +
|
||||
theme_rsi()
|
||||
|
||||
@@ -271,7 +273,6 @@ ggplot_rsi <- function(data,
|
||||
minimum = minimum,
|
||||
language = language,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
datalabels.size = datalabels.size,
|
||||
datalabels.colour = datalabels.colour
|
||||
)
|
||||
@@ -301,7 +302,6 @@ geom_rsi <- function(position = NULL,
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE,
|
||||
...) {
|
||||
x <- x[1]
|
||||
stop_ifnot_installed("ggplot2")
|
||||
@@ -311,12 +311,11 @@ geom_rsi <- function(position = NULL,
|
||||
meet_criteria(fill, allow_class = "character", has_length = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
|
||||
y <- "value"
|
||||
if (missing(position) | is.null(position)) {
|
||||
if (missing(position) || is.null(position)) {
|
||||
position <- "fill"
|
||||
}
|
||||
|
||||
@@ -346,8 +345,7 @@ geom_rsi <- function(position = NULL,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
minimum = minimum,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR
|
||||
combine_SI = combine_SI
|
||||
)
|
||||
},
|
||||
mapping = ggplot2::aes_string(x = x, y = y, fill = fill),
|
||||
@@ -492,7 +490,6 @@ labels_rsi_count <- function(position = NULL,
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE,
|
||||
datalabels.size = 3,
|
||||
datalabels.colour = "grey15") {
|
||||
stop_ifnot_installed("ggplot2")
|
||||
@@ -500,9 +497,8 @@ labels_rsi_count <- function(position = NULL,
|
||||
meet_criteria(x, allow_class = "character", has_length = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_IR, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(datalabels.size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE)
|
||||
meet_criteria(datalabels.colour, allow_class = "character", has_length = 1)
|
||||
|
||||
@@ -529,7 +525,6 @@ labels_rsi_count <- function(position = NULL,
|
||||
data = x,
|
||||
translate_ab = translate_ab,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
minimum = minimum,
|
||||
language = language
|
||||
)
|
||||
|
||||
+38
-34
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -29,7 +33,7 @@
|
||||
#' @param x a [data.frame]
|
||||
#' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x`
|
||||
#' @param verbose a [logical] to indicate whether additional info should be printed
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only antibiotic columns must be detected that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only antibiotic columns must be detected that were transformed to class `rsi` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @details You can look for an antibiotic (trade) name or abbreviation and it will search `x` and the [antibiotics] data set for any column containing a name or code of that antibiotic.
|
||||
#' @return A column name of `x`, or `NULL` when no result is found.
|
||||
#' @export
|
||||
@@ -59,7 +63,7 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_r
|
||||
meet_criteria(verbose, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (is.null(x) & is.null(search_string)) {
|
||||
if (is.null(x) && is.null(search_string)) {
|
||||
return(as.name("guess_ab_col"))
|
||||
} else {
|
||||
meet_criteria(search_string, allow_class = "character", has_length = 1, allow_NULL = FALSE)
|
||||
@@ -73,7 +77,7 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_r
|
||||
ab_result <- unname(all_found[names(all_found) == search_string.ab])
|
||||
|
||||
if (length(ab_result) == 0) {
|
||||
if (verbose == TRUE) {
|
||||
if (isTRUE(verbose)) {
|
||||
message_("No column found as input for ", search_string,
|
||||
" (", ab_name(search_string, language = NULL, tolower = TRUE), ").",
|
||||
add_fn = font_black,
|
||||
@@ -82,7 +86,7 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_r
|
||||
}
|
||||
return(NULL)
|
||||
} else {
|
||||
if (verbose == TRUE) {
|
||||
if (isTRUE(verbose)) {
|
||||
message_(
|
||||
"Using column '", font_bold(ab_result), "' as input for ", search_string,
|
||||
" (", ab_name(search_string, language = NULL, tolower = TRUE), ")."
|
||||
@@ -108,17 +112,17 @@ get_column_abx <- function(x,
|
||||
entire_session = FALSE,
|
||||
match_fn = fn
|
||||
),
|
||||
pkg_env$get_column_abx.call
|
||||
AMR_env$get_column_abx.call
|
||||
)) {
|
||||
# so within the same call, within the same environment, we got here again.
|
||||
# but we could've come from another function within the same call, so now only check the columns that changed
|
||||
|
||||
# first remove the columns that are not existing anymore
|
||||
previous <- pkg_env$get_column_abx.out
|
||||
previous <- AMR_env$get_column_abx.out
|
||||
current <- previous[previous %in% colnames(x)]
|
||||
|
||||
# then compare columns in current call with columns in original call
|
||||
new_cols <- colnames(x)[!colnames(x) %in% pkg_env$get_column_abx.checked_cols]
|
||||
new_cols <- colnames(x)[!colnames(x) %in% AMR_env$get_column_abx.checked_cols]
|
||||
if (length(new_cols) > 0) {
|
||||
# these columns did not exist in the last call, so add them
|
||||
new_cols_rsi <- get_column_abx(x[, new_cols, drop = FALSE], reuse_previous_result = FALSE, info = FALSE, sort = FALSE)
|
||||
@@ -128,11 +132,11 @@ get_column_abx <- function(x,
|
||||
}
|
||||
|
||||
# update pkg environment to improve speed on next run
|
||||
pkg_env$get_column_abx.out <- current
|
||||
pkg_env$get_column_abx.checked_cols <- colnames(x)
|
||||
AMR_env$get_column_abx.out <- current
|
||||
AMR_env$get_column_abx.checked_cols <- colnames(x)
|
||||
|
||||
# and return right values
|
||||
return(pkg_env$get_column_abx.out)
|
||||
return(AMR_env$get_column_abx.out)
|
||||
}
|
||||
|
||||
meet_criteria(x, allow_class = "data.frame")
|
||||
@@ -143,7 +147,7 @@ get_column_abx <- function(x,
|
||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(sort, allow_class = "logical", has_length = 1)
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_("Auto-guessing columns suitable for analysis", appendLF = FALSE, as_note = FALSE)
|
||||
}
|
||||
|
||||
@@ -155,21 +159,21 @@ get_column_abx <- function(x,
|
||||
|
||||
if (NROW(x) > 10000) {
|
||||
# only test maximum of 10,000 values per column
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_(" (using only ", font_bold("the first 10,000 rows"), ")...",
|
||||
appendLF = FALSE,
|
||||
as_note = FALSE
|
||||
)
|
||||
}
|
||||
x <- x[1:10000, , drop = FALSE]
|
||||
} else if (info == TRUE) {
|
||||
} else if (isTRUE(info)) {
|
||||
message_("...", appendLF = FALSE, as_note = FALSE)
|
||||
}
|
||||
|
||||
# only check columns that are a valid AB code, ATC code, name, abbreviation or synonym,
|
||||
# or already have the <rsi> class (as.rsi)
|
||||
# or already have the 'rsi' class (as.rsi)
|
||||
# and that they have no more than 50% invalid values
|
||||
vectr_antibiotics <- unlist(AB_lookup$generalised_all)
|
||||
vectr_antibiotics <- unlist(AMR_env$AB_lookup$generalised_all)
|
||||
vectr_antibiotics <- vectr_antibiotics[!is.na(vectr_antibiotics) & nchar(vectr_antibiotics) >= 3]
|
||||
x_columns <- vapply(
|
||||
FUN.VALUE = character(1),
|
||||
@@ -205,8 +209,8 @@ get_column_abx <- function(x,
|
||||
dots <- dots[!vapply(FUN.VALUE = logical(1), dots, is.data.frame)]
|
||||
if (length(dots) > 0) {
|
||||
newnames <- suppressWarnings(as.ab(names(dots), info = FALSE))
|
||||
if (any(is.na(newnames))) {
|
||||
if (info == TRUE) {
|
||||
if (anyNA(newnames)) {
|
||||
if (isTRUE(info)) {
|
||||
message_(" WARNING", add_fn = list(font_yellow, font_bold), as_note = FALSE)
|
||||
}
|
||||
warning_("Invalid antibiotic reference(s): ", vector_and(names(dots)[is.na(newnames)], quotes = FALSE),
|
||||
@@ -217,7 +221,7 @@ get_column_abx <- function(x,
|
||||
}
|
||||
unexisting_cols <- which(!vapply(FUN.VALUE = logical(1), dots, function(col) all(col %in% x_columns)))
|
||||
if (length(unexisting_cols) > 0) {
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
message_(" ERROR", add_fn = list(font_red, font_bold), as_note = FALSE)
|
||||
}
|
||||
stop_("Column(s) not found: ", vector_and(unlist(dots[[unexisting_cols]]), quotes = FALSE),
|
||||
@@ -236,12 +240,12 @@ get_column_abx <- function(x,
|
||||
}
|
||||
|
||||
if (length(out) == 0) {
|
||||
if (info == TRUE & all_okay == TRUE) {
|
||||
if (isTRUE(info) && all_okay == TRUE) {
|
||||
message_("No columns found.")
|
||||
}
|
||||
pkg_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn)
|
||||
pkg_env$get_column_abx.checked_cols <- colnames(x.bak)
|
||||
pkg_env$get_column_abx.out <- out
|
||||
AMR_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn)
|
||||
AMR_env$get_column_abx.checked_cols <- colnames(x.bak)
|
||||
AMR_env$get_column_abx.out <- out
|
||||
return(out)
|
||||
}
|
||||
|
||||
@@ -255,14 +259,14 @@ get_column_abx <- function(x,
|
||||
all_okay <- FALSE
|
||||
}
|
||||
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
if (all_okay == TRUE) {
|
||||
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
|
||||
} else {
|
||||
message_(" WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
|
||||
}
|
||||
for (i in seq_len(length(out))) {
|
||||
if (verbose == TRUE & !names(out[i]) %in% names(duplicates)) {
|
||||
if (isTRUE(verbose) && !names(out[i]) %in% names(duplicates)) {
|
||||
message_(
|
||||
"Using column '", font_bold(out[i]), "' as input for ", names(out)[i],
|
||||
" (", ab_name(names(out)[i], tolower = TRUE, language = NULL), ")."
|
||||
@@ -300,7 +304,7 @@ get_column_abx <- function(x,
|
||||
}
|
||||
if (!is.null(soft_dependencies)) {
|
||||
soft_dependencies <- unique(soft_dependencies)
|
||||
if (info == TRUE & !all(soft_dependencies %in% names(out))) {
|
||||
if (isTRUE(info) && !all(soft_dependencies %in% names(out))) {
|
||||
# missing a soft dependency may lower the reliability
|
||||
missing <- soft_dependencies[!soft_dependencies %in% names(out)]
|
||||
missing_msg <- vector_and(paste0(
|
||||
@@ -316,26 +320,26 @@ get_column_abx <- function(x,
|
||||
}
|
||||
}
|
||||
|
||||
pkg_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn)
|
||||
pkg_env$get_column_abx.checked_cols <- colnames(x.bak)
|
||||
pkg_env$get_column_abx.out <- out
|
||||
AMR_env$get_column_abx.call <- unique_call_id(entire_session = FALSE, match_fn = fn)
|
||||
AMR_env$get_column_abx.checked_cols <- colnames(x.bak)
|
||||
AMR_env$get_column_abx.out <- out
|
||||
out
|
||||
}
|
||||
|
||||
get_ab_from_namespace <- function(x, cols_ab) {
|
||||
# cols_ab comes from get_column_abx()
|
||||
|
||||
x <- trimws(unique(toupper(unlist(strsplit(x, ",")))))
|
||||
x <- trimws2(unique(toupper(unlist(strsplit(x, ",", fixed = TRUE)))))
|
||||
x_new <- character()
|
||||
for (val in x) {
|
||||
if (paste0("AB_", val) %in% ls(envir = asNamespace("AMR"))) {
|
||||
# antibiotic group names, as defined in data-raw/_pre_commit_hook.R, such as `AB_CARBAPENEMS`
|
||||
val <- eval(parse(text = paste0("AB_", val)), envir = asNamespace("AMR"))
|
||||
} else if (val %in% AB_lookup$ab) {
|
||||
} else if (val %in% AMR_env$AB_lookup$ab) {
|
||||
# separate drugs, such as `AMX`
|
||||
val <- as.ab(val)
|
||||
} else {
|
||||
stop_("unknown antimicrobial agent (group): ", val, call = FALSE)
|
||||
stop_("unknown antimicrobial drug (group): ", val, call = FALSE)
|
||||
}
|
||||
x_new <- c(x_new, val)
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -62,12 +66,12 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
|
||||
FUN.VALUE = character(1),
|
||||
string,
|
||||
function(s) {
|
||||
s_split <- unlist(strsplit(s, " "))
|
||||
s_split <- unlist(strsplit(s, " ", fixed = TRUE))
|
||||
|
||||
search_strings <- gsub("[^a-zA-Z-]", "", s_split)
|
||||
|
||||
ind_species <- search_strings != "" &
|
||||
search_strings %in% MO_lookup[which(MO_lookup$rank %in% c(
|
||||
search_strings %in% AMR_env$MO_lookup[which(AMR_env$MO_lookup$rank %in% c(
|
||||
"family",
|
||||
"genus",
|
||||
"species",
|
||||
@@ -81,7 +85,7 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
|
||||
|
||||
ind_fullname <- search_strings != "" &
|
||||
search_strings %in% c(
|
||||
MO_lookup[which(MO_lookup$rank %in% c(
|
||||
AMR_env$MO_lookup[which(AMR_env$MO_lookup$rank %in% c(
|
||||
"family",
|
||||
"genus",
|
||||
"species",
|
||||
@@ -92,7 +96,7 @@ italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
|
||||
"fullname",
|
||||
drop = TRUE
|
||||
],
|
||||
MO_lookup[which(MO_lookup$rank %in% c(
|
||||
AMR_env$MO_lookup[which(AMR_env$MO_lookup$rank %in% c(
|
||||
"family",
|
||||
"genus",
|
||||
"species",
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -123,8 +127,6 @@ anti_join_microorganisms <- function(x, by = NULL, ...) {
|
||||
}
|
||||
|
||||
join_microorganisms <- function(type, x, by, suffix, ...) {
|
||||
check_dataset_integrity()
|
||||
|
||||
if (!is.data.frame(x)) {
|
||||
if (pkg_is_available("tibble", also_load = FALSE)) {
|
||||
x <- import_fn("tibble", "tibble")(mo = x)
|
||||
@@ -143,7 +145,7 @@ join_microorganisms <- function(type, x, by, suffix, ...) {
|
||||
}
|
||||
message_('Joining, by = "', by, '"', add_fn = font_black, as_note = FALSE) # message same as dplyr::join functions
|
||||
}
|
||||
if (!all(x[, by, drop = TRUE] %in% MO_lookup$mo, na.rm = TRUE)) {
|
||||
if (!all(x[, by, drop = TRUE] %in% AMR_env$MO_lookup$mo, na.rm = TRUE)) {
|
||||
x$join.mo <- as.mo(x[, by, drop = TRUE])
|
||||
by <- c("join.mo" = "mo")
|
||||
} else {
|
||||
|
||||
+22
-19
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -29,20 +33,20 @@
|
||||
#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be left blank to determine automatically
|
||||
#' @param y,z [character] vectors to compare
|
||||
#' @inheritParams first_isolate
|
||||
#' @param universal names of **broad-spectrum** antimicrobial agents, case-insensitive. Set to `NULL` to ignore. See *Details* for the default agents.
|
||||
#' @param gram_negative names of antibiotic agents for **Gram-positives**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default agents.
|
||||
#' @param gram_positive names of antibiotic agents for **Gram-negatives**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default agents.
|
||||
#' @param antifungal names of antifungal agents for **fungi**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default agents.
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only columns must be included that were transformed to class `<rsi>` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param universal names of **broad-spectrum** antimicrobial drugs, case-insensitive. Set to `NULL` to ignore. See *Details* for the default antimicrobial drugs
|
||||
#' @param gram_negative names of antibiotic drugs for **Gram-positives**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default antibiotic drugs
|
||||
#' @param gram_positive names of antibiotic drugs for **Gram-negatives**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default antibiotic drugs
|
||||
#' @param antifungal names of antifungal drugs for **fungi**, case-insensitive. Set to `NULL` to ignore. See *Details* for the default antifungal drugs
|
||||
#' @param only_rsi_columns a [logical] to indicate whether only columns must be included that were transformed to class `rsi` (see [as.rsi()]) on beforehand (defaults to `FALSE`)
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
#' @details
|
||||
#' The [key_antimicrobials()] and [all_antimicrobials()] functions are context-aware. This means that the `x` argument can be left blank if used inside a [data.frame] call, see *Examples*.
|
||||
#'
|
||||
#' The function [key_antimicrobials()] returns a [character] vector with 12 antimicrobial results for every isolate. The function [all_antimicrobials()] returns a [character] vector with all antimicrobial results for every isolate. These vectors can then be compared using [antimicrobials_equal()], to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (`"."`) by [key_antimicrobials()] and ignored by [antimicrobials_equal()].
|
||||
#' The function [key_antimicrobials()] returns a [character] vector with 12 antimicrobial results for every isolate. The function [all_antimicrobials()] returns a [character] vector with all antimicrobial drug results for every isolate. These vectors can then be compared using [antimicrobials_equal()], to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (`"."`) by [key_antimicrobials()] and ignored by [antimicrobials_equal()].
|
||||
#'
|
||||
#' Please see the [first_isolate()] function how these important functions enable the 'phenotype-based' method for determination of first isolates.
|
||||
#'
|
||||
#' The default antimicrobial agents used for **all rows** (set in `universal`) are:
|
||||
#' The default antimicrobial drugs used for **all rows** (set in `universal`) are:
|
||||
#'
|
||||
#' - Ampicillin
|
||||
#' - Amoxicillin/clavulanic acid
|
||||
@@ -51,7 +55,7 @@
|
||||
#' - Piperacillin/tazobactam
|
||||
#' - Trimethoprim/sulfamethoxazole
|
||||
#'
|
||||
#' The default antimicrobial agents used for **Gram-negative bacteria** (set in `gram_negative`) are:
|
||||
#' The default antimicrobial drugs used for **Gram-negative bacteria** (set in `gram_negative`) are:
|
||||
#'
|
||||
#' - Cefotaxime
|
||||
#' - Ceftazidime
|
||||
@@ -60,7 +64,7 @@
|
||||
#' - Meropenem
|
||||
#' - Tobramycin
|
||||
#'
|
||||
#' The default antimicrobial agents used for **Gram-positive bacteria** (set in `gram_positive`) are:
|
||||
#' The default antimicrobial drugs used for **Gram-positive bacteria** (set in `gram_positive`) are:
|
||||
#'
|
||||
#' - Erythromycin
|
||||
#' - Oxacillin
|
||||
@@ -70,7 +74,7 @@
|
||||
#' - Vancomycin
|
||||
#'
|
||||
#'
|
||||
#' The default antimicrobial agents used for **fungi** (set in `antifungal`) are:
|
||||
#' The default antimicrobial drugs used for **fungi** (set in `antifungal`) are:
|
||||
#'
|
||||
#' - Anidulafungin
|
||||
#' - Caspofungin
|
||||
@@ -175,8 +179,8 @@ key_antimicrobials <- function(x = NULL,
|
||||
values <- cols[names(cols) %in% values]
|
||||
values_new_length <- length(values)
|
||||
|
||||
if (values_new_length < values_old_length &
|
||||
any(filter, na.rm = TRUE) &
|
||||
if (values_new_length < values_old_length &&
|
||||
any(filter, na.rm = TRUE) &&
|
||||
message_not_thrown_before("key_antimicrobials", name)) {
|
||||
warning_(
|
||||
"in `key_antimicrobials()`: ",
|
||||
@@ -305,7 +309,7 @@ antimicrobials_equal <- function(y,
|
||||
stop_ifnot(length(y) == length(z), "length of `y` and `z` must be equal")
|
||||
|
||||
key2rsi <- function(val) {
|
||||
val <- strsplit(val, "")[[1L]]
|
||||
val <- strsplit(val, "", fixed = TRUE)[[1L]]
|
||||
val.int <- rep(NA_real_, length(val))
|
||||
val.int[val == "S"] <- 1
|
||||
val.int[val == "I"] <- 2
|
||||
@@ -347,8 +351,8 @@ antimicrobials_equal <- function(y,
|
||||
all(a == b, na.rm = TRUE)
|
||||
}
|
||||
}
|
||||
out <- unlist(mapply(
|
||||
FUN = determine_equality,
|
||||
out <- unlist(Map(
|
||||
f = determine_equality,
|
||||
y,
|
||||
z,
|
||||
MoreArgs = list(
|
||||
@@ -356,7 +360,6 @@ antimicrobials_equal <- function(y,
|
||||
points_threshold = points_threshold,
|
||||
ignore_I = ignore_I
|
||||
),
|
||||
SIMPLIFY = FALSE,
|
||||
USE.NAMES = FALSE
|
||||
))
|
||||
out[is.na(y) | is.na(z)] <- NA
|
||||
|
||||
+8
-4
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -48,7 +52,7 @@ kurtosis.default <- function(x, na.rm = FALSE, excess = FALSE) {
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(excess, allow_class = "logical", has_length = 1)
|
||||
x <- as.vector(x)
|
||||
if (na.rm == TRUE) {
|
||||
if (isTRUE(na.rm)) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
n <- length(x)
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -102,14 +106,13 @@ like <- function(x, pattern, ignore.case = TRUE) {
|
||||
)
|
||||
}
|
||||
unlist(
|
||||
mapply(
|
||||
FUN = grepl,
|
||||
Map(
|
||||
f = grepl,
|
||||
x = x,
|
||||
pattern = pattern,
|
||||
fixed = fixed,
|
||||
perl = !fixed,
|
||||
MoreArgs = list(ignore.case = FALSE),
|
||||
SIMPLIFY = FALSE,
|
||||
USE.NAMES = FALSE
|
||||
)
|
||||
)
|
||||
|
||||
+14
-10
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -37,7 +41,7 @@
|
||||
#'
|
||||
#' For data sets, the mean AMR distance will be calculated per variable, after which the mean of all columns will returned per row (using [rowMeans()]), see *Examples*.
|
||||
#'
|
||||
#' Use [distance_from_row()] to subtract distances from the distance of one row, see *Examples*.
|
||||
#' Use [amr_distance_from_row()] to subtract distances from the distance of one row, see *Examples*.
|
||||
#' @section Interpretation:
|
||||
#' Isolates with distances less than 0.01 difference from each other should be considered similar. Differences lower than 0.025 should be considered suspicious.
|
||||
#' @export
|
||||
@@ -62,7 +66,7 @@
|
||||
#' y %>%
|
||||
#' mutate(
|
||||
#' amr_distance = mean_amr_distance(., where(is.mic)),
|
||||
#' check_id_C = distance_from_row(amr_distance, id == "C")
|
||||
#' check_id_C = amr_distance_from_row(amr_distance, id == "C")
|
||||
#' ) %>%
|
||||
#' arrange(check_id_C)
|
||||
#' }
|
||||
@@ -100,7 +104,7 @@ mean_amr_distance.disk <- function(x, ...) {
|
||||
|
||||
#' @rdname mean_amr_distance
|
||||
#' @export
|
||||
mean_amr_distance.rsi <- function(x, combine_SI = TRUE, ...) {
|
||||
mean_amr_distance.rsi <- function(x, ..., combine_SI = TRUE) {
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1, .call_depth = -1)
|
||||
if (isTRUE(combine_SI)) {
|
||||
x[x == "I"] <- "S"
|
||||
@@ -150,14 +154,14 @@ mean_amr_distance.data.frame <- function(x, ..., combine_SI = TRUE) {
|
||||
}
|
||||
|
||||
#' @rdname mean_amr_distance
|
||||
#' @param mean_distance the outcome of [mean_amr_distance()]
|
||||
#' @param amr_distance the outcome of [mean_amr_distance()]
|
||||
#' @param row an index, such as a row number
|
||||
#' @export
|
||||
distance_from_row <- function(mean_distance, row) {
|
||||
meet_criteria(mean_distance, allow_class = c("double", "numeric"), is_finite = TRUE)
|
||||
amr_distance_from_row <- function(amr_distance, row) {
|
||||
meet_criteria(amr_distance, allow_class = c("double", "numeric"), is_finite = TRUE)
|
||||
meet_criteria(row, allow_class = c("logical", "double", "numeric"))
|
||||
if (is.logical(row)) {
|
||||
row <- which(row)
|
||||
}
|
||||
abs(mean_distance[row] - mean_distance)
|
||||
abs(amr_distance[row] - amr_distance)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -24,23 +28,27 @@
|
||||
# ==================================================================== #
|
||||
|
||||
# these are allowed MIC values and will become [factor] levels
|
||||
ops <- c("<", "<=", "", ">=", ">")
|
||||
operators <- c("<", "<=", "", ">=", ">")
|
||||
valid_mic_levels <- c(
|
||||
c(t(vapply(
|
||||
FUN.VALUE = character(9), ops,
|
||||
function(x) paste0(x, "0.00", 1:9)
|
||||
FUN.VALUE = character(6), operators,
|
||||
function(x) paste0(x, "0.000", c(1:4, 6, 8))
|
||||
))),
|
||||
c(t(vapply(
|
||||
FUN.VALUE = character(90), operators,
|
||||
function(x) paste0(x, "0.00", c(1:9, 11:19, 21:29, 31:39, 41:49, 51:59, 61:69, 71:79, 81:89, 91:99))
|
||||
))),
|
||||
unique(c(t(vapply(
|
||||
FUN.VALUE = character(104), ops,
|
||||
FUN.VALUE = character(106), operators,
|
||||
function(x) {
|
||||
paste0(x, sort(as.double(paste0(
|
||||
"0.0",
|
||||
sort(c(1:99, 125, 128, 256, 512, 625))
|
||||
sort(c(1:99, 125, 128, 156, 165, 256, 512, 625))
|
||||
))))
|
||||
}
|
||||
)))),
|
||||
unique(c(t(vapply(
|
||||
FUN.VALUE = character(103), ops,
|
||||
FUN.VALUE = character(103), operators,
|
||||
function(x) {
|
||||
paste0(x, sort(as.double(paste0(
|
||||
"0.",
|
||||
@@ -49,15 +57,15 @@ valid_mic_levels <- c(
|
||||
}
|
||||
)))),
|
||||
c(t(vapply(
|
||||
FUN.VALUE = character(10), ops,
|
||||
FUN.VALUE = character(10), operators,
|
||||
function(x) paste0(x, sort(c(1:9, 1.5)))
|
||||
))),
|
||||
c(t(vapply(
|
||||
FUN.VALUE = character(45), ops,
|
||||
FUN.VALUE = character(45), operators,
|
||||
function(x) paste0(x, c(10:98)[9:98 %% 2 == TRUE])
|
||||
))),
|
||||
c(t(vapply(
|
||||
FUN.VALUE = character(17), ops,
|
||||
FUN.VALUE = character(17), operators,
|
||||
function(x) paste0(x, sort(c(2^c(7:11), 192, 80 * c(2:12))))
|
||||
)))
|
||||
)
|
||||
@@ -76,7 +84,7 @@ valid_mic_levels <- c(
|
||||
#' ```
|
||||
#' x <- random_mic(10)
|
||||
#' x
|
||||
#' #> Class <mic>
|
||||
#' #> Class 'mic'
|
||||
#' #> [1] 16 1 8 8 64 >=128 0.0625 32 32 16
|
||||
#'
|
||||
#' is.factor(x)
|
||||
@@ -93,7 +101,7 @@ valid_mic_levels <- c(
|
||||
#'
|
||||
#' ```
|
||||
#' x[x > 4]
|
||||
#' #> Class <mic>
|
||||
#' #> Class 'mic'
|
||||
#' #> [1] 16 8 8 64 >=128 32 32 16
|
||||
#'
|
||||
#' df <- data.frame(x, hospital = "A")
|
||||
@@ -111,7 +119,7 @@ valid_mic_levels <- c(
|
||||
#'
|
||||
#' 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.
|
||||
#' @aliases mic
|
||||
#' @export
|
||||
@@ -163,11 +171,15 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
if (is.mic(x)) {
|
||||
x
|
||||
} else {
|
||||
x <- as.character(unlist(x))
|
||||
if (na.rm == TRUE) {
|
||||
if (is.numeric(x)) {
|
||||
x <- format(x, scientific = FALSE)
|
||||
} else {
|
||||
x <- as.character(unlist(x))
|
||||
}
|
||||
if (isTRUE(na.rm)) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
x[trimws(x) == ""] <- NA
|
||||
x[trimws2(x) == ""] <- NA
|
||||
x.bak <- x
|
||||
|
||||
# comma to period
|
||||
@@ -202,7 +214,7 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
# never end with dot
|
||||
x <- gsub("[.]$", "", x, perl = TRUE)
|
||||
# trim it
|
||||
x <- trimws(x)
|
||||
x <- trimws2(x)
|
||||
|
||||
## previously unempty values now empty - should return a warning later on
|
||||
x[x.bak != "" & x == ""] <- "invalid"
|
||||
@@ -216,11 +228,15 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
unique() %pm>%
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_("in `as.mic()`: ", na_after - na_before, " results truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid MICs: ",
|
||||
list_missing,
|
||||
call = FALSE
|
||||
cur_col <- get_current_column()
|
||||
warning_("in `as.mic()`: ", na_after - na_before, " result",
|
||||
ifelse(na_after - na_before > 1, "s", ""),
|
||||
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
|
||||
" truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid MICs: ",
|
||||
list_missing,
|
||||
call = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
@@ -241,7 +257,7 @@ all_valid_mics <- function(x) {
|
||||
}
|
||||
|
||||
#' @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
|
||||
#' @export
|
||||
NA_mic_ <- set_clean_class(factor(NA, levels = valid_mic_levels, ordered = TRUE),
|
||||
@@ -270,7 +286,7 @@ as.numeric.mic <- function(x, ...) {
|
||||
|
||||
#' @rdname as.mic
|
||||
#' @method droplevels mic
|
||||
#' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE`
|
||||
#' @param as.mic a [logical] to indicate whether the `mic` class should be kept, defaults to `FALSE`
|
||||
#' @export
|
||||
droplevels.mic <- function(x, as.mic = FALSE, ...) {
|
||||
x <- droplevels.factor(x, ...)
|
||||
@@ -301,7 +317,7 @@ type_sum.mic <- function(x, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.mic <- function(x, ...) {
|
||||
cat("Class <mic>",
|
||||
cat("Class 'mic'",
|
||||
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""),
|
||||
"\n",
|
||||
sep = ""
|
||||
|
||||
+34
-25
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -29,6 +33,7 @@
|
||||
#' @author Dr. Matthijs Berends
|
||||
#' @param x Any user input value(s)
|
||||
#' @param n A full taxonomic name, that exists in [`microorganisms$fullname`][microorganisms]
|
||||
#' @note This algorithm was described in: 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}.
|
||||
#' @section Matching Score for Microorganisms:
|
||||
#' With ambiguous user input in [as.mo()] and all the [`mo_*`][mo_property()] functions, the returned results are chosen based on their matching score using [mo_matching_score()]. This matching score \eqn{m}, is calculated as:
|
||||
#'
|
||||
@@ -39,17 +44,21 @@
|
||||
#' * \ifelse{html}{\out{<i>x</i> is the user input;}}{\eqn{x} is the user input;}
|
||||
#' * \ifelse{html}{\out{<i>n</i> is a taxonomic name (genus, species, and subspecies);}}{\eqn{n} is a taxonomic name (genus, species, and subspecies);}
|
||||
#' * \ifelse{html}{\out{<i>l<sub>n</sub></i> is the length of <i>n</i>;}}{l_n is the length of \eqn{n};}
|
||||
#' * \ifelse{html}{\out{<i>lev</i> is the <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance function</a>, which counts any insertion, deletion and substitution as 1 that is needed to change <i>x</i> into <i>n</i>;}}{lev is the Levenshtein distance function, which counts any insertion, deletion and substitution as 1 that is needed to change \eqn{x} into \eqn{n};}
|
||||
#' * \ifelse{html}{\out{<i>lev</i> is the <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance function</a> (counting any insertion as 1, and any deletion or substitution as 2) that is needed to change <i>x</i> into <i>n</i>;}}{lev is the Levenshtein distance function (counting any insertion as 1, and any deletion or substitution as 2) that is needed to change \eqn{x} into \eqn{n};}
|
||||
#' * \ifelse{html}{\out{<i>p<sub>n</sub></i> is the human pathogenic prevalence group of <i>n</i>, as described below;}}{p_n is the human pathogenic prevalence group of \eqn{n}, as described below;}
|
||||
#' * \ifelse{html}{\out{<i>k<sub>n</sub></i> is the taxonomic kingdom of <i>n</i>, set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.}}{l_n is the taxonomic kingdom of \eqn{n}, set as Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5.}
|
||||
#'
|
||||
#' The grouping into human pathogenic prevalence (\eqn{p}) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence. **Group 1** (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is *Enterococcus*, *Staphylococcus* or *Streptococcus*. This group consequently contains all common Gram-negative bacteria, such as *Pseudomonas* and *Legionella* and all species within the order Enterobacterales. **Group 2** consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is *Absidia*, *Acremonium*, *Actinotignum*, *Alternaria*, *Anaerosalibacter*, *Apophysomyces*, *Arachnia*, *Aspergillus*, *Aureobacterium*, *Aureobasidium*, *Bacteroides*, *Basidiobolus*, *Beauveria*, *Blastocystis*, *Branhamella*, *Calymmatobacterium*, *Candida*, *Capnocytophaga*, *Catabacter*, *Chaetomium*, *Chryseobacterium*, *Chryseomonas*, *Chrysonilia*, *Cladophialophora*, *Cladosporium*, *Conidiobolus*, *Cryptococcus*, *Curvularia*, *Exophiala*, *Exserohilum*, *Flavobacterium*, *Fonsecaea*, *Fusarium*, *Fusobacterium*, *Hendersonula*, *Hypomyces*, *Koserella*, *Lelliottia*, *Leptosphaeria*, *Leptotrichia*, *Malassezia*, *Malbranchea*, *Mortierella*, *Mucor*, *Mycocentrospora*, *Mycoplasma*, *Nectria*, *Ochroconis*, *Oidiodendron*, *Phoma*, *Piedraia*, *Pithomyces*, *Pityrosporum*, *Prevotella*, *Pseudallescheria*, *Rhizomucor*, *Rhizopus*, *Rhodotorula*, *Scolecobasidium*, *Scopulariopsis*, *Scytalidium*, *Sporobolomyces*, *Stachybotrys*, *Stomatococcus*, *Treponema*, *Trichoderma*, *Trichophyton*, *Trichosporon*, *Tritirachium* or *Ureaplasma*. **Group 3** consists of all other microorganisms.
|
||||
#' The grouping into human pathogenic prevalence (\eqn{p}) is based on experience from several microbiological laboratories in the Netherlands in conjunction with international reports on pathogen prevalence:
|
||||
#'
|
||||
#' **Group 1** (most prevalent microorganisms) consists of all microorganisms where the taxonomic class is Gammaproteobacteria or where the taxonomic genus is *Enterococcus*, *Staphylococcus* or *Streptococcus*. This group consequently contains all common Gram-negative bacteria, such as *Pseudomonas* and *Legionella* and all species within the order Enterobacterales.
|
||||
#'
|
||||
#' **Group 2** consists of all microorganisms where the taxonomic phylum is Proteobacteria, Firmicutes, Actinobacteria or Sarcomastigophora, or where the taxonomic genus is `r vector_or(MO_PREVALENT_GENERA, quotes = "*")`.
|
||||
#'
|
||||
#' **Group 3** consists of all other microorganisms.
|
||||
#'
|
||||
#' All characters in \eqn{x} and \eqn{n} are ignored that are other than A-Z, a-z, 0-9, spaces and parentheses.
|
||||
#'
|
||||
#' All matches are sorted descending on their matching score and for all user input values, the top match will be returned. This will lead to the effect that e.g., `"E. coli"` will return the microbial ID of *Escherichia coli* (\eqn{m = `r round(mo_matching_score("E. coli", "Escherichia coli"), 3)`}, a highly prevalent microorganism found in humans) and not *Entamoeba coli* (\eqn{m = `r round(mo_matching_score("E. coli", "Entamoeba coli"), 3)`}, a less prevalent microorganism in humans), although the latter would alphabetically come first.
|
||||
#'
|
||||
#' Since `AMR` version 1.8.1, common microorganism abbreviations are ignored in determining the matching score. These abbreviations are currently: `r vector_and(pkg_env$mo_field_abbreviations, quotes = FALSE)`.
|
||||
#' @export
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @examples
|
||||
@@ -68,19 +77,12 @@ mo_matching_score <- function(x, n) {
|
||||
# no dots and other non-whitespace characters
|
||||
x <- gsub("[^a-zA-Z0-9 \\(\\)]+", "", x)
|
||||
|
||||
# remove abbreviations known to the field
|
||||
x <- gsub(paste0(
|
||||
"(^|[^a-z0-9]+)(",
|
||||
paste0(pkg_env$mo_field_abbreviations, collapse = "|"),
|
||||
")([^a-z0-9]+|$)"
|
||||
),
|
||||
"", x,
|
||||
perl = TRUE, ignore.case = TRUE
|
||||
)
|
||||
|
||||
# only keep one space
|
||||
x <- gsub(" +", " ", x)
|
||||
|
||||
# force a capital letter, so this conversion will not count as a substitution
|
||||
substr(x, 1, 1) <- toupper(substr(x, 1, 1))
|
||||
|
||||
# n is always a taxonomically valid full name
|
||||
if (length(n) == 1) {
|
||||
n <- rep(n, length(x))
|
||||
@@ -93,16 +95,23 @@ mo_matching_score <- function(x, n) {
|
||||
l_n <- nchar(n)
|
||||
lev <- double(length = length(x))
|
||||
l_n.lev <- double(length = length(x))
|
||||
for (i in seq_len(length(x))) {
|
||||
# determine Levenshtein distance, but maximise to nchar of n
|
||||
lev[i] <- utils::adist(x[i], n[i], ignore.case = FALSE, fixed = TRUE, costs = c(ins = 1, del = 1, sub = 1))
|
||||
# minimum of (l_n, Levenshtein distance)
|
||||
l_n.lev[i] <- min(l_n[i], as.double(lev[i]))
|
||||
}
|
||||
lev <- unlist(Map(f = function(a, b) {
|
||||
as.double(utils::adist(a, b,
|
||||
ignore.case = FALSE,
|
||||
fixed = TRUE,
|
||||
costs = c(insertions = 1, deletions = 2, substitutions = 2),
|
||||
counts = FALSE
|
||||
))
|
||||
}, x, n, USE.NAMES = FALSE))
|
||||
|
||||
l_n.lev[l_n < lev] <- l_n[l_n < lev]
|
||||
l_n.lev[lev < l_n] <- lev[lev < l_n]
|
||||
l_n.lev[lev == l_n] <- lev[lev == l_n]
|
||||
|
||||
# human pathogenic prevalence (1 to 3), see ?as.mo
|
||||
p_n <- MO_lookup[match(n, MO_lookup$fullname), "prevalence", drop = TRUE]
|
||||
p_n <- AMR_env$MO_lookup[match(n, AMR_env$MO_lookup$fullname), "prevalence", drop = TRUE]
|
||||
# kingdom index (Bacteria = 1, Fungi = 2, Protozoa = 3, Archaea = 4, others = 5)
|
||||
k_n <- MO_lookup[match(n, MO_lookup$fullname), "kingdom_index", drop = TRUE]
|
||||
k_n <- AMR_env$MO_lookup[match(n, AMR_env$MO_lookup$fullname), "kingdom_index", drop = TRUE]
|
||||
|
||||
# matching score:
|
||||
(l_n - 0.5 * l_n.lev) / (l_n * p_n * k_n)
|
||||
|
||||
+311
-233
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -28,14 +32,14 @@
|
||||
#' Use these functions to return a specific property of a microorganism based on the latest accepted taxonomy. All input values will be evaluated internally with [as.mo()], which makes it possible to use microbial abbreviations, codes and names as input. See *Examples*.
|
||||
#' @param x any [character] (vector) that can be coerced to a valid microorganism code with [as.mo()]. Can be left blank for auto-guessing the column containing microorganism codes if used in a data set, see *Examples*.
|
||||
#' @param property one of the column names of the [microorganisms] data set: `r vector_or(colnames(microorganisms), sort = FALSE, quotes = TRUE)`, or must be `"shortname"`
|
||||
#' @param language language of the returned text, defaults to system language (see [get_AMR_locale()]) and can be overwritten by setting the option `AMR_locale`, e.g. `options(AMR_locale = "de")`, see [translate]. Also used to translate text like "no growth". Use `language = NULL` or `language = ""` to prevent translation.
|
||||
#' @param ... other arguments passed on to [as.mo()], such as 'allow_uncertain' and 'ignore_pattern'
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||
#' @inheritParams as.mo
|
||||
#' @param ... other arguments passed on to [as.mo()], such as 'minimum_matching_score', 'ignore_pattern', and 'remove_from_input'
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antibiotic drug code with [as.ab()]
|
||||
#' @param open browse the URL using [`browseURL()`][utils::browseURL()]
|
||||
#' @details All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for [mo_ref()], [mo_authors()] and [mo_year()]. Please refer to this example, knowing that *Escherichia blattae* was renamed to *Shimwellia blattae* in 2010:
|
||||
#' @details All functions will, at default, keep old taxonomic properties. Please refer to this example, knowing that *Escherichia blattae* was renamed to *Shimwellia blattae* in 2010:
|
||||
#' - `mo_name("Escherichia blattae")` will return `"Shimwellia blattae"` (with a message about the renaming)
|
||||
#' - `mo_ref("Escherichia blattae")` will return `"Burgess et al., 1973"` (with a message about the renaming)
|
||||
#' - `mo_ref("Shimwellia blattae")` will return `"Priest et al., 2010"` (without a message)
|
||||
#' - `mo_ref("Escherichia blattae", keep_synonyms = TRUE)` will return `"Burgess et al., 1973"` (with a warning about the renaming)
|
||||
#' - `mo_ref("Shimwellia blattae", keep_synonyms = FALSE)` will return `"Priest et al., 2010"` (without a message)
|
||||
#'
|
||||
#' The short name - [mo_shortname()] - almost always returns the first character of the genus and the full species, like `"E. coli"`. 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*. In other words, `mo_fullname(mo_shortname("Entamoeba coli"))` returns `"Escherichia coli"`.
|
||||
#'
|
||||
@@ -51,15 +55,16 @@
|
||||
#'
|
||||
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
|
||||
#'
|
||||
#' SNOMED codes - [mo_snomed()] - are from the `r SNOMED_VERSION$current_source`. See *Source* and the [microorganisms] data set for more info.
|
||||
#' 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.
|
||||
#'
|
||||
#' Old taxonomic names (so-called 'synonyms') can be retrieved with [mo_synonyms()], the current taxonomic name can be retrieved with [mo_current()]. Both functions return full names.
|
||||
#' @inheritSection mo_matching_score Matching Score for Microorganisms
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @inheritSection as.mo Source
|
||||
#' @rdname mo_property
|
||||
#' @name mo_property
|
||||
#' @return
|
||||
#' - An [integer] in case of [mo_year()]
|
||||
#' - A [list] in case of [mo_taxonomy()] and [mo_info()]
|
||||
#' - A [list] in case of [mo_taxonomy()], [mo_synonyms()] and [mo_info()]
|
||||
#' - A named [character] in case of [mo_url()]
|
||||
#' - A [numeric] in case of [mo_snomed()]
|
||||
#' - A [character] in all other cases
|
||||
@@ -95,6 +100,7 @@
|
||||
#' mo_authors("Klebsiella pneumoniae")
|
||||
#' mo_year("Klebsiella pneumoniae")
|
||||
#' mo_lpsn("Klebsiella pneumoniae")
|
||||
#' mo_gbif("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # abbreviations known in the field -----------------------------------------
|
||||
#' mo_genus("MRSA")
|
||||
@@ -106,20 +112,15 @@
|
||||
#' mo_species("EHEC")
|
||||
#'
|
||||
#' # known subspecies ---------------------------------------------------------
|
||||
#' mo_name("doylei")
|
||||
#' mo_genus("doylei")
|
||||
#' mo_species("doylei")
|
||||
#' mo_subspecies("doylei")
|
||||
#'
|
||||
#' mo_fullname("K. pneu rh")
|
||||
#' mo_shortname("K. pneu rh")
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # Becker classification, see ?as.mo ----------------------------------------
|
||||
#' mo_fullname("S. epi")
|
||||
#' mo_fullname("S. epi", Becker = TRUE)
|
||||
#' mo_shortname("S. epi")
|
||||
#' mo_shortname("S. epi", Becker = TRUE)
|
||||
#' mo_fullname("Staph. epidermidis")
|
||||
#' mo_fullname("Staph. epidermidis", Becker = TRUE)
|
||||
#' mo_shortname("Staph. epidermidis")
|
||||
#' mo_shortname("Staph. epidermidis", Becker = TRUE)
|
||||
#'
|
||||
#' # Lancefield classification, see ?as.mo ------------------------------------
|
||||
#' mo_fullname("S. pyo")
|
||||
@@ -129,23 +130,20 @@
|
||||
#'
|
||||
#'
|
||||
#' # language support --------------------------------------------------------
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "de")
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "nl")
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "es")
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "de") # German
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "nl") # Dutch
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "es") # Spanish
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "el") # Greek
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "uk") # Ukrainian
|
||||
#'
|
||||
#' # mo_type is equal to mo_kingdom, but mo_kingdom will remain official
|
||||
#' mo_kingdom("Klebsiella pneumoniae")
|
||||
#' mo_type("Klebsiella pneumoniae")
|
||||
#' mo_type("Klebsiella pneumoniae")
|
||||
#' mo_kingdom("Klebsiella pneumoniae", language = "zh") # Chinese, no effect
|
||||
#' mo_type("Klebsiella pneumoniae", language = "zh") # Chinese, translated
|
||||
#'
|
||||
#' mo_fullname("S. pyogenes",
|
||||
#' Lancefield = TRUE,
|
||||
#' language = "de"
|
||||
#' )
|
||||
#' mo_fullname("S. pyogenes",
|
||||
#' Lancefield = TRUE,
|
||||
#' language = "nl"
|
||||
#' )
|
||||
#' mo_fullname("S. pyogenes", Lancefield = TRUE, language = "de")
|
||||
#' mo_fullname("S. pyogenes", Lancefield = TRUE, language = "uk")
|
||||
#'
|
||||
#'
|
||||
#' # other --------------------------------------------------------------------
|
||||
@@ -155,10 +153,13 @@
|
||||
#' # gram stains and intrinsic resistance can be used as a filter in dplyr verbs
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' filter(mo_is_gram_positive())
|
||||
#'
|
||||
#' filter(mo_is_gram_positive()) %>%
|
||||
#' count(mo_genus(), sort = TRUE)
|
||||
#' }
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' filter(mo_is_intrinsic_resistant(ab = "vanco"))
|
||||
#' filter(mo_is_intrinsic_resistant(ab = "vanco")) %>%
|
||||
#' count(mo_genus(), sort = TRUE)
|
||||
#' }
|
||||
#'
|
||||
#'
|
||||
@@ -169,15 +170,16 @@
|
||||
#' # SNOMED codes, and URL to the online database
|
||||
#' mo_info("Klebsiella pneumoniae")
|
||||
#' }
|
||||
mo_name <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_name <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_name")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "fullname", language = language, ...),
|
||||
translate_into_language(mo_validate(x = x, property = "fullname", language = language, keep_synonyms = keep_synonyms, ...),
|
||||
language = language,
|
||||
only_unknown = FALSE,
|
||||
only_affect_mo_names = TRUE
|
||||
@@ -190,17 +192,18 @@ mo_fullname <- mo_name
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_shortname <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_shortname <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_shortname")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
replace_empty <- function(x) {
|
||||
x[x == ""] <- "spp."
|
||||
@@ -208,8 +211,8 @@ mo_shortname <- function(x, language = get_AMR_locale(), ...) {
|
||||
}
|
||||
|
||||
# get first char of genus and complete species in English
|
||||
genera <- mo_genus(x.mo, language = NULL)
|
||||
shortnames <- paste0(substr(genera, 1, 1), ". ", replace_empty(mo_species(x.mo, language = NULL)))
|
||||
genera <- mo_genus(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
shortnames <- paste0(substr(genera, 1, 1), ". ", replace_empty(mo_species(x.mo, language = NULL, keep_synonyms = keep_synonyms)))
|
||||
|
||||
# exceptions for where no species is known
|
||||
shortnames[shortnames %like% ".[.] spp[.]"] <- genera[shortnames %like% ".[.] spp[.]"]
|
||||
@@ -219,10 +222,12 @@ mo_shortname <- function(x, language = get_AMR_locale(), ...) {
|
||||
# exceptions for streptococci: Group A Streptococcus -> GAS
|
||||
shortnames[shortnames %like% "S. group [ABCDFGHK]"] <- paste0("G", gsub("S. group ([ABCDFGHK])", "\\1", shortnames[shortnames %like% "S. group [ABCDFGHK]"], perl = TRUE), "S")
|
||||
# unknown species etc.
|
||||
shortnames[shortnames %like% "unknown"] <- paste0("(", trimws(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[is.na(x.mo)] <- NA_character_
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
translate_into_language(shortnames, language = language, only_unknown = FALSE, only_affect_mo_names = TRUE)
|
||||
}
|
||||
|
||||
@@ -230,106 +235,114 @@ mo_shortname <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_subspecies <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_subspecies <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_subspecies")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "subspecies", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "subspecies", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_species <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_species <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_species")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "species", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "species", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_genus <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_genus <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_genus")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "genus", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "genus", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_family <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_family <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_family")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "family", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "family", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_order <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_order <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_order")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "order", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "order", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_class <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_class <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_class")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "class", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "class", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_phylum <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_phylum <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_phylum")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "phylum", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "phylum", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_kingdom <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_kingdom <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_kingdom")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "kingdom", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "kingdom", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@@ -338,67 +351,85 @@ mo_domain <- mo_kingdom
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_type <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_type <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_type")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
out <- mo_kingdom(x.mo, language = NULL)
|
||||
out[which(mo_is_yeast(x.mo))] <- "Yeasts"
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
out <- mo_kingdom(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
out[which(mo_is_yeast(x.mo, keep_synonyms = keep_synonyms))] <- "Yeasts"
|
||||
translate_into_language(out, language = language, only_unknown = FALSE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_gramstain <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_status <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_status")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = "status", language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_gramstain <- 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_gramstain")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
x <- rep(NA_character_, length(x))
|
||||
# make all bacteria Gram negative
|
||||
x[mo_kingdom(x.mo) == "Bacteria"] <- "Gram-negative"
|
||||
x[mo_kingdom(x.mo, language = NULL, keep_synonyms = keep_synonyms) == "Bacteria"] <- "Gram-negative"
|
||||
# overwrite these 4 phyla with Gram-positives
|
||||
# Source: https://itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=956097 (Cavalier-Smith, 2002)
|
||||
x[(mo_phylum(x.mo) %in% c(
|
||||
x[(mo_phylum(x.mo, language = NULL, keep_synonyms = keep_synonyms) %in% c(
|
||||
"Actinobacteria",
|
||||
"Chloroflexi",
|
||||
"Firmicutes",
|
||||
"Tenericutes"
|
||||
"Tenericutes",
|
||||
"Bacillota" # this one is new! It was renamed from Firmicutes by Gibbons et al., 2021
|
||||
) &
|
||||
# but class Negativicutes (of phylum Firmicutes) are Gram-negative!
|
||||
mo_class(x.mo) != "Negativicutes")
|
||||
mo_class(x.mo, language = NULL, keep_synonyms = keep_synonyms) != "Negativicutes")
|
||||
# and of course our own ID for Gram-positives
|
||||
| x.mo == "B_GRAMP"] <- "Gram-positive"
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
translate_into_language(x, language = language, only_unknown = FALSE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_is_gram_negative <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_is_gram_negative <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_is_gram_negative")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
grams <- mo_gramstain(x.mo, language = NULL)
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
grams <- mo_gramstain(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
load_mo_uncertainties(metadata)
|
||||
out <- grams == "Gram-negative" & !is.na(grams)
|
||||
out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA
|
||||
out
|
||||
@@ -406,18 +437,19 @@ mo_is_gram_negative <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_is_gram_positive <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_is_gram_positive <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_is_gram_positive")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
grams <- mo_gramstain(x.mo, language = NULL)
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
grams <- mo_gramstain(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
load_mo_uncertainties(metadata)
|
||||
out <- grams == "Gram-positive" & !is.na(grams)
|
||||
out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA
|
||||
out
|
||||
@@ -425,21 +457,22 @@ mo_is_gram_positive <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_is_yeast <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_is_yeast <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_is_yeast")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
x.kingdom <- mo_kingdom(x.mo, language = NULL)
|
||||
x.class <- mo_class(x.mo, language = NULL)
|
||||
x.kingdom <- mo_kingdom(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
x.class <- mo_class(x.mo, language = NULL, keep_synonyms = keep_synonyms)
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
|
||||
out <- rep(FALSE, length(x))
|
||||
out[x.kingdom == "Fungi" & x.class == "Saccharomycetes"] <- TRUE
|
||||
@@ -449,16 +482,17 @@ mo_is_yeast <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_is_intrinsic_resistant <- function(x, ab, language = get_AMR_locale(), ...) {
|
||||
mo_is_intrinsic_resistant <- function(x, ab, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||
if (missing(x)) {
|
||||
# this tries to find the data and an <mo> column
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_is_intrinsic_resistant")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(ab, allow_NA = FALSE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- as.mo(x, language = language, ...)
|
||||
x <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
ab <- as.ab(ab, language = NULL, flag_multiple_results = FALSE, info = FALSE)
|
||||
|
||||
if (length(x) == 1 & length(ab) > 1) {
|
||||
@@ -470,7 +504,7 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_AMR_locale(), ...) {
|
||||
stop_("length of `x` and `ab` must be equal, or one of them must be of length 1.")
|
||||
}
|
||||
|
||||
# show used version number once per session (pkg_env will reload every session)
|
||||
# show used version number once per session (AMR_env will reload every session)
|
||||
if (message_not_thrown_before("mo_is_intrinsic_resistant", "version.mo", entire_session = TRUE)) {
|
||||
message_(
|
||||
"Determining intrinsic resistance based on ",
|
||||
@@ -479,47 +513,51 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_AMR_locale(), ...) {
|
||||
)
|
||||
}
|
||||
|
||||
# runs against internal vector: INTRINSIC_R (see zzz.R)
|
||||
paste(x, ab) %in% INTRINSIC_R
|
||||
# runs against internal vector: intrinsic_resistant (see zzz.R)
|
||||
add_intrinsic_resistance_to_AMR_env()
|
||||
paste(x, ab) %in% AMR_env$intrinsic_resistant
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_snomed <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_snomed <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_snomed")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
mo_validate(x = x, property = "snomed", language = language, ...)
|
||||
mo_validate(x = x, property = "snomed", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_ref <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_ref <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_ref")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
mo_validate(x = x, property = "ref", language = language, ...)
|
||||
mo_validate(x = x, property = "ref", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_authors <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_authors <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_authors")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- mo_validate(x = x, property = "ref", language = language, ...)
|
||||
x <- mo_validate(x = x, property = "ref", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
# remove last 4 digits and presumably the comma and space that preceed them
|
||||
x[!is.na(x)] <- gsub(",? ?[0-9]{4}", "", x[!is.na(x)], perl = TRUE)
|
||||
suppressWarnings(x)
|
||||
@@ -527,15 +565,16 @@ mo_authors <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_year <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_year <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_year")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- mo_validate(x = x, property = "ref", language = language, ...)
|
||||
x <- mo_validate(x = x, property = "ref", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
# get last 4 digits
|
||||
x[!is.na(x)] <- gsub(".*([0-9]{4})$", "\\1", x[!is.na(x)], perl = TRUE)
|
||||
suppressWarnings(as.integer(x))
|
||||
@@ -543,113 +582,145 @@ mo_year <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_lpsn <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_lpsn <- 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_rank")
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_lpsn")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
mo_validate(x = x, property = "species_id", language = language, ...)
|
||||
mo_validate(x = x, property = "lpsn", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_rank <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_gbif <- 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_rank")
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_gbif")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
mo_validate(x = x, property = "rank", language = language, ...)
|
||||
mo_validate(x = x, property = "gbif", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_taxonomy <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_rank <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_rank")
|
||||
}
|
||||
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 = "rank", language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_taxonomy <- 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_taxonomy")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
out <- list(
|
||||
kingdom = mo_kingdom(x, language = language),
|
||||
phylum = mo_phylum(x, language = language),
|
||||
class = mo_class(x, language = language),
|
||||
order = mo_order(x, language = language),
|
||||
family = mo_family(x, language = language),
|
||||
genus = mo_genus(x, language = language),
|
||||
species = mo_species(x, language = language),
|
||||
subspecies = mo_subspecies(x, language = language)
|
||||
kingdom = mo_kingdom(x, language = language, keep_synonyms = keep_synonyms),
|
||||
phylum = mo_phylum(x, language = language, keep_synonyms = keep_synonyms),
|
||||
class = mo_class(x, language = language, keep_synonyms = keep_synonyms),
|
||||
order = mo_order(x, language = language, keep_synonyms = keep_synonyms),
|
||||
family = mo_family(x, language = language, keep_synonyms = keep_synonyms),
|
||||
genus = mo_genus(x, language = language, keep_synonyms = keep_synonyms),
|
||||
species = mo_species(x, language = language, keep_synonyms = keep_synonyms),
|
||||
subspecies = mo_subspecies(x, language = language, keep_synonyms = keep_synonyms)
|
||||
)
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
out
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_synonyms <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_synonyms <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_synonyms")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x.mo <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
IDs <- mo_name(x = x, language = NULL)
|
||||
syns <- lapply(IDs, function(newname) {
|
||||
res <- sort(microorganisms.old[which(microorganisms.old$fullname_new == newname), "fullname", drop = TRUE])
|
||||
if (length(res) == 0) {
|
||||
syns <- lapply(x.mo, function(y) {
|
||||
gbif <- AMR::microorganisms$gbif[match(y, AMR::microorganisms$mo)]
|
||||
lpsn <- AMR::microorganisms$lpsn[match(y, AMR::microorganisms$mo)]
|
||||
out <- AMR::microorganisms[which(AMR::microorganisms$lpsn_renamed_to == lpsn | AMR::microorganisms$gbif_renamed_to == gbif), "fullname", drop = TRUE]
|
||||
if (length(out) == 0) {
|
||||
NULL
|
||||
} else {
|
||||
res
|
||||
out
|
||||
}
|
||||
})
|
||||
|
||||
if (length(syns) > 1) {
|
||||
names(syns) <- mo_name(x)
|
||||
names(syns) <- mo_name(x, language = language)
|
||||
result <- syns
|
||||
} else {
|
||||
result <- unlist(syns)
|
||||
}
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
result
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_info <- function(x, language = get_AMR_locale(), ...) {
|
||||
mo_current <- function(x, language = get_AMR_locale(), ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
x.mo <- suppressWarnings(as.mo(x, keep_synonyms = TRUE, ...))
|
||||
out <- synonym_mo_to_accepted_mo(x.mo, fill_in_accepted = TRUE)
|
||||
mo_name(out, language = language)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_info <- 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
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_info")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- as.mo(x, language = language, ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
info <- lapply(x, function(y) {
|
||||
c(
|
||||
mo_taxonomy(y, language = language),
|
||||
mo_taxonomy(y, language = language, keep_synonyms = keep_synonyms),
|
||||
list(
|
||||
synonyms = mo_synonyms(y),
|
||||
gramstain = mo_gramstain(y, language = language),
|
||||
url = unname(mo_url(y, open = FALSE)),
|
||||
ref = mo_ref(y),
|
||||
snomed = unlist(mo_snomed(y))
|
||||
status = mo_status(y, language = language, keep_synonyms = keep_synonyms),
|
||||
synonyms = mo_synonyms(y, keep_synonyms = keep_synonyms),
|
||||
gramstain = mo_gramstain(y, language = language, keep_synonyms = keep_synonyms),
|
||||
url = unname(mo_url(y, open = FALSE, keep_synonyms = keep_synonyms)),
|
||||
ref = mo_ref(y, keep_synonyms = keep_synonyms),
|
||||
snomed = unlist(mo_snomed(y, keep_synonyms = keep_synonyms))
|
||||
)
|
||||
)
|
||||
})
|
||||
@@ -660,37 +731,36 @@ mo_info <- function(x, language = get_AMR_locale(), ...) {
|
||||
result <- info[[1L]]
|
||||
}
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
result
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_url <- function(x, open = FALSE, language = get_AMR_locale(), ...) {
|
||||
mo_url <- function(x, open = FALSE, language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||
if (missing(x)) {
|
||||
# this tries to find the data and an <mo> column
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_url")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(open, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
x.mo <- as.mo(x = x, language = language, ... = ...)
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
x.mo <- as.mo(x = x, language = language, keep_synonyms = keep_synonyms, ... = ...)
|
||||
metadata <- get_mo_uncertainties()
|
||||
|
||||
df <- microorganisms[match(x.mo, microorganisms$mo), c("mo", "fullname", "source", "kingdom", "rank"), drop = FALSE]
|
||||
df$url <- ifelse(df$source == "LPSN",
|
||||
paste0(CATALOGUE_OF_LIFE$url_LPSN, "/species/", gsub(" ", "-", tolower(df$fullname), fixed = TRUE)),
|
||||
paste0(CATALOGUE_OF_LIFE$url_CoL, "/data/search?type=EXACT&q=", gsub(" ", "%20", df$fullname, fixed = TRUE))
|
||||
)
|
||||
x.rank <- AMR::microorganisms$rank[match(x.mo, AMR::microorganisms$mo)]
|
||||
x.name <- AMR::microorganisms$fullname[match(x.mo, AMR::microorganisms$mo)]
|
||||
x.lpsn <- AMR::microorganisms$lpsn[match(x.mo, AMR::microorganisms$mo)]
|
||||
x.gbif <- AMR::microorganisms$gbif[match(x.mo, AMR::microorganisms$mo)]
|
||||
|
||||
genera <- which(df$kingdom == "Bacteria" & df$rank == "genus")
|
||||
df$url[genera] <- gsub("/species/", "/genus/", df$url[genera], fixed = TRUE)
|
||||
subsp <- which(df$kingdom == "Bacteria" & df$rank %in% c("subsp.", "infraspecies"))
|
||||
df$url[subsp] <- gsub("/species/", "/subspecies/", df$url[subsp], fixed = TRUE)
|
||||
u <- character(length(x))
|
||||
u[!is.na(x.gbif)] <- paste0(TAXONOMY_VERSION$GBIF$url, "/species/", x.gbif[!is.na(x.gbif)])
|
||||
# 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 <- df$url
|
||||
names(u) <- df$fullname
|
||||
names(u) <- x.name
|
||||
|
||||
if (isTRUE(open)) {
|
||||
if (length(u) > 1) {
|
||||
@@ -699,61 +769,69 @@ mo_url <- function(x, open = FALSE, language = get_AMR_locale(), ...) {
|
||||
utils::browseURL(u[1L])
|
||||
}
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
load_mo_uncertainties(metadata)
|
||||
u
|
||||
}
|
||||
|
||||
|
||||
#' @rdname mo_property
|
||||
#' @export
|
||||
mo_property <- function(x, property = "fullname", language = get_AMR_locale(), ...) {
|
||||
mo_property <- function(x, property = "fullname", language = get_AMR_locale(), keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...) {
|
||||
if (missing(x)) {
|
||||
# this tries to find the data and an <mo> column
|
||||
# this tries to find the data and an 'mo' column
|
||||
x <- find_mo_col(fn = "mo_property")
|
||||
}
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(microorganisms))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(AMR::microorganisms))
|
||||
language <- validate_language(language)
|
||||
meet_criteria(keep_synonyms, allow_class = "logical", has_length = 1)
|
||||
|
||||
translate_into_language(mo_validate(x = x, property = property, language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = property, language = language, keep_synonyms = keep_synonyms, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
mo_validate <- function(x, property, language, ...) {
|
||||
check_dataset_integrity()
|
||||
mo_validate <- function(x, property, language, keep_synonyms = keep_synonyms, ...) {
|
||||
|
||||
# try to catch an error when inputting an invalid argument
|
||||
# so the 'call.' can be set to FALSE
|
||||
tryCatch(x[1L] %in% unlist(AMR::microorganisms[1, property, drop = TRUE]),
|
||||
error = function(e) stop(e$message, call. = FALSE)
|
||||
)
|
||||
|
||||
dots <- list(...)
|
||||
Becker <- dots$Becker
|
||||
if (is.null(Becker) | property %in% c("kingdom", "phylum", "class", "order", "family", "genus")) {
|
||||
if (is.null(Becker) || property %in% c("kingdom", "phylum", "class", "order", "family", "genus")) {
|
||||
Becker <- FALSE
|
||||
}
|
||||
Lancefield <- dots$Lancefield
|
||||
if (is.null(Lancefield) | property %in% c("kingdom", "phylum", "class", "order", "family", "genus")) {
|
||||
if (is.null(Lancefield) || property %in% c("kingdom", "phylum", "class", "order", "family", "genus")) {
|
||||
Lancefield <- FALSE
|
||||
}
|
||||
has_Becker_or_Lancefield <- Becker %in% c(TRUE, "all") | Lancefield %in% c(TRUE, "all")
|
||||
has_Becker_or_Lancefield <- Becker %in% c(TRUE, "all") || Lancefield %in% c(TRUE, "all")
|
||||
|
||||
if (tryCatch(all(x[!is.na(x)] %in% MO_lookup$mo) & !has_Becker_or_Lancefield, error = function(e) FALSE)) {
|
||||
# special case for mo_* functions where class is already <mo>
|
||||
x <- MO_lookup[match(x, MO_lookup$mo), property, drop = TRUE]
|
||||
# get microorganisms data set, but remove synonyms if keep_synonyms is FALSE
|
||||
mo_data_check <- AMR::microorganisms[which(AMR::microorganisms$status %in% if (isTRUE(keep_synonyms)) c("synonym", "accepted") else "accepted"), , drop = FALSE]
|
||||
|
||||
if (all(x %in% c(mo_data_check$mo, NA)) && !has_Becker_or_Lancefield) {
|
||||
# do nothing, just don't run the other if-else's
|
||||
} else if (all(x %in% c(unlist(mo_data_check[[property]]), NA)) && !has_Becker_or_Lancefield) {
|
||||
# no need to do anything, just return it
|
||||
return(x)
|
||||
} else {
|
||||
# try to catch an error when inputting an invalid argument
|
||||
# so the 'call.' can be set to FALSE
|
||||
tryCatch(x[1L] %in% MO_lookup[1, property, drop = TRUE],
|
||||
error = function(e) stop(e$message, call. = FALSE)
|
||||
)
|
||||
|
||||
if (!all(x[!is.na(x)] %in% MO_lookup[, property, drop = TRUE]) | has_Becker_or_Lancefield) {
|
||||
x <- exec_as.mo(x, property = property, language = language, ...)
|
||||
}
|
||||
# we need to get MO codes now
|
||||
x <- replace_old_mo_codes(x, property = property)
|
||||
x <- as.mo(x, language = language, keep_synonyms = keep_synonyms, ...)
|
||||
}
|
||||
|
||||
# get property reeaaally fast using match()
|
||||
x <- AMR::microorganisms[[property]][match(x, AMR::microorganisms$mo)]
|
||||
|
||||
if (property == "mo") {
|
||||
return(set_clean_class(x, new_class = c("mo", "character")))
|
||||
} else if (property == "species_id") {
|
||||
return(as.double(x))
|
||||
} else if (property == "snomed") {
|
||||
return(as.double(eval(parse(text = x))))
|
||||
return(sort(as.character(eval(parse(text = x)))))
|
||||
} else {
|
||||
return(x)
|
||||
# everything else is character
|
||||
return(as.character(x))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-24
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -71,7 +75,7 @@
|
||||
#'
|
||||
#' ```
|
||||
#' as.mo("lab_mo_ecoli")
|
||||
#' #> Class <mo>
|
||||
#' #> Class 'mo'
|
||||
#' #> [1] B_ESCHR_COLI
|
||||
#'
|
||||
#' mo_genus("lab_mo_kpneumoniae")
|
||||
@@ -81,7 +85,7 @@
|
||||
#' as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
|
||||
#' #> NOTE: Translation to one microorganism was guessed with uncertainty.
|
||||
#' #> Use mo_uncertainties() to review it.
|
||||
#' #> Class <mo>
|
||||
#' #> Class 'mo'
|
||||
#' #> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
|
||||
#' ```
|
||||
#'
|
||||
@@ -104,7 +108,7 @@
|
||||
#' #> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
|
||||
#' #> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
|
||||
#' #> "Organisation XYZ" and "mo"
|
||||
#' #> Class <mo>
|
||||
#' #> Class 'mo'
|
||||
#' #> [1] B_ESCHR_COLI
|
||||
#'
|
||||
#' mo_genus("lab_Staph_aureus")
|
||||
@@ -127,10 +131,10 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
|
||||
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 home folder.")
|
||||
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, "")) {
|
||||
pkg_env$mo_source <- NULL
|
||||
AMR_env$mo_source <- NULL
|
||||
if (file.exists(mo_source_destination)) {
|
||||
unlink(mo_source_destination)
|
||||
message_("Removed mo_source file '", font_bold(mo_source_destination), "'",
|
||||
@@ -204,14 +208,14 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
word_wrap(paste0(
|
||||
"This will write create the new file '",
|
||||
mo_source_destination,
|
||||
"', for which your permission is needed."
|
||||
"', for which your permission is required."
|
||||
)),
|
||||
"\n\n",
|
||||
word_wrap("Do you agree that this file will be created?")
|
||||
)
|
||||
showQuestion <- import_fn("showQuestion", "rstudioapi", error_on_fail = FALSE)
|
||||
if (!is.null(showQuestion)) {
|
||||
q_continue <- showQuestion("Create new file in home directory", txt)
|
||||
q_continue <- showQuestion("Create new file", txt)
|
||||
} else {
|
||||
q_continue <- utils::menu(choices = c("OK", "Cancel"), graphics = FALSE, title = txt)
|
||||
}
|
||||
@@ -223,7 +227,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
attr(df, "mo_source_destination") <- mo_source_destination
|
||||
attr(df, "mo_source_timestamp") <- file.mtime(path)
|
||||
saveRDS(df, mo_source_destination)
|
||||
pkg_env$mo_source <- df
|
||||
AMR_env$mo_source <- df
|
||||
message_(
|
||||
action, " mo_source file '", font_bold(mo_source_destination),
|
||||
"' (", formatted_filesize(mo_source_destination),
|
||||
@@ -243,26 +247,24 @@ get_mo_source <- function(destination = getOption("AMR_mo_source", "~/mo_source.
|
||||
}
|
||||
return(NULL)
|
||||
}
|
||||
if (is.null(pkg_env$mo_source)) {
|
||||
pkg_env$mo_source <- readRDS(path.expand(destination))
|
||||
if (is.null(AMR_env$mo_source)) {
|
||||
AMR_env$mo_source <- readRDS(path.expand(destination))
|
||||
}
|
||||
|
||||
old_time <- attributes(pkg_env$mo_source)$mo_source_timestamp
|
||||
new_time <- file.mtime(attributes(pkg_env$mo_source)$mo_source_location)
|
||||
old_time <- attributes(AMR_env$mo_source)$mo_source_timestamp
|
||||
new_time <- file.mtime(attributes(AMR_env$mo_source)$mo_source_location)
|
||||
if (interactive() && !identical(old_time, new_time)) {
|
||||
# source file was updated, also update reference
|
||||
set_mo_source(attributes(pkg_env$mo_source)$mo_source_location)
|
||||
set_mo_source(attributes(AMR_env$mo_source)$mo_source_location)
|
||||
}
|
||||
pkg_env$mo_source
|
||||
AMR_env$mo_source
|
||||
}
|
||||
|
||||
check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_on_error = TRUE) {
|
||||
check_dataset_integrity()
|
||||
|
||||
if (paste(deparse(substitute(x)), collapse = "") == "get_mo_source()") {
|
||||
return(TRUE)
|
||||
}
|
||||
if (is.null(pkg_env$mo_source) && (identical(x, get_mo_source()))) {
|
||||
if (is.null(AMR_env$mo_source) && (identical(x, get_mo_source()))) {
|
||||
return(TRUE)
|
||||
}
|
||||
if (is.null(x)) {
|
||||
@@ -286,9 +288,9 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
|
||||
return(FALSE)
|
||||
}
|
||||
}
|
||||
if (!all(x$mo %in% c("", microorganisms$mo, microorganisms$fullname), na.rm = TRUE)) {
|
||||
if (!all(x$mo %in% c("", AMR::microorganisms$mo, AMR::microorganisms$fullname), na.rm = TRUE)) {
|
||||
if (stop_on_error == TRUE) {
|
||||
invalid <- x[which(!x$mo %in% c("", microorganisms$mo, microorganisms$fullname)), , drop = FALSE]
|
||||
invalid <- x[which(!x$mo %in% c("", AMR::microorganisms$mo, AMR::microorganisms$fullname)), , drop = FALSE]
|
||||
if (nrow(invalid) > 1) {
|
||||
plural <- "s"
|
||||
} else {
|
||||
@@ -303,14 +305,14 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
|
||||
return(FALSE)
|
||||
}
|
||||
}
|
||||
if (colnames(x)[1] != "mo" & nrow(x) > length(unique(x[, 1, drop = TRUE]))) {
|
||||
if (colnames(x)[1] != "mo" && nrow(x) > length(unique(x[, 1, drop = TRUE]))) {
|
||||
if (stop_on_error == TRUE) {
|
||||
stop_(refer_to_name, " contains duplicate values in column '", colnames(x)[1], "'", call = FALSE)
|
||||
} else {
|
||||
return(FALSE)
|
||||
}
|
||||
}
|
||||
if (colnames(x)[2] != "mo" & nrow(x) > length(unique(x[, 2, drop = TRUE]))) {
|
||||
if (colnames(x)[2] != "mo" && nrow(x) > length(unique(x[, 2, drop = TRUE]))) {
|
||||
if (stop_on_error == TRUE) {
|
||||
stop_(refer_to_name, " contains duplicate values in column '", colnames(x)[2], "'", call = FALSE)
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -50,7 +54,7 @@
|
||||
#' filter(n() >= 30) %>% # filter on only 30 results per group
|
||||
#' summarise_if(is.rsi, resistance) # then get resistance of all drugs
|
||||
#'
|
||||
#' # now conduct PCA for certain antimicrobial agents
|
||||
#' # now conduct PCA for certain antimicrobial drugs
|
||||
#' pca_result <- resistance_data %>%
|
||||
#' pca(AMC, CXM, CTX, CAZ, GEN, TOB, TMP, SXT)
|
||||
#'
|
||||
@@ -60,9 +64,9 @@
|
||||
#' # old base R plotting method:
|
||||
#' biplot(pca_result)
|
||||
#' # new ggplot2 plotting method using this package:
|
||||
#' ggplot_pca(pca_result)
|
||||
#'
|
||||
#' if (require("ggplot2")) {
|
||||
#' ggplot_pca(pca_result)
|
||||
#'
|
||||
#' ggplot_pca(pca_result) +
|
||||
#' scale_colour_viridis_d() +
|
||||
#' labs(title = "Title here")
|
||||
@@ -97,7 +101,7 @@ pca <- function(x,
|
||||
error = function(e) stop(e$message, call. = FALSE)
|
||||
)
|
||||
if (length(new_list[[i]]) == 1) {
|
||||
if (is.character(new_list[[i]]) & new_list[[i]] %in% colnames(x)) {
|
||||
if (is.character(new_list[[i]]) && new_list[[i]] %in% colnames(x)) {
|
||||
# this is to support quoted variables: df %pm>% pca("mycol1", "mycol2")
|
||||
new_list[[i]] <- x[, new_list[[i]]]
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -29,7 +33,7 @@
|
||||
|
||||
#' @param x,object values created with [as.mic()], [as.disk()] or [as.rsi()] (or their `random_*` variants, such as [random_mic()])
|
||||
#' @param mo any (vector of) text that can be coerced to a valid microorganism code with [as.mo()]
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial drug code with [as.ab()]
|
||||
#' @param guideline interpretation guideline to use, defaults to the latest included EUCAST guideline, see *Details*
|
||||
#' @param main,title title of the plot
|
||||
#' @param xlab,ylab axis title
|
||||
@@ -97,7 +101,7 @@ plot.mic <- function(x,
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -188,7 +192,7 @@ barplot.mic <- function(height,
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -236,7 +240,7 @@ autoplot.mic <- function(object,
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -336,7 +340,7 @@ plot.disk <- function(x,
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -427,7 +431,7 @@ barplot.disk <- function(height,
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -475,7 +479,7 @@ autoplot.disk <- function(object,
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
@@ -639,7 +643,7 @@ barplot.rsi <- function(height,
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(colours_RSI, allow_class = "character", has_length = c(1, 3))
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
language <- validate_language(language)
|
||||
meet_criteria(expand, allow_class = "logical", has_length = 1)
|
||||
|
||||
# translate if not specifically set
|
||||
|
||||
+114
-19
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -35,12 +39,16 @@
|
||||
#' @param data a [data.frame] containing columns with class [`rsi`] (see [as.rsi()])
|
||||
#' @param translate_ab a column name of the [antibiotics] data set to translate the antibiotic abbreviations to, using [ab_property()]
|
||||
#' @inheritParams ab_property
|
||||
#' @param combine_SI a [logical] to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant). This used to be the argument `combine_IR`, but this now follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section 'Interpretation of S, I and R' below. Default is `TRUE`.
|
||||
#' @param combine_IR a [logical] to indicate whether all values of I and R must be merged into one, so the output only consists of S vs. I+R (susceptible vs. non-susceptible). This is outdated, see argument `combine_SI`.
|
||||
#' @param combine_SI a [logical] to indicate whether all values of S and I must be merged into one, so the output only consists of S+I vs. R (susceptible vs. resistant), defaults to `TRUE`
|
||||
#' @param ab_result antibiotic results to test against, must be one of more values of "R", "S", "I"
|
||||
#' @param confidence_level the confidence level for the returned confidence interval. For the calculation, the number of S or SI isolates, and R isolates are compared with the total number of available isolates with R, S, or I by using [binom.test()], i.e., the Clopper-Pearson method.
|
||||
#' @param side the side of the confidence interval to return. Defaults to `"both"` for a length 2 vector, but can also be (abbreviated as) `"min"`/`"left"`/`"lower"`/`"less"` or `"max"`/`"right"`/`"higher"`/`"greater"`.
|
||||
#' @inheritSection as.rsi Interpretation of R and S/I
|
||||
#' @details
|
||||
#' The function [resistance()] is equal to the function [proportion_R()]. The function [susceptibility()] is equal to the function [proportion_SI()].
|
||||
#'
|
||||
#' Use [rsi_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.
|
||||
#'
|
||||
#' **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.
|
||||
#'
|
||||
#' These functions are not meant to count isolates, but to calculate the proportion of resistance/susceptibility. Use the [`count()`][AMR::count()] functions to count isolates. The function [susceptibility()] is essentially equal to `count_susceptible() / count_all()`. *Low counts can influence the outcome - the `proportion` functions may camouflage this, since they only return the proportion (albeit being dependent on the `minimum` argument).*
|
||||
@@ -80,7 +88,7 @@
|
||||
#' ```
|
||||
#'
|
||||
#' Using `only_all_tested` has no impact when only using one antibiotic as input.
|
||||
#' @source **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition**, 2014, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' @source **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition**, 2022, *Clinical and Laboratory Standards Institute (CLSI)*. <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' @seealso [AMR::count()] to count resistant and susceptible isolates.
|
||||
#' @return A [double] or, when `as_percent = TRUE`, a [character].
|
||||
#' @rdname proportion
|
||||
@@ -92,8 +100,18 @@
|
||||
#' # run ?example_isolates for more info.
|
||||
#'
|
||||
#' # base R ------------------------------------------------------------
|
||||
#' resistance(example_isolates$AMX) # determines %R
|
||||
#' susceptibility(example_isolates$AMX) # determines %S+I
|
||||
#' # determines %R
|
||||
#' resistance(example_isolates$AMX)
|
||||
#' rsi_confidence_interval(example_isolates$AMX)
|
||||
#' rsi_confidence_interval(example_isolates$AMX,
|
||||
#' confidence_level = 0.975
|
||||
#' )
|
||||
#'
|
||||
#' # determines %S+I:
|
||||
#' susceptibility(example_isolates$AMX)
|
||||
#' rsi_confidence_interval(example_isolates$AMX,
|
||||
#' ab_result = c("S", "I")
|
||||
#' )
|
||||
#'
|
||||
#' # be more specific
|
||||
#' proportion_S(example_isolates$AMX)
|
||||
@@ -111,7 +129,28 @@
|
||||
#' r = resistance(CIP),
|
||||
#' n = n_rsi(CIP)
|
||||
#' ) # n_rsi works like n_distinct in dplyr, see ?n_rsi
|
||||
#' }
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' group_by(ward) %>%
|
||||
#' summarise(
|
||||
#' cipro_R = resistance(CIP),
|
||||
#' ci_min = rsi_confidence_interval(CIP, side = "min"),
|
||||
#' ci_max = rsi_confidence_interval(CIP, side = "max"),
|
||||
#' )
|
||||
#' }
|
||||
#' if (require("dplyr")) {
|
||||
#'
|
||||
#' # scoped dplyr verbs with antibiotic selectors
|
||||
#' # (you could also use across() of course)
|
||||
#' example_isolates %>%
|
||||
#' group_by(ward) %>%
|
||||
#' summarise_at(
|
||||
#' c(aminoglycosides(), carbapenems()),
|
||||
#' resistance
|
||||
#' )
|
||||
#' }
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' group_by(ward) %>%
|
||||
#' summarise(
|
||||
@@ -186,7 +225,7 @@ resistance <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -204,10 +243,67 @@ susceptibility <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
#' @export
|
||||
rsi_confidence_interval <- function(...,
|
||||
ab_result = "R",
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE,
|
||||
confidence_level = 0.95,
|
||||
side = "both") {
|
||||
meet_criteria(ab_result, allow_class = c("character", "rsi"), has_length = c(1, 2, 3), is_in = c("R", "S", "I"))
|
||||
meet_criteria(confidence_level, allow_class = "numeric", is_positive = TRUE, has_length = 1)
|
||||
meet_criteria(side, allow_class = "character", has_length = 1, is_in = c("both", "b", "left", "l", "lower", "lowest", "less", "min", "right", "r", "higher", "highest", "greater", "g", "max"))
|
||||
x <- tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = ab_result,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
n <- tryCatch(
|
||||
rsi_calc(...,
|
||||
ab_result = c("S", "I", "R"),
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = TRUE
|
||||
),
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
|
||||
if (n < minimum) {
|
||||
warning_("Introducing NA: ",
|
||||
ifelse(n == 0, "no", paste("only", n)),
|
||||
" results available for `rsi_confidence_interval()` (`minimum` = ", minimum, ").",
|
||||
call = FALSE
|
||||
)
|
||||
if (as_percent == TRUE) {
|
||||
return(NA_character_)
|
||||
} else {
|
||||
return(NA_real_)
|
||||
}
|
||||
}
|
||||
|
||||
out <- stats::binom.test(x = x, n = n, conf.level = confidence_level)$conf.int
|
||||
out <- set_clean_class(out, "double")
|
||||
|
||||
if (side %in% c("left", "l", "lower", "lowest", "less", "min")) {
|
||||
out <- out[1]
|
||||
} else if (side %in% c("right", "r", "higher", "highest", "greater", "g", "max")) {
|
||||
out <- out[2]
|
||||
}
|
||||
if (as_percent == TRUE) {
|
||||
percentage(out, digits = 1)
|
||||
} else {
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname proportion
|
||||
#' @export
|
||||
proportion_R <- function(...,
|
||||
@@ -222,7 +318,7 @@ proportion_R <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -240,7 +336,7 @@ proportion_IR <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -258,7 +354,7 @@ proportion_I <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -276,7 +372,7 @@ proportion_SI <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -294,7 +390,7 @@ proportion_S <- function(...,
|
||||
only_all_tested = only_all_tested,
|
||||
only_count = FALSE
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -306,7 +402,7 @@ proportion_df <- function(data,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE) {
|
||||
confidence_level = 0.95) {
|
||||
tryCatch(
|
||||
rsi_calc_df(
|
||||
type = "proportion",
|
||||
@@ -316,9 +412,8 @@ proportion_df <- function(data,
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
combine_SI_missing = missing(combine_SI)
|
||||
confidence_level = confidence_level
|
||||
),
|
||||
error = function(e) stop_(e$message, call = -5)
|
||||
error = function(e) stop_(gsub("in rsi_calc_df(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
+10
-7
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -25,16 +29,16 @@
|
||||
|
||||
#' Random MIC Values/Disk Zones/RSI Generation
|
||||
#'
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial agent, the generated results will reflect reality as much as possible.
|
||||
#' These functions can be used for generating random MIC values and disk diffusion diameters, for AMR data analysis practice. By providing a microorganism and antimicrobial drug, the generated results will reflect reality as much as possible.
|
||||
#' @param size desired size of the returned vector. If used in a [data.frame] call or `dplyr` verb, will get the current (group) size if left blank.
|
||||
#' @param mo any [character] that can be coerced to a valid microorganism code with [as.mo()]
|
||||
#' @param ab any [character] that can be coerced to a valid antimicrobial agent code with [as.ab()]
|
||||
#' @param ab any [character] that can be coerced to a valid antimicrobial drug code with [as.ab()]
|
||||
#' @param prob_RSI a vector of length 3: the probabilities for "R" (1st value), "S" (2nd value) and "I" (3rd value)
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
#' @details The base \R function [sample()] is used for generating values.
|
||||
#'
|
||||
#' Generated values are based on the EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))` guideline as implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
|
||||
#' @return class `<mic>` for [random_mic()] (see [as.mic()]) and class `<disk>` for [random_disk()] (see [as.disk()])
|
||||
#' @return class `mic` for [random_mic()] (see [as.mic()]) and class `disk` for [random_disk()] (see [as.disk()])
|
||||
#' @name random
|
||||
#' @rdname random
|
||||
#' @export
|
||||
@@ -87,7 +91,6 @@ random_rsi <- function(size = NULL, prob_RSI = c(0.33, 0.33, 0.33), ...) {
|
||||
}
|
||||
|
||||
random_exec <- function(type, size, mo = NULL, ab = NULL) {
|
||||
check_dataset_integrity()
|
||||
df <- rsi_translation %pm>%
|
||||
pm_filter(guideline %like% "EUCAST") %pm>%
|
||||
pm_arrange(pm_desc(guideline)) %pm>%
|
||||
|
||||
+15
-23
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -132,18 +136,6 @@ resistance_predict <- function(x,
|
||||
x.bak <- x
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
|
||||
dots <- unlist(list(...))
|
||||
if (length(dots) != 0) {
|
||||
# backwards compatibility with old arguments
|
||||
dots.names <- names(dots)
|
||||
if ("tbl" %in% dots.names) {
|
||||
x <- dots[which(dots.names == "tbl")]
|
||||
}
|
||||
if ("I_as_R" %in% dots.names) {
|
||||
warning_("in `resistance_predict()`: I_as_R is deprecated - use I_as_S instead.")
|
||||
}
|
||||
}
|
||||
|
||||
# -- date
|
||||
if (is.null(col_date)) {
|
||||
col_date <- search_type_in_df(x = x, type = "date")
|
||||
@@ -167,10 +159,10 @@ resistance_predict <- function(x,
|
||||
df[, col_ab] <- droplevels(as.rsi(df[, col_ab, drop = TRUE]))
|
||||
if (I_as_S == TRUE) {
|
||||
# then I as S
|
||||
df[, col_ab] <- gsub("I", "S", df[, col_ab, drop = TRUE])
|
||||
df[, col_ab] <- gsub("I", "S", df[, col_ab, drop = TRUE], fixed = TRUE)
|
||||
} else {
|
||||
# then I as R
|
||||
df[, col_ab] <- gsub("I", "R", df[, col_ab, drop = TRUE])
|
||||
df[, col_ab] <- gsub("I", "R", df[, col_ab, drop = TRUE], fixed = TRUE)
|
||||
}
|
||||
df[, col_ab] <- ifelse(is.na(df[, col_ab, drop = TRUE]), 0, df[, col_ab, drop = TRUE])
|
||||
|
||||
@@ -205,7 +197,7 @@ resistance_predict <- function(x,
|
||||
if (model %in% c("binomial", "binom", "logit")) {
|
||||
model <- "binomial"
|
||||
model_lm <- with(df, glm(df_matrix ~ year, family = binomial))
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\nLogistic regression model (logit) with binomial distribution")
|
||||
cat("\n------------------------------------------------------------\n")
|
||||
print(summary(model_lm))
|
||||
@@ -217,7 +209,7 @@ resistance_predict <- function(x,
|
||||
} else if (model %in% c("loglin", "poisson")) {
|
||||
model <- "poisson"
|
||||
model_lm <- with(df, glm(R ~ year, family = poisson))
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\nLog-linear regression model (loglin) with poisson distribution")
|
||||
cat("\n--------------------------------------------------------------\n")
|
||||
print(summary(model_lm))
|
||||
@@ -229,7 +221,7 @@ resistance_predict <- function(x,
|
||||
} else if (model %in% c("lin", "linear")) {
|
||||
model <- "linear"
|
||||
model_lm <- with(df, lm((R / (R + S)) ~ year))
|
||||
if (info == TRUE) {
|
||||
if (isTRUE(info)) {
|
||||
cat("\nLinear regression model")
|
||||
cat("\n-----------------------\n")
|
||||
print(summary(model_lm))
|
||||
@@ -257,10 +249,10 @@ resistance_predict <- function(x,
|
||||
df_prediction$se_max <- as.integer(df_prediction$se_max)
|
||||
} else {
|
||||
# se_max not above 1
|
||||
df_prediction$se_max <- ifelse(df_prediction$se_max > 1, 1, df_prediction$se_max)
|
||||
df_prediction$se_max <- pmin(df_prediction$se_max, 1)
|
||||
}
|
||||
# se_min not below 0
|
||||
df_prediction$se_min <- ifelse(df_prediction$se_min < 0, 0, df_prediction$se_min)
|
||||
df_prediction$se_min <- pmax(df_prediction$se_min, 0)
|
||||
|
||||
df_observations <- data.frame(
|
||||
year = df$year,
|
||||
@@ -279,7 +271,7 @@ resistance_predict <- function(x,
|
||||
df_prediction$se_max <- ifelse(!is.na(df_prediction$observed), NA, df_prediction$se_max)
|
||||
}
|
||||
|
||||
df_prediction$value <- ifelse(df_prediction$value > 1, 1, ifelse(df_prediction$value < 0, 0, df_prediction$value))
|
||||
df_prediction$value <- ifelse(df_prediction$value > 1, 1, pmax(df_prediction$value, 0))
|
||||
df_prediction <- df_prediction[order(df_prediction$year), , drop = FALSE]
|
||||
|
||||
out <- as_original_data_class(df_prediction, class(x.bak))
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -29,17 +33,17 @@
|
||||
#' @rdname as.rsi
|
||||
#' @param x vector of values (for class [`mic`]: MIC values in mg/L, for class [`disk`]: a disk diffusion radius in millimetres)
|
||||
#' @param mo any (vector of) text that can be coerced to valid microorganism codes with [as.mo()], can be left empty to determine it automatically
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
|
||||
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial drug code with [as.ab()]
|
||||
#' @param uti (Urinary Tract Infection) A vector with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.rsi()] on a [data.frame], this can also be a column containing [logical]s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See *Examples*.
|
||||
#' @inheritParams first_isolate
|
||||
#' @param guideline defaults to EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))` (the latest implemented EUCAST guideline in the [rsi_translation] data set), supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`), see *Details*
|
||||
#' @param guideline defaults to EUCAST `r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))` (the latest implemented EUCAST guideline in the [rsi_translation] data set), but can be set with the [option][options()] `AMR_guideline`. Supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`), see *Details*.
|
||||
#' @param conserve_capped_values a [logical] to indicate that MIC values starting with `">"` (but not `">="`) must always return "R" , and that MIC values starting with `"<"` (but not `"<="`) must always return "S"
|
||||
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [logical] to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
|
||||
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [rsi_translation] data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the [rsi_translation] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
|
||||
#' @param threshold maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*
|
||||
#' @param ... for using on a [data.frame]: names of columns to apply [as.rsi()] on (supports tidy selection such as `column1:column4`). Otherwise: arguments passed on to methods.
|
||||
#' @details
|
||||
#' ## How it Works
|
||||
#' ### How it Works
|
||||
#'
|
||||
#' The [as.rsi()] function works in four ways:
|
||||
#'
|
||||
@@ -48,37 +52,47 @@
|
||||
#' 2. For **interpreting minimum inhibitory concentration (MIC) values** according to EUCAST or CLSI. You must clean your MIC values first using [as.mic()], that also gives your columns the new data class [`mic`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
||||
#' * Using `dplyr`, R/SI interpretation can be done very easily with either:
|
||||
#' ```
|
||||
#' your_data %>% mutate_if(is.mic, as.rsi) # until dplyr 1.0.0
|
||||
#' your_data %>% mutate(across(where(is.mic), as.rsi)) # since dplyr 1.0.0
|
||||
#' your_data %>% mutate_if(is.mic, as.rsi)
|
||||
#' your_data %>% mutate(across(where(is.mic), as.rsi))
|
||||
#' ```
|
||||
#' * Operators like "<=" will be stripped before interpretation. When using `conserve_capped_values = TRUE`, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (`conserve_capped_values = FALSE`) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||
#' 3. For **interpreting disk diffusion diameters** according to EUCAST or CLSI. You must clean your disk zones first using [as.disk()], that also gives your columns the new data class [`disk`]. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the `mo` argument.
|
||||
#' * Using `dplyr`, R/SI interpretation can be done very easily with either:
|
||||
#' ```
|
||||
#' your_data %>% mutate_if(is.disk, as.rsi) # until dplyr 1.0.0
|
||||
#' your_data %>% mutate(across(where(is.disk), as.rsi)) # since dplyr 1.0.0
|
||||
#' your_data %>% mutate_if(is.disk, as.rsi)
|
||||
#' your_data %>% mutate(across(where(is.disk), as.rsi))
|
||||
#' ```
|
||||
#' 4. For **interpreting a complete data set**, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running `as.rsi(your_data)`.
|
||||
#'
|
||||
#' For points 2, 3 and 4: Use [rsi_interpretation_history()] to retrieve a [data.frame] (or [tibble][tibble::tibble()] if the `tibble` package is installed) with all results of the last [as.rsi()] call.
|
||||
#'
|
||||
#' ## Supported Guidelines
|
||||
#' ### Supported Guidelines
|
||||
#'
|
||||
#' For interpreting MIC values as well as disk diffusion diameters, currently implemented guidelines are EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`).
|
||||
#'
|
||||
#' Thus, the `guideline` argument must be set to e.g., ``r paste0('"', subset(rsi_translation, guideline %like% "EUCAST")$guideline[1], '"')`` or ``r paste0('"', subset(rsi_translation, guideline %like% "CLSI")$guideline[1], '"')``. By simply using `"EUCAST"` (the default) or `"CLSI"` as input, the latest included version of that guideline will automatically be selected. You can set your own data set using the `reference_data` argument. The `guideline` argument will then be ignored.
|
||||
#'
|
||||
#' You can set the default guideline with the `AMR_guideline` [option][options()] (e.g. in your `.Rprofile` file), such as:
|
||||
#'
|
||||
#' ```
|
||||
#' options(AMR_guideline = "CLSI")
|
||||
#' options(AMR_guideline = "CLSI 2018")
|
||||
#' options(AMR_guideline = "EUCAST 2020")
|
||||
#' # or to reset:
|
||||
#' options(AMR_guideline = NULL)
|
||||
#' ```
|
||||
#'
|
||||
#' ## After Interpretation
|
||||
#' ### After Interpretation
|
||||
#'
|
||||
#' After using [as.rsi()], you can use the [eucast_rules()] defined by EUCAST to (1) apply inferred susceptibility and resistance based on results of other antimicrobials and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
|
||||
#'
|
||||
#' ## Machine-Readable Interpretation Guidelines
|
||||
#' ### Machine-Readable Interpretation Guidelines
|
||||
#'
|
||||
#' The repository of this package [contains a machine-readable version](https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt) of all guidelines. This is a CSV file consisting of `r format(nrow(AMR::rsi_translation), big.mark = ",")` rows and `r ncol(AMR::rsi_translation)` columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. **This allows for easy implementation of these rules in laboratory information systems (LIS)**. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
||||
#' The repository of this package [contains a machine-readable version](https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt) of all guidelines. This is a CSV file consisting of `r format(nrow(AMR::rsi_translation), big.mark = ",")` rows and `r ncol(AMR::rsi_translation)` columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. **This allows for easy implementation of these rules in laboratory information systems (LIS)**. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
||||
#'
|
||||
#' ## Other
|
||||
#' ### Other
|
||||
#'
|
||||
#' The function [is.rsi()] detects if the input contains class `<rsi>`. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
|
||||
#' The function [is.rsi()] detects if the input contains class `rsi`. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
|
||||
#'
|
||||
#' The function [is.rsi.eligible()] returns `TRUE` when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and `FALSE` otherwise. The threshold of 5% can be set with the `threshold` argument. If the input is a [data.frame], it iterates over all columns and returns a [logical] vector.
|
||||
#' @section Interpretation of R and S/I:
|
||||
@@ -91,11 +105,17 @@
|
||||
#' - **I = Susceptible, Increased exposure**\cr
|
||||
#' A microorganism is categorised as *Susceptible, Increased exposure* when there is a high likelihood of therapeutic success because exposure to the agent is increased by adjusting the dosing regimen or by its concentration at the site of infection.
|
||||
#'
|
||||
#' This AMR package honours this (new) insight. Use [susceptibility()] (equal to [proportion_SI()]) to determine antimicrobial susceptibility and [count_susceptible()] (equal to [count_SI()]) to count susceptible isolates.
|
||||
#' @return Ordered [factor] with new class `<rsi>`
|
||||
#' This AMR package honours this insight. Use [susceptibility()] (equal to [proportion_SI()]) to determine antimicrobial susceptibility and [count_susceptible()] (equal to [count_SI()]) to count susceptible isolates.
|
||||
#' @return Ordered [factor] with new class `rsi`
|
||||
#' @aliases rsi
|
||||
#' @export
|
||||
#' @seealso [as.mic()], [as.disk()], [as.mo()]
|
||||
#' @source
|
||||
#' For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:
|
||||
#'
|
||||
#' - **M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data**, `r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m39/>.
|
||||
#' - **M100 Performance Standard for Antimicrobial Susceptibility Testing**, `r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`, *Clinical and Laboratory Standards Institute* (CLSI). <https://clsi.org/standards/products/microbiology/documents/m100/>.
|
||||
#' - **Breakpoint tables for interpretation of MICs and zone diameters**, `r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`, *European Committee on Antimicrobial Susceptibility Testing* (EUCAST). <https://www.eucast.org/clinical_breakpoints>.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @examples
|
||||
#' example_isolates
|
||||
@@ -160,7 +180,7 @@
|
||||
#' as.rsi() # automatically determines urine isolates
|
||||
#'
|
||||
#' df %>%
|
||||
#' mutate_at(vars(AMP:NIT), as.rsi, mo = "E. coli", uti = TRUE)
|
||||
#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli", uti = TRUE)
|
||||
#' }
|
||||
#'
|
||||
#' # For CLEANING existing R/SI values ------------------------------------
|
||||
@@ -194,7 +214,7 @@ as.rsi <- function(x, ...) {
|
||||
}
|
||||
|
||||
#' @rdname as.rsi
|
||||
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
|
||||
#' @details `NA_rsi_` is a missing value of the new `rsi` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
|
||||
#' @export
|
||||
NA_rsi_ <- set_clean_class(factor(NA, levels = c("S", "I", "R"), ordered = TRUE),
|
||||
new_class = c("rsi", "ordered", "factor")
|
||||
@@ -248,7 +268,7 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
|
||||
if (!is.null(cur_col)) {
|
||||
ab <- suppressWarnings(as.ab(cur_col, fast_mode = TRUE, info = FALSE))
|
||||
if (!is.na(ab)) {
|
||||
# this is a valid antibiotic code
|
||||
# this is a valid antibiotic drug code
|
||||
message_(
|
||||
"Column '", font_bold(cur_col), "' is as.rsi()-eligible (despite only having empty values), since it seems to be ",
|
||||
ab_name(ab, language = NULL, tolower = TRUE), " (", ab, ")"
|
||||
@@ -275,7 +295,7 @@ as.rsi.default <- function(x, ...) {
|
||||
|
||||
x.bak <- x
|
||||
x <- as.character(x) # this is needed to prevent the vctrs pkg from throwing an error
|
||||
|
||||
|
||||
if (inherits(x.bak, c("integer", "numeric", "double")) && all(x %in% c(1:3, NA))) {
|
||||
# support haven package for importing e.g., from SPSS - it adds the 'labels' attribute
|
||||
lbls <- attributes(x.bak)$labels
|
||||
@@ -288,6 +308,10 @@ as.rsi.default <- function(x, ...) {
|
||||
x[x.bak == 2] <- "I"
|
||||
x[x.bak == 3] <- "R"
|
||||
}
|
||||
} else if (inherits(x.bak, "character") && all(x %in% c("1", "2", "3", "S", "I", "R", NA_character_))) {
|
||||
x[x.bak == "1"] <- "S"
|
||||
x[x.bak == "2"] <- "I"
|
||||
x[x.bak == "3"] <- "R"
|
||||
} else if (!all(is.na(x)) && !identical(levels(x), c("R", "S", "I")) && !all(x %in% c("R", "S", "I", NA))) {
|
||||
if (all(x %unlike% "(R|S|I)", na.rm = TRUE)) {
|
||||
# check if they are actually MICs or disks
|
||||
@@ -302,6 +326,7 @@ as.rsi.default <- function(x, ...) {
|
||||
x <- trimws2(as.character(unlist(x)))
|
||||
x[x %in% c(NA, "", "-", "NULL")] <- NA_character_
|
||||
x.bak <- x
|
||||
|
||||
na_before <- length(x[is.na(x)])
|
||||
|
||||
# correct for translations
|
||||
@@ -327,13 +352,15 @@ as.rsi.default <- function(x, ...) {
|
||||
# remove other invalid characters
|
||||
# set to capitals
|
||||
x <- toupper(x)
|
||||
x <- gsub("[^RSIHDU]+", "", x, perl = TRUE)
|
||||
x <- gsub("[^A-Z]+", "", x, perl = TRUE)
|
||||
# CLSI uses SDD for "susceptible dose-dependent"
|
||||
x <- gsub("SDD", "I", x, fixed = TRUE)
|
||||
# some labs now report "H" instead of "I" to not interfere with EUCAST prior to 2019
|
||||
x <- gsub("^H$", "I", x, perl = TRUE)
|
||||
# and MIPS uses D for Dose-dependent (which is I, but it will throw a note)
|
||||
x <- gsub("^D$", "I", x, perl = TRUE)
|
||||
# and MIPS uses U for "susceptible urine"
|
||||
x <- gsub("^U$", "S", x, perl = TRUE)
|
||||
x <- gsub("H", "I", x, fixed = TRUE)
|
||||
# MIPS uses D for Dose-dependent (which is I, but it will throw a note)
|
||||
x <- gsub("D", "I", x, fixed = TRUE)
|
||||
# MIPS uses U for "susceptible urine"
|
||||
x <- gsub("U", "S", x, fixed = TRUE)
|
||||
# in cases of "S;S" keep S, but in case of "S;I" make it NA
|
||||
x <- gsub("^S+$", "S", x)
|
||||
x <- gsub("^I+$", "I", x)
|
||||
@@ -347,7 +374,11 @@ as.rsi.default <- function(x, ...) {
|
||||
unique() %pm>%
|
||||
sort() %pm>%
|
||||
vector_and(quotes = TRUE)
|
||||
warning_("in `as.rsi()`: ", na_after - na_before, " results truncated (",
|
||||
cur_col <- get_current_column()
|
||||
warning_("in `as.rsi()`: ", na_after - na_before, " result",
|
||||
ifelse(na_after - na_before > 1, "s", ""),
|
||||
ifelse(is.null(cur_col), "", paste0(" in column '", cur_col, "'")),
|
||||
" truncated (",
|
||||
round(((na_after - na_before) / length(x)) * 100),
|
||||
"%) that were invalid antimicrobial interpretations: ",
|
||||
list_missing,
|
||||
@@ -360,6 +391,9 @@ as.rsi.default <- function(x, ...) {
|
||||
if (any(toupper(x.bak[!is.na(x.bak)]) == "D") && message_not_thrown_before("as.rsi", "D")) {
|
||||
warning_("in `as.rsi()`: 'D' (dose-dependent) was interpreted as 'I', following some laboratory systems")
|
||||
}
|
||||
if (any(toupper(x.bak[!is.na(x.bak)]) == "SDD") && message_not_thrown_before("as.rsi", "SDD")) {
|
||||
warning_("in `as.rsi()`: 'SDD' (susceptible dose-dependent, coined by CLSI) was interpreted as 'I' to comply with EUCAST's 'I'")
|
||||
}
|
||||
if (any(toupper(x.bak[!is.na(x.bak)]) == "H") && message_not_thrown_before("as.rsi", "H")) {
|
||||
warning_("in `as.rsi()`: 'H' was interpreted as 'I', following some laboratory systems")
|
||||
}
|
||||
@@ -376,8 +410,8 @@ as.rsi.default <- function(x, ...) {
|
||||
as.rsi.mic <- function(x,
|
||||
mo = NULL,
|
||||
ab = deparse(substitute(x)),
|
||||
guideline = "EUCAST",
|
||||
uti = FALSE,
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = AMR::rsi_translation,
|
||||
@@ -402,8 +436,8 @@ as.rsi.mic <- function(x,
|
||||
as.rsi.disk <- function(x,
|
||||
mo = NULL,
|
||||
ab = deparse(substitute(x)),
|
||||
guideline = "EUCAST",
|
||||
uti = FALSE,
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
uti = NULL,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = AMR::rsi_translation,
|
||||
...) {
|
||||
@@ -427,7 +461,7 @@ as.rsi.disk <- function(x,
|
||||
as.rsi.data.frame <- function(x,
|
||||
...,
|
||||
col_mo = NULL,
|
||||
guideline = "EUCAST",
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
@@ -435,7 +469,7 @@ as.rsi.data.frame <- function(x,
|
||||
meet_criteria(x, allow_class = "data.frame") # will also check for dimensions > 0
|
||||
meet_criteria(col_mo, allow_class = "character", is_in = colnames(x), allow_NULL = TRUE)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1)
|
||||
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE)
|
||||
meet_criteria(uti, allow_class = c("logical", "character"), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(reference_data, allow_class = "data.frame")
|
||||
@@ -476,7 +510,7 @@ as.rsi.data.frame <- function(x,
|
||||
uti <- as.logical(x[, col_uti, drop = TRUE])
|
||||
}
|
||||
} else {
|
||||
# look for specimen column and make logicals of the urines
|
||||
# col_uti is still NULL - look for specimen column and make logicals of the urines
|
||||
col_specimen <- suppressMessages(search_type_in_df(x = x, type = "specimen"))
|
||||
if (!is.null(col_specimen)) {
|
||||
uti <- x[, col_specimen, drop = TRUE] %like% "urin"
|
||||
@@ -495,7 +529,7 @@ as.rsi.data.frame <- function(x,
|
||||
)
|
||||
} else {
|
||||
# no data about UTI's found
|
||||
uti <- FALSE
|
||||
uti <- NULL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,16 +635,16 @@ as.rsi.data.frame <- function(x,
|
||||
} else if (!is.rsi(x.bak[, ab_cols[i], drop = TRUE])) {
|
||||
show_message <- TRUE
|
||||
# only print message if class not already set
|
||||
message_("=> Assigning class <rsi> to already clean column '", font_bold(ab), "' (",
|
||||
message_("=> Assigning class 'rsi' to already clean column '", font_bold(ab), "' (",
|
||||
ifelse(ab_coerced != toupper(ab), paste0(ab_coerced, ", "), ""),
|
||||
ab_name(ab_coerced, tolower = TRUE), ")... ",
|
||||
ab_name(ab_coerced, tolower = TRUE, language = NULL), ")... ",
|
||||
appendLF = FALSE,
|
||||
as_note = FALSE
|
||||
)
|
||||
}
|
||||
x[, ab_cols[i]] <- as.rsi.default(x = as.character(x[, ab_cols[i], drop = TRUE]))
|
||||
if (show_message == TRUE) {
|
||||
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
|
||||
message_(" OK.", add_fn = list(font_green), as_note = FALSE)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,9 +687,9 @@ as_rsi_method <- function(method_short,
|
||||
...) {
|
||||
meet_criteria(x, allow_NA = TRUE, .call_depth = -2)
|
||||
meet_criteria(mo, allow_class = c("mo", "character"), allow_NULL = TRUE, .call_depth = -2)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), .call_depth = -2)
|
||||
meet_criteria(ab, allow_class = c("ab", "character"), has_length = 1, .call_depth = -2)
|
||||
meet_criteria(guideline, allow_class = "character", has_length = 1, .call_depth = -2)
|
||||
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)), .call_depth = -2)
|
||||
meet_criteria(uti, allow_class = "logical", has_length = c(1, length(x)), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = -2)
|
||||
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1, .call_depth = -2)
|
||||
meet_criteria(reference_data, allow_class = "data.frame", .call_depth = -2)
|
||||
@@ -694,9 +728,9 @@ as_rsi_method <- function(method_short,
|
||||
)
|
||||
}
|
||||
if (is.null(mo)) {
|
||||
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class <mo> found). See ?as.rsi.\n\n",
|
||||
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class 'mo' found). See ?as.rsi.\n\n",
|
||||
"To transform certain columns with e.g. mutate(), use `data %>% mutate(across(..., as.rsi, mo = x))`, where x is your column with microorganisms.\n",
|
||||
"To tranform all ", method_long, " in a data set, use `data %>% as.rsi()` or `data %>% mutate(across(where(is.", method_short, "), as.rsi))`.",
|
||||
"To tranform all ", method_long, " in a data set, use `data %>% as.rsi()` or `data %>% mutate_if(is.", method_short, ", as.rsi)`.",
|
||||
call = FALSE
|
||||
)
|
||||
}
|
||||
@@ -711,8 +745,9 @@ as_rsi_method <- function(method_short,
|
||||
mo.bak <- list(...)$mo.bak
|
||||
} else {
|
||||
mo.bak <- mo
|
||||
mo <- suppressWarnings(as.mo(mo))
|
||||
}
|
||||
# be sure to take current taxonomy, as the rsi_translation data set only contains current taxonomy
|
||||
mo <- suppressWarnings(suppressMessages(as.mo(mo, keep_synonyms = FALSE, inf0 = FALSE)))
|
||||
guideline_coerced <- get_guideline(guideline, reference_data)
|
||||
if (is.na(ab)) {
|
||||
message_("Returning NAs for unknown drug: '", font_bold(ab.bak),
|
||||
@@ -725,13 +760,27 @@ as_rsi_method <- function(method_short,
|
||||
if (length(mo) == 1) {
|
||||
mo <- rep(mo, length(x))
|
||||
}
|
||||
if (is.null(uti)) {
|
||||
uti <- NA
|
||||
}
|
||||
if (length(uti) == 1) {
|
||||
uti <- rep(uti, length(x))
|
||||
}
|
||||
|
||||
|
||||
if (isTRUE(add_intrinsic_resistance) && guideline_coerced %unlike% "EUCAST") {
|
||||
if (message_not_thrown_before("as.rsi", "intrinsic")) {
|
||||
warning_("in `as.rsi()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.")
|
||||
}
|
||||
}
|
||||
|
||||
agent_formatted <- paste0("'", font_bold(ab.bak), "'")
|
||||
agent_name <- ab_name(ab, tolower = TRUE, language = NULL)
|
||||
if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
|
||||
if (generalise_antibiotic_name(ab.bak) == generalise_antibiotic_name(agent_name)) {
|
||||
agent_formatted <- paste0(
|
||||
agent_formatted,
|
||||
" (", ab, ")"
|
||||
)
|
||||
} else if (generalise_antibiotic_name(ab) != generalise_antibiotic_name(agent_name)) {
|
||||
agent_formatted <- paste0(
|
||||
agent_formatted,
|
||||
" (", ifelse(ab.bak == ab, "",
|
||||
@@ -750,204 +799,208 @@ as_rsi_method <- function(method_short,
|
||||
appendLF = FALSE,
|
||||
as_note = FALSE
|
||||
)
|
||||
|
||||
msg_note <- function(messages) {
|
||||
for (i in seq_len(length(messages))) {
|
||||
messages[i] <- word_wrap(extra_indent = 5, messages[i])
|
||||
}
|
||||
message(font_green(font_bold(" * NOTE *\n")),
|
||||
paste0(" ", font_black(AMR_env$bullet_icon)," ", font_black(messages, collapse = NULL) , collapse = "\n"))
|
||||
}
|
||||
|
||||
method <- method_short
|
||||
|
||||
metadata_mo <- get_mo_failures_uncertainties_renamed()
|
||||
|
||||
x_bak <- data.frame(x_mo = paste0(x, mo), stringsAsFactors = FALSE)
|
||||
df <- unique(data.frame(x, mo, x_mo = paste0(x, mo), stringsAsFactors = FALSE))
|
||||
x <- df$x
|
||||
mo <- df$mo
|
||||
metadata_mo <- get_mo_uncertainties()
|
||||
|
||||
df <- data.frame(values = x,
|
||||
mo = mo,
|
||||
result = NA_rsi_,
|
||||
uti = uti,
|
||||
stringsAsFactors = FALSE)
|
||||
if (method == "mic") {
|
||||
x <- as.mic(x) # when as.rsi.mic is called directly
|
||||
# when as.rsi.mic is called directly
|
||||
df$values <- as.mic(df$values)
|
||||
} else if (method == "disk") {
|
||||
x <- as.disk(x) # when as.rsi.disk is called directly
|
||||
# when as.rsi.disk is called directly
|
||||
df$values <- as.disk(df$values)
|
||||
}
|
||||
|
||||
rise_warning <- FALSE
|
||||
method_param <- toupper(method)
|
||||
|
||||
genera <- mo_genus(mo, language = NULL)
|
||||
mo_genus <- as.mo(genera, language = NULL)
|
||||
mo_family <- as.mo(mo_family(mo, language = NULL))
|
||||
mo_order <- as.mo(mo_order(mo, language = NULL))
|
||||
if (any(genera == "Staphylococcus", na.rm = TRUE)) {
|
||||
mo_becker <- as.mo(mo, Becker = TRUE)
|
||||
} else {
|
||||
mo_becker <- mo
|
||||
}
|
||||
if (any(genera == "Streptococcus", na.rm = TRUE)) {
|
||||
mo_lancefield <- as.mo(mo, Lancefield = TRUE)
|
||||
} else {
|
||||
mo_lancefield <- mo
|
||||
}
|
||||
mo_other <- as.mo(rep("UNKNOWN", length(mo)))
|
||||
|
||||
new_rsi <- rep(NA_character_, length(x))
|
||||
ab_param <- ab
|
||||
|
||||
rise_note <- FALSE
|
||||
method_coerced <- toupper(method)
|
||||
ab_coerced <- ab
|
||||
mo_coerced <- mo
|
||||
|
||||
if (identical(reference_data, AMR::rsi_translation)) {
|
||||
trans <- reference_data %pm>%
|
||||
subset(guideline == guideline_coerced & method == method_param & ab == ab_param)
|
||||
if (ab_param == "AMX" && nrow(trans) == 0) {
|
||||
ab_param <- "AMP"
|
||||
if (message_not_thrown_before("as.rsi", "AMP_for_AMX")) {
|
||||
message_("(using ampicillin rules)", appendLF = FALSE, as_note = FALSE)
|
||||
}
|
||||
trans <- reference_data %pm>%
|
||||
subset(guideline == guideline_coerced & method == method_param & ab == ab_param)
|
||||
breakpoints <- reference_data %pm>%
|
||||
subset(guideline == guideline_coerced & method == method_coerced & ab == ab_coerced)
|
||||
if (ab_coerced == "AMX" && nrow(breakpoints) == 0) {
|
||||
ab_coerced <- "AMP"
|
||||
breakpoints <- reference_data %pm>%
|
||||
subset(guideline == guideline_coerced & method == method_coerced & ab == ab_coerced)
|
||||
}
|
||||
} else {
|
||||
trans <- reference_data %pm>%
|
||||
subset(method == method_param & ab == ab_param)
|
||||
breakpoints <- reference_data %pm>%
|
||||
subset(method == method_coerced & ab == ab_coerced)
|
||||
}
|
||||
|
||||
if (nrow(trans) == 0) {
|
||||
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
|
||||
load_mo_failures_uncertainties_renamed(metadata_mo)
|
||||
return(set_clean_class(factor(new_rsi, levels = c("S", "I", "R"), ordered = TRUE),
|
||||
new_class = c("rsi", "ordered", "factor")
|
||||
))
|
||||
|
||||
msgs <- character(0)
|
||||
if (nrow(breakpoints) == 0) {
|
||||
# apparently no breakpoints found
|
||||
msg_note(paste0("No ", method_coerced, " breakpoints available for ",
|
||||
suppressMessages(suppressWarnings(ab_name(ab_coerced, language = NULL, tolower = TRUE))),
|
||||
" (", ab_coerced, ")"))
|
||||
load_mo_uncertainties(metadata_mo)
|
||||
return(rep(NA_rsi_, nrow(df)))
|
||||
}
|
||||
|
||||
trans$lookup <- paste(trans$mo, trans$ab)
|
||||
|
||||
lookup_mo <- paste(mo, ab_param)
|
||||
lookup_genus <- paste(mo_genus, ab_param)
|
||||
lookup_family <- paste(mo_family, ab_param)
|
||||
lookup_order <- paste(mo_order, ab_param)
|
||||
lookup_becker <- paste(mo_becker, ab_param)
|
||||
lookup_lancefield <- paste(mo_lancefield, ab_param)
|
||||
lookup_other <- paste(mo_other, ab_param)
|
||||
|
||||
any_is_intrinsic_resistant <- FALSE
|
||||
|
||||
for (i in seq_len(length(x))) {
|
||||
is_intrinsic_r <- paste(mo[i], ab_param) %in% INTRINSIC_R
|
||||
any_is_intrinsic_resistant <- any_is_intrinsic_resistant | is_intrinsic_r
|
||||
|
||||
if (isTRUE(add_intrinsic_resistance) & is_intrinsic_r) {
|
||||
if (guideline_coerced %unlike% "EUCAST") {
|
||||
if (message_not_thrown_before("as.rsi", "intrinsic")) {
|
||||
warning_("in `as.rsi()`: using 'add_intrinsic_resistance' is only useful when using EUCAST guidelines, since the rules for intrinsic resistance are based on EUCAST.")
|
||||
}
|
||||
} else {
|
||||
new_rsi[i] <- "R"
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
get_record <- trans %pm>%
|
||||
# no subsetting to UTI here
|
||||
subset(lookup %in% c(
|
||||
lookup_mo[i],
|
||||
lookup_genus[i],
|
||||
lookup_family[i],
|
||||
lookup_order[i],
|
||||
lookup_becker[i],
|
||||
lookup_lancefield[i],
|
||||
lookup_other[i]
|
||||
))
|
||||
|
||||
if (any(nrow(get_record) == 1 && get_record$uti == TRUE, na.rm = TRUE) && !any(uti == TRUE, na.rm = TRUE) && message_not_thrown_before("as.rsi", "uti", ab_param)) {
|
||||
warning_("in `as.rsi()`: interpretation of ", font_bold(ab_name(ab_param, tolower = TRUE)), " is only available for (uncomplicated) urinary tract infections (UTI) for some microorganisms. Use argument `uti` to set which isolates are from urine. See ?as.rsi.")
|
||||
rise_warning <- TRUE
|
||||
}
|
||||
|
||||
if (isTRUE(uti[i])) {
|
||||
get_record <- get_record %pm>%
|
||||
# be as specific as possible (i.e. prefer species over genus):
|
||||
# pm_desc(uti) = TRUE on top and FALSE on bottom
|
||||
pm_arrange(pm_desc(uti), rank_index) # 'uti' is a column in data set 'rsi_translation'
|
||||
|
||||
if (guideline_coerced %like% "EUCAST") {
|
||||
any_is_intrinsic_resistant <- FALSE
|
||||
add_intrinsic_resistance_to_AMR_env()
|
||||
}
|
||||
|
||||
# run the rules
|
||||
for (mo_unique in unique(df$mo)) {
|
||||
|
||||
rows <- which(df$mo == mo_unique)
|
||||
values <- df[rows, "values", drop = TRUE]
|
||||
uti <- df[rows, "uti", drop = TRUE]
|
||||
new_rsi <- rep(NA_rsi_, length(rows))
|
||||
|
||||
# find different mo properties
|
||||
mo_current_genus <- as.mo(mo_genus(mo_unique, language = NULL))
|
||||
mo_current_family <- as.mo(mo_family(mo_unique, language = NULL))
|
||||
mo_current_order <- as.mo(mo_order(mo_unique, language = NULL))
|
||||
mo_current_class <- as.mo(mo_class(mo_unique, language = NULL))
|
||||
if (mo_genus(mo_unique, language = NULL) == "Staphylococcus") {
|
||||
mo_current_becker <- as.mo(mo_unique, Becker = TRUE)
|
||||
} else {
|
||||
get_record <- get_record %pm>%
|
||||
pm_filter(uti == FALSE) %pm>% # 'uti' is a column in rsi_translation
|
||||
pm_arrange(rank_index)
|
||||
mo_current_becker <- mo_unique
|
||||
}
|
||||
|
||||
get_record <- get_record[1L, , drop = FALSE]
|
||||
|
||||
if (NROW(get_record) > 0) {
|
||||
if (is.na(x[i]) | (is.na(get_record$breakpoint_S) & is.na(get_record$breakpoint_R))) {
|
||||
new_rsi[i] <- NA_character_
|
||||
} else if (method == "mic") {
|
||||
new_rsi[i] <- quick_case_when(
|
||||
isTRUE(conserve_capped_values) & isTRUE(x[i] %like% "^<[0-9]") ~ "S",
|
||||
isTRUE(conserve_capped_values) & isTRUE(x[i] %like% "^>[0-9]") ~ "R",
|
||||
# these basically call `<=.mic()` and `>=.mic()`:
|
||||
isTRUE(x[i] <= get_record$breakpoint_S) ~ "S",
|
||||
guideline_coerced %like% "EUCAST" & isTRUE(x[i] > get_record$breakpoint_R) ~ "R",
|
||||
guideline_coerced %like% "CLSI" & isTRUE(x[i] >= get_record$breakpoint_R) ~ "R",
|
||||
# return "I" when not match the bottom or top
|
||||
!is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I",
|
||||
if (mo_genus(mo_unique, language = NULL) == "Streptococcus") {
|
||||
mo_current_lancefield <- as.mo(mo_unique, Lancefield = TRUE)
|
||||
} else {
|
||||
mo_current_lancefield <- mo_unique
|
||||
}
|
||||
mo_current_other <- as.mo("UNKNOWN")
|
||||
# formatted for notes
|
||||
mo_formatted <- suppressMessages(suppressWarnings(mo_fullname(mo_unique, language = NULL, keep_synonyms = FALSE)))
|
||||
if (!mo_rank(mo_unique) %in% c("kingdom", "phylum", "class", "order")) {
|
||||
mo_formatted <- font_italic(mo_formatted)
|
||||
}
|
||||
ab_formatted <- paste0(suppressMessages(suppressWarnings(ab_name(ab_coerced, language = NULL, tolower = TRUE))),
|
||||
" (", ab_coerced, ")")
|
||||
|
||||
# gather all available breakpoints for current MO and sort on taxonomic rank
|
||||
# (this will prefer species breakpoints over order breakpoints)
|
||||
breakpoints_current <- breakpoints %pm>%
|
||||
subset(mo %in% c(mo_current_genus, mo_current_family,
|
||||
mo_current_order, mo_current_class,
|
||||
mo_current_becker, mo_current_lancefield,
|
||||
mo_current_other))
|
||||
|
||||
if (any(df[rows, "uti", drop = TRUE], na.rm = TRUE)) {
|
||||
breakpoints_current <- breakpoints_current %pm>%
|
||||
# be as specific as possible (i.e. prefer species over genus):
|
||||
# the below `pm_desc(uti)` will put `TRUE` on top and FALSE on bottom
|
||||
pm_arrange(rank_index, pm_desc(uti)) # 'uti' is a column in data set 'rsi_translation'
|
||||
} else {
|
||||
breakpoints_current <- breakpoints_current %pm>%
|
||||
# sort UTI = FALSE first, then UTI = TRUE
|
||||
pm_arrange(rank_index, uti)
|
||||
}
|
||||
|
||||
# throw notes for different body sites
|
||||
if (nrow(breakpoints_current) == 1 && all(breakpoints_current$uti == TRUE) && any(uti %in% c(FALSE, NA)) && message_not_thrown_before("as.rsi", "uti", ab_coerced)) {
|
||||
# only UTI breakpoints available
|
||||
warning_("in `as.rsi()`: interpretation of ", font_bold(ab_formatted), " is only available for (uncomplicated) urinary tract infections (UTI) for some microorganisms, thus assuming `uti = TRUE`. See `?as.rsi`.")
|
||||
rise_warning <- TRUE
|
||||
} else if (nrow(breakpoints_current) > 1 && length(unique(breakpoints_current$site)) > 1 && any(is.na(uti)) && all(c(TRUE, FALSE) %in% breakpoints_current$uti, na.rm = TRUE) && message_not_thrown_before("as.rsi", "siteUTI", mo_unique, ab_coerced)) {
|
||||
# both UTI and Non-UTI breakpoints available
|
||||
msgs <- c(msgs, paste0("Breakpoints for UTI ", font_underline("and"), " non-UTI available for ", ab_formatted, " in ", mo_formatted, " - assuming non-UTI. Use argument `uti` to set which isolates are from urine. See `?as.rsi`."))
|
||||
breakpoints_current <- breakpoints_current %pm>%
|
||||
pm_filter(uti == FALSE)
|
||||
} else if (nrow(breakpoints_current) > 1 && length(unique(breakpoints_current$site)) > 1 && all(breakpoints_current$uti == FALSE, na.rm = TRUE) && message_not_thrown_before("as.rsi", "siteOther", mo_unique, ab_coerced)) {
|
||||
# breakpoints for multiple body sites available
|
||||
site <- breakpoints_current[1L, "site", drop = FALSE] # this is the one we'll take
|
||||
if (is.na(site)) {
|
||||
site <- paste0("an unspecified body site")
|
||||
} else {
|
||||
site <- paste0("body site '", site, "'")
|
||||
}
|
||||
msgs <- c(msgs, paste0("Multiple breakpoints available for ", ab_formatted, " in ", mo_formatted, " - assuming ", site, "."))
|
||||
}
|
||||
|
||||
# first check if mo is intrinsic resistant
|
||||
if (isTRUE(add_intrinsic_resistance) && guideline_coerced %like% "EUCAST" && paste(mo_unique, ab_coerced) %in% AMR_env$intrinsic_resistant) {
|
||||
msgs <- c(msgs, paste0("Intrinsic resistance applied for ", ab_formatted, " in ", mo_formatted, ""))
|
||||
new_rsi <- rep(as.rsi("R"), length(rows))
|
||||
|
||||
} else {
|
||||
# then run the rules
|
||||
breakpoints_current <- breakpoints_current[1L, , drop = FALSE]
|
||||
|
||||
if (method == "mic") {
|
||||
new_rsi <- quick_case_when(
|
||||
is.na(values) ~ NA_rsi_,
|
||||
values <= breakpoints_current$breakpoint_S ~ as.rsi("S"),
|
||||
guideline_coerced %like% "EUCAST" & values > breakpoints_current$breakpoint_R ~ as.rsi("R"),
|
||||
guideline_coerced %like% "CLSI" & values >= breakpoints_current$breakpoint_R ~ as.rsi("R"),
|
||||
# return "I" when breakpoints are in the middle
|
||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) ~ as.rsi("I"),
|
||||
# and NA otherwise
|
||||
TRUE ~ NA_character_
|
||||
TRUE ~ NA_rsi_
|
||||
)
|
||||
|
||||
} else if (method == "disk") {
|
||||
new_rsi[i] <- quick_case_when(
|
||||
isTRUE(as.double(x[i]) >= as.double(get_record$breakpoint_S)) ~ "S",
|
||||
guideline_coerced %like% "EUCAST" & isTRUE(as.double(x[i]) < as.double(get_record$breakpoint_R)) ~ "R",
|
||||
guideline_coerced %like% "CLSI" & isTRUE(as.double(x[i]) <= as.double(get_record$breakpoint_R)) ~ "R",
|
||||
# return "I" when not match the bottom or top
|
||||
!is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I",
|
||||
new_rsi <- quick_case_when(
|
||||
is.na(values) ~ NA_rsi_,
|
||||
as.double(values) >= as.double(breakpoints_current$breakpoint_S) ~ as.rsi("S"),
|
||||
guideline_coerced %like% "EUCAST" & as.double(values) < as.double(breakpoints_current$breakpoint_R) ~ as.rsi("R"),
|
||||
guideline_coerced %like% "CLSI" & as.double(values) <= as.double(breakpoints_current$breakpoint_R) ~ as.rsi("R"),
|
||||
# return "I" when breakpoints are in the middle
|
||||
!is.na(breakpoints_current$breakpoint_S) & !is.na(breakpoints_current$breakpoint_R) ~ as.rsi("I"),
|
||||
# and NA otherwise
|
||||
TRUE ~ NA_character_
|
||||
TRUE ~ NA_rsi_
|
||||
)
|
||||
}
|
||||
|
||||
# write to verbose output
|
||||
pkg_env$rsi_interpretation_history <- rbind(
|
||||
pkg_env$rsi_interpretation_history,
|
||||
AMR_env$rsi_interpretation_history <- rbind(
|
||||
AMR_env$rsi_interpretation_history,
|
||||
# recycling 1 to 2 rows does not seem to work, which is why rep() was added
|
||||
data.frame(
|
||||
datetime = Sys.time(),
|
||||
index = i,
|
||||
ab_input = ab.bak[1],
|
||||
ab_considered = ab[1],
|
||||
mo_input = mo.bak[1],
|
||||
mo_considered = mo[1],
|
||||
guideline = guideline_coerced,
|
||||
ref_table = get_record[, "ref_tbl", drop = TRUE],
|
||||
method = method,
|
||||
breakpoint_S = get_record[, "breakpoint_S", drop = TRUE],
|
||||
breakpoint_R = get_record[, "breakpoint_R", drop = TRUE],
|
||||
input = as.double(x[i]),
|
||||
interpretation = new_rsi[i],
|
||||
datetime = rep(Sys.time(), length(rows)),
|
||||
index = rows,
|
||||
ab_input = rep(ab.bak, length(rows)),
|
||||
ab_guideline = rep(ab_coerced, length(rows)),
|
||||
mo_input = rep(mo.bak[match(mo_unique, df$mo)][1], length(rows)),
|
||||
mo_guideline = rep(breakpoints_current[, "mo", drop = TRUE], length(rows)),
|
||||
guideline = rep(guideline_coerced, length(rows)),
|
||||
ref_table = rep(breakpoints_current[, "ref_tbl", drop = TRUE], length(rows)),
|
||||
method = rep(method_coerced, length(rows)),
|
||||
input = as.double(values),
|
||||
outcome = as.rsi(new_rsi),
|
||||
breakpoint_S_R = rep(paste0(breakpoints_current[, "breakpoint_S", drop = TRUE], "-", breakpoints_current[, "breakpoint_R", drop = TRUE]), length(rows)),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
df[rows, "result"] <- new_rsi
|
||||
}
|
||||
|
||||
if (any_is_intrinsic_resistant & guideline_coerced %like% "EUCAST" & !isTRUE(add_intrinsic_resistance)) {
|
||||
# found some intrinsic resistance, but was not applied
|
||||
if (message_not_thrown_before("as.rsi", "unapplied_instrinsic")) {
|
||||
warning_("in `as.rsi()`: found intrinsic resistance in some bug/drug combinations, although it was not applied.\nUse `as.rsi(..., add_intrinsic_resistance = TRUE)` to apply it.")
|
||||
}
|
||||
rise_warning <- TRUE
|
||||
}
|
||||
|
||||
new_rsi <- x_bak %pm>%
|
||||
pm_left_join(data.frame(
|
||||
x_mo = paste0(x, mo), new_rsi,
|
||||
stringsAsFactors = FALSE
|
||||
),
|
||||
by = "x_mo"
|
||||
) %pm>%
|
||||
pm_pull(new_rsi)
|
||||
|
||||
|
||||
if (isTRUE(rise_warning)) {
|
||||
message_("WARNING.", add_fn = list(font_yellow, font_bold), as_note = FALSE)
|
||||
message(font_yellow(font_bold(" * WARNING *")))
|
||||
} else if (length(msgs) == 0) {
|
||||
message(font_green(" OK."))
|
||||
} else {
|
||||
message_(" OK.", add_fn = list(font_green, font_bold), as_note = FALSE)
|
||||
msg_note(sort(msgs))
|
||||
}
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata_mo)
|
||||
|
||||
set_clean_class(factor(new_rsi, levels = c("S", "I", "R"), ordered = TRUE),
|
||||
new_class = c("rsi", "ordered", "factor")
|
||||
)
|
||||
|
||||
load_mo_uncertainties(metadata_mo)
|
||||
|
||||
df$result
|
||||
}
|
||||
|
||||
#' @rdname as.rsi
|
||||
@@ -956,20 +1009,20 @@ as_rsi_method <- function(method_short,
|
||||
rsi_interpretation_history <- function(clean = FALSE) {
|
||||
meet_criteria(clean, allow_class = "logical", has_length = 1)
|
||||
|
||||
out.bak <- pkg_env$rsi_interpretation_history
|
||||
out.bak <- AMR_env$rsi_interpretation_history
|
||||
out <- out.bak
|
||||
if (NROW(out) == 0) {
|
||||
message_("No results to return. Run `as.rsi()` on MIC values or disk diffusion zones first to see a 'logbook' data set here.")
|
||||
return(NULL)
|
||||
return(invisible(NULL))
|
||||
}
|
||||
out$ab_considered <- as.ab(out$ab_considered)
|
||||
out$mo_considered <- as.mo(out$mo_considered)
|
||||
out$interpretation <- as.rsi(out$interpretation)
|
||||
out$ab_guideline <- as.ab(out$ab_guideline)
|
||||
out$mo_guideline <- as.mo(out$mo_guideline)
|
||||
out$outcome <- as.rsi(out$outcome)
|
||||
# keep stored for next use
|
||||
if (isTRUE(clean)) {
|
||||
pkg_env$rsi_interpretation_history <- pkg_env$rsi_interpretation_history[0, , drop = FALSE]
|
||||
AMR_env$rsi_interpretation_history <- AMR_env$rsi_interpretation_history[0, , drop = FALSE]
|
||||
} else {
|
||||
pkg_env$rsi_interpretation_history <- out.bak
|
||||
AMR_env$rsi_interpretation_history <- out.bak
|
||||
}
|
||||
|
||||
if (pkg_is_available("tibble", also_load = FALSE)) {
|
||||
@@ -985,10 +1038,10 @@ pillar_shaft.rsi <- function(x, ...) {
|
||||
if (has_colour()) {
|
||||
# colours will anyway not work when has_colour() == FALSE,
|
||||
# but then the indentation should also not be applied
|
||||
out[is.na(x)] <- font_grey(" NA")
|
||||
out[x == "R"] <- font_rsi_R_bg(font_black(" R "))
|
||||
out[x == "S"] <- font_rsi_S_bg(font_black(" S "))
|
||||
out[x == "I"] <- font_rsi_I_bg(font_black(" I "))
|
||||
out[is.na(x)] <- font_grey(" NA")
|
||||
out[x == "R"] <- font_red_bg(" R ")
|
||||
out[x == "S"] <- font_green_bg(" S ")
|
||||
out[x == "I"] <- font_orange_bg(" I ")
|
||||
}
|
||||
create_pillar_column(out, align = "left", width = 5)
|
||||
}
|
||||
@@ -1078,7 +1131,7 @@ get_skimmers.rsi <- function(column) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.rsi <- function(x, ...) {
|
||||
cat("Class <rsi>\n")
|
||||
cat("Class 'rsi'\n")
|
||||
print(as.character(x), quote = FALSE)
|
||||
}
|
||||
|
||||
|
||||
+53
-61
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -36,11 +40,11 @@ rsi_calc <- function(...,
|
||||
as_percent = FALSE,
|
||||
only_all_tested = FALSE,
|
||||
only_count = FALSE) {
|
||||
meet_criteria(ab_result, allow_class = c("character", "numeric", "integer"), has_length = c(1, 2, 3), .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE, .call_depth = 1)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(only_count, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(ab_result, allow_class = c("character", "numeric", "integer"), has_length = c(1, 2, 3))
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(only_count, allow_class = "logical", has_length = 1)
|
||||
|
||||
data_vars <- dots2vars(...)
|
||||
|
||||
@@ -72,7 +76,7 @@ rsi_calc <- function(...,
|
||||
} else {
|
||||
dots <- dots[2:length(dots)]
|
||||
}
|
||||
if (length(dots) == 0 | all(dots == "df")) {
|
||||
if (length(dots) == 0 || all(dots == "df")) {
|
||||
# for complete data.frames, like example_isolates %pm>% select(AMC, GEN) %pm>% proportion_S()
|
||||
# and the old rsi function, which has "df" as name of the first argument
|
||||
x <- dots_df
|
||||
@@ -116,7 +120,7 @@ rsi_calc <- function(...,
|
||||
if (is.data.frame(x)) {
|
||||
rsi_integrity_check <- character(0)
|
||||
for (i in seq_len(ncol(x))) {
|
||||
# check integrity of columns: force <rsi> class
|
||||
# check integrity of columns: force 'rsi' class
|
||||
if (!is.rsi(x[, i, drop = TRUE])) {
|
||||
rsi_integrity_check <- c(rsi_integrity_check, as.character(x[, i, drop = TRUE]))
|
||||
x[, i] <- suppressWarnings(as.rsi(x[, i, drop = TRUE])) # warning will be given later
|
||||
@@ -137,12 +141,12 @@ rsi_calc <- function(...,
|
||||
FUN = min
|
||||
)
|
||||
numerator <- sum(as.integer(y) %in% as.integer(ab_result), na.rm = TRUE)
|
||||
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(any(is.na(y)))))
|
||||
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(anyNA(y))))
|
||||
} else {
|
||||
# may contain NAs in any column
|
||||
other_values <- setdiff(c(NA, levels(ab_result)), ab_result)
|
||||
numerator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) any(y %in% ab_result, na.rm = TRUE)))
|
||||
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(all(y %in% other_values) & any(is.na(y)))))
|
||||
denominator <- sum(vapply(FUN.VALUE = logical(1), x_transposed, function(y) !(all(y %in% other_values) & anyNA(y))))
|
||||
}
|
||||
} else {
|
||||
# x is not a data.frame
|
||||
@@ -156,9 +160,8 @@ rsi_calc <- function(...,
|
||||
|
||||
if (print_warning == TRUE) {
|
||||
if (message_not_thrown_before("rsi_calc")) {
|
||||
warning_("Increase speed by transforming to class <rsi> on beforehand:\n",
|
||||
" your_data %>% mutate_if(is.rsi.eligible, as.rsi)\n",
|
||||
" your_data %>% mutate(across(where(is.rsi.eligible), as.rsi))",
|
||||
warning_("Increase speed by transforming to class 'rsi' on beforehand:\n",
|
||||
" your_data %>% mutate_if(is.rsi.eligible, as.rsi)",
|
||||
call = FALSE
|
||||
)
|
||||
}
|
||||
@@ -217,23 +220,15 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE,
|
||||
combine_SI_missing = FALSE) {
|
||||
meet_criteria(type, is_in = c("proportion", "count", "both"), has_length = 1, .call_depth = 1)
|
||||
meet_criteria(data, allow_class = "data.frame", contains_column_class = "rsi", .call_depth = 1)
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE, .call_depth = 1)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE, .call_depth = 1)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE, .call_depth = 1)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
meet_criteria(combine_SI_missing, allow_class = "logical", has_length = 1, .call_depth = 1)
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
if (isTRUE(combine_IR) & isTRUE(combine_SI_missing)) {
|
||||
combine_SI <- FALSE
|
||||
}
|
||||
stop_if(isTRUE(combine_SI) & isTRUE(combine_IR), "either `combine_SI` or `combine_IR` can be TRUE, not both", call = -2)
|
||||
confidence_level = 0.95) {
|
||||
meet_criteria(type, is_in = c("proportion", "count", "both"), has_length = 1)
|
||||
meet_criteria(data, allow_class = "data.frame", contains_column_class = "rsi")
|
||||
meet_criteria(translate_ab, allow_class = c("character", "logical"), has_length = 1, allow_NA = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_finite = TRUE)
|
||||
meet_criteria(as_percent, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(confidence_level, allow_class = "numeric", has_length = 1)
|
||||
|
||||
translate_ab <- get_translate_ab(translate_ab)
|
||||
|
||||
@@ -249,15 +244,11 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
}
|
||||
|
||||
data <- as.data.frame(data, stringsAsFactors = FALSE)
|
||||
if (isTRUE(combine_SI) | isTRUE(combine_IR)) {
|
||||
if (isTRUE(combine_SI)) {
|
||||
for (i in seq_len(ncol(data))) {
|
||||
if (is.rsi(data[, i, drop = TRUE])) {
|
||||
data[, i] <- as.character(data[, i, drop = TRUE])
|
||||
if (isTRUE(combine_SI)) {
|
||||
data[, i] <- gsub("(I|S)", "SI", data[, i, drop = TRUE])
|
||||
} else if (isTRUE(combine_IR)) {
|
||||
data[, i] <- gsub("(I|R)", "IR", data[, i, drop = TRUE])
|
||||
}
|
||||
data[, i] <- gsub("(I|S)", "SI", data[, i, drop = TRUE])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,6 +258,8 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
antibiotic = character(0),
|
||||
interpretation = character(0),
|
||||
value = double(0),
|
||||
ci_min = double(0),
|
||||
ci_max = double(0),
|
||||
isolates = integer(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
@@ -279,8 +272,6 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
values <- .data[, i, drop = TRUE]
|
||||
if (isTRUE(combine_SI)) {
|
||||
values <- factor(values, levels = c("SI", "R"), ordered = TRUE)
|
||||
} else if (isTRUE(combine_IR)) {
|
||||
values <- factor(values, levels = c("S", "IR"), ordered = TRUE)
|
||||
} else {
|
||||
values <- factor(values, levels = c("S", "I", "R"), ordered = TRUE)
|
||||
}
|
||||
@@ -290,8 +281,23 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
if (NROW(col_results) > 0 && sum(col_results$isolates, na.rm = TRUE) > 0) {
|
||||
if (sum(col_results$isolates, na.rm = TRUE) >= minimum) {
|
||||
col_results$value <- col_results$isolates / sum(col_results$isolates, na.rm = TRUE)
|
||||
ci <- lapply(
|
||||
col_results$isolates,
|
||||
function(x) {
|
||||
stats::binom.test(
|
||||
x = x,
|
||||
n = sum(col_results$isolates, na.rm = TRUE),
|
||||
conf.level = confidence_level
|
||||
)$conf.int
|
||||
}
|
||||
)
|
||||
col_results$ci_min <- vapply(FUN.VALUE = double(1), ci, `[`, 1)
|
||||
col_results$ci_max <- vapply(FUN.VALUE = double(1), ci, `[`, 2)
|
||||
} else {
|
||||
col_results$value <- rep(NA_real_, NROW(col_results))
|
||||
# confidence intervals also to NA
|
||||
col_results$ci_min <- col_results$value
|
||||
col_results$ci_max <- col_results$value
|
||||
}
|
||||
out_new <- data.frame(
|
||||
antibiotic = ifelse(isFALSE(translate_ab),
|
||||
@@ -300,6 +306,8 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
),
|
||||
interpretation = col_results$interpretation,
|
||||
value = col_results$value,
|
||||
ci_min = col_results$ci_min,
|
||||
ci_max = col_results$ci_max,
|
||||
isolates = col_results$isolates,
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
@@ -339,10 +347,8 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
# apply factors for right sorting in interpretation
|
||||
if (isTRUE(combine_SI)) {
|
||||
out$interpretation <- factor(out$interpretation, levels = c("SI", "R"), ordered = TRUE)
|
||||
} else if (isTRUE(combine_IR)) {
|
||||
out$interpretation <- factor(out$interpretation, levels = c("S", "IR"), ordered = TRUE)
|
||||
} else {
|
||||
# don't use as.rsi() here, as it would add the class <rsi> and we would like
|
||||
# don't use as.rsi() here, as it would add the class 'rsi' and we would like
|
||||
# the same data structure as output, regardless of input
|
||||
out$interpretation <- factor(out$interpretation, levels = c("S", "I", "R"), ordered = TRUE)
|
||||
}
|
||||
@@ -355,30 +361,16 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
|
||||
}
|
||||
|
||||
if (type == "proportion") {
|
||||
# remove number of isolates
|
||||
out <- subset(out, select = -c(isolates))
|
||||
} else if (type == "count") {
|
||||
# set value to be number of isolates
|
||||
out$value <- out$isolates
|
||||
out <- subset(out, select = -c(isolates))
|
||||
# remove redundant columns
|
||||
out <- subset(out, select = -c(ci_min, ci_max, isolates))
|
||||
}
|
||||
|
||||
rownames(out) <- NULL
|
||||
out <- as_original_data_class(out, class(data.bak))
|
||||
structure(out, class = c("rsi_df", class(out)))
|
||||
}
|
||||
|
||||
get_translate_ab <- function(translate_ab) {
|
||||
translate_ab <- as.character(translate_ab)[1L]
|
||||
if (translate_ab %in% c("TRUE", "official")) {
|
||||
return("name")
|
||||
} else if (translate_ab %in% c(NA_character_, "FALSE")) {
|
||||
return(FALSE)
|
||||
} else {
|
||||
translate_ab <- tolower(translate_ab)
|
||||
stop_ifnot(translate_ab %in% colnames(AMR::antibiotics),
|
||||
"invalid value for 'translate_ab', this must be a column name of the antibiotics data set\n",
|
||||
"or TRUE (equals 'name') or FALSE to not translate at all.",
|
||||
call = FALSE
|
||||
)
|
||||
translate_ab
|
||||
}
|
||||
}
|
||||
|
||||
+20
-14
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -31,16 +35,18 @@ rsi_df <- function(data,
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
combine_IR = FALSE) {
|
||||
rsi_calc_df(
|
||||
type = "both",
|
||||
data = data,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
combine_SI = combine_SI,
|
||||
combine_IR = combine_IR,
|
||||
combine_SI_missing = missing(combine_SI)
|
||||
confidence_level = 0.95) {
|
||||
tryCatch(
|
||||
rsi_calc_df(
|
||||
type = "both",
|
||||
data = data,
|
||||
translate_ab = translate_ab,
|
||||
language = language,
|
||||
minimum = minimum,
|
||||
as_percent = as_percent,
|
||||
combine_SI = combine_SI,
|
||||
confidence_level = confidence_level
|
||||
),
|
||||
error = function(e) stop_(gsub("in rsi_calc_df(): ", "", e$message, fixed = TRUE), call = -5)
|
||||
)
|
||||
}
|
||||
|
||||
+8
-4
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -46,7 +50,7 @@ skewness <- function(x, na.rm = FALSE) {
|
||||
skewness.default <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
x <- as.vector(x)
|
||||
if (na.rm == TRUE) {
|
||||
if (isTRUE(na.rm)) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
n <- length(x)
|
||||
|
||||
Binary file not shown.
+70
-46
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -27,17 +31,29 @@
|
||||
#'
|
||||
#' For language-dependent output of AMR functions, like [mo_name()], [mo_gramstain()], [mo_type()] and [ab_name()].
|
||||
#' @param x text to translate
|
||||
#' @param language language to choose. Use one of these supported language names or ISO-639-1 codes: `r paste0('"', sapply(LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]), '" ("' , LANGUAGES_SUPPORTED, '")', collapse = ", ")`.
|
||||
#' @details The currently `r length(LANGUAGES_SUPPORTED)` supported languages are `r vector_and(sapply(LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]), quotes = FALSE, sort = FALSE)`. All these languages have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
#' @param language language to choose. Use 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)`.
|
||||
#' @details The currently `r length(LANGUAGES_SUPPORTED)` supported languages are `r vector_or(paste0(sapply(LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]), " (" , LANGUAGES_SUPPORTED, ")"), quotes = FALSE, sort = FALSE)`. All these languages have translations available for all antimicrobial drugs and colloquial microorganism names.
|
||||
#'
|
||||
#' **To silence language notes when this package loads** on a non-English operating system, you can set the option `AMR_locale` in your `.Rprofile` file like this:
|
||||
#'
|
||||
#' ```r
|
||||
#' # Open .Rprofile file
|
||||
#' utils::file.edit("~/.Rprofile")
|
||||
#'
|
||||
#' # Add e.g. Italian support to that file using:
|
||||
#' options(AMR_locale = "Italian")
|
||||
#' ```
|
||||
#'
|
||||
#' And then save the file.
|
||||
#'
|
||||
#' Please read about adding or updating a language in [our Wiki](https://github.com/msberends/AMR/wiki/).
|
||||
#'
|
||||
#' ## Changing the Default Language
|
||||
#' ### Changing the Default Language
|
||||
#' The system language will be used at default (as returned by `Sys.getenv("LANG")` or, if `LANG` is not set, [`Sys.getlocale("LC_COLLATE")`][Sys.getlocale()]), if that language is supported. But the language to be used can be overwritten in two ways and will be checked in this order:
|
||||
#'
|
||||
#' 1. Setting the R option `AMR_locale`, either by using `set_AMR_locale()` or by running e.g. `options(AMR_locale = "de")`.
|
||||
#' 1. Setting the R option `AMR_locale`, either by using e.g. `set_AMR_locale("German")` or by running e.g. `options(AMR_locale = "German")`.
|
||||
#'
|
||||
#' Note that setting an \R option only works in the same session. Save the command `options(AMR_locale = "(your language)")` to your `.Rprofile` file to apply it for every session.
|
||||
#' Note that setting an \R option only works in the same session. Save the command `options(AMR_locale = "(your language)")` to your `.Rprofile` file to apply it for every session. Run `utils::file.edit("~/.Rprofile")` to edit your `.Rprofile` file.
|
||||
#' 2. Setting the system variable `LANGUAGE` or `LANG`, e.g. by adding `LANGUAGE="de_DE.utf8"` to your `.Renviron` file in your home directory.
|
||||
#'
|
||||
#' Thus, if the R option `AMR_locale` is set, the system variables `LANGUAGE` and `LANG` will be ignored.
|
||||
@@ -47,16 +63,22 @@
|
||||
#' @examples
|
||||
#' # Current settings (based on system language)
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#' mo_name("Coagulase-negative Staphylococcus (CoNS)")
|
||||
#'
|
||||
#' # setting another language
|
||||
#' set_AMR_locale("Greek")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#'
|
||||
#' set_AMR_locale("Spanish")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#' mo_name("Coagulase-negative Staphylococcus (CoNS)")
|
||||
#'
|
||||
#' # setting yet another language
|
||||
#' set_AMR_locale("Greek")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus (CoNS)")
|
||||
#'
|
||||
#' # setting yet another language
|
||||
#' set_AMR_locale("Ukrainian")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus (CoNS)")
|
||||
#'
|
||||
#' # set_AMR_locale() understands endonyms, English exonyms, and ISO-639-1:
|
||||
#' set_AMR_locale("Deutsch")
|
||||
@@ -69,7 +91,6 @@ get_AMR_locale <- function() {
|
||||
if (!is.null(getOption("AMR_locale", default = NULL))) {
|
||||
return(validate_language(getOption("AMR_locale"), extra_txt = "set with `options(AMR_locale = ...)`"))
|
||||
}
|
||||
|
||||
lang <- ""
|
||||
# now check the LANGUAGE system variable - return it if set
|
||||
if (!identical("", Sys.getenv("LANGUAGE"))) {
|
||||
@@ -81,16 +102,7 @@ get_AMR_locale <- function() {
|
||||
if (lang == "") {
|
||||
lang <- Sys.getlocale("LC_COLLATE")
|
||||
}
|
||||
|
||||
lang <- find_language(lang)
|
||||
if (lang != "en" && interactive() && message_not_thrown_before("get_AMR_locale", entire_session = TRUE)) {
|
||||
message_(
|
||||
"Assuming the ", LANGUAGES_SUPPORTED_NAMES[[lang]]$exonym, " language (",
|
||||
LANGUAGES_SUPPORTED_NAMES[[lang]]$endonym, ") for the AMR package. Change this with `set_AMR_locale()`. ",
|
||||
"This note will be shown once per session."
|
||||
)
|
||||
}
|
||||
lang
|
||||
find_language(lang)
|
||||
}
|
||||
|
||||
#' @rdname translate
|
||||
@@ -98,13 +110,28 @@ get_AMR_locale <- function() {
|
||||
set_AMR_locale <- function(language) {
|
||||
language <- validate_language(language)
|
||||
options(AMR_locale = language)
|
||||
message_("Using the ", LANGUAGES_SUPPORTED_NAMES[[language]]$exonym, " language (", LANGUAGES_SUPPORTED_NAMES[[language]]$endonym, ") for the AMR package for this session.")
|
||||
if (interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true")) {
|
||||
# show which language to use now
|
||||
message_(
|
||||
"Using ", LANGUAGES_SUPPORTED_NAMES[[language]]$exonym,
|
||||
ifelse(language != "en",
|
||||
paste0(" (", LANGUAGES_SUPPORTED_NAMES[[language]]$endonym, ")"),
|
||||
""
|
||||
),
|
||||
" for the AMR package for this session."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname translate
|
||||
#' @export
|
||||
reset_AMR_locale <- function() {
|
||||
options(AMR_locale = NULL)
|
||||
if (interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true")) {
|
||||
# show which language to use now
|
||||
language <- suppressMessages(get_AMR_locale())
|
||||
message_("Using the ", LANGUAGES_SUPPORTED_NAMES[[language]]$exonym, " language (", LANGUAGES_SUPPORTED_NAMES[[language]]$endonym, ") for the AMR package for this session.")
|
||||
}
|
||||
}
|
||||
|
||||
#' @rdname translate
|
||||
@@ -115,10 +142,10 @@ translate_AMR <- function(x, language = get_AMR_locale()) {
|
||||
|
||||
|
||||
validate_language <- function(language, extra_txt = character(0)) {
|
||||
if (trimws(tolower(language)) %in% c("en", "english", "", "false", NA)) {
|
||||
if (isTRUE(trimws2(tolower(language[1])) %in% c("en", "english", "", "false", NA)) || length(language) == 0) {
|
||||
return("en")
|
||||
}
|
||||
lang <- find_language(language, fallback = FALSE)
|
||||
lang <- find_language(language[1], fallback = FALSE)
|
||||
stop_ifnot(length(lang) > 0 && lang %in% LANGUAGES_SUPPORTED,
|
||||
"unsupported language for AMR package", extra_txt, ": \"", language, "\". Use one of these language names or ISO-639-1 codes: ",
|
||||
paste0('"', vapply(FUN.VALUE = character(1), LANGUAGES_SUPPORTED_NAMES, function(x) x[[1]]),
|
||||
@@ -131,20 +158,20 @@ validate_language <- function(language, extra_txt = character(0)) {
|
||||
}
|
||||
|
||||
find_language <- function(language, fallback = TRUE) {
|
||||
language <- Map(function(l, n, check = language) {
|
||||
grepl(paste0(
|
||||
"^(", l[1], "|", l[2], "|",
|
||||
n, "(_|$)|", toupper(n), "(_|$))"
|
||||
),
|
||||
check,
|
||||
ignore.case = FALSE,
|
||||
perl = TRUE,
|
||||
useBytes = FALSE
|
||||
)
|
||||
},
|
||||
LANGUAGES_SUPPORTED_NAMES,
|
||||
LANGUAGES_SUPPORTED,
|
||||
USE.NAMES = TRUE
|
||||
language <- Map(LANGUAGES_SUPPORTED_NAMES,
|
||||
LANGUAGES_SUPPORTED,
|
||||
f = function(l, n, check = language) {
|
||||
grepl(paste0(
|
||||
"^(", l[1], "|", l[2], "|",
|
||||
n, "(_|$)|", toupper(n), "(_|$))"
|
||||
),
|
||||
check,
|
||||
ignore.case = TRUE,
|
||||
perl = TRUE,
|
||||
useBytes = FALSE
|
||||
)
|
||||
},
|
||||
USE.NAMES = TRUE
|
||||
)
|
||||
language <- names(which(language == TRUE))
|
||||
if (isTRUE(fallback) && length(language) == 0) {
|
||||
@@ -160,10 +187,7 @@ translate_into_language <- function(from,
|
||||
only_unknown = FALSE,
|
||||
only_affect_ab_names = FALSE,
|
||||
only_affect_mo_names = FALSE) {
|
||||
if (is.null(language)) {
|
||||
return(from)
|
||||
}
|
||||
if (language %in% c("en", "", NA)) {
|
||||
if (is.null(language) || language[1] %in% c("en", "", NA)) {
|
||||
return(from)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -60,7 +64,24 @@ vec_ptype2.ab.character <- function(x, y, ...) {
|
||||
y
|
||||
}
|
||||
vec_cast.character.ab <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
as.character(x)
|
||||
}
|
||||
vec_cast.ab.character <- function(x, to, ...) {
|
||||
return_after_integrity_check(x, "antimicrobial drug code", as.character(AMR_env$AB_lookup$ab))
|
||||
}
|
||||
|
||||
# S3: av
|
||||
vec_ptype2.character.av <- function(x, y, ...) {
|
||||
x
|
||||
}
|
||||
vec_ptype2.av.character <- function(x, y, ...) {
|
||||
y
|
||||
}
|
||||
vec_cast.character.av <- function(x, to, ...) {
|
||||
as.character(x)
|
||||
}
|
||||
vec_cast.av.character <- function(x, to, ...) {
|
||||
return_after_integrity_check(x, "antiviral drug code", as.character(AMR_env$AV_lookup$av))
|
||||
}
|
||||
|
||||
# S3: mo
|
||||
@@ -71,7 +92,10 @@ vec_ptype2.mo.character <- function(x, y, ...) {
|
||||
y
|
||||
}
|
||||
vec_cast.character.mo <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
as.character(x)
|
||||
}
|
||||
vec_cast.mo.character <- function(x, to, ...) {
|
||||
return_after_integrity_check(x, "microorganism code", as.character(AMR::microorganisms$mo))
|
||||
}
|
||||
|
||||
# S3: disk
|
||||
@@ -84,15 +108,49 @@ vec_ptype2.disk.integer <- function(x, y, ...) {
|
||||
vec_cast.integer.disk <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
}
|
||||
vec_cast.disk.integer <- function(x, to, ...) {
|
||||
as.disk(x)
|
||||
}
|
||||
vec_cast.double.disk <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
}
|
||||
vec_cast.disk.double <- function(x, to, ...) {
|
||||
as.disk(x)
|
||||
}
|
||||
vec_cast.character.disk <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
}
|
||||
vec_cast.disk.character <- function(x, to, ...) {
|
||||
as.disk(x)
|
||||
}
|
||||
|
||||
# S3: mic
|
||||
vec_cast.character.mic <- function(x, to, ...) {
|
||||
as.character(x)
|
||||
}
|
||||
vec_cast.double.mic <- function(x, to, ...) {
|
||||
# this calls as.double.mic()
|
||||
as.double(x)
|
||||
}
|
||||
vec_cast.mic.double <- function(x, to, ...) {
|
||||
as.mic(x)
|
||||
}
|
||||
vec_cast.mic.character <- function(x, to, ...) {
|
||||
as.mic(x)
|
||||
}
|
||||
vec_math.mic <- function(.fn, x, ...) {
|
||||
.fn(as.double(x), ...)
|
||||
}
|
||||
|
||||
# S3: rsi
|
||||
vec_ptype2.character.rsi <- function(x, y, ...) {
|
||||
x
|
||||
}
|
||||
vec_ptype2.rsi.character <- function(x, y, ...) {
|
||||
y
|
||||
}
|
||||
vec_cast.character.rsi <- function(x, to, ...) {
|
||||
as.character(x)
|
||||
}
|
||||
vec_cast.rsi.character <- function(x, to, ...) {
|
||||
as.rsi(x)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -24,16 +28,34 @@
|
||||
# ==================================================================== #
|
||||
|
||||
# set up package environment, used by numerous AMR functions
|
||||
pkg_env <- new.env(hash = FALSE)
|
||||
pkg_env$mo_failed <- character(0)
|
||||
pkg_env$mo_field_abbreviations <- c(
|
||||
"AIEC", "ATEC", "BORSA", "CRSM", "DAEC", "EAEC",
|
||||
"EHEC", "EIEC", "EPEC", "ETEC", "GISA", "MRPA",
|
||||
"MRSA", "MRSE", "MSSA", "MSSE", "NMEC", "PISP",
|
||||
"PRSP", "STEC", "UPEC", "VISA", "VISP", "VRE",
|
||||
"VRSA", "VRSP"
|
||||
AMR_env <- new.env(hash = FALSE)
|
||||
AMR_env$mo_uncertainties <- data.frame(
|
||||
original_input = character(0),
|
||||
input = character(0),
|
||||
fullname = character(0),
|
||||
mo = character(0),
|
||||
candidates = character(0),
|
||||
minimum_matching_score = integer(0),
|
||||
keep_synonyms = logical(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
pkg_env$rsi_interpretation_history <- data.frame(
|
||||
AMR_env$mo_renamed <- list()
|
||||
AMR_env$mo_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
mo = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$ab_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
ab = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$av_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
av = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$rsi_interpretation_history <- data.frame(
|
||||
datetime = Sys.time()[0],
|
||||
index = integer(0),
|
||||
ab_input = character(0),
|
||||
@@ -49,6 +71,8 @@ pkg_env$rsi_interpretation_history <- data.frame(
|
||||
interpretation = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$custom_ab_codes <- character(0)
|
||||
AMR_env$is_dark_theme <- NULL
|
||||
|
||||
# determine info icon for messages
|
||||
utf8_supported <- isTRUE(base::l10n_info()$`UTF-8`)
|
||||
@@ -57,26 +81,30 @@ is_latex <- tryCatch(import_fn("is_latex_output", "knitr", error_on_fail = FALSE
|
||||
)
|
||||
if (utf8_supported && !is_latex) {
|
||||
# \u2139 is a symbol officially named 'information source'
|
||||
pkg_env$info_icon <- "\u2139"
|
||||
AMR_env$info_icon <- "\u2139"
|
||||
AMR_env$bullet_icon <- "\u2022"
|
||||
} else {
|
||||
pkg_env$info_icon <- "i"
|
||||
AMR_env$info_icon <- "i"
|
||||
AMR_env$bullet_icon <- "*"
|
||||
}
|
||||
|
||||
.onLoad <- function(...) {
|
||||
.onLoad <- function(lib, pkg) {
|
||||
# Support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
|
||||
# without the need to depend on other packages. This was suggested by the
|
||||
# developers of the vctrs package:
|
||||
# https://github.com/r-lib/vctrs/blob/05968ce8e669f73213e3e894b5f4424af4f46316/R/register-s3.R
|
||||
s3_register("pillar::pillar_shaft", "ab")
|
||||
s3_register("pillar::pillar_shaft", "av")
|
||||
s3_register("pillar::pillar_shaft", "mo")
|
||||
s3_register("pillar::pillar_shaft", "rsi")
|
||||
s3_register("pillar::pillar_shaft", "mic")
|
||||
s3_register("pillar::pillar_shaft", "disk")
|
||||
s3_register("tibble::type_sum", "ab")
|
||||
s3_register("tibble::type_sum", "mo")
|
||||
s3_register("tibble::type_sum", "rsi")
|
||||
s3_register("tibble::type_sum", "mic")
|
||||
s3_register("tibble::type_sum", "disk")
|
||||
s3_register("pillar::type_sum", "ab")
|
||||
s3_register("pillar::type_sum", "av")
|
||||
s3_register("pillar::type_sum", "mo")
|
||||
s3_register("pillar::type_sum", "rsi")
|
||||
s3_register("pillar::type_sum", "mic")
|
||||
s3_register("pillar::type_sum", "disk")
|
||||
# Support for frequency tables from the cleaner package
|
||||
s3_register("cleaner::freq", "mo")
|
||||
s3_register("cleaner::freq", "rsi")
|
||||
@@ -97,34 +125,54 @@ if (utf8_supported && !is_latex) {
|
||||
s3_register("ggplot2::fortify", "mic")
|
||||
s3_register("ggplot2::fortify", "disk")
|
||||
# Support vctrs package for use in e.g. dplyr verbs
|
||||
s3_register("vctrs::vec_ptype2", "ab.character")
|
||||
s3_register("vctrs::vec_ptype2", "character.ab")
|
||||
s3_register("vctrs::vec_cast", "character.ab")
|
||||
s3_register("vctrs::vec_ptype2", "mo.character")
|
||||
s3_register("vctrs::vec_ptype2", "character.mo")
|
||||
s3_register("vctrs::vec_cast", "character.mo")
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector.character")
|
||||
# S3: ab_selector
|
||||
s3_register("vctrs::vec_ptype2", "character.ab_selector")
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector.character")
|
||||
s3_register("vctrs::vec_cast", "character.ab_selector")
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
|
||||
# S3: ab_selector_any_all
|
||||
s3_register("vctrs::vec_ptype2", "logical.ab_selector_any_all")
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
|
||||
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
|
||||
s3_register("vctrs::vec_ptype2", "disk.integer")
|
||||
# S3: ab
|
||||
s3_register("vctrs::vec_ptype2", "character.ab")
|
||||
s3_register("vctrs::vec_ptype2", "ab.character")
|
||||
s3_register("vctrs::vec_cast", "character.ab")
|
||||
s3_register("vctrs::vec_cast", "ab.character")
|
||||
# S3: av
|
||||
s3_register("vctrs::vec_ptype2", "character.av")
|
||||
s3_register("vctrs::vec_ptype2", "av.character")
|
||||
s3_register("vctrs::vec_cast", "character.av")
|
||||
s3_register("vctrs::vec_cast", "av.character")
|
||||
# S3: mo
|
||||
s3_register("vctrs::vec_ptype2", "character.mo")
|
||||
s3_register("vctrs::vec_ptype2", "mo.character")
|
||||
s3_register("vctrs::vec_cast", "character.mo")
|
||||
s3_register("vctrs::vec_cast", "mo.character")
|
||||
# S3: disk
|
||||
s3_register("vctrs::vec_ptype2", "integer.disk")
|
||||
s3_register("vctrs::vec_ptype2", "disk.integer")
|
||||
s3_register("vctrs::vec_cast", "integer.disk")
|
||||
s3_register("vctrs::vec_cast", "disk.integer")
|
||||
s3_register("vctrs::vec_cast", "double.disk")
|
||||
s3_register("vctrs::vec_cast", "disk.double")
|
||||
s3_register("vctrs::vec_cast", "character.disk")
|
||||
s3_register("vctrs::vec_cast", "disk.character")
|
||||
# S3: mic
|
||||
s3_register("vctrs::vec_cast", "character.mic")
|
||||
s3_register("vctrs::vec_cast", "double.mic")
|
||||
s3_register("vctrs::vec_cast", "mic.character")
|
||||
s3_register("vctrs::vec_cast", "mic.double")
|
||||
s3_register("vctrs::vec_math", "mic")
|
||||
# S3: rsi
|
||||
s3_register("vctrs::vec_ptype2", "character.rsi")
|
||||
s3_register("vctrs::vec_ptype2", "rsi.character")
|
||||
s3_register("vctrs::vec_cast", "character.rsi")
|
||||
s3_register("vctrs::vec_cast", "rsi.character")
|
||||
|
||||
# if mo source exists, fire it up (see mo_source())
|
||||
try(
|
||||
{
|
||||
if (file.exists(getOption("AMR_mo_source", "~/mo_source.rds"))) {
|
||||
invisible(get_mo_source())
|
||||
}
|
||||
},
|
||||
silent = TRUE
|
||||
)
|
||||
if (tryCatch(file.exists(getOption("AMR_mo_source", "~/mo_source.rds")), error = function(e) FALSE)) {
|
||||
invisible(get_mo_source())
|
||||
}
|
||||
|
||||
# be sure to print tibbles as tibbles
|
||||
if (pkg_is_available("tibble", also_load = FALSE)) {
|
||||
@@ -133,11 +181,22 @@ if (utf8_supported && !is_latex) {
|
||||
|
||||
# reference data - they have additional columns compared to `antibiotics` and `microorganisms` to improve speed
|
||||
# they cannot be part of R/sysdata.rda since CRAN thinks it would make the package too large (+3 MB)
|
||||
assign(x = "AB_lookup", value = create_AB_lookup(), envir = asNamespace("AMR"))
|
||||
assign(x = "MO_lookup", value = create_MO_lookup(), envir = asNamespace("AMR"))
|
||||
assign(x = "MO.old_lookup", value = create_MO.old_lookup(), envir = asNamespace("AMR"))
|
||||
# for mo_is_intrinsic_resistant() - saves a lot of time when executed on this vector
|
||||
assign(x = "INTRINSIC_R", value = create_intr_resistance(), envir = asNamespace("AMR"))
|
||||
AMR_env$AB_lookup <- create_AB_lookup()
|
||||
AMR_env$AV_lookup <- create_AV_lookup()
|
||||
AMR_env$MO_lookup <- create_MO_lookup()
|
||||
}
|
||||
|
||||
.onAttach <- function(lib, pkg) {
|
||||
if (interactive() && is.null(getOption("AMR_locale", default = NULL))) {
|
||||
current_lang <- get_AMR_locale()
|
||||
if (current_lang != "en") {
|
||||
packageStartupMessage(word_wrap(
|
||||
"Assuming the ", LANGUAGES_SUPPORTED_NAMES[[current_lang]]$exonym, " language (",
|
||||
LANGUAGES_SUPPORTED_NAMES[[current_lang]]$endonym, ") for the AMR package. See `set_AMR_locale()` to change this or to silence this note.",
|
||||
add_fn = list(font_blue), as_note = TRUE
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Helper functions --------------------------------------------------------
|
||||
@@ -146,6 +205,10 @@ create_AB_lookup <- function() {
|
||||
cbind(AMR::antibiotics, AB_LOOKUP)
|
||||
}
|
||||
|
||||
create_AV_lookup <- function() {
|
||||
cbind(AMR::antivirals, AV_LOOKUP)
|
||||
}
|
||||
|
||||
create_MO_lookup <- function() {
|
||||
MO_lookup <- AMR::microorganisms
|
||||
|
||||
@@ -157,33 +220,16 @@ create_MO_lookup <- function() {
|
||||
# all the rest
|
||||
MO_lookup[which(is.na(MO_lookup$kingdom_index)), "kingdom_index"] <- 5
|
||||
|
||||
# use this paste instead of `fullname` to work with Viridans Group Streptococci, etc.
|
||||
if (length(MO_FULLNAME_LOWER) == nrow(MO_lookup)) {
|
||||
MO_lookup$fullname_lower <- MO_FULLNAME_LOWER
|
||||
} else {
|
||||
MO_lookup$fullname_lower <- ""
|
||||
warning("MO table updated - Run: source(\"data-raw/_pre_commit_hook.R\")", call. = FALSE)
|
||||
}
|
||||
MO_lookup$fullname_lower <- MO_FULLNAME_LOWER
|
||||
MO_lookup$full_first <- substr(MO_lookup$fullname_lower, 1, 1)
|
||||
MO_lookup$species_first <- substr(MO_lookup$species, 1, 1)
|
||||
|
||||
# add a column with only "e coli" like combinations
|
||||
MO_lookup$g_species <- gsub("^([a-z])[a-z]+ ([a-z]+) ?.*", "\\1 \\2", MO_lookup$fullname_lower, perl = TRUE)
|
||||
|
||||
# so arrange data on prevalence first, then kingdom, then full name
|
||||
MO_lookup[order(MO_lookup$prevalence, MO_lookup$kingdom_index, MO_lookup$fullname_lower), , drop = FALSE]
|
||||
MO_lookup
|
||||
}
|
||||
|
||||
create_MO.old_lookup <- function() {
|
||||
MO.old_lookup <- AMR::microorganisms.old
|
||||
MO.old_lookup$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", tolower(trimws(MO.old_lookup$fullname))))
|
||||
|
||||
# add a column with only "e coli"-like combinations
|
||||
MO.old_lookup$g_species <- trimws(gsub("^([a-z])[a-z]+ ([a-z]+) ?.*", "\\1 \\2", MO.old_lookup$fullname_lower))
|
||||
|
||||
# so arrange data on prevalence first, then full name
|
||||
MO.old_lookup[order(MO.old_lookup$prevalence, MO.old_lookup$fullname_lower), , drop = FALSE]
|
||||
}
|
||||
|
||||
create_intr_resistance <- function() {
|
||||
add_intrinsic_resistance_to_AMR_env <- function() {
|
||||
# for mo_is_intrinsic_resistant() - saves a lot of time when executed on this vector
|
||||
paste(AMR::intrinsic_resistant$mo, AMR::intrinsic_resistant$ab)
|
||||
if (is.null(AMR_env$intrinsic_resistant)) {
|
||||
AMR_env$intrinsic_resistant <- paste(AMR::intrinsic_resistant$mo, AMR::intrinsic_resistant$ab)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
% AMR (for R)
|
||||
|
||||
# `AMR` (for R)
|
||||
|
||||

|
||||
[](https://www.codefactor.io/repository/github/msberends/amr)
|
||||
[](https://app.codecov.io/gh/msberends/AMR?branch=main)
|
||||
<a href="https://msberends.github.io/AMR/"><img src="https://msberends.github.io/AMR/AMR_intro.png" align="center"></a>
|
||||
|
||||
<img src="https://msberends.github.io/AMR/AMR_intro.svg" align="center" height="300px" />
|
||||
----
|
||||
|
||||
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.
|
||||
|
||||
After installing this package, R knows ~71,000 distinct microbial species and all ~570 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data. Antimicrobial names and group names are available in Danish, Dutch, English, French, German, Italian, Portuguese and Spanish.
|
||||
After installing this package, R knows ~49,000 distinct microbial species and all ~570 antibiotic, antimycotic, and antiviral drugs by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI 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.
|
||||
|
||||
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice Foundation and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
|
||||
|
||||
+25
-13
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -41,7 +45,6 @@ template:
|
||||
opengraph:
|
||||
twitter:
|
||||
creator: "@msberends"
|
||||
site: "@univgroningen"
|
||||
card: summary_large_image
|
||||
|
||||
news:
|
||||
@@ -54,11 +57,11 @@ footer:
|
||||
right: [logo]
|
||||
components:
|
||||
devtext: '<code>AMR</code> (for R). Developed at the <a target="_blank" href="https://www.rug.nl">University of Groningen</a> in collaboration with non-profit organisations<br><a target="_blank" href="https://www.certe.nl">Certe Medical Diagnostics and Advice Foundation</a> and <a target="_blank" href="https://www.umcg.nl">University Medical Center Groningen</a>.'
|
||||
logo: '<a target="_blank" href="https://www.rug.nl"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/logos/logo_rug.svg" style="max-width: 200px;"></a>'
|
||||
logo: '<a target="_blank" href="https://www.rug.nl"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/logos/logo_rug.svg" style="max-width: 150px;"></a>'
|
||||
|
||||
home:
|
||||
sidebar:
|
||||
structure: [toc, links, authors, citation]
|
||||
structure: [toc, links, authors]
|
||||
|
||||
navbar:
|
||||
title: "AMR (for R)"
|
||||
@@ -99,9 +102,9 @@ navbar:
|
||||
- text: "Get properties of an antibiotic"
|
||||
icon: "fa-capsules"
|
||||
href: "reference/ab_property.html" # reference instead of an article
|
||||
# - text: "Other: benchmarks"
|
||||
# icon: "fa-shipping-fast"
|
||||
# href: "articles/benchmarks.html"
|
||||
- text: "Get properties of an antiviral agent"
|
||||
icon: "fa-capsules"
|
||||
href: "reference/av_property.html" # reference instead of an article
|
||||
- text: "Manual"
|
||||
icon: "fa-book-open"
|
||||
href: "reference/index.html"
|
||||
@@ -138,6 +141,7 @@ reference:
|
||||
- "`ab_property`"
|
||||
- "`ab_from_text`"
|
||||
- "`atc_online_property`"
|
||||
- "`add_custom_antimicrobials`"
|
||||
|
||||
- title: "Preparing data: antimicrobial resistance"
|
||||
desc: >
|
||||
@@ -171,8 +175,19 @@ reference:
|
||||
- "`mean_amr_distance`"
|
||||
- "`resistance_predict`"
|
||||
- "`guess_ab_col`"
|
||||
|
||||
- title: "Other: antiviral drugs"
|
||||
desc: >
|
||||
This package also provides extensive support for antiviral agents, even though it is not the primary
|
||||
scope of this package. Working with data containing information about antiviral drugs was never easier.
|
||||
Use these functions to get valid properties of antiviral drugs from any input or to clean your input.
|
||||
You can even retrieve drug names and doses from clinical text records, using `av_from_text()`.
|
||||
contents:
|
||||
- "`as.av`"
|
||||
- "`av_property`"
|
||||
- "`av_from_text`"
|
||||
|
||||
- title: "Background information on included data"
|
||||
- title: "Other: background information on included data"
|
||||
desc: >
|
||||
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.
|
||||
@@ -181,12 +196,9 @@ reference:
|
||||
- "`example_isolates`"
|
||||
- "`microorganisms`"
|
||||
- "`microorganisms.codes`"
|
||||
- "`microorganisms.old`"
|
||||
- "`antibiotics`"
|
||||
- "`intrinsic_resistant`"
|
||||
- "`dosage`"
|
||||
- "`catalogue_of_life`"
|
||||
- "`catalogue_of_life_version`"
|
||||
- "`WHOCC`"
|
||||
- "`example_isolates_unclean`"
|
||||
- "`rsi_translation`"
|
||||
|
||||
+7
-3
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
+4482
-4480
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
+99080
-92370
File diff suppressed because one or more lines are too long
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -28,7 +32,7 @@ install.packages("data-raw/tinytest_1.3.1.tar.gz", dependencies = c("Depends", "
|
||||
install.packages(getwd(), repos = NULL, type = "source")
|
||||
|
||||
pkg_suggests <- gsub(
|
||||
"[^a-zA-Z0-9]+", "",
|
||||
"[^a-zA-Z0-9.]+", "",
|
||||
unlist(strsplit(unlist(packageDescription("AMR",
|
||||
fields = c("Suggests", "Enhances", "LinkingTo")
|
||||
)),
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
|
||||
+76
-72
@@ -1,12 +1,16 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# CITE AS #
|
||||
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||
# doi:10.18637/jss.v104.i03 #
|
||||
# #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
@@ -38,7 +42,7 @@ old_globalenv <- ls(envir = globalenv())
|
||||
# See 'data-raw/eucast_rules.tsv' for the EUCAST reference file
|
||||
EUCAST_RULES_DF <- utils::read.delim(
|
||||
file = "data-raw/eucast_rules.tsv",
|
||||
skip = 10,
|
||||
skip = 9,
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
@@ -100,7 +104,7 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
MO_staph[which(MO_staph$species %in% c(
|
||||
"coagulase-negative", "argensis", "arlettae",
|
||||
"auricularis", "borealis", "caeli", "capitis", "caprae",
|
||||
"carnosus", "casei", "chromogenes", "cohnii", "condimenti",
|
||||
"carnosus", "casei", "caseolyticus", "chromogenes", "cohnii", "condimenti",
|
||||
"croceilyticus",
|
||||
"debuckii", "devriesei", "edaphicus", "epidermidis",
|
||||
"equorum", "felis", "fleurettii", "gallinarum",
|
||||
@@ -113,8 +117,10 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
"ureilyticus",
|
||||
"vitulinus", "vitulus", "warneri", "xylosus",
|
||||
"caledonicus", "canis",
|
||||
"durrellii", "lloydii"
|
||||
"durrellii", "lloydii",
|
||||
"ratti", "taiwanensis", "veratri", "urealyticus"
|
||||
) |
|
||||
# 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",
|
||||
drop = TRUE
|
||||
@@ -128,8 +134,10 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
"hyicus", "intermedius",
|
||||
"pseudintermedius", "pseudointermedius",
|
||||
"schweitzeri", "simiae",
|
||||
"roterodami"
|
||||
"roterodami",
|
||||
"singaporensis"
|
||||
) |
|
||||
# old, now renamed to S. coagulans (but still as synonym in our data of course):
|
||||
(MO_staph$species == "schleiferi" & MO_staph$subspecies == "coagulans")),
|
||||
"mo",
|
||||
drop = TRUE
|
||||
@@ -137,45 +145,49 @@ create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
}
|
||||
}
|
||||
create_MO_fullname_lower <- function() {
|
||||
MO_lookup <- AMR::microorganisms
|
||||
AMR_env$MO_lookup <- AMR::microorganisms
|
||||
# use this paste instead of `fullname` to work with Viridans Group Streptococci, etc.
|
||||
MO_lookup$fullname_lower <- tolower(trimws(paste(
|
||||
MO_lookup$genus,
|
||||
MO_lookup$species,
|
||||
MO_lookup$subspecies
|
||||
AMR_env$MO_lookup$fullname_lower <- tolower(trimws(paste(
|
||||
AMR_env$MO_lookup$genus,
|
||||
AMR_env$MO_lookup$species,
|
||||
AMR_env$MO_lookup$subspecies
|
||||
)))
|
||||
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$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", MO_lookup$fullname_lower, perl = TRUE))
|
||||
MO_lookup$fullname_lower
|
||||
ind <- AMR_env$MO_lookup$genus == "" | grepl("^[(]unknown ", AMR_env$MO_lookup$fullname, perl = TRUE)
|
||||
AMR_env$MO_lookup[ind, "fullname_lower"] <- tolower(AMR_env$MO_lookup[ind, "fullname", drop = TRUE])
|
||||
AMR_env$MO_lookup$fullname_lower <- trimws(gsub("[^.a-z0-9/ \\-]+", "", AMR_env$MO_lookup$fullname_lower, perl = TRUE))
|
||||
AMR_env$MO_lookup$fullname_lower
|
||||
}
|
||||
MO_CONS <- create_species_cons_cops("CoNS")
|
||||
MO_COPS <- create_species_cons_cops("CoPS")
|
||||
MO_STREP_ABCG <- as.mo(MO_lookup[which(MO_lookup$genus == "Streptococcus"), "mo", drop = TRUE], Lancefield = TRUE) %in% c("B_STRPT_GRPA", "B_STRPT_GRPB", "B_STRPT_GRPC", "B_STRPT_GRPG")
|
||||
MO_STREP_ABCG <- AMR_env$MO_lookup$mo[which(AMR_env$MO_lookup$genus == "Streptococcus" &
|
||||
AMR_env$MO_lookup$species %in% c(
|
||||
"pyogenes", "agalactiae", "dysgalactiae", "equi", "anginosus", "sanguinis", "salivarius",
|
||||
"group A", "group B", "group C", "group D", "group F", "group G", "group H", "group K", "group L"
|
||||
))]
|
||||
MO_FULLNAME_LOWER <- create_MO_fullname_lower()
|
||||
MO_PREVALENT_GENERA <- c(
|
||||
"Absidia", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", "Alloprevotella",
|
||||
"Alternaria", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus", "Anisakis", "Anopheles",
|
||||
"Absidia", "Acanthamoeba", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", "Alloprevotella",
|
||||
"Alternaria", "Amoeba", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus", "Anisakis", "Anopheles",
|
||||
"Apophysomyces", "Arachnia", "Aspergillus", "Aureobasidium", "Bacteroides", "Basidiobolus",
|
||||
"Beauveria", "Bergeyella", "Blastocystis", "Blastomyces", "Borrelia", "Brachyspira", "Branhamella",
|
||||
"Butyricimonas", "Candida", "Capillaria", "Capnocytophaga", "Catabacter", "Cetobacterium", "Chaetomium",
|
||||
"Chlamydia", "Chlamydophila", "Chryseobacterium", "Chrysonilia", "Cladophialophora", "Cladosporium",
|
||||
"Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Deinococcus", "Demodex",
|
||||
"Dermatobia", "Diphyllobothrium", "Dirofilaria", "Dysgonomonas", "Echinostoma", "Elizabethkingia",
|
||||
"Empedobacter", "Enterobius", "Exophiala", "Exserohilum", "Fasciola", "Flavobacterium", "Fonsecaea",
|
||||
"Dermatobia", "Dientamoeba", "Diphyllobothrium", "Dirofilaria", "Dysgonomonas", "Echinostoma", "Elizabethkingia",
|
||||
"Empedobacter", "Entamoeba", "Enterobius", "Exophiala", "Exserohilum", "Fasciola", "Flavobacterium", "Fonsecaea",
|
||||
"Fusarium", "Fusobacterium", "Giardia", "Haloarcula", "Halobacterium", "Halococcus", "Hendersonula",
|
||||
"Heterophyes", "Histoplasma", "Hymenolepis", "Hypomyces", "Hysterothylacium", "Lelliottia",
|
||||
"Leptosphaeria", "Leptotrichia", "Lucilia", "Lumbricus", "Malassezia", "Malbranchea", "Metagonimus",
|
||||
"Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Mycoplasma", "Myroides", "Necator",
|
||||
"Heterophyes", "Histomonas", "Histoplasma", "Hymenolepis", "Hypomyces", "Hysterothylacium", "Leishmania", "Lelliottia",
|
||||
"Leptosphaeria", "Leptotrichia", "Lucilia", "Lumbricus", "Malassezia", "Malbranchea", "Metagonimus", "Meyerozyma",
|
||||
"Microsporidium", "Microsporum", "Mortierella", "Mucor", "Mycocentrospora", "Mycoplasma", "Myroides", "Necator",
|
||||
"Nectria", "Ochroconis", "Odoribacter", "Oesophagostomum", "Oidiodendron", "Opisthorchis",
|
||||
"Ornithobacterium", "Parabacteroides", "Pediculus", "Pedobacter", "Phlebotomus", "Phocaeicola",
|
||||
"Phocanema", "Phoma", "Piedraia", "Pithomyces", "Pityrosporum", "Porphyromonas", "Prevotella",
|
||||
"Phocanema", "Phoma", "Pichia", "Piedraia", "Pithomyces", "Pityrosporum", "Pneumocystis", "Porphyromonas", "Prevotella",
|
||||
"Pseudallescheria", "Pseudoterranova", "Pulex", "Rhizomucor", "Rhizopus", "Rhodotorula", "Riemerella",
|
||||
"Saccharomyces", "Sarcoptes", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Sphingobacterium",
|
||||
"Spirometra", "Spiroplasma", "Sporobolomyces", "Stachybotrys", "Streptobacillus", "Strongyloides",
|
||||
"Syngamus", "Taenia", "Tannerella", "Tenacibaculum", "Terrimonas", "Toxocara", "Treponema", "Trichinella",
|
||||
"Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus",
|
||||
"Trichuris", "Tritirachium", "Trombicula", "Tunga", "Ureaplasma", "Victivallis", "Wautersiella",
|
||||
"Trichuris", "Tritirachium", "Trypanosoma", "Trombicula", "Tunga", "Ureaplasma", "Victivallis", "Wautersiella",
|
||||
"Weeksella", "Wuchereria"
|
||||
)
|
||||
|
||||
@@ -186,10 +198,10 @@ AB_AMINOGLYCOSIDES <- antibiotics %>%
|
||||
filter(group %like% "aminoglycoside") %>%
|
||||
pull(ab)
|
||||
AB_AMINOPENICILLINS <- as.ab(c("AMP", "AMX"))
|
||||
AB_ANTIFUNGALS <- AB_lookup %>%
|
||||
AB_ANTIFUNGALS <- AMR_env$AB_lookup %>%
|
||||
filter(group %like% "antifungal") %>%
|
||||
pull(ab)
|
||||
AB_ANTIMYCOBACTERIALS <- AB_lookup %>%
|
||||
AB_ANTIMYCOBACTERIALS <- AMR_env$AB_lookup %>%
|
||||
filter(group %like% "antimycobacterial") %>%
|
||||
pull(ab)
|
||||
AB_CARBAPENEMS <- antibiotics %>%
|
||||
@@ -255,17 +267,19 @@ AB_BETALACTAMS <- c(AB_PENICILLINS, AB_CEPHALOSPORINS, AB_CARBAPENEMS)
|
||||
# this will be used for documentation:
|
||||
DEFINED_AB_GROUPS <- ls(envir = globalenv())
|
||||
DEFINED_AB_GROUPS <- DEFINED_AB_GROUPS[!DEFINED_AB_GROUPS %in% globalenv_before_ab]
|
||||
create_AB_lookup <- function() {
|
||||
AB_lookup <- AMR::antibiotics
|
||||
AB_lookup$generalised_name <- generalise_antibiotic_name(AB_lookup$name)
|
||||
AB_lookup$generalised_synonyms <- lapply(AB_lookup$synonyms, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_abbreviations <- lapply(AB_lookup$abbreviations, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_loinc <- lapply(AB_lookup$loinc, generalise_antibiotic_name)
|
||||
AB_lookup$generalised_all <- unname(lapply(
|
||||
as.list(as.data.frame(t(AB_lookup[,
|
||||
create_AB_AV_lookup <- function(df) {
|
||||
new_df <- df
|
||||
new_df$generalised_name <- generalise_antibiotic_name(new_df$name)
|
||||
new_df$generalised_synonyms <- lapply(new_df$synonyms, generalise_antibiotic_name)
|
||||
if ("abbreviations" %in% colnames(df)) {
|
||||
new_df$generalised_abbreviations <- lapply(new_df$abbreviations, generalise_antibiotic_name)
|
||||
}
|
||||
new_df$generalised_loinc <- lapply(new_df$loinc, generalise_antibiotic_name)
|
||||
new_df$generalised_all <- unname(lapply(
|
||||
as.list(as.data.frame(t(new_df[,
|
||||
c(
|
||||
"ab", "atc", "cid", "name",
|
||||
colnames(AB_lookup)[colnames(AB_lookup) %like% "generalised"]
|
||||
colnames(new_df)[colnames(new_df) %in% c("ab", "av", "atc", "cid", "name")],
|
||||
colnames(new_df)[colnames(new_df) %like% "generalised"]
|
||||
),
|
||||
drop = FALSE
|
||||
]),
|
||||
@@ -276,12 +290,13 @@ create_AB_lookup <- function() {
|
||||
x[x != ""]
|
||||
}
|
||||
))
|
||||
AB_lookup[, colnames(AB_lookup)[colnames(AB_lookup) %like% "^generalised"]]
|
||||
new_df[, colnames(new_df)[colnames(new_df) %like% "^generalised"]]
|
||||
}
|
||||
AB_LOOKUP <- create_AB_lookup()
|
||||
AB_LOOKUP <- create_AB_AV_lookup(AMR::antibiotics)
|
||||
AV_LOOKUP <- create_AB_AV_lookup(AMR::antivirals)
|
||||
|
||||
# Export to package as internal data ----
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('sysdata.rda')} to {usethis::ui_value('R/')}"))
|
||||
usethis::ui_info(paste0("Updating internal package data"))
|
||||
suppressMessages(usethis::use_data(EUCAST_RULES_DF,
|
||||
TRANSLATIONS,
|
||||
LANGUAGES_SUPPORTED_NAMES,
|
||||
@@ -292,6 +307,7 @@ suppressMessages(usethis::use_data(EUCAST_RULES_DF,
|
||||
MO_FULLNAME_LOWER,
|
||||
MO_PREVALENT_GENERA,
|
||||
AB_LOOKUP,
|
||||
AV_LOOKUP,
|
||||
AB_AMINOGLYCOSIDES,
|
||||
AB_AMINOPENICILLINS,
|
||||
AB_ANTIFUNGALS,
|
||||
@@ -360,7 +376,7 @@ changed_md5 <- function(object) {
|
||||
|
||||
# give official names to ABs and MOs
|
||||
rsi <- rsi_translation %>%
|
||||
mutate(mo_name = mo_name(mo, language = NULL), .after = mo) %>%
|
||||
mutate(mo_name = mo_name(mo, language = NULL, keep_synonyms = TRUE, info = FALSE), .after = mo) %>%
|
||||
mutate(ab_name = ab_name(ab, language = NULL), .after = ab)
|
||||
if (changed_md5(rsi)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('rsi_translation')} to {usethis::ui_value('data-raw/')}"))
|
||||
@@ -379,7 +395,6 @@ if (changed_md5(microorganisms)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('microorganisms')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(microorganisms)
|
||||
try(saveRDS(microorganisms, "data-raw/microorganisms.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(mo, "data-raw/microorganisms.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
max_50_snomed <- sapply(microorganisms$snomed, function(x) paste(x[seq_len(min(50, length(x), na.rm = TRUE))], collapse = " "))
|
||||
mo <- microorganisms
|
||||
mo$snomed <- max_50_snomed
|
||||
@@ -387,34 +402,24 @@ if (changed_md5(microorganisms)) {
|
||||
try(haven::write_sas(mo, "data-raw/microorganisms.sas"), silent = TRUE)
|
||||
try(haven::write_sav(mo, "data-raw/microorganisms.sav"), silent = TRUE)
|
||||
try(haven::write_dta(mo, "data-raw/microorganisms.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(mo, "data-raw/microorganisms.xlsx"), silent = TRUE)
|
||||
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(openxlsx::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_parquet(microorganisms, "data-raw/microorganisms.parquet"), silent = TRUE)
|
||||
}
|
||||
|
||||
if (changed_md5(microorganisms.old)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('microorganisms.old')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(microorganisms.old)
|
||||
try(saveRDS(microorganisms.old, "data-raw/microorganisms.old.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(microorganisms.old, "data-raw/microorganisms.old.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(microorganisms.old, "data-raw/microorganisms.old.sas"), silent = TRUE)
|
||||
try(haven::write_sav(microorganisms.old, "data-raw/microorganisms.old.sav"), silent = TRUE)
|
||||
try(haven::write_dta(microorganisms.old, "data-raw/microorganisms.old.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(microorganisms.old, "data-raw/microorganisms.old.xlsx"), silent = TRUE)
|
||||
try(arrow::write_feather(microorganisms.old, "data-raw/microorganisms.old.feather"), silent = TRUE)
|
||||
try(arrow::write_parquet(microorganisms.old, "data-raw/microorganisms.old.parquet"), silent = TRUE)
|
||||
}
|
||||
|
||||
ab <- dplyr::mutate_if(antibiotics, ~ !is.numeric(.), as.character)
|
||||
if (changed_md5(ab)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antibiotics')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(ab)
|
||||
try(saveRDS(antibiotics, "data-raw/antibiotics.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(antibiotics, "data-raw/antibiotics.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(ab, "data-raw/antibiotics.sas"), silent = TRUE)
|
||||
try(haven::write_sav(ab, "data-raw/antibiotics.sav"), silent = TRUE)
|
||||
try(haven::write_dta(ab, "data-raw/antibiotics.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(ab, "data-raw/antibiotics.xlsx"), silent = TRUE)
|
||||
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(openxlsx::write.xlsx(ab_lists, "data-raw/antibiotics.xlsx"), silent = TRUE)
|
||||
try(arrow::write_feather(antibiotics, "data-raw/antibiotics.feather"), silent = TRUE)
|
||||
try(arrow::write_parquet(antibiotics, "data-raw/antibiotics.parquet"), silent = TRUE)
|
||||
}
|
||||
@@ -424,18 +429,19 @@ if (changed_md5(av)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('antivirals')} to {usethis::ui_value('data-raw/')}"))
|
||||
write_md5(av)
|
||||
try(saveRDS(antivirals, "data-raw/antivirals.rds", version = 2, compress = "xz"), silent = TRUE)
|
||||
try(write.table(av, "data-raw/antivirals.txt", sep = "\t", na = "", row.names = FALSE), silent = TRUE)
|
||||
try(haven::write_sas(av, "data-raw/antivirals.sas"), silent = TRUE)
|
||||
try(haven::write_sav(av, "data-raw/antivirals.sav"), silent = TRUE)
|
||||
try(haven::write_dta(av, "data-raw/antivirals.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(av, "data-raw/antivirals.xlsx"), silent = TRUE)
|
||||
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(openxlsx::write.xlsx(av_lists, "data-raw/antivirals.xlsx"), silent = TRUE)
|
||||
try(arrow::write_feather(antivirals, "data-raw/antivirals.feather"), silent = TRUE)
|
||||
try(arrow::write_parquet(antivirals, "data-raw/antivirals.parquet"), silent = TRUE)
|
||||
}
|
||||
|
||||
# give official names to ABs and MOs
|
||||
intrinsicR <- data.frame(
|
||||
microorganism = mo_name(intrinsic_resistant$mo, language = NULL),
|
||||
microorganism = mo_name(intrinsic_resistant$mo, language = NULL, keep_synonyms = TRUE, info = FALSE),
|
||||
antibiotic = ab_name(intrinsic_resistant$ab, language = NULL),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
@@ -486,16 +492,14 @@ suppressMessages(devtools::document(quiet = TRUE))
|
||||
|
||||
|
||||
# Style pkg ---------------------------------------------------------------
|
||||
usethis::ui_info("Styling package")
|
||||
invisible(capture.output(styler::style_pkg(
|
||||
style = styler::tidyverse_style,
|
||||
filetype = c("R", "Rmd")
|
||||
)))
|
||||
invisible(capture.output(styler::style_dir(
|
||||
path = "inst", # unit tests
|
||||
style = styler::tidyverse_style,
|
||||
filetype = c("R", "Rmd")
|
||||
)))
|
||||
# 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 ----------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
79ed9c5d9ddd2c270a5bbb579a920992
|
||||
43220347c34d06a5c57f2014a8ecaa82
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+483
-1
@@ -1,2 +1,484 @@
|
||||
"ab" "cid" "name" "group" "atc" "atc_group1" "atc_group2" "abbreviations" "synonyms" "oral_ddd" "oral_units" "iv_ddd" "iv_units" "loinc"
|
||||
"AMA" 4649 "4-aminosalicylic acid" "Antimycobacterials"
|
||||
"AMA" 4649 "4-aminosalicylic acid" "Antimycobacterials" "J04AA01" "Drugs for treatment of tuberculosis" "Aminosalicylic acid and derivatives" "" "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" 12 "g" ""
|
||||
"ACM" 6450012 "Acetylmidecamycin" "Macrolides/lincosamides" "NA" "" "" ""
|
||||
"ASP" 49787020 "Acetylspiramycin" "Macrolides/lincosamides" "NA" "" "acetylspiramycin,foromacidin b,spiramycin ii" ""
|
||||
"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" "13546-7,15098-7,17798-0,31097-9,31098-7,31099-5,3319-1,3320-9,3321-7,35669-1,50802-8,50803-6,56628-1,59378-0,80972-3"
|
||||
"AKF" "Amikacin/fosfomycin" "Aminoglycosides" "NA" "" "" ""
|
||||
"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" "16365-9,25274-2,3344-9,80133-2"
|
||||
"AMC" 23665637 "Amoxicillin/clavulanic acid" "Beta-lactams/penicillins" "J01CR02" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "a/c,amcl,aml,aug,xl" "amocla,amoclan,amoclav,amoksiclav,amoxsiklav,amoxyclav,augmentan,augmentin,augmentin xr,augmentine,auspilic,clamentin,clamobit,clavamox,clavinex,clavoxilin plus,clavulin,clavumox,coamoxiclav,eumetinex,kmoxilin,spectramox,spektramox,synulox,viaclav,xiclav" 1.5 "g" 3 "g" ""
|
||||
"AXS" 465441 "Amoxicillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"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,3353-0,3354-8,40707-2,40757-7,49859-2"
|
||||
"AMH" "Amphotericin B-high" "Aminoglycosides" "NA" "amfo b high,amhl,ampho b high,amphotericin high" "" ""
|
||||
"AMP" 6249 "Ampicillin" "Beta-lactams/penicillins" "J01CA01,S01AA19" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "am,amp,ampi" "acillin,adobacillin,amblosin,amcill,amfipen,amfipen v,amipenix s,ampichel,ampicil,ampicilina,ampicillin,ampicillin a,ampicillin acid,ampicillin anhydrate,ampicillin anhydrous,ampicillin base,ampicillin hydrate,ampicillin sodium,ampicillina,ampicilline,ampicillinum,ampicin,ampifarm,ampikel,ampimed,ampipenin,ampiscel,ampisyn,ampivax,ampivet,amplacilina,amplin,amplipenyl,amplisom,amplital,anhydrous ampicillin,austrapen,binotal,bonapicillin,britacil,campicillin,copharcilin,delcillin,deripen,divercillin,doktacillin,duphacillin,grampenil,guicitrina,guicitrine,lifeampil,marcillin,morepen,norobrittin,nuvapen,olin kid,omnipen,orbicilina,pen a oral,pen ampil,penbristol,penbritin,penbritin paediatric,penbritin syrup,penbrock,penicline,penimic,pensyn,pentrex,pentrexl,pentrexyl,pentritin,pfizerpen a,polycillin,polyflex,ponecil,princillin,principen,qidamp,racenacillin,redicilin,rosampline,roscillin,semicillin,semicillin r,servicillin,sumipanto,synpenin,texcillin,tokiocillin,tolomol,totacillin,totalciclina,totapen,trifacilina,ukapen,ultrabion,ultrabron,vampen,viccillin,viccillin s,vidocillin,wypicil" 2 "g" 6 "g" "21066-6,3355-5,33562-0,33919-2,43883-8,43884-6,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" ""
|
||||
"AMR" 73341 "Amprolium" "Other antibacterials" "NA" "" "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" "58420-1"
|
||||
"APL" 6602341 "Apalcillin" "Beta-lactams/penicillins" "NA" "" "apalcilina,apalcillin,apalcilline,apalcillinum" ""
|
||||
"APR" 3081545 "Apramycin" "Aminoglycosides" "NA" "" "ambylan,apralan,apramicina,apramycin,apramycine,apramycinum,nebramycin ii" ""
|
||||
"ARB" 68682 "Arbekacin" "Aminoglycosides" "J01GB12" "" "arbekacin,arbekacina,arbekacine,arbekacini sulfas,arbekacinum,habekacin,haberacin" 0.2 "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" ""
|
||||
"AVB" 9835049 "Avibactam" "Beta-lactams/penicillins" "NA" "" "avibactam,avibactam free acid,avibactamfreeacid" ""
|
||||
"AVI" 71674 "Avilamycin" "Other antibacterials" "NA" "" "avilamycin,avilamycina,avilamycine,avilamycinum,surmax" ""
|
||||
"AVO" 16131159 "Avoparcin" "Glycopeptides" "NA" "" "avoparcin,avoparcina,avoparcine,avoparcinum,avotan" ""
|
||||
"AZD" 15574941 "Azidocillin" "Beta-lactams/penicillins" "J01CE04" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "azidocilina,azidocillin,azidocillina,azidocilline,azidocillinum" 1.5 "g" ""
|
||||
"AZM" 447043 "Azithromycin" "Macrolides/lincosamides" "J01FA10,S01AA26" "Macrolides, lincosamides and streptogramins" "Macrolides" "az,azi,azit,azm" "aritromicina,aruzilina,azasite,azenil,azifast,azigram,azimakrol,azithramycine,azithrocin,azithromycin,azithromycine,azithromycinum,azitrocin,azitromax,azitromicina,azitromicine,azitromin,aziwin,aziwok,aztrin,azyter,azythromycin,durasite,hemomycin,macrozit,misultina,mixoterin,setron,sumamed,toraseptol,tromix,trozocina,trulimax,xithrone,zentavion,zithrax,zithromac,zithromax,zithromax iv,zithromycin,zitrim,zitromax,zitrotek,zmax sr,zythromax" 0.3 "g" 0.5 "g" "16420-2,25233-8"
|
||||
"AFC" "Azithromycin/fluconazole/secnidazole" "Other antibacterials" "J01RA07" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"AZL" 6479523 "Azlocillin" "Beta-lactams/penicillins" "J01CA09" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "az,azl,azlo" "azlocilina,azlocillin,azlocilline,azlocillinum" 12 "g" ""
|
||||
"ATM" 5742832 "Aztreonam" "Beta-lactams/penicillins" "J01DF01" "Other beta-lactam antibacterials" "Monobactams" "at,atm,azm,azt,aztr" "azactam,azetreonam,azonam,azthreonam,aztreon,aztreonam,nebactam,primbactam" 4 "g" "16423-6,25234-6,3369-6"
|
||||
"AZA" "Aztreonam/avibactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"ANC" "Aztreonam/nacubactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"BAM" 441397 "Bacampicillin" "Beta-lactams/penicillins" "J01CA06" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "bacampicilina,bacampicillin,bacampicilline,bacampicillinum,penglobe" 1.2 "g" ""
|
||||
"BAC" 78358334 "Bacitracin" "Other antibacterials" "R02AB04,J01XX10" "baci" "fortracin,md bacitracin" ""
|
||||
"BDQ" 5388906 "Bedaquiline" "Other antibacterials" "J04AK05" "" "bedaquiline,sirturo" 86 "mg" "80637-2"
|
||||
"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" ""
|
||||
"BNP" 64725 "Benzathine phenoxymethylpenicillin" "Beta-lactams/penicillins" "J01CE10" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "bicillin v,biphecillin" 2 "g" ""
|
||||
"PEN" 5904 "Benzylpenicillin" "Beta-lactams/penicillins" "J01CE01,S01AA14" "Combinations of antibacterials" "Combinations of antibacterials" "bepe,pen,peni,peni g,penicillin,penicillin g,pg" "abbocillin,ayercillin,bencilpenicilina,benzopenicillin,benzyl penicillin,benzylpenicillin,benzylpenicillin g,benzylpenicilline,benzylpenicillinum,bicillin,cillora,cilloral,cilopen,compocillin g,cosmopen,dropcillin,free penicillin g,free penicillin ii,galofak,gelacillin,liquacillin,megacillin,pencillin g,penicillin,penicilling,pentids,permapen,pfizerpen,pfizerpen g,pharmacillin,pradupen,specilline g,ursopen" 3.6 "g" ""
|
||||
"BES" 10178705 "Besifloxacin" "Quinolones" "S01AE08" "" "besifloxacin,besivance" ""
|
||||
"BIA" 71339 "Biapenem" "Carbapenems" "J01DH05" "" "biapenem,biapenern,bipenem,omegacin" 1.2 "g" ""
|
||||
"BCZ" 65807 "Bicyclomycin" "Other antibacterials" "NA" "bicozamycin" "aizumycin,bacfeed,bacteron,bicozamicina,bicozamycin,bicozamycine,bicozamycinum,bicyclomycin" ""
|
||||
"BDP" 68760 "Brodimoprim" "Trimethoprims" "J01EA02" "Sulfonamides and trimethoprim" "Trimethoprim and derivatives" "" "brodimoprim,brodimoprima,brodimoprime,brodimoprimum,bromdimoprim,hyprim,unitrim" 0.2 "g" ""
|
||||
"BUT" 47472 "Butoconazole" "Antifungals/antimycotics" "G01AF15" "" "butaconazole,butoconazol,butoconazole,butoconazolum,compositenstarke,dahlin,femstat,gynofort,polyfructosanum" ""
|
||||
"CDZ" 44242317 "Cadazolid" "Oxazolidinones" "NA" "" "cadazolid" ""
|
||||
"CLA" "Calcium aminosalicylate" "Antimycobacterials" "J04AA03" "Drugs for treatment of tuberculosis" "Aminosalicylic acid and derivatives" "" "" 15 "g" ""
|
||||
"CAP" 135565060 "Capreomycin" "Antimycobacterials" "J04AB30" "Drugs for treatment of tuberculosis" "Antibiotics" "capr" "" 1 "g" ""
|
||||
"CRB" 20824 "Carbenicillin" "Beta-lactams/penicillins" "J01CA03" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "bar,carb,cb" "anabactyl,carbenicilina,carbenicillin,carbenicillina,carbenicilline,carbenicillinum,geopen,pyopen" 12 "g" "3434-8"
|
||||
"CRN" 93184 "Carindacillin" "Beta-lactams/penicillins" "J01CA05" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "carindacilina,carindacillin,carindacilline,carindacillinum" 4 "g" ""
|
||||
"CAR" 6540466 "Carumonam" "Other antibacterials" "J01DF02" "" "carumonam,carumonamum" 2 "g" ""
|
||||
"CAS" 2826718 "Caspofungin" "Antifungals/antimycotics" "J02AX04" "Antimycotics for systemic use" "Other antimycotics for systemic use" "casp" "cancidas,capsofungin,caspofungin" 50 "mg" "58419-3"
|
||||
"CAC" 91562 "Cefacetrile" "Cephalosporins (1st gen.)" "J01DB10" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "cefacetril,cefacetrile,cefacetrilo,cefacetrilum,celospor,celtol,cephacetrile,cristacef,vetrimast" ""
|
||||
"CEC" 51039 "Cefaclor" "Cephalosporins (2nd gen.)" "J01DC04" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "ccl,cec,cf,cfac,cfc,cfcl,cfr,fac" "alenfral,alfacet,ceclor,ceclor cd,cefaclor,cefaclor anhydrous,cefaclor impurity c,cefaclor monohydrate,cefaclorimpurityc,cefacloro,cefaclorum,cefeaclor,cephaclor,dystaclor mr,keflor,kefral,panoral,raniclor" 1 "g" "16564-7,21149-0"
|
||||
"CFR" 47965 "Cefadroxil" "Cephalosporins (1st gen.)" "J01DB05" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cfdx,cfr,fad" "anhydrous cefadroxil,cefadrops,cefadroxil,cefadroxil anhydrous,cefadroxilo,cefadroxilum,cefradroxil,cephadroxil,duracef,duricef,sumacef,ultracef" 2 "g" "16565-4"
|
||||
"LEX" 27447 "Cefalexin" "Cephalosporins (1st gen.)" "J01DB01" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cflx" "alcephin,alexin,alsporin,amplex,anhydrous cefalexin,anhydrous cephalexin,biocef,carnosporin,cefablan,cefadal,cefadin,cefadina,cefaleksin,cefalessina,cefalexin,cefalexin anhydrous,cefalexina,cefalexine,cefalexinum,cefalin,cefaloto,cefaseptin,ceffanex,ceflax,ceforal,cefovit,celexin,cepastar,cepexin,cephacillin,cephalexin,cephalexin anhydrous,cephalexine,cephalexinum,cephanasten,cephaxin,cephin,ceporex,ceporex forte,ceporexin,ceporexine,cerexin,cerexins,cophalexin,durantel,durantel ds,erocetin,factagard,felexin,ibilex,ibrexin,inphalex,kefalospes,keflet,keflex,kefolan,keforal,keftab,kekrinal,kidolex,lafarine,larixin,lenocef,lexibiotico,lonflex,lopilexin,madlexin,mamalexin,mamlexin,medoxine,neokef,neolexina,novolexin,optocef,oracef,oriphex,oroxin,ortisporina,ospexin,palitrex,panixine disperdose,pectril,pyassan,roceph,roceph distab,sanaxin,sartosona,sencephalin,sepexin,servispor,sialexin,sinthecillin,sporicef,sporidex,syncle,synecl,tepaxin,tokiolexin,uphalexin,voxxim,winlex,zozarine" 2 "g" ""
|
||||
"RID" 5773 "Cefaloridine" "Cephalosporins (1st gen.)" "J01DB02" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cefa" "aliporina,ampligram,cefaloridin,cefaloridina,cefaloridine,cefaloridinum,cefalorizin,ceflorin,cepaloridin,cepalorin,cephalomycine,cephaloridin,cephaloridine,cephaloridinum,ceporan,ceporin,ceporine,cilifor,deflorin,faredina,floridin,glaxoridin,intrasporin,keflodin,keflordin,kefloridin,kefspor,lloncefal,loridine,sasperin,sefacin,verolgin,vioviantine" 3 "g" ""
|
||||
"CEP" 6024 "Cefalotin" "Cephalosporins (1st gen.)" "J01DB03" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cfal,cflt" "cefalothin,cefalotin,cefalotina,cefalotina fabra,cefalotine,cefalotinum,cemastin,cephalothinum,cephalotin,cephalotin acid,coaxin,keflin,seffin" 4 "g" ""
|
||||
"MAN" 456255 "Cefamandole" "Cephalosporins (2nd gen.)" "J01DC03" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cfam,cfmn" "cefadole,cefamandol,cefamandole,cefamandolum,cephadole,cephamandole,kefamandol,kefdole,mancef" 6 "g" "3441-3"
|
||||
"HAP" 30699 "Cefapirin" "Cephalosporins (1st gen.)" "J01DB08" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "ambrocef,cefadyl,cefapilin,cefapirin,cefapirina,cefapirine,cefapirinum,cefaprin,cefaprin sodium,cefatrex,cefatrexyl,cephapirine,metricure" 4 "g" ""
|
||||
"CTZ" 6410758 "Cefatrizine" "Cephalosporins (1st gen.)" "J01DB07" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "bricef,cefatrix,cefatrizine,cefatrizino,cefatrizinum,cephatriazine,cepticol,cetrazil,latocef,orosporina,trizina" 1 "g" ""
|
||||
"CZD" 71736 "Cefazedone" "Cephalosporins (1st gen.)" "J01DB06" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "cefazedon,cefazedona,cefazedone,cefazedone acid,cefazedonum,refosporen,refosporene,refosporin" 3 "g" ""
|
||||
"CZO" 33255 "Cefazolin" "Cephalosporins (1st gen.)" "J01DB04" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cfz,cfzl,cz,czol,faz,kz" "atirin,cefamezin,cefamezine,cefazina,cefazolin,cefazolin acid,cefazolina,cefazoline,cefazolinum,cephamezine,cephazolidin,cephazolin,cephazoline,elzogram,firmacef,kefzol,liviclina,totacef" 3 "g" "16566-2,25235-3,3442-1,3443-9,80962-4"
|
||||
"CFB" 127527 "Cefbuperazone" "Other antibacterials" "J01DC13" "" "cefbuperazona,cefbuperazone,cefbuperazonum,cefbuperzaone,cerbuperazone,tomiporan" 2 "g" ""
|
||||
"CCP" 6436055 "Cefcapene" "Cephalosporins (3rd gen.)" "J01DD17" "" "cefcamate,cefcapene" 0.45 "g" ""
|
||||
"CCX" 5282438 "Cefcapene pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefcamate pivoxil,cefcapene piroxil" ""
|
||||
"CDR" 6915944 "Cefdinir" "Cephalosporins (3rd gen.)" "J01DD15" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cd,cdn,cdr,cfd,din" "cefdinir,cefdinir anhydrous,cefdinirum,cefdinyl,cefdirnir,ceftinex,cefzon,omnicef" 0.6 "g" ""
|
||||
"DIT" 9870843 "Cefditoren" "Cephalosporins (3rd gen.)" "J01DD16" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cdn" "cefditoren" 0.4 "g" ""
|
||||
"DIX" 6437877 "Cefditoren pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefditoren,cefditoren pi voxil,cefditoren pivoxil,cefditorin,cefditorin pivoxil,meiact,spectracef" ""
|
||||
"FEP" 5479537 "Cefepime" "Cephalosporins (4th gen.)" "J01DE01" "Other beta-lactam antibacterials" "Fourth-generation cephalosporins" "cfep,cfpi,cpe,cpm,fep,pm,xpm" "axepim,cefepima,cefepime,cefepimum,cepimax,cepimex,maxcef,maxipime" 4 "g" "38363-8"
|
||||
"CFA" "Cefepime/amikacin" "Other antibacterials" "J01RA06" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"CPC" 9567559 "Cefepime/clavulanic acid" "Cephalosporins (4th gen.)" "NA" "cicl,xpml" "" ""
|
||||
"FNC" "Cefepime/nacubactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"FPT" 9567558 "Cefepime/tazobactam" "Cephalosporins (4th gen.)" "NA" "" "" ""
|
||||
"FPZ" "Cefepime/zidebactam" "Other antibacterials" "NA" "" "" ""
|
||||
"CAT" 5487888 "Cefetamet" "Cephalosporins (3rd gen.)" "J01DD10" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "cefetamet,cefetametum,cepime o,deacetoxycefotaxime" 1 "g" ""
|
||||
"CPI" 5486182 "Cefetamet pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefetamet pivoxyl,globocef" ""
|
||||
"CCL" 71719688 "Cefetecol" "Cephalosporins (4th gen.)" "NA" "cefcatacol" "cefetecol,cefetecol anhydrous" ""
|
||||
"CZL" 193956 "Cefetrizole" "Cephalosporins (unclassified gen.)" "NA" "" "cefetrizole,cefetrizolum" ""
|
||||
"FDC" 77843966 "Cefiderocol" "Other antibacterials" "J01DI04" "" "cefiderocol" ""
|
||||
"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,25236-1"
|
||||
"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" ""
|
||||
"CMZ" 42008 "Cefmetazole" "Cephalosporins (2nd gen.)" "J01DC09" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "" "cefmetazole,cefmetazolesodium,cefmetazolo,cefmetazolum" 4 "g" ""
|
||||
"CNX" 71141 "Cefminox" "Other antibacterials" "J01DC12" "" "cefminox,cefminoxum" 4 "g" ""
|
||||
"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" ""
|
||||
"CID" 43594 "Cefonicid" "Cephalosporins (2nd gen.)" "J01DC06" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "" "cefonicid,cefonicido,cefonicidum,monocef" 1 "g" "25237-9,3444-7"
|
||||
"CFP" 44187 "Cefoperazone" "Cephalosporins (3rd gen.)" "J01DD12" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfp,cfpz,cp,cpz,fop,per" "bioperazone,cefobid,cefoperazine,cefoperazon,cefoperazone,cefoperazone acid,cefoperazono,cefoperazonum,cefozon,medocef,myticef,pathozone,peracef" 4 "g" "3445-4"
|
||||
"CSL" "Cefoperazone/sulbactam" "Cephalosporins (3rd gen.)" "J01DD62" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "" 4 "g" ""
|
||||
"CND" 43507 "Ceforanide" "Cephalosporins (2nd gen.)" "J01DC11" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "" "ceforanide,ceforanido,ceforanidum,precef,radacef" 4 "g" ""
|
||||
"CSE" 9830519 "Cefoselis" "Cephalosporins (4th gen.)" "NA" "" "cefoselis,cefoselis sulfate,wincef,winsef" ""
|
||||
"CTX" 5742673 "Cefotaxime" "Cephalosporins (3rd gen.)" "J01DD01" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfot,cft,cftx,ct,ctx,fot,tax,xct" "cefotaxim,cefotaxim hikma,cefotaxima,cefotaxima acid,cefotaxime,cefotaxime acid,cefotaximum,cephotaxime,claforan,omnatax" 4 "g" "25238-7,3446-2,80961-6"
|
||||
"CTC" 9575353 "Cefotaxime/clavulanic acid" "Cephalosporins (3rd gen.)" "NA,J01DD51" "cxcl,xctl" "" ""
|
||||
"CTS" 9574753 "Cefotaxime/sulbactam" "Cephalosporins (3rd gen.)" "NA" "" "" ""
|
||||
"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" "25239-5,3447-0"
|
||||
"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" ""
|
||||
"CHE" 125846 "Cefotiam hexetil" "Cephalosporins (3rd gen.)" "NA" "" "cefotiam cilexetil,pansporin t" ""
|
||||
"FOV" 9578573 "Cefovecin" "Cephalosporins (3rd gen.)" "NA" "" "cefovecin" ""
|
||||
"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" "25240-3,3448-8"
|
||||
"FOX1" "Cefoxitin screening" "Cephalosporins (2nd gen.)" "NA" "cfsc" "" ""
|
||||
"ZOP" 9571080 "Cefozopran" "Cephalosporins (4th gen.)" "J01DE03" "" "cefozopran" 4 "g" ""
|
||||
"CFZ" 68597 "Cefpimizole" "Cephalosporins (3rd gen.)" "NA" "" "cefpimizol,cefpimizole,cefpimizole sodium,cefpimizolum" ""
|
||||
"CPM" 636405 "Cefpiramide" "Cephalosporins (3rd gen.)" "J01DD11" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "cefpiramide,cefpiramide acid,cefpiramido,cefpiramidum" 2 "g" ""
|
||||
"CPO" 5479539 "Cefpirome" "Cephalosporins (4th gen.)" "J01DE02" "Other beta-lactam antibacterials" "Fourth-generation cephalosporins" "cfpr" "broact,cefpiroma,cefpirome,cefpiromum,cefrom,cerfpirome,keiten" 4 "g" ""
|
||||
"CPD" 6335986 "Cefpodoxime" "Cephalosporins (3rd gen.)" "J01DD13" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cfpd,cfpo,cpd,pod,px" "cefpodoxim acid,cefpodoxima,cefpodoxime,cefpodoxime acid,cefpodoximum,epoxim" 0.4 "g" "25241-1"
|
||||
"CPX" 6526396 "Cefpodoxime proxetil" "Cephalosporins (3rd gen.)" "NA" "" "cefodox,cefoprox,cefpodoxime proxetil,cepodem,orelox,orelox paed,otreon,podomexef,simplicef,vantin" ""
|
||||
"CDC" "Cefpodoxime/clavulanic acid" "Cephalosporins (3rd gen.)" "NA" "cecl" "" ""
|
||||
"CPR" 5281006 "Cefprozil" "Cephalosporins (2nd gen.)" "J01DC10" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cpr,cpz,fp" "arzimol,brisoral,cefprozil,cefprozil anhydrous,cefprozil hydrate,cefprozilo,cefprozilum,cefzil,cronocef,procef,serozil" 1 "g" ""
|
||||
"CEQ" 5464355 "Cefquinome" "Cephalosporins (4th gen.)" "NA" "" "cefquinoma,cefquinome,cefquinomum,cobactan" ""
|
||||
"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" "131-3,25242-9"
|
||||
"CSU" 68718 "Cefsumide" "Cephalosporins (unclassified gen.)" "NA" "" "cefsulmid,cefsumide,cefsumido,cefsumidum" ""
|
||||
"CPT" 56841980 "Ceftaroline" "Cephalosporins (5th gen.)" "J01DI02" "cfro" "ceftaroline fosamil,teflaro,zinforo" 1.2 "g" ""
|
||||
"CPA" "Ceftaroline/avibactam" "Cephalosporins (5th gen.)" "NA" "" "" ""
|
||||
"CAZ" 5481173 "Ceftazidime" "Cephalosporins (3rd gen.)" "J01DD02" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "caz,cefta,cfta,cftz,taz,tz,xtz" "ceftazidim,ceftazidima,ceftazidime,ceftazidimum,ceptaz,fortaz,fortum,pentacef,tazicef,tazidime" 4 "g" "21151-6,3449-6,80960-8"
|
||||
"CZA" 90643431 "Ceftazidime/avibactam" "Cephalosporins (3rd gen.)" "NA" "cfav" "avycaz,zavicefta" ""
|
||||
"CCV" 9575352 "Ceftazidime/clavulanic acid" "Cephalosporins (3rd gen.)" "J01DD52" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "czcl,xtzl" "" 6 "g" ""
|
||||
"CEM" 6537431 "Cefteram" "Cephalosporins (3rd gen.)" "J01DD18" "" "cefteram,cefterame,cefteramum,ceftetrame" 0.4 "g" ""
|
||||
"CPL" 5362114 "Cefteram pivoxil" "Cephalosporins (3rd gen.)" "NA" "" "cefteram pivoxil,cefterampivoxil,tomiron" ""
|
||||
"CTL" 65755 "Ceftezole" "Cephalosporins (1st gen.)" "J01DB12" "Other beta-lactam antibacterials" "First-generation cephalosporins" "" "ceftezol,ceftezole,ceftezolo,ceftezolum,demethylcefazolin" 3 "g" ""
|
||||
"CTB" 5282242 "Ceftibuten" "Cephalosporins (3rd gen.)" "J01DD14" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "cb,cfbu,ctb,tib" "ceftem,ceftibuten,ceftibuten dihydrate,ceftibuten hydrate,ceftibutene,ceftibuteno,ceftibutenum,ceftibutin,cephem,ceprifran,isocef,keimax" 0.4 "g" ""
|
||||
"TIO" 6328657 "Ceftiofur" "Cephalosporins (3rd gen.)" "NA" "" "ceftiofur,ceftiofurum,excede,excenel,naxcel" ""
|
||||
"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" "25243-7,3450-4"
|
||||
"CZP" 9578661 "Ceftizoxime alapivoxil" "Cephalosporins (3rd gen.)" "NA" "" "" ""
|
||||
"BPR" 135413542 "Ceftobiprole" "Cephalosporins (5th gen.)" "NA" "" "ceftobiprole" ""
|
||||
"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" ""
|
||||
"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" "25244-5,3451-2,80957-4"
|
||||
"CEB" "Ceftriaxone/beta-lactamase inhibitor" "Cephalosporins (3rd gen.)" "J01DD63" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "" "" 2 "g" ""
|
||||
"CXM" 5479529 "Cefuroxime" "Cephalosporins (2nd gen.)" "J01DC02,S01AA27" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "cfrx,cfur,cfx,crm,cxm,fur,rox,xm" "biofuroksym,cefuril,cefuroxim,cefuroxima,cefuroxime,cefuroxime acid,cefuroximine,cefuroximo,cefuroximum,cephuroxime,kefurox,sharox,zinacef,zinacef danmark" 0.5 "g" 3 "g" "25245-2,3452-0,80608-3,80617-4"
|
||||
"CXA" 6321416 "Cefuroxime axetil" "Cephalosporins (2nd gen.)" "NA" "cfax" "altacef,bioracef,cefaks,cefazine,ceftin,cefurax,cefuroximaxetil,cefuroxime,cefuroxime axetil,celocid,cepazine,cethixim,cetoxil,coliofossim,elobact,forcef,furoxime,kalcef,maxitil,medoxm,nivador,novador,novocef,oraxim,zinnat" ""
|
||||
"CFM2" "Cefuroxime/metronidazole" "Other antibacterials" "J01RA03" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"ZON" 6336505 "Cefuzonam" "Other antibacterials" "NA" "" "cefuzonam,cefuzonam sodium,cefuzoname,cefuzonamum" ""
|
||||
"CED" 38103 "Cephradine" "Cephalosporins (1st gen.)" "J01DB09" "Other beta-lactam antibacterials" "First-generation cephalosporins" "cfra,cfrd" "anspor,cefradin,cefradina,cefradine,cefradine hydrate,cefradinum,cekodin,cephradin,cephradine,cephradine anhydrous,cephradine hydrate,eskacef,infexin,megace f,megacef,sefril,velocef,velosef" 2 "g" 2 "g" ""
|
||||
"CTO" 71402 "Cetocycline" "Tetracyclines" "NA" "" "cetocycline,cetocyline,cetotetrine,chelocardin" ""
|
||||
"CHL" 5959 "Chloramphenicol" "Amphenicols" "D06AX02,D10AF03,G01AA05,J01BA01,S01AA01,S02AA01,S03AA08" "Amphenicols" "Amphenicols" "c,chl,chlo,cl" "alficetyn,ambofen,amphenicol,amphicol,amseclor,anacetin,aquamycetin,austracil,austracol,biocetin,biophenicol,catilan,ch loramex,chemiceticol,chemicetin,chemicetina,chlomin,chlomycol,chloramex,chloramfenikol,chloramficin,chloramfilin,chloramphenicol,chloramphenicole,chloramphenicolum,chloramsaar,chlorasol,chlorbiotic,chloricol,chlormycetin r,chlornitromycin,chloroamphenicol,chlorocaps,chlorocid,chlorocid s,chlorocide,chlorocidin c,chlorocidin c tetran,chlorocin,chlorocol,chlorofair,chloroject l,chloromax,chloromycetin,chloromycetny,chloromyxin,chloronitrin,chloroptic,chloroptic s.o.p,chloroptic s.o.p.,chlorovules,chlorsig,cidocetine,ciplamycetin,cloramfen,cloramfenicol,cloramfenicolo,cloramficin,cloramical,cloramicol,cloramidina,cloranfenicol,cloroamfenicolo,clorocyn,cloromisan,cloromissan,clorosintex,comycetin,cylphenicol,desphen,detreomycin,detreomycine,dextromycetin,doctamicina,duphenicol,econochlor,embacetin,emetren,enicol,enteromycetin,erbaplast,ertilen,f armicetina,farmicetina,fenicol,globenicol,glorous,gloveticol,halcetin,halomycetin,hortfenicol,interomycetine,intramycetin,intramyctin,isicetin,ismicetina,isophenicol,isopto fenicol,juvamycetin,kamaver,kemicetina,kemicetine,kloramfenikol,klorita,klorocid s,laevomycetinum,leukamycin,leukomyan,leukomycin,levocin,levomicetina,levomitsetin,levomycetin,levoplast,levosin,levovetin,loromicetina,loromisan,loromisin,mastiphen,mediamycetine,medichol,micloretin,micochlorine,micoclorina,microcetina,mychel,mycinol,myclocin,mycochlorin,myscel,normimycin v,novochlorocap,novomycetin,novophenicol,ocuphenicol,oftalent,oleomycetin,opclor,opelor,ophthochlor,ophthocort,ophtochlor,optomycin,otachron,otophen,pantovernil,paraxin,pentamycetin,quemicetina,rivomycin,romphenil,ronfenil,ronphenil,septicol,sificetina,sintomicetin,sintomicetina,sintomicetine r,sno phenicol,soluthor,stanomycetin,synthomycetin,synthomycetine,synthomycine,syntomycin,tevcocin,tevcosin,tifomycin,tifomycine,tiromycetin,treomicetina,tyfomycine,unimycetin,veticol,vice ton,viceton" 3 "g" 3 "g" "15101-9,16603-3,16604-1,25247-8,29214-4,29346-4,29347-2,3455-3"
|
||||
"CTE" 54675777 "Chlortetracycline" "Tetracyclines" "A01AB21,D06AA02,J01AA03,S01AA02" "Tetracyclines" "Tetracyclines" "" "acronize,aueromycin,aureocina,aureomycin,aureomykoin,biomitsin,biomycin,biomycin a,chlormax,chlorotetracycline,chlortetracycline,chlortetracyclinum,chrysomykine,clortetraciclina,duomycin,flamycin,uromycin" 1 "g" "87600-3"
|
||||
"CIC" 19003 "Ciclacillin" "Beta-lactams/penicillins" "NA" "" "bastcillin,calthor,ciclacilina,ciclacillin,ciclacilline,ciclacillinum,ciclacillum,citosarin,cyclacillin,cyclapen,noblicil,orfilina,peamezin,syngacillin,ultracillin,vastcillin,vipicil,wyvital" ""
|
||||
"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" ""
|
||||
"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" "14031-9,14032-7,14058-2,14059-0,25248-6,34636-1,3484-3"
|
||||
"CIM" "Ciprofloxacin/metronidazole" "Other antibacterials" "J01RA10" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"CIO" "Ciprofloxacin/ornidazole" "Other antibacterials" "J01RA12" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"CIT" "Ciprofloxacin/tinidazole" "Other antibacterials" "J01RA11" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"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" "16619-9,25253-6,34638-7,80559-8"
|
||||
"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" ""
|
||||
"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,25249-4,3486-8"
|
||||
"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" ""
|
||||
"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" ""
|
||||
"CLM1" 54680675 "Clomocycline" "Tetracyclines" "J01AA11" "Tetracyclines" "Tetracyclines" "" "chlormethylencycline,clomociclina,clomocyclin,clomocycline,clomocyclinum,megaclor" 1 "g" ""
|
||||
"CTR" 2812 "Clotrimazole" "Antifungals/antimycotics" "A01AB18,D01AC01,G01AF02" "clot" "canesten,canesten cream,canesten solution,canestene,canestine,canifug,chlotrimazole,cimitidine,clomatin,clotrimaderm,clotrimaderm cream,clotrimazol,clotrimazole,clotrimazolum,cutistad,desamix f,diphenylmethane,empecid,esparol,fem care,femcare,gyne lotrimin,jidesheng,kanesten,klotrimazole,lotrimax,lotrimin,lotrimin af,lotrimin af cream,lotrimin af lotion,lotrimin af solution,lotrimin cream,lotrimin lotion,lotrimin solution,monobaycuten,mycelax,mycelex,mycelex cream,mycelex g,mycelex otc,mycelex solution,mycelex troches,mycelex twin pack,myclo cream,myclo solution,myclo spray solution,mycofug,mycosporin,mykosporin,nalbix,otomax,pedisafe,rimazole,stiemazol,tibatin,trimysten,trivagizole,veltrim" ""
|
||||
"CLO" 6098 "Cloxacillin" "Beta-lactams/penicillins" "J01CF02" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "clox" "chloroxacillin,clossacillina,cloxacilina,cloxacillin,cloxacillin sodium,cloxacilline,cloxacillinna,cloxacillinum,cloxapen,methocillin s,orbenin,syntarpen,tegopen" 2 "g" 2 "g" "16628-0,25250-2"
|
||||
"COL" 5311054 "Colistin" "Polymyxins" "A07AA10,J01XB01" "Other antibacterials" "Polymyxins" "cl,coli,cs,cst,ct" "belcomycine,colimycin,colimycin sulphate,colisticin,colistimethate,colistimethate sodium,colistin sulfate,colistin sulphate,colobreathe,colomycin,coly-mycin,polymyxin e,polymyxin e. sulfate,promixin,totazina" 9 "MU" 9 "MU" "16645-4,29493-4"
|
||||
"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,25251-0,3519-6"
|
||||
"DAL" 23724878 "Dalbavancin" "Glycopeptides" "J01XA04" "Other antibacterials" "Glycopeptide antibacterials" "dalb" "dalbavancin,dalvance" 1.5 "g" ""
|
||||
"DAN" 71335 "Danofloxacin" "Quinolones" "NA" "" "advocin,danofloxacin,danofloxacine,danofloxacino,danofloxacinum" ""
|
||||
"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" "9747-7"
|
||||
"DAP" 16134395 "Daptomycin" "Other antibacterials" "J01XX09" "Other antibacterials" "Other antibacterials" "dap,dapt" "cidecin,cubicin,dapcin,daptomicina,daptomycine,daptomycinum" 0.28 "g" ""
|
||||
"DFX" 487101 "Delafloxacin" "Quinolones" "J01MA23" "" "baxdela,delafloxacin,delafloxacinum,quofenix" 0.9 "g" 0.6 "g" ""
|
||||
"DLM" 6480466 "Delamanid" "Antimycobacterials" "J04AK06" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "dela" "delamanid,deltyba" 0.2 "g" ""
|
||||
"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,29494-2"
|
||||
"DKB" 470999 "Dibekacin" "Aminoglycosides" "J01GB09" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "debecacin,dibekacin,dibekacin sulfate,dibekacina,dibekacine,dibekacinum,dideoxykanamycin b,kappati,orbicin,panamicin" 0.14 "g" ""
|
||||
"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,25252-8"
|
||||
"DIF" 56206 "Difloxacin" "Quinolones" "NA" "" "dicural,difloxacin,pulsaflox" ""
|
||||
"DIR" 6473883 "Dirithromycin" "Macrolides/lincosamides" "J01FA13" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "dirithromycin,dirithromycine,dirithromycinum,diritromicina,divitross,dynabac,noriclan,valodin" 0.5 "g" ""
|
||||
"DOR" 73303 "Doripenem" "Carbapenems" "J01DH04" "Other beta-lactam antibacterials" "Carbapenems" "dori" "doribax,doripenem,doripenem hydrate,finibax" 1.5 "g" ""
|
||||
"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,21250-6,26902-7"
|
||||
"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" ""
|
||||
"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,3590-7"
|
||||
"ENR" 71188 "Enrofloxacin" "Quinolones" "NA" "" "baytril,enrofloxacin,enrofloxacine,enrofloxacino,enrofloxacinum,enroxil" ""
|
||||
"ENV" 135565326 "Enviomycin" "Antimycobacterials" "J04AB06" "tuberactinomycin" "enviomicina,enviomycin,enviomycina,enviomycinum,tuberactin" ""
|
||||
"EPE" "Eperozolid" "Other antibacterials" "NA" "" "" ""
|
||||
"EPC" 71392 "Epicillin" "Beta-lactams/penicillins" "J01CA07" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "dexacillin,dihydroampicillin,epicilina,epicillin,epicilline,epicillinum" 2 "g" 2 "g" ""
|
||||
"EPP" 68916 "Epiroprim" "Other antibacterials" "NA" "" "epiroprim,epiroprima,epiroprime,epiroprimum" ""
|
||||
"ERV" 54726192 "Eravacycline" "Tetracyclines" "J01AA13" "Tetracyclines" "Tetracyclines" "erav" "eravacycline,xerava" ""
|
||||
"ETP" 150610 "Ertapenem" "Carbapenems" "J01DH03" "Other beta-lactam antibacterials" "Carbapenems" "erta,etp" "ertapenem,invanz" 1 "g" ""
|
||||
"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" "12298-6,16829-4,25275-9,3597-2"
|
||||
"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" "25404-5,3607-9"
|
||||
"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" "16845-0"
|
||||
"ETO" 6034 "Ethopabate" "Other antibacterials" "NA" "" "amprol plus,ethopabat,ethopabate,ethyl pabate" ""
|
||||
"EXE" "Exebacase" "NA" "" "" ""
|
||||
"FAR" 65894 "Faropenem" "Other antibacterials" "J01DI03" "Other beta-lactam antibacterials" "Other cephalosporins and penems" "" "faropenem,faropenem sodium,fropenem,fropenum sodium" 0.75 "g" ""
|
||||
"FDX" 10034073 "Fidaxomicin" "Other antibacterials" "A07AA12" "" "dificid,dificlir,difimicin,fidaxomicin,lipiarmicin,lipiarmycin,lipiarrmycin,tiacumicin b" 0.4 "g" ""
|
||||
"FIN" 11567473 "Finafloxacin" "Quinolones" "NA" "" "finafloxacin" ""
|
||||
"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" ""
|
||||
"FLO" 65864 "Flomoxef" "Other antibacterials" "J01DC14" "" "flomoxef,flomoxefo,flomoxefum" 2 "g" ""
|
||||
"FLR" 114811 "Florfenicol" "Other antibacterials" "NA" "" "aquafen,florfenicol,nuflor,nuflor gold" "87599-7"
|
||||
"FLC" 21319 "Flucloxacillin" "Beta-lactams/penicillins" "J01CF05" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "clox,flux" "culpen,floxacillin,floxacillin sodium,floxapen,floxapen sodium salt,fluclox,flucloxacilina,flucloxacillin,flucloxacilline,flucloxacillinum,fluorochloroxacillin,staphylex" 2 "g" 2 "g" ""
|
||||
"FLU" 3365 "Fluconazole" "Antifungals/antimycotics" "D01AC15,J02AC01" "Antimycotics for systemic use" "Triazole derivatives" "fluc,fluz,flz" "alflucoz,alfumet,alkanazole,biocanol,biozole,biozolene,canzol,cryptal,diflazon,diflucan,dimycon,elazor,flucazol,fluconazol,fluconazole,fluconazole capsules,fluconazoli,fluconazolum,flucoral,flucostat,flukezol,flunazol,flunizol,flusol,fluzon,fluzone,forcan,fuconal,fungata,loitin,oxifugol,pritenzol,syscan,trican,triconal,triflucan,zoltec" 0.2 "g" 0.2 "g" "10987-6,16870-8,25255-1,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" ""
|
||||
"FLM" 3374 "Flumequine" "Quinolones" "J01MB07" "Quinolone antibacterials" "Other quinolones" "" "apurone,fantacin,flumequine,flumequino,flumequinum,flumigal,flumiquil,flumisol,flumix,imequyl" 1.2 "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" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"GRN" 124093 "Garenoxacin" "Quinolones" "J01MA19" "" "ganefloxacin,garenfloxacin,garenoxacin" 0.4 "g" ""
|
||||
"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" ""
|
||||
"GEM" 9571107 "Gemifloxacin" "Quinolones" "J01MA15" "Quinolone antibacterials" "Fluoroquinolones" "" "factiv,factive,gemifioxacin,gemifloxacin,gemifloxacine,gemifloxacino,gemifloxacinum" 0.32 "g" ""
|
||||
"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" "13561-6,13562-4,15106-8,22746-2,22747-0,31091-2,31092-0,31093-8,35668-3,3663-2,3664-0,3665-7,39082-3,47109-4,59379-8,80971-5,88111-0"
|
||||
"GEH" "Gentamicin-high" "Aminoglycosides" "NA" "gehi,gehl,genta high,gentamicin high" "" ""
|
||||
"GEP" 25101874 "Gepotidacin" "Other antibacterials" "NA" "" "gepotidacin" ""
|
||||
"GRX" 72474 "Grepafloxacin" "Quinolones" "J01MA11" "Quinolone antibacterials" "Fluoroquinolones" "grep" "grepafloxacin" 0.4 "g" ""
|
||||
"GRI" 441140 "Griseofulvin" "Antifungals/antimycotics" "D01AA08,D01BA01" "" "amudane,curling factor,delmofulvina,fulcin,fulcine,fulvican grisactin,fulvicin,fulvicin bolus,fulvidex,fulvina,fulvinil,fulvistatin,fungivin,greosin,gresfeed,gricin,grifulin,grifulvin,grifulvin v,grisactin,grisactin ultra,grisactin v,griscofulvin,grise ostatin,grisefuline,griseo,griseoflulvin,griseofulvin,griseofulvin forte,griseofulvina,griseofulvine,griseofulvinum,griseomix,griseostatin,grisetin,grisofulvin,grisovin,grisovin fp,grizeofulvin,grysio,guservin,lamoryl,likuden,likunden,murfulvin,poncyl,spirofulvin,sporostatin xan,xuanjing" 0.5 "g" "12402-4"
|
||||
"HAB" 175989 "Habekacin" "Aminoglycosides" "NA" "" "arbekacin sulfate,arbekacin sulphate,habekacin,habekacin sulfate,habekacin xsulfate,habekacinxsulfate" ""
|
||||
"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" ""
|
||||
"HYG" 56928061 "Hygromycin" "Aminoglycosides" "NA" "" "antihelmycin,hydromycin b,hygrovetine" ""
|
||||
"IBX" "Ibrexafungerp" "Antifungals" "NA" "" "ibrexafungerp" ""
|
||||
"ICL" 213043 "Iclaprim" "Other antibacterials" "J01EA03" "" "iclaprim,mersarex" ""
|
||||
"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" "17010-0,25257-7,27331-8,3688-9"
|
||||
"IPE" "Imipenem/EDTA" "Carbapenems" "NA" "" "" ""
|
||||
"IMR" "Imipenem/relebactam" "Carbapenems" "NA,J01DH56" "" "" ""
|
||||
"ISV" 6918485 "Isavuconazole" "Antifungals/antimycotics" "J02AC05" "isav" "isavuconazole" 0.2 "g" 0.2 "g" ""
|
||||
"ISE" 3037209 "Isepamicin" "Aminoglycosides" "J01GB11" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "isepacin,isepalline,isepamicin,isepamicina,isepamicine,isepamicinsulphate,isepamicinum" 0.4 "g" ""
|
||||
"ISO" 3760 "Isoconazole" "Antifungals/antimycotics" "D01AC05,G01AF07" "Antimycotics for topic use" "Triazole derivatives" "" "isoconazol,isoconazole,isoconazolum,travogen" ""
|
||||
"INH" 3767 "Isoniazid" "Antimycobacterials" "J04AC01" "Drugs for treatment of tuberculosis" "Hydrazides" "inh" "abdizide,andrazide,anidrasona,antimicina,antituberkulosum,armacide,armazid,armazide,atcotibine,azt + isoniazid,azuren,bacillin,cemidon,chemiazid,chemidon,continazine,cortinazine,cotinazin,cotinizin,defonin,dianicotyl,dibutin,diforin,dinacrin,ditubin,ebidene,eralon,ertuban,eutizon,evalon,fetefu,fimalene,hid rasonil,hidranizil,hidrasonil,hidrulta,hidrun,hycozid,hydrazid,hydrazide,hyozid,i.a.i.,idrazil,inizid,ipcazide,iscotin,isidrina,ismazide,isobicina,isocid,isocidene,isocotin,isohydrazide,isokin,isolyn,isonerit,isonex,isoniacid,isoniazid,isoniazid sa,isoniazida,isoniazide,isoniazidum,isonicazide,isonicid,isonico,isonicotan,isonicotil,isonicotinhydrazid,isonicotinohydrazide,isonide,isonidrin,isonikazid,isonilex,isonin,isonindon,isonirit,isoniton,isonizida,isonizide,isotamine,isotebe,isotebezid,isotinyl,isozid,isozide,isozyd,laniazid,laniozid,lanizid,mayambutol,mybasan,neoteben,neoxin,neumandin,niadrin,nicazide,nicetal,nicizina,niconyl,nicotibina,nicotibine,nicotisan,nicozide,nidaton,nidrazid,nikozid,niplen,nitadon,niteban,nydrazid,nyscozid,pelazid,percin,phthisen,pycazide,pyreazid,pyricidin,pyridicin,pyrizidin,raumanon,razide,retozide,rifater,rimicid,rimifon,rimiphone,rimitsid,robiselin,robisellin,roxifen,sanohidrazina,sauterazid,sauterzid,stanozide,tebecid,tebenic,tebexin,tebilon,teebaconin,tekazin,tibazide,tibemid,tibiazide,tibinide,tibison,tibivis,tibizide,tibusan,tisiodrazida,tizide,tubazid,tubazide,tubeco,tubecotubercid,tuberian,tubicon,tubilysin,tubizid,tubomel,unicocyde,unicozyde,vazadrine,vederon,zidafimia,zinadon,zonazide" 0.3 "g" 0.3 "g" "25451-6,26756-7,3697-0,40371-7"
|
||||
"IST" "Isoniazid/sulfamethoxazole/trimethoprim/pyridoxine" "Antimycobacterials" "J04AM08" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"ITR" 3793 "Itraconazole" "Antifungals/antimycotics" "J02AC02" "Antimycotics for systemic use" "Triazole derivatives" "itra" "intraconazole,itraconazol,itraconazole,itraconazolo,itraconazolum,itraconzaole,itrazole,itrizole,oriconazole,sporanox" 0.2 "g" 0.2 "g" "10989-2,12392-7,25258-5,27081-9,32184-4,32185-1,80531-7"
|
||||
"JOS" 5282165 "Josamycin" "Macrolides/lincosamides" "J01FA07" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "jomybel,josacine,josamicina,josamycin,josamycine,josamycinum" 2 "g" ""
|
||||
"KAN" 6032 "Kanamycin" "Aminoglycosides" "A07AA08,J01GB04,S01AA24" "Aminoglycoside antibacterials" "Other aminoglycosides" "hlk,k,kan,kana,km" "kanamicina,kanamycin,kanamycin a,kanamycin base,kanamycin sulfate,kanamycina,kanamycine,kanamycins,kanamycinum,kantrex,kenamycin a,klebcil,liposomal kanamycin" 3 "g" 1 "g" "23889-9,3698-8,3699-6,3700-2,47395-9"
|
||||
"KAH" "Kanamycin-high" "Aminoglycosides" "NA" "k_h,kahl" "" ""
|
||||
"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,25259-3,60091-6,60092-4"
|
||||
"KIT" "Kitasamycin" "Macrolides/lincosamides" "NA" "leucomycin" "jomybel,josacine,josamicina,josamycin,josamycine,josamycinum" ""
|
||||
"LAS" 5360807 "Lasalocid" "Other antibacterials" "NA" "" "avatec,lasalocid,lasalocid a,lasalocide,lasalocide a,lasalocido,lasalocidum" "87598-9"
|
||||
"LSC" 71528768 "Lascufloxacin" "Quinolones" "J01MA25" "Quinolone antibacterials" "Fluoroquinolones" "" "lascufloxacin" 75 "mg" ""
|
||||
"LTM" 47499 "Latamoxef" "Cephalosporins (3rd gen.)" "J01DD06" "Other beta-lactam antibacterials" "Third-generation cephalosporins" "mox,moxa,moxalactam" "disodium moxalactam,festamoxin,lamoxactam,latamoxef,latamoxefum,moxalactamsupplement,shiomarin" 4 "g" ""
|
||||
"LMU" 25185057 "Lefamulin" "Other antibacterials" "J01XX12" "" "lefamulin,xenleta" ""
|
||||
"LEN" 65646 "Lenampicillin" "Beta-lactams/penicillins" "NA" "" "lenampicilina,lenampicillin,lenampicillin hcl,lenampicilline,lenampicillinum" ""
|
||||
"LVX" 149096 "Levofloxacin" "Quinolones" "J01MA12,S01AE05" "Quinolone antibacterials" "Fluoroquinolones" "le,lev,levo,lvx" "aeroquin,anhydrous ofloxacin,cravit,cravit hydrate,cravit iv,cravit ophthalmic,elequine,floxacin,floxel,fluoroquinolone,iquix hydrate,leroxacin,lesacin,levaquin,levaquin hydrate,levo floxacin,levofiexacin,levofloxacin,levofloxacin hydrate,levofloxacine,levofloxacino,levofloxacinum,levokacin,levoxacin,mosardal,nofaxin,ofloxcacin,oftaquix,quinsair,quixin,reskuin,tavanic,unibiotic,venaxan,volequin" 0.5 "g" 0.5 "g" "21368-6,30532-6,30533-4"
|
||||
"LEO" "Levofloxacin/ornidazole" "Other antibacterials" "J01RA05" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"LND" 9850038 "Levonadifloxacin" "Quinolones" "J01MA24" "" "levonadifloxacin" ""
|
||||
"LSP" "Linco-spectin" "Other antibacterials" "NA" "lincomycin/spectinomycin" "" ""
|
||||
"LIN" 3000540 "Lincomycin" "Macrolides/lincosamides" "J01FF02" "Macrolides, lincosamides and streptogramins" "Lincosamides" "linc" "bactramycin,cillimycin,frademicina,jiemycin,lincocin,lincolcina,lincolnensin,lincomicina,lincomycin,lincomycin a,lincomycine,lincomycinum,lincorex" 1.8 "g" 1.8 "g" "87597-1"
|
||||
"LNZ" 441401 "Linezolid" "Oxazolidinones" "J01XX08" "Other antibacterials" "Other antibacterials" "line,lnz,lz,lzd" "linezlid,linezoid,linezolid,linezolide,linezolidum,zivoxid,zyvoxa,zyvoxam,zyvoxid" 1.2 "g" 1.2 "g" "34202-2,80609-1"
|
||||
"LFE" "Linoprist-flopristin" "Other antibacterials" "NA" "" "" ""
|
||||
"LOM" 3948 "Lomefloxacin" "Quinolones" "J01MA07,S01AE04" "Quinolone antibacterials" "Fluoroquinolones" "lmf,lom,lome" "lomefloxacin,lomefloxacine,lomefloxacino,lomefloxacinum,maxaquin" 0.4 "g" ""
|
||||
"LOR" 5284585 "Loracarbef" "Cephalosporins (2nd gen.)" "J01DC08" "Other beta-lactam antibacterials" "Second-generation cephalosporins" "lora" "anhydrous loracarbef,lorabid,loracabef,loracarbef,loracarbefum,lorbef,loribid" 0.6 "g" ""
|
||||
"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" ""
|
||||
"MNA" 1292 "Mandelic acid" "Other antibacterials" "B05CA06,J01XX06" "Other antibacterials" "Other antibacterials" "" "acido mandelico,almond acid,ammonium mandelate,amygdalic acid,benzoglycolic acid,hydroxyacetic acid,kyselina mandlova,mandelic acid,paramandelic acid,phenylglycolic acid,uromaline" 12 "g" ""
|
||||
"MGX" "Manogepix" "Antifungals" "NA" "" "manogepix" ""
|
||||
"MAR" 60651 "Marbofloxacin" "Quinolones" "NA" "" "marbocyl,marbofloxacin,marbofloxacine,marbofloxacino,marbofloxacinum,zeniquin" ""
|
||||
"MEC" 36273 "Mecillinam" "Beta-lactams/penicillins" "J01CA11" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "amdinocillin" "amdinocillin,coactin,hexacillin,mecilinamo,mecillinam,mecillinamum,micillinam,penicillin hx,selexidin" 1.2 "g" ""
|
||||
"MEL" 71306732 "Meleumycin" "Macrolides/lincosamides" "NA" "" "" ""
|
||||
"MEM" 441130 "Meropenem" "Carbapenems" "J01DH02" "Other beta-lactam antibacterials" "Carbapenems" "mem,mer,mero,mp,mrp" "meronem,meropen,meropenem,meropenem anhydrous,meropenem hydrate,meropenem trihydrate,meropenemum,merrem,merrem i.v.,merrem iv" 3 "g" "41406-0"
|
||||
"MNC" "Meropenem/nacubactam" "Carbapenems" "NA" "" "" ""
|
||||
"MEV" "Meropenem/vaborbactam" "Carbapenems" "J01DH52" "Other beta-lactam antibacterials" "Carbapenems" "" "carbavance,vabomere" 3 "g" ""
|
||||
"MES" 176886 "Mesulfamide" "Other antibacterials" "NA" "" "mesulfamide,mesulfamido,mesulfamidum" ""
|
||||
"MTC" 54675785 "Metacycline" "Tetracyclines" "J01AA05" "Tetracyclines" "Tetracyclines" "" "bialatan,metaciclina,metacycline,metacyclinum,methacycline,methacycline base,methacyclinum,methylenecycline,physiomycine,rondomycin" 0.6 "g" ""
|
||||
"MTM" 6713928 "Metampicillin" "Beta-lactams/penicillins" "J01CA14" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "blomopen,bonopen,celinmicina,elatocilline,fedacilina kapseln,filorex,italcina kapseln,magnipen,metabacter ampullen,metambac,metampicilina,metampicillin,metampicillin sodium,metampicillina,metampicilline,metampicillinum,methampicillin,metiskia ampullen,micinovo,micinovo ampullen,pangocilin,probiotic,rastomycin k,relyothenate,ruticina,rutizina,rutizina ampullen,sedomycin,suvipen,suvipen ampullen,tampilen ampullen,teonicon trofen,viderpen,viderpin,vioplex" 1.5 "g" 1.5 "g" ""
|
||||
"MTH" 4101 "Methenamine" "Other antibacterials" "J01XX05" "Other antibacterials" "Other antibacterials" "" "aceto hmt,aminoform,aminoformaldehyde,ammoform,ammonioformaldehyde,antihydral,cystamin,cystex,cystogen,duirexol,ekagom h,esametilentetramina,formamine,formin,h.m.t.,heksa k,herax uts,heterin,hexa b,hexaform,hexaloids,hexamethylamine,hexamethylenamine,hexamethyleneamine,hexamethylentetramin,hexamine,hexamine silver,hexamine superfine,hexaminum,hexasan,hexilmethylenamine,mandelamine,metenamina,metenamine,methamin,methenamin,methenamine,methenamine silver,methenaminum,metramine,naphthamine,nocceler h,preparation af,resotropin,sanceler h,sanceler ht,silver methenamine,uramin,uratrine,urisol,uritone,urodeine,urotropin,urotropine,vesaloin,vesalvine,xametrin" 3 "g" ""
|
||||
"MET" 6087 "Meticillin" "Beta-lactams/penicillins" "J01CF03" "Beta-lactam antibacterials, penicillins" "Beta-lactamase resistant penicillins" "meti" "dimocillin,metacillin,methcilline,methicillin,methicillinum,methycillin,meticilina,meticillin,meticillina,meticilline,meticillinum,staphcillin" 4 "g" ""
|
||||
"MTP" 68590 "Metioprim" "Other antibacterials" "NA" "" "methioprim,metioprim,metioprima,metioprime,metioprimum" ""
|
||||
"MXT" 3047729 "Metioxate" "Quinolones" "NA" "" "metioxate,metioxato,metioxatum" ""
|
||||
"MTR" 4173 "Metronidazole" "Other antibacterials" "A01AB17,D06BX01,G01AF01,J01XD01,P01AB01" "Other antibacterials" "Imidazole derivatives" "metr,mnz" "acromona,anagiardil,arilin,atrivyl,danizol,deflamon,donnan,efloran,elyzol,entizol,flagemona,flagesol,flagil,flagyl,flagyl er,flagyl i.v.,flagyl i.v. rtu,flazol,flegyl,florazole,fossyol,giatricol,ginefla vir,gineflavir,helidac,mepagyl,meronidal,methronidazole,metric,metro cream,metro gel,metro i.v,metro i.v.,metro iv,metrocream,metrodzhil,metrogel,metrogyl,metrolag,metrolotion,metrolyl,metromidol,metronidaz,metronidazol,metronidazole,metronidazole usp,metronidazolo,metronidazolum,metrotop,metrozine,metryl,mexibol,mexibol 'silanes',monagyl,monasin,nidagel,nidagyl,noritate,novonidazol,nuvessa,orvagil,polibiotic,protostat,rathimed,rosased,sanatrichom,satric,takimetol,trichazol,trichex,tricho cordes,trichobrol,trichocide,trichomol,trichopal,trichopol,tricocet,tricom,tricowas b,trikacide,trikamon,trikhopol,trikojol,trikozol,trimeks,trivazol,vagilen,vagimid,vandazole,vertisal,wagitran,zadstat,zidoval" 2 "g" 1.5 "g" "10991-8"
|
||||
"MEZ" 656511 "Mezlocillin" "Beta-lactams/penicillins" "J01CA10" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "mez,mezl,mz" "mezlin,mezlocilina,mezlocillin,mezlocillin acid,mezlocillin sodium,mezlocilline,mezlocillinum,multocillin" 6 "g" "3820-8"
|
||||
"MSU" "Mezlocillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"MIF" 477468 "Micafungin" "Antifungals/antimycotics" "J02AX05" "Antimycotics for systemic use" "Other antimycotics for systemic use" "mica" "micafungin,mycamine" 0.1 "g" "58418-5"
|
||||
"MCZ" 4189 "Miconazole" "Antifungals/antimycotics" "A01AB09,A07AC01,D01AC02,G01AF04,J02AB01,S02AA13" "Antimycotics for systemic use" "Imidazole derivatives" "mico" "aflorix,albistat,andergin,brentan,conofite,dactarin,daktarin,daktarin iv,florid,lotrimin af,micantin,miconasil nitrate,miconazol,miconazole,miconazole base,miconazolo,miconazolum,micozole,minostate,monista,monistat,monistat iv,oravig,vusion,zimybase,zimycan" 0.2 "g" 1 "g" "17278-3"
|
||||
"MCR" 3037206 "Micronomicin" "Aminoglycosides" "S01AA22" "" "gentamicin c,micromicin,micromycin,micronomicin,micronomicina,micronomicine,micronomicinum,sagamicin,santemycin" ""
|
||||
"MID" 5282169 "Midecamycin" "Macrolides/lincosamides" "J01FA03" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "aboren,espinomycin a,macropen,madecacine,medemycin,midecamicina,midecamycin,midecamycin a,midecamycine,midecamycinum,midecin,momicine,mydecamycin,myoxam,normicina,rubimycin,turimycin p" 1.2 "g" 1 "g" ""
|
||||
"MIL" 37614 "Miloxacin" "Quinolones" "NA" "" "miloxacin,miloxacine,miloxacino,miloxacinum" ""
|
||||
"MNO" 54675783 "Minocycline" "Tetracyclines" "A01AB23,D10AF07,J01AA08" "Tetracyclines" "Tetracyclines" "mc,mh,mi,min,mino,mn,mno" "akamin,aknemin,borymycin,dynacin,klinomycin,minociclina,minocin,minocline,minocyclin,minocycline,minocyclinum,minocyn,minoderm,minomycin,sebomin,solodyn,vectrin" 1 "mg" 0.2 "g" "34606-4,3822-4,49757-8"
|
||||
"MCM" 5282188 "Miocamycin" "Macrolides/lincosamides" "J01FA11" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "acecamycin,macroral,midecamycin acetate,miocamen,miocamycin,miocamycine,miokamycin,myocamicin,ponsinomycin" 1.2 "g" ""
|
||||
"MON" 23667299 "Monensin sodium" "Other antibacterials" "NA" "" "monensin sodium,sodium monensin" ""
|
||||
"MRN" 70374 "Morinamide" "Antimycobacterials" "J04AK04" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "morfazinamide,morfazinammide,morfgazinamide,morinamida,morinamide,morinamide hcl,morinamidum,morphazinamid,morphazinamide,piazofolina,piazolin,piazolina" ""
|
||||
"MFX" 152946 "Moxifloxacin" "Quinolones" "J01MA14,S01AE07" "Quinolone antibacterials" "Fluoroquinolones" "mox,moxi,mxf" "actira,avelox,avelox i.v.,avelox iv,avolex,izilox,moxeza,moxifloxacin,moxifloxacine,moxivig,vigamox,zimoxin" 0.4 "g" 0.4 "g" "43751-7,45223-5,80540-8"
|
||||
"MUP" 446596 "Mupirocin" "Other antibacterials" "D06AX09,R01AX06" "mup,mupi" "bactoderm,bactroban,bactroban nasal,bactroban ointment,centany,mupirocin,mupirocina,mupirocine,mupirocinum,plasimine,pseudomonic acid,pseudomonic acid a,turixin" ""
|
||||
"NAC" 73386748 "Nacubactam" "Beta-lactams/penicillins" "NA" "" "nacubactam" ""
|
||||
"NAD" 4410 "Nadifloxacin" "Quinolones" "D10AF05" "" "acuatim,nadifloxacin,nadifloxacine,nadifloxacino,nadifloxacinum,nadixa,nadoxin" ""
|
||||
"NAF" 8982 "Nafcillin" "Beta-lactams/penicillins" "J01CF06" "" "nafcilina,nafcillin,nafcillin sodium,nafcilline,nafcillinum,nallpen,naphcillin,unipen" 3 "g" "10993-4,25232-0"
|
||||
"ZWK" 117587595 "Nafithromycin" "Macrolides/lincosamides" "NA" "" "nafithromycin" ""
|
||||
"NAL" 4421 "Nalidixic acid" "Quinolones" "J01MB02" "Quinolone antibacterials" "Other quinolones" "na,nal,nali" "acide nalidixico,acide nalidixique,acido nalidissico,acido nalidixico,acidum nalidixicum,betaxina,dixiben,dixinal,eucisten,eucistin,innoxalomn,innoxalon,jicsron,kusnarin,naldixic acid,nalidic acid,nalidicron,nalidixan,nalidixane,nalidixate,nalidixate sodium,nalidixic,nalidixic acid,nalidixicacid,nalidixin,nalidixinic acid,nalidixinsaure,nalitucsan,nalurin,narigix,naxuril,neggram,negram,nevigramon,nicelate,nogram,poleon,sicmylon,specifen,specifin,unaserus,uralgin,uriben,uriclar,urisal,urodixin,uroman,uroneg,uronidix,uropan,wintomylon,wintron" 4 "g" ""
|
||||
"NAR" 65452 "Narasin" "Other antibacterials" "NA" "" "monteban,narasin,narasin a,narasine,narasino,narasinum,narasul" "87570-8"
|
||||
"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,25262-7"
|
||||
"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" "25263-5,3848-9,3849-7,3850-5,47385-0,59565-2,59566-0,59567-8"
|
||||
"NIC" 9507 "Nicarbazin" "Other antibacterials" "NA" "" "nicarb,nicarbasin,nicarbazin,nicarbazine,nicoxin,nicrazin,nicrazine,nirazin" ""
|
||||
"NIF" 71946 "Nifuroquine" "Quinolones" "NA" "" "abimasten,nifuroquina,nifuroquine,nifuroquinum,quinaldofur" ""
|
||||
"NFR" 9571062 "Nifurtoinol" "Other antibacterials" "J01XE02" "Other antibacterials" "Nitrofuran derivatives" "" "levantin,nifurtoinol,nifurtoinolo,nifurtoinolum,urfadin,urfadine,urfadyn" 0.16 "g" ""
|
||||
"NTZ" 41684 "Nitazoxanide" "Other antibacterials" "P01AX11" "" "adrovet,alinia,azt + nitazoxanide,colufase,cryptaz,dexidex,heliton,kidonax,nitaxozanid,nitaxozanide,nitazox,nitazoxamide,nitazoxanid,nitazoxanida,nitazoxanide,nitazoxanidum,nitrazoxanide,omniparax,pacovanton,paramix,taenitaz" 1 "g" ""
|
||||
"NIT" 6604200 "Nitrofurantoin" "Other antibacterials" "J01XE01" "Other antibacterials" "Nitrofuran derivatives" "f,f/m,fd,ft,ni,nit,nitr" "alfuran,benkfuran,berkfuran,berkfurin,ceduran,chemiofuran,cistofuran,cyantin,cystit,dantafur,fua med,fuamed,furabid,furachel,furadantin,furadantin retard,furadantina mc,furadantine,furadantine mc,furadantoin,furadoin,furadoine,furadonin,furadonine,furadoninum,furadontin,furadoxyl,furalan,furaloid,furantoin,furantoina,furatoin,furedan,furina,furobactina,furodantin,furophen t,gerofuran,io>>uss>>a<<ixoo,ituran,ivadantin,macpac,macrobid,macrodantin,macrodantina,macrofuran,macrofurin,nierofu,nifurantin,nifuretten,nitoin,nitrex,nitrofuradantin,nitrofurantion,nitrofurantoin,nitrofurantoin macro,nitrofurantoina,nitrofurantoine,nitrofurantoinum,novofuran,orafuran,parfuran,phenurin,piyeloseptyl,siraliden,trantoin,uerineks,urantoin,urizept,urodin,urofuran,urofurin,urolisa,urolong,uvamin,welfurin,zoofurin" 0.2 "g" "3860-4"
|
||||
"NIZ" 5447130 "Nitrofurazone" "Other antibacterials" "NA" "" "acutol,aldomycin,alfucin,amifur,babrocid,becafurazone,biofuracina,biofurea,chemofuran,chixin,cocafurin,coxistat,dermofural,dymazone,dynazone,eldezol,fedacin,flavazone,fracine,furacilin,furacilinum,furacillin,furacin,furacine,furacinetten,furacoccid,furacort,furacycline,furaderm,furagent,furalcyn,furaldon,furalone,furametral,furaplast,furaseptyl,furaskin,furatsilin,furaziline,furazin,furazina,furazol w,furazone,furazyme,furesol,furfurin,furosem,fuvacillin,hemofuran,ibiofural,mammex,mastofuran,monafuracin,monafuracis,monofuracin,nfz mix,nifucin,nifurid,nifuzon,nitrofural,nitrofuralum,nitrofuran,nitrofurane,nitrofurazan,nitrofurazone,nitrofurazonum,nitrofurol,nitrozone,otofural,otofuran,rivafurazon,sanfuran,vabrocid,vadrocid,yatrocin" ""
|
||||
"NTR" 19910 "Nitroxoline" "Quinolones" "J01XX07" "Other antibacterials" "Other antibacterials" "" "galinok,isinok,nibiol,nicene forte,nitroxlina,nitroxolin,nitroxolina,nitroxoline,nitroxolinum,notroxoline,noxibiol" 1 "g" ""
|
||||
"NOR" 4539 "Norfloxacin" "Quinolones" "J01MA06,S01AE02" "Quinolone antibacterials" "Fluoroquinolones" "nor,norf,nx,nxn" "baccidal,barazan,chibroxin,chibroxine,chibroxol,fulgram,gonorcin,lexinor,nolicin,noracin,noraxin,norflo,norfloxacin,norfloxacine,norfloxacino,norfloxacinum,norocin,noroxin,noroxine,norxacin,sebercim,uroxacin,utinor,zoroxin" 0.8 "g" "3867-9"
|
||||
"NME" "Norfloxacin/metronidazole" "Other antibacterials" "J01RA14" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"NTI" "Norfloxacin/tinidazole" "Other antibacterials" "J01RA13" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"NVA" 10419027 "Norvancomycin" "Glycopeptides" "NA" "" "norvancomycin" ""
|
||||
"NOV" 54675769 "Novobiocin" "Other antibacterials" "NA" "novo" "albamix,albamycin,cardelmycin,cathocin,cathomycin,crystallinic acid,inamycin,novobiocin,novobiocina,novobiocine,novobiocinum,robiocina,sirbiocina,spheromycin,stilbiocina,streptonivicin" "17378-1"
|
||||
"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" ""
|
||||
"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" "25264-3,3877-8"
|
||||
"OOR" "Ofloxacin/ornidazole" "Other antibacterials" "J01RA09" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"OLE" 72493 "Oleandomycin" "Macrolides/lincosamides" "J01FA05" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "amimycin,landomycin,matromycin,oleandomicina,oleandomycin,oleandomycin a,oleandomycine,oleandomycinum,romicil" 1 "g" ""
|
||||
"OMC" 54697325 "Omadacycline" "Tetracyclines" "J01AA15" "" "amadacycline,omadacycline" 0.3 "g" 0.1 "g" ""
|
||||
"OPT" 87880 "Optochin" "Other antibacterials" "NA" "" "numoquin,optochin,optoquine" ""
|
||||
"ORB" 60605 "Orbifloxacin" "Quinolones" "NA" "" "orbifloxacin" ""
|
||||
"ORI" 16136912 "Oritavancin" "Glycopeptides" "J01XA05" "Other antibacterials" "Glycopeptide antibacterials" "orit" "kimyrsa,oritavancin" ""
|
||||
"ORS" "Ormetroprim/sulfamethoxazole" "Other antibacterials" "NA" "" "" ""
|
||||
"ORN" 28061 "Ornidazole" "Other antibacterials" "G01AF06,J01XD03,P01AB03" "Other antibacterials" "Imidazole derivatives" "" "madelen,ornidal,ornidazol,ornidazole,ornidazolum,tiberal" 1.5 "g" 1 "g" ""
|
||||
"OTE" 77050711 "Oteseconazole" "Antifungals/antimycotics" "J02AC06" "Antimycotics for systemic use" "Triazole derivatives" "" "oteseconazole" ""
|
||||
"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" "25265-0,3882-8"
|
||||
"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,25266-8,87595-5"
|
||||
"OZN" "Ozenoxacin" "D06AX14" "" "ozadub,ozenoxacin,ozenoxacin cream" ""
|
||||
"PAS" 4649 "P-aminosalicylic acid" "Antimycobacterials" "NA" "" "aminopar,aminosalicylic,aminosalicylic acid,aminosalyl,aminox,apacil,deapasil,entepas,ferrosan,gabbropas,granupas,helipidyl,hellipidyl,neopasalate,osacyl,pamacyl,pamisyl,paramycin,parasal,parasalicil,parasalindon,pasalon,pasara,pascorbic,pasdium,paser granules,paskalium,pasmed,pasnodia,pasolac,propasa,rezipas,teebacin" ""
|
||||
"PAN" 72015 "Panipenem" "Carbapenems" "NA,J01DH55" "" "panipenem,panipenem/betamipron,panipenemum,penipanem" ""
|
||||
"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" ""
|
||||
"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" "3906-5"
|
||||
"PNM" 10250769 "Penamecillin" "Beta-lactams/penicillins" "J01CE06" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "hydroxymethyl,penamecilina,penamecillin,penamecillina,penamecilline,penamecillinum" 1.05 "g" ""
|
||||
"PNO" "Penicillin/novobiocin" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"PSU" "Penicillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"PNM1" 54686187 "Penimepicycline" "Tetracyclines" "J01AA10" "Tetracyclines" "Tetracyclines" "" "criseocil,duamine,geotricyn,hydrocycline,penetracyne,penimepiciclina,penimepicycline,penimepicyclinum" ""
|
||||
"PIM" 65453 "Pentisomicin" "Aminoglycosides" "NA" "" "pentisomicin,pentisomicina,pentisomicine,pentisomicinum" ""
|
||||
"PTZ" 55250256 "Pentizidone" "Other antibacterials" "NA" "" "pentizidona,pentizidone,pentizidonum" ""
|
||||
"PEX" 16132253 "Pexiganan" "Other antibacterials" "NA" "" "pexiganan" ""
|
||||
"PHE" 272833 "Pheneticillin" "Beta-lactams/penicillins" "J01CE05" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "fene" "feneticilina,feneticillin,feneticillina,feneticilline,k phenethicillin,phenethicilin,phenethicillinum,pheneticillin,pheneticilline,pheneticillinum,phenoxy pc,potassium penicillin,synthepen" 1 "g" ""
|
||||
"PHN" 6869 "Phenoxymethylpenicillin" "Beta-lactams/penicillins" "J01CE02" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "fepe,peni v,penicillin v,pnv,pv" "acipen v,apocillin,apopen,beromycin,calcipen,compocillin v,crystapen v,distaquaine v,eskacillian v,eskacillin v,fenacilin,fenospen,meropenin,oracillin,oratren,pc pen vk,penicillin v,penicillinv,phenocillin,phenomycilline,phenopenicillin,robicillin,rocilin,stabicillin,vebecillin,veetids,vegacillin" 2 "g" ""
|
||||
"PMR" 5284447 "Pimaricin" "Antifungals/antimycotics" "NA" "natamycin" "delvocid,delvolan,delvopos,mycophyt,myprozine,natacyn,natafucin,natamicina,natamycin,natamycine,natamycinum,pimafucin,pimaracin,pimaricin,pimaricine,pimarizin,synogil,tennecetin" ""
|
||||
"PPA" 4831 "Pipemidic acid" "Quinolones" "J01MB04" "Quinolone antibacterials" "Other quinolones" "pipz,pizu" "acide pipemidique,acido pipemidico,acidum pipemidicum,deblaston,dolcol,filtrax,pipedac,pipemid,pipemidate,pipemidic,pipemidic acid,pipemidicacid,pipram,pipurin,tractur,uromidin,urosten,uroval" 0.8 "g" ""
|
||||
"PIP" 43672 "Piperacillin" "Beta-lactams/penicillins" "J01CA12" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "pi,pip,pipc,pipe,pp" "isipen,pentcillin,peperacillin,peracin,piperacilina,piperacillin,piperacillin hydrate,piperacillin na,piperacillin sodium,piperacillina,piperacilline,piperacillinum,pipercillin,pipracil,pipril,tazocin" 14 "g" "25268-4,3972-7"
|
||||
"PIS" "Piperacillin/sulbactam" "Beta-lactams/penicillins" "NA" "" "" ""
|
||||
"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" ""
|
||||
"PRC" 71978 "Piridicillin" "Beta-lactams/penicillins" "NA" "" "piridicillin" ""
|
||||
"PRL" 157385 "Pirlimycin" "Macrolides/lincosamides" "NA" "" "pirlimycin,pirlimycina,pirlimycine,pirlimycinum,pirsue" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"PLZ" 42613186 "Plazomicin" "Aminoglycosides" "J01GB14" "" "plazomicin,zemdri" "92024-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,25269-2"
|
||||
"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,80545-7"
|
||||
"PRA" 9802884 "Pradofloxacin" "Quinolones" "NA" "" "pradofloxacin,pudofloxacin,veraflox" ""
|
||||
"PRX" 71455 "Premafloxacin" "Quinolones" "NA" "" "premafloxacin,remafloxacin" ""
|
||||
"PMD" 456199 "Pretomanid" "Antimycobacterials" "J04AK08" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "oxazine,pretomanid" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"PRP" 92879 "Propicillin" "Beta-lactams/penicillins" "J01CE03" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "propicilina,propicillin,propicilline,propicillinum" 0.9 "g" ""
|
||||
"PKA" 9872451 "Propikacin" "Aminoglycosides" "NA" "" "propikacin,propikacina,propikacine,propikacinum" ""
|
||||
"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" ""
|
||||
"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,25270-0"
|
||||
"QDA" 11979418 "Quinupristin/dalfopristin" "Macrolides/lincosamides" "J01FG02" "Macrolides, lincosamides and streptogramins" "Streptogramins" "q/d,qda,qida,quda,rp,syn" "" 1.5 "g" ""
|
||||
"RAC" 56052 "Ractopamine" "Other antibacterials" "NA" "" "optaflexx,paylean,ractopamina,ractopamine,ractopaminum" ""
|
||||
"RAM" 16132338 "Ramoplanin" "Glycopeptides" "NA" "" "ramoplanin" ""
|
||||
"RZM" 10993211 "Razupenem" "Carbapenems" "NA" "" "razupenem" ""
|
||||
"RTP" 6918462 "Retapamulin" "Other antibacterials" "D06AX13" "Antibiotics for topical use" "Other antibiotics for topical use" "ret" "altabax,altargo,retapamulin" ""
|
||||
"RZF" "Rezafungin" "Antifungals" "NA" "" "biafungin,rezafungin cation,rezafungin ion" ""
|
||||
"RBC" 44631912 "Ribociclib" "Antifungals/antimycotics" "L01EF02" "Antimycotics for systemic use" "Triazole derivatives" "ribo" "kisqali,ribociclib" 0.45 ""
|
||||
"RST" 33042 "Ribostamycin" "Aminoglycosides" "J01GB10" "Aminoglycoside antibacterials" "Other aminoglycosides" "" "dekamycin iv,hetangmycin,ribastamin,ribostamicina,ribostamycin,ribostamycine,ribostamycinum,vistamycin,xylostatin" 1 "g" ""
|
||||
"RID1" 16659285 "Ridinilazole" "Other antibacterials" "NA" "" "ridinilazole" ""
|
||||
"RIB" 135398743 "Rifabutin" "Antimycobacterials" "J04AB04" "Drugs for treatment of tuberculosis" "Antibiotics" "rifb" "alfacid,ansamicin,ansamycin,ansatipin,ansatipine,assatipin,mycobutin,rifabutin,rifabutina,rifabutine,rifabutinum" 0.15 "g" "24032-5"
|
||||
"RIF" 135398735 "Rifampicin" "Antimycobacterials" "J04AB02" "Drugs for treatment of tuberculosis" "Antibiotics" "rifa" "abrifam,archidyn,arficin,arzide,azt + rifampin,benemicin,benemycin,dipicin,doloresum,eremfat,famcin,fenampicin,rifadin,rifadin i.v,rifadin i.v.,rifadine,rifagen,rifaldazin,rifaldazine,rifaldin,rifamate,rifamicin amp,rifamor,rifampicin,rifampicin sv,rifampicina,rifampicine,rifampicinum,rifampin,rifamsolin,rifamycin amp,rifapiam,rifaprodin,rifcin,rifinah,rifobac,rifoldin,rifoldine,riforal,rimactan,rimactane,rimactazid,rimactizid,rimazid,rimycin,sinerdol,tubocin" 0.6 "g" 0.6 "g" ""
|
||||
"REI" 135483893 "Rifampicin/ethambutol/isoniazid" "Antimycobacterials" "J04AM07" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"RFI" "Rifampicin/isoniazid" "Antimycobacterials" "J04AM02" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "rifinah,rimactazid" ""
|
||||
"RPEI" "Rifampicin/pyrazinamide/ethambutol/isoniazid" "Antimycobacterials" "J04AM06" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"RPI" "Rifampicin/pyrazinamide/isoniazid" "Antimycobacterials" "J04AM05" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"RFM" 6324616 "Rifamycin" "Antimycobacterials" "A07AA13,D06AX15,J04AB03,S01AA16,S02AA12" "Drugs for treatment of tuberculosis" "Antibiotics" "" "aemcolo,rifacin,rifamicina,rifamicine sv,rifamycin,rifamycine,rifamycinum,rifocin,rifocyn,rifomycin,rifomycin sv,tuborin" 0.6 "g" ""
|
||||
"RFP" 135403821 "Rifapentine" "Antimycobacterials" "J04AB05" "Drugs for treatment of tuberculosis" "Antibiotics" "rifp,rpt" "cyclopentyl rifampin,prifitin,priftin,rifapentin,rifapentina,rifapentine,rifapentinum" 0.11 "g" ""
|
||||
"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" ""
|
||||
"RIT" 65633 "Ritipenem" "Carbapenems" "NA" "" "ritipenem" ""
|
||||
"RIA" 163692 "Ritipenem acoxil" "Carbapenems" "NA" "" "ritipenem acoxil" ""
|
||||
"ROK" 5282211 "Rokitamycin" "Macrolides/lincosamides" "J01FA12" "Macrolides, lincosamides and streptogramins" "Macrolides" "" "propionylleucomycin,ricamycin,rokicid,rokital,rokitamicina,rokitamycin,rokitamycine,rokitamycinum" 0.8 "g" ""
|
||||
"RLT" 54682938 "Rolitetracycline" "Tetracyclines" "J01AA09" "Tetracyclines" "Tetracyclines" "" "bristacin,kinteto,reverin,rolitetraciclina,rolitetracycline,rolitetracyclinum,solvocillin,superciclin,synotodecin,synterin,syntetrex,syntetrin,transcycline,velacicline,velacycline" 0.35 "g" ""
|
||||
"ROS" 287180 "Rosoxacin" "Quinolones" "J01MB01" "Quinolone antibacterials" "Other quinolones" "" "acrosoxacin,eracine,eradacil,eradacin,eradicin,rosoxacin,rosoxacine,rosoxacino,rosoxacinum,roxadyl,winoxacin,winuron" 0.3 "g" ""
|
||||
"RXT" "Roxithromycin" "Macrolides/lincosamides" "J01FA06" "Macrolides, lincosamides and streptogramins" "Macrolides" "roxi" "roxithromycin,roxithromycine,roxithromycinum,roxitromicina,rulide" 0.3 "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" "87593-0"
|
||||
"SAR" 56208 "Sarafloxacin" "Quinolones" "NA" "" "difloxacine,difloxacino,difloxacinum,quinolone der.,saraflox,sarafloxacin,sarafloxacine,sarafloxacino,sarafloxacinum" ""
|
||||
"SRC" 54681908 "Sarecycline" "Tetracyclines" "J01AA14" "Tetracyclines" "Tetracyclines" "" "sarecycline,seysara" 0.1 "g" ""
|
||||
"SRX" 9933415 "Sarmoxicillin" "Beta-lactams/penicillins" "NA" "" "sarmoxicillin" ""
|
||||
"SEC" 71815 "Secnidazole" "Other antibacterials" "P01AB07" "" "flagentyl,secnidal,secnidazol,secnidazole,secnidazolum,secnil,sindose,solosec" 2 "g" ""
|
||||
"SMF" "Simvastatin/fenofibrate" "Antimycobacterials" "C10BA04" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "simv" "" ""
|
||||
"SIS" 36119 "Sisomicin" "Aminoglycosides" "J01GB08" "Aminoglycoside antibacterials" "Other aminoglycosides" "siso" "rickamicin,salvamina,siseptin sulfate,sisomicin,sisomicin sulfate,sisomicina,sisomicine,sisomicinum,sisomin,sisomycin,sissomicin,sizomycin" 0.24 "g" ""
|
||||
"SIT" 461399 "Sitafloxacin" "Quinolones" "J01MA21" "" "gracevit,sitafloxacin,sitafloxacinisomer" 0.1 "g" ""
|
||||
"SDA" 2724368 "Sodium aminosalicylate" "Antimycobacterials" "J04AA02" "Drugs for treatment of tuberculosis" "Aminosalicylic acid and derivatives" "" "bactylan,decapasil,lepasen,monopas,nippas,p.a.s. sodium,pamisyl sodium,parasal sodium,pas sodium,pasade,pasnal,passodico,salvis,sanipirol,sodiopas,sodium p.a.s,sodium pas,teebacin,tubersan" 14 "g" 14 "g" ""
|
||||
"SOL" 25242512 "Solithromycin" "Macrolides/lincosamides" "J01FA16" "" "solithera,solithromycin" ""
|
||||
"SPX" 60464 "Sparfloxacin" "Quinolones" "J01MA09" "Quinolone antibacterials" "Fluoroquinolones" "spa,spar" "esparfloxacino,sparfloxacin,sparfloxacine,sparfloxacinum" 0.2 "g" ""
|
||||
"SPT" 15541 "Spectinomycin" "Other antibacterials" "J01XX04" "Other antibacterials" "Other antibacterials" "sc,spe,spec,spt" "actinospectacina,adspec,espectinomicina,prospec,specitinomycin,spectam,spectinomicina,spectinomycin,spectinomycin di hcl,spectinomycine,spectinomycinum,stanilo,togamycin,trobicin" 3 "g" ""
|
||||
"SPI" 6419898 "Spiramycin" "Macrolides/lincosamides" "J01FA02" "Macrolides, lincosamides and streptogramins" "Macrolides" "spir" "espiramicin,provamycin,rovamycin,rovamycine,sequamycin,spiramycine,spiramycinum" 3 "g" ""
|
||||
"SPM" "Spiramycin/metronidazole" "Other antibacterials" "J01RA04" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"STR" "Streptoduocin" "Aminoglycosides" "J01GA02" "Aminoglycoside antibacterials" "Streptomycins" "" "ambistrin" 1 "g" ""
|
||||
"STR1" 19649 "Streptomycin" "Aminoglycosides" "A07AA04,J01GA01" "Aminoglycoside antibacterials" "Streptomycins" "s,stm,str,stre" "agrept,agrimycin,chemform,estreptomicina,neodiestreptopab,strepcen,streptomicina,streptomycin,streptomycin a,streptomycin spx,streptomycin sulfate,streptomycine,streptomycinum,streptomyzin,vetstrep" 1 "g" "4039-4"
|
||||
"STH" "Streptomycin-high" "Aminoglycosides" "NA" "sthi,sthl,strepto high,streptomycin high" "" ""
|
||||
"STI" "Streptomycin/isoniazid" "Antimycobacterials" "J04AM01" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"SUL" 130313 "Sulbactam" "Beta-lactams/penicillins" "J01CG01" "Beta-lactam antibacterials, penicillins" "Beta-lactamase inhibitors" "" "betamaze,sulbactam,sulbactam acid,sulbactam free acid,sulbactamum" 1 "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" ""
|
||||
"SUP" 6634 "Sulfachlorpyridazine" "Other antibacterials" "NA" "" "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" "27216-1,59742-7,6907-0"
|
||||
"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" ""
|
||||
"SUD" 5323 "Sulfadimethoxine" "Trimethoprims" "J01ED01" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "agribon,arnosulfan,bactrovet,deposul,diasulfa,diasulfyl,dimetazina,dinosol,dorisul,lasibon,madribon,madrigid,madriqid,madroxin,madroxine,maxulvet,mecozine,memcozine,metoxidon,neostrepal,neostreptal,nsulfanilamide,omnibon,persulfen,primor,radonin,redifal,rofenaid,roscosulf,scandisil,solfadimetossina,sudine,suldixine,sulfabon,sulfadimethoxin,sulfadimethoxine,sulfadimethoxinum,sulfadimetossina,sulfadimetoxin,sulfadimetoxina,sulfadimetoxine,sulfadimoxine,sulfastop,sulfdimethoxine,sulfoplan,sulphadimethoxine,sulxin,sumbio,symbio,theracanzan,ultrasulfon" 0.5 "g" ""
|
||||
"SDM" 5327 "Sulfadimidine" "Trimethoprims" "J01EB03" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "azolmetazin,benzene sulfonamide,calfspan,calfspan tablets,cremomethazine,diazil,diazilsulfadine,dimezathine,intradine,kelametazine,mermeth,metazin,neasina,neazina,nsulfanilamide,panazin,pirmazin,primazin,sa iii,solfadimidina,spanbolet,sulfadimerazine,sulfadimesin,sulfadimesine,sulfadimethyldiazine,sulfadimezin,sulfadimezine,sulfadimezinum,sulfadimidin,sulfadimidina,sulfadimidine,sulfadimidinum,sulfadine,sulfametazina,sulfametazyny,sulfamethazine,sulfamethiazine,sulfamezathine,sulfamidine,sulfasure sr bolus,sulfodimesin,sulfodimezine,sulka k boluses,sulka s boluses,sulmet,sulphadimidine,sulphamethasine,sulphamethazine,sulphamezathine,sulphamidine,sulphodimezine,superseptil,superseptyl,vertolan" 4 "g" ""
|
||||
"SLT2" "Sulfadimidine/trimethoprim" "Trimethoprims" "J01EE05" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "" "" ""
|
||||
"SLF" 5344 "Sulfafurazole" "Trimethoprims" "J01EB05,S01AB02" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "sfsz" "accuzole,alphazole,amidoxal,astrazolo,azo gantrisin,azosulfizin,bactesulf,barazae,chemouag,cosoxazole,dorsulfan,dorsulfan warthausen,entusil,entusul,eryzole,gantrisin,gantrisine,gantrisona,gantrizin,gantrosan,isoxamin,neazolin,neoxazoi,neoxazol,novazolo,novosaxazole,nsulfanilamide,nsulphanilamide,pancid,pediazole,renosulfan,resoxol,roxosul,roxosul tablets,roxoxol,saxosozine,sodizole,solfafurazolo,soxamide,soxazole,soxisol,soxitabs,soxomide,stansin,sulbio,sulfafuraz ole,sulfafurazol,sulfafurazole,sulfafurazolum,sulfagan,sulfagen,sulfaisoxazole,sulfalar,sulfapolar,sulfasol,sulfasoxazole,sulfasoxizole,sulfazin,sulfisin,sulfisonazole,sulfisoxasole,sulfisoxazol,sulfisoxazole,sulfisoxazolum,sulfizin,sulfizol,sulfizole,sulfofurazole,sulfoxol,suloxsol,sulphafuraz,sulphafurazol,sulphafurazole,sulphafurazolum,sulphaisoxazole,sulphisoxazol,sulphisoxazole,sulphofurazole,sulsoxin,thiasin,unisulf,urisoxin,uritrisin,urogan,vagilia" 4 "g" 4 "g" ""
|
||||
"SLF1" 5343 "Sulfaisodimidine" "Trimethoprims" "J01EB01" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "aristamid,aristamide,aristogyn,domain,domian,elcosin,elcosine,elkosil,elkosin,elkosine,erycon,isosulf,mefenal,nsulfanilamide,solfisomidina,sulfadimetine,sulfaisodimerazine,sulfaisodimidine,sulfaisodimidinum,sulfaisomidine,sulfamethin,sulfasomidine,sulfisomidina,sulfisomidine,sulfisomidine sodium,sulfisomidinum,sulphasomidine" 4 "g" 4 "g" ""
|
||||
"SLF2" 9047 "Sulfalene" "Trimethoprims" "J01ED02" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "dalysep,kelfizin,kelfizina,kelfizine,kelfizine w,longum,nsulfanilamide,policydal,polycidal,solfametopirazina,sulfalen,sulfalene,sulfaleno,sulfalenum,sulfamethopyrazine,sulfamethoxypyrazine,sulfametopyrazine,sulfametoxypyridazin,sulphalene,sulphametopyrazine,vetkelfizina" 0.1 "g" ""
|
||||
"SZO" 187764 "Sulfamazone" "Trimethoprims" "J01ED09" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "sulfamazon,sulfamazona,sulfamazone,sulfamazonum" 1.5 "g" ""
|
||||
"SLF3" 5325 "Sulfamerazine" "Trimethoprims" "D06BA06,J01ED07" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "cremomerazine,kelamerazine,mebacid,mesulfa,methylpyrimal,methylsulfazin,methylsulfazine,metilsulfadiazin,metilsulfazin,nsulfanilamide,percoccide,pyralcid,pyrimal m,romezin,septacil,septosyl,solfamerazina,solumedin,solumedine,sulfameradine,sulfamerazin,sulfamerazina,sulfamerazine,sulfamerazinum,sulfamethyldiazine,sulphamerazine,sumedine,susfamerazine" 3 "g" ""
|
||||
"SLT3" "Sulfamerazine/trimethoprim" "Trimethoprims" "J01EE07" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "" "" ""
|
||||
"SUM" 5327 "Sulfamethazine" "Other antibacterials" "NA" "" "azolmetazin,benzene sulfonamide,calfspan,calfspan tablets,cremomethazine,diazil,diazilsulfadine,dimezathine,intradine,kelametazine,mermeth,metazin,neasina,neazina,nsulfanilamide,panazin,pirmazin,primazin,sa iii,solfadimidina,spanbolet,sulfadimerazine,sulfadimesin,sulfadimesine,sulfadimethyldiazine,sulfadimezin,sulfadimezine,sulfadimezinum,sulfadimidin,sulfadimidina,sulfadimidine,sulfadimidinum,sulfadine,sulfametazina,sulfametazyny,sulfamethazine,sulfamethiazine,sulfamezathine,sulfamidine,sulfasure sr bolus,sulfodimesin,sulfodimezine,sulka k boluses,sulka s boluses,sulmet,sulphadimidine,sulphamethasine,sulphamethazine,sulphamezathine,sulphamidine,sulphodimezine,superseptil,superseptyl,vertolan" "87592-2"
|
||||
"SLF4" 5328 "Sulfamethizole" "Trimethoprims" "B05CA04,D06BA04,J01EB02,S01AB01" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "sfmz" "ayerlucil,lucosil,methazol,microsul,nsulfanilamide,proklar,renasul,salimol,solfametizolo,sulamethizole,sulfa gram,sulfamethizol,sulfamethizole,sulfamethizolum,sulfametizol,sulfapyelon,sulfstat,sulfurine,sulphamethizole,tetracid,thidicur,thiosulfil,thiosulfil forte,ultrasul,urocydal,urodiaton,urolucosil,urosulfin" 4 "g" "60175-7,60176-5,60177-3"
|
||||
"SMX" 5329 "Sulfamethoxazole" "Trimethoprims" "J01EC01" "Sulfonamides and trimethoprim" "Intermediate-acting sulfonamides" "sfmx,sulf" "azo gantanol,bactrim,bactrimel,cotrimoxazole,eusaprim,gamazole,gantanol,gantanol ds,metoxal,nsulfanilamide,nsulphanilamide,radonil,septran,septrin,simsinomin,sinomin,solfametossazolo,sulfamethalazole,sulfamethoxazol,sulfamethoxazole,sulfamethoxazolum,sulfamethoxizole,sulfamethylisoxazole,sulfametoxazol,sulfisomezole,sulmeprim,sulphamethalazole,sulphamethoxazol,sulphamethoxazole,sulphisomezole,urobak" 2 "g" "10342-4,25271-8,39772-9,59971-2,59972-0,60333-2,72674-5,80549-9,80974-9"
|
||||
"SLF5" 5330 "Sulfamethoxypyridazine" "Trimethoprims" "J01ED05" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "altezol,davosin,depovernil,kineks,lederkyn,lentac,lisulfen,longin,medicel,midicel,midikel,myasul,nsulfanilamide,opinsul,paramid,paramid supra,petrisul,piridolo,quinoseptyl,retamid,retasulfin,retasulphine,slosul,spofadazine,sulfalex,sulfapyridazine,sulfdurazin,sulfozona,sultirene,vinces" 0.5 "g" ""
|
||||
"SLF6" 19596 "Sulfametomidine" "Trimethoprims" "J01ED03" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "duroprocin,methofadin,methofazine,nsulfanilamide,solfametomidina,sulfamethomidine,sulfametomidin,sulfametomidina,sulfametomidine,sulfametomidinum" ""
|
||||
"SLF7" 5326 "Sulfametoxydiazine" "Trimethoprims" "J01ED04" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "bayrena,berlicid,dairena,durenat,juvoxin,kinecid,kirocid,longasulf,methoxypyrimal,nsulfanilamide,solfametossidiazina,sulfameter,sulfamethorine,sulfamethoxine,sulfamethoxydiazin,sulfamethoxydiazine,sulfamethoxydin,sulfamethoxydine,sulfametin,sulfametinum,sulfametorin,sulfametorine,sulfametorinum,sulfametoxidiazina,sulfametoxidine,sulfametoxydiazine,sulfametoxydiazinum,sulphameter,sulphamethoxydiazine,supramid,ultrax" 0.5 "g" ""
|
||||
"SLT4" "Sulfametrole/trimethoprim" "Trimethoprims" "J01EE03" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "trsm" "" ""
|
||||
"SLF8" 12894 "Sulfamoxole" "Trimethoprims" "J01EC03" "Sulfonamides and trimethoprim" "Intermediate-acting sulfonamides" "" "justamil,nsulfanilamide,oxasulfa,solfamossolo,sulfadimethyloxazole,sulfamoxol,sulfamoxole,sulfamoxolum,sulfano,sulfavigor,sulfmidil,sulfono,sulfune,sulfuno,sulphamoxole,tardamid,tardamide" 1 "g" 1 "g" ""
|
||||
"SLT5" "Sulfamoxole/trimethoprim" "Trimethoprims" "J01EE04" "Sulfonamides and trimethoprim" "Combinations of sulfonamides and trimethoprim, incl. derivatives" "" "cotrifamole" ""
|
||||
"SLF9" 5333 "Sulfanilamide" "Trimethoprims" "D06BA05,J01EB06" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "albexan,albosal,ambeside,antistrept,astreptine,astrocid,bacteramid,bactesid,collomide,colsulanyde,copticide,deseptyl,desseptyl,dipron,ergaseptine,erysipan,estreptocida,exoseptoplix,gerison,gombardol,infepan,lysococcine,neococcyl,orgaseptine,prontalbin,prontosil album,prontosil i,prontosil white,prontylin,pronzin album,proseptal,proseptine,proseptol,pysococcine,rubiazol a,sanamid,septamide album,septanilam,septinal,septolix,septoplex,septoplix,solfanilamide,stopton album,stramid,strepamide,strepsan,streptagol,streptamid,streptamin,streptasol,streptocid,streptocid album,streptocide,streptocide white,streptocidum,streptoclase,streptocom,streptol,strepton,streptopan,streptosil,streptozol,streptozone,streptrocide,sulfamidyl,sulfamine,sulfana,sulfanalone,sulfanidyl,sulfanil,sulfanilamida,sulfanilamide,sulfanilamidum,sulfanilimidic acid,sulfanimide,sulfocidin,sulfocidine,sulfonamide,sulfonamide p,sulfonylamide,sulphanilamide,sulphanilamide gr,sulphanilamidum,sulphonamide,therapol,tolder,white streptocide" ""
|
||||
"SLF10" 68933 "Sulfaperin" "Trimethoprims" "J01ED06" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "anastaf,archisulfa,avissul,chemiopen,demosulfan,durisan saft,ipersulfidin sirup,isosulfamerazine,methylsulfadiazin,methylsulfadiazine,novosul,nsulfanilamide,orosulfan,pallidin,retardon,risulfasens,sulfaperin,sulfaperina,sulfaperine,sulfaperinum,sulfatreis,sulfopirimidine,sulpenta,ultrasulfon sirup" 0.5 "g" ""
|
||||
"SLF11" 5335 "Sulfaphenazole" "Trimethoprims" "J01ED08" "Sulfonamides and trimethoprim" "Long-acting sulfonamides" "" "depocid,depotsulfonamide,eftolon,firmazolo,inamil,isarol,isarol v,merian,microtan pirazolo,nsulfanilamide,orisul,orisulf,paidazolo,phenylsulfapyrazole,plisulfan,raziosulfa,solfafenazolo,sulfabid,sulfafenazol,sulfafenazolo,sulfaphenazol,sulfaphenazole,sulfaphenazolum,sulfaphenazon,sulfaphenylpipazol,sulfaphenylpyrazol,sulfaphenylpyrazole,sulfonylpyrazol,sulphaphenazole,sulphenazole" 1 "g" ""
|
||||
"SLF12" 5336 "Sulfapyridine" "Trimethoprims" "J01EB04" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "adiplon,coccoclase,dagenan,eubasin,eubasinum,haptocil,piridazol,plurazol,pyriamid,pyridazol,relbapiridina,septipulmon,solfapiridina,streptosilpyridine,sulfapiridina,sulfapyridin,sulfapyridine,sulfapyridinum,sulfidin,sulfidine,sulphapyridin,sulphapyridine,thioseptal,trianon" 1 "g" "14075-6,55580-5"
|
||||
"SNA" 60582 "Sulfasuccinamide" "Other antibacterials" "NA" "" "ambesid,derganil,sulfasuccinamid,sulfasuccinamida,sulfasuccinamide,sulfasuccinamidum" ""
|
||||
"SUT" 5340 "Sulfathiazole" "Trimethoprims" "D06BA02,J01EB07" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "azoquimiol,azoseptale,cerazol,cerazole,chemosept,cibazol,duatok,dulana,eleudron,enterobiocine,estafilol,formosulfathiazole,neostrepsan,norsulfasol,norsulfazol,norsulfazole,norsulfazolum,nsulfanilamide,planomide,poliseptil,sanotiazol,septozol,sodium sulfathiazole,solfatiazolo,streptosilthiazole,sulfamul,sulfathiazol,sulfathiazole,sulfathiazolum,sulfatiazol,sulfavitina,sulfocerol,sulphathiazole,sulzol,thiacoccine,thiasulfol,thiazamide,thiozamide,triple sulfa,wintrazole" "87591-4"
|
||||
"SLF13" 3000579 "Sulfathiourea" "Trimethoprims" "J01EB08" "Sulfonamides and trimethoprim" "Short-acting sulfonamides" "" "badional,baldinol,fontamide,salvoseptyl,solfatiourea,solufontamide,sulfanilthiourea,sulfathiocarbamid,sulfathiocarbamide,sulfathiocarbamidum,sulfathiourea,sulfathiouree,sulfatiourea,sulphathiourea" 6 "g" ""
|
||||
"SOX" 5344 "Sulfisoxazole" "Other antibacterials" "NA" "" "accuzole,alphazole,amidoxal,astrazolo,azo gantrisin,azosulfizin,bactesulf,barazae,chemouag,cosoxazole,dorsulfan,dorsulfan warthausen,entusil,entusul,eryzole,gantrisin,gantrisine,gantrisona,gantrizin,gantrosan,isoxamin,neazolin,neoxazoi,neoxazol,novazolo,novosaxazole,nsulfanilamide,nsulphanilamide,pancid,pediazole,renosulfan,resoxol,roxosul,roxosul tablets,roxoxol,saxosozine,sodizole,solfafurazolo,soxamide,soxazole,soxisol,soxitabs,soxomide,stansin,sulbio,sulfafuraz ole,sulfafurazol,sulfafurazole,sulfafurazolum,sulfagan,sulfagen,sulfaisoxazole,sulfalar,sulfapolar,sulfasol,sulfasoxazole,sulfasoxizole,sulfazin,sulfisin,sulfisonazole,sulfisoxasole,sulfisoxazol,sulfisoxazole,sulfisoxazolum,sulfizin,sulfizol,sulfizole,sulfofurazole,sulfoxol,suloxsol,sulphafuraz,sulphafurazol,sulphafurazole,sulphafurazolum,sulphaisoxazole,sulphisoxazol,sulphisoxazole,sulphofurazole,sulsoxin,thiasin,unisulf,urisoxin,uritrisin,urogan,vagilia" "9701-4"
|
||||
"SSS" 86225 "Sulfonamide" "Other antibacterials" "NA" "sfna" "anhydron,aquirel,ciclotiazida,ciclotiazide,cyclothiazide,cyclothiazidum,doburil,fluidil,renazide,valmiran" ""
|
||||
"SLP" 9950244 "Sulopenem" "Other antibacterials" "NA" "" "sulopenem" ""
|
||||
"SLT6" 444022 "Sultamicillin" "Beta-lactams/penicillins" "J01CR04" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "" "sultamicilina,sultamicillin,sultamicillinum" 1.5 "g" ""
|
||||
"SUR" 46700778 "Surotomycin" "Other antibacterials" "NA" "" "surotomycin" ""
|
||||
"TAL" 71447 "Talampicillin" "Beta-lactams/penicillins" "J01CA15" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "" "talampicilina,talampicillin,talampicilline,talampicillinum" 2 "g" ""
|
||||
"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" ""
|
||||
"TBP" 9800194 "Tebipenem" "Carbapenems" "NA,J01DH06" "" "tebipenem pivoxil" ""
|
||||
"TZD" 11234049 "Tedizolid" "Oxazolidinones" "J01XX11" "Other antibacterials" "Other antibacterials" "tedi" "sivextro,tedizolid,torezolid" 0.2 "g" 0.2 "g" ""
|
||||
"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" "25534-9,25535-6,34378-0,34379-8,4043-6,80968-1"
|
||||
"TCM" "Teicoplanin-macromethod" "Glycopeptides" "NA" "" "" ""
|
||||
"TLV" 3081362 "Telavancin" "Glycopeptides" "J01XA03" "Other antibacterials" "Glycopeptide antibacterials" "tela" "telavancin,televancin,vibativ" ""
|
||||
"TLT" 3002190 "Telithromycin" "Macrolides/lincosamides" "J01FA15" "Macrolides, lincosamides and streptogramins" "Macrolides" "teli" "levviax,telithromycin" 0.8 "g" ""
|
||||
"TMX" 60021 "Temafloxacin" "Quinolones" "J01MA05" "Quinolone antibacterials" "Fluoroquinolones" "tema" "omniflox,temafloxacin,temafloxacina,temafloxacine,temafloxacinum" 0.8 "g" ""
|
||||
"TEM" 171758 "Temocillin" "Beta-lactams/penicillins" "J01CA17" "Beta-lactam antibacterials, penicillins" "Penicillins with extended spectrum" "temo" "negaban,temocilina,temocillin,temocillina,temocilline,temocillinum" 4 "g" ""
|
||||
"TRB" 1549008 "Terbinafine" "Antifungals/antimycotics" "D01AE15,D01BA02" "Antifungals for systemic use" "Antifungals for systemic use" "terb" "corbinal,lamasil,lamisil,lamisil at,lamisil tablet,terbinafina,terbinafine,terbinafinum,terbinex" 0.25 "g" ""
|
||||
"TRC" 441383 "Terconazole" "Antifungals/antimycotics" "G01AG02" "" "fungistat,panlomyc,terazol,terconazol,terconazole,terconazolum,tercospor,triaconazole,zazole" ""
|
||||
"TRZ" 65720 "Terizidone" "Antimycobacterials" "J04AK03" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "terivalidin,terizidon,terizidona,terizidone,terizidonum" ""
|
||||
"TCY" 54675776 "Tetracycline" "Tetracyclines" "A01AB13,D06AA04,J01AA07,S01AA09,S02AA08,S03AA02" "Tetracyclines" "Tetracyclines" "tc,te,tet,tetr" "abramycin,abricycline,achromycin,achromycin v,actisite,agromicina,ambramicina,ambramycin,amycin,biocycline,bristaciclin,bristaciclina,bristacycline,brodspec,cefracycline,centet,ciclibion,copharlan,criseociclina,cyclomycin,cyclopar,cytome,democracin,deschlorobiomycin,dumocyclin,economycin,enterocycline,hostacyclin,lexacycline,limecycline,liquamycin,medocycline,mericycline,micycline,neocycline,oletetrin,omegamycin,orlycycline,panmycin,piracaps,polycycline,polyotic,purocyclina,resteclin,robitet,roviciclina,sigmamycin,solvocin,sumycin,sumycin syrup,supramycin,sustamycin,tetrabid organon,tetrabon,tetrachel,tetraciclina,tetracycl,tetracyclin,tetracycline,tetracycline base,tetracycline i,tetracycline ii,tetracyclinehydrate,tetracyclinum,tetracyn,tetradecin,tetrafil,tetramed,tetrasure,tetraverine,tetrazyklin,tetrex,topicycline,tsiklomistsin,tsiklomitsin,veracin,vetacyclinum,vetquamycin" 1 "g" 1 "g" "25272-6,4045-1,87590-6"
|
||||
"TOL" 54691494 "Tetracycline/oleandomycin" "Other antibacterials" "J01RA08" "Combinations of antibacterials" "Combinations of antibacterials" "" "" ""
|
||||
"TET" 65450 "Tetroxoprim" "Other antibacterials" "NA" "" "tetroxoprim,tetroxoprima,tetroxoprime,tetroxoprimum" ""
|
||||
"THA" 9568512 "Thiacetazone" "Oxazolidinones" "NA" "" "aktivan,ambathizon,amithiozone,amithizone,amitiozon,benthiozone,benzothiozane,benzothiozon,berculon a,berkazon,citazone,conteben,diasan,diazan,domakol,ilbion,livazone,mirizone neustab,mivizon,myvizone,neotibil,neustab,novakol,nuclon argentinian,panrone,parazone,seroden,siocarbazone,tebalon,tebecure,tebemar,tebesone i,tebethion,tebethione,tebezon,thiacetazone,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" ""
|
||||
"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" ""
|
||||
"TAT" 9568512 "Thioacetazone" "Antimycobacterials" "J04AK07" "Drugs for treatment of tuberculosis" "Other drugs for treatment of tuberculosis" "" "aktivan,ambathizon,amithiozone,amitiozon,benthiozone,benzothiozane,benzothiozon,berculon a,berkazon,citazone,conteben,diasan,domakol,ilbion,livazone,mirizone neustab,mivizon,myvizone,neotibil,neustab,novakol,nuclon argentinian,panrone,parazone,seroden,siocarbazone,tebalon,tebecure,tebemar,tebesone i,tebethion,tebethione,tebezon,thiacetone,thiacetozone,thibon,thibone,thioacetazon,thioacetazone,thioacetazonum,thioazetazone,thiocarbazil,thiomicid,thionicid,thioparamizon,thioparamizone,thiosemicarbarzone,thiosemicarbazone,thiotebesin,thiotebezin,thiotebicina,thizone,tiacetazon,tibicur,tibion,tibione,tibizan,tibone,tioacetazon,tioacetazona,tioatsetazon,tiobicina,tiocarone,tiosecolo,tubercazon,tubigal" ""
|
||||
"THI1" "Thioacetazone/isoniazid" "Antimycobacterials" "J04AM04" "Drugs for treatment of tuberculosis" "Combinations of drugs for treatment of tuberculosis" "" "" ""
|
||||
"TIA" 656958 "Tiamulin" "Other antibacterials" "NA" "" "denagard,thiamutilin,tiamulin,tiamulin pamoate,tiamulina,tiamuline,tiamulinum,tiavet p" "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" "25254-4,4054-3,4055-0"
|
||||
"TCC" 6437075 "Ticarcillin/clavulanic acid" "Beta-lactams/penicillins" "J01CR03" "Beta-lactam antibacterials, penicillins" "Combinations of penicillins, incl. beta-lactamase inhibitors" "t/c,tcc,ticl,tim,tlc" "timentin" 15 "g" ""
|
||||
"TGC" 54686904 "Tigecycline" "Tetracyclines" "J01AA12" "Tetracyclines" "Tetracyclines" "tgc,tig,tige" "haizheng li xing,tigeciclina,tigecyclin,tigecycline,tigecycline hydrate,tigecyclinum,tigilcycline,tygacil" 0.1 "g" ""
|
||||
"TBQ" 65592 "Tilbroquinol" "Quinolones" "P01AA05" "" "tilbroquinol,tilbroquinolum" ""
|
||||
"TIP" 24860548 "Tildipirosin" "Macrolides/lincosamides" "NA" "" "tildipirosin,zuprevo" ""
|
||||
"TIL" 5282521 "Tilmicosin" "Macrolides/lincosamides" "NA" "" "micotil,pulmotil,tilmicosin,tilmicosina,tilmicosine,tilmicosinum" "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" ""
|
||||
"TCR" 3001386 "Tiocarlide" "Antimycobacterials" "J04AD02" "Drugs for treatment of tuberculosis" "Thiocarbamide derivatives" "" "amixyl,datanil,disocarban,disoxyl,isoxyl,thiocarlide,tiocarlid,tiocarlida,tiocarlide,tiocarlidum" 7 "g" ""
|
||||
"TDC" 10247721 "Tiodonium chloride" "Other antibacterials" "NA" "" "cloruro de tiodonio,tiodonii chloridum,tiodonium chloride" ""
|
||||
"TXC" 65788 "Tioxacin" "Quinolones" "NA" "" "tioxacin,tioxacine,tioxacino,tioxacinum,tioxic acid" ""
|
||||
"TIZ" 394397 "Tizoxanide" "Other antibacterials" "NA" "" "ntzdes" ""
|
||||
"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" "13584-8,17808-7,22750-4,22751-2,22752-0,31094-6,31095-3,31096-1,35239-3,35670-9,4057-6,4058-4,4059-2,50927-3,52962-8,59380-6,80966-5"
|
||||
"TOH" "Tobramycin-high" "Aminoglycosides" "NA" "tobra high,tobramycin high,tohl" "" ""
|
||||
"TFX" 5517 "Tosufloxacin" "Quinolones" "J01MA22" "" "tosufloxacin" 0.45 "g" ""
|
||||
"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" "11005-6,17747-7,25273-4,32342-8,4079-0,4080-8,4081-6,55584-7,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" ""
|
||||
"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" ""
|
||||
"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" ""
|
||||
"TUL" 9832301 "Tulathromycin" "Macrolides/lincosamides" "NA" "" "draxxin,tulathrmycin a,tulathromycin,tulathromycin a" ""
|
||||
"TYL" 5280440 "Tylosin" "Macrolides/lincosamides" "NA" "" "fradizine,tilosina,tylocine,tylosin,tylosin a,tylosine,tylosinum" "87587-2"
|
||||
"TYL1" 6441094 "Tylvalosin" "Macrolides/lincosamides" "NA" "tvn" "tylvalosin" ""
|
||||
"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,20578-1,31012-8,39092-2,39796-8,39797-6,4089-9,4090-7,4091-5,4092-3,50938-0,59381-4,97657-1"
|
||||
"VAM" "Vancomycin-macromethod" "Glycopeptides" "NA" "" "" ""
|
||||
"VIO" 135398671 "Viomycin" "Antimycobacterials" "NA" "" "celiomycin,florimycin,floromycin,tuberactinomycin b,vinacetin a,vioactane,viomicina,viomycin,viomycine,viomycinum" ""
|
||||
"VIR" 11979535 "Virginiamycine" "Other antibacterials" "NA" "" "eskalin,eskalin v,micamicina,mikamycin,mikamycine,mikamycinum,ostreogricina,ostreogrycin,ostreogrycine,ostreogrycinum,pristinamicina,pristinamycin,pristinamycine,pristinamycinum,pyostacine,stafac,stafytracine,staphylomycin,stapyocine,starfac,streptogramin,vernamycin,virgimycin,virgimycine,virginiamicina,virginiamycin,virginiamycina,virginiamycine,virginiamycinum" ""
|
||||
"VOR" 71616 "Voriconazole" "Antifungals/antimycotics" "J02AC03" "Antimycotics for systemic use" "Triazole derivatives" "vori,vrc" "pfizer,vfend i.v.,voriconazol,voriconazole,voriconazole vfend,voriconazolum,voriconzole,vorikonazole" 0.4 "g" 0.4 "g" "38370-3,53902-3,73676-9,80553-1,80651-3"
|
||||
"XBR" 72144 "Xibornol" "Other antibacterials" "J01XX02" "Other antibacterials" "Other antibacterials" "" "bactacine,bracen,nanbacine,xibornol,xibornolo,xibornolum" ""
|
||||
"ZID" 77846445 "Zidebactam" "Other antibacterials" "NA" "" "zidebactam" ""
|
||||
"ZFD" "Zoliflodacin" "NA" "" "zoliflodacin" ""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+121
-103
@@ -1,103 +1,121 @@
|
||||
"atc" "cid" "name" "atc_group" "synonyms" "oral_ddd" "oral_units" "iv_ddd" "iv_units"
|
||||
"J05AF06" 441300 "Abacavir" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Abacavir\", \"Abacavir sulfate\", \"Ziagen\")" 0.6 "g"
|
||||
"J05AB01" 135398513 "Aciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Acicloftal\", \"Aciclovier\", \"Aciclovir\", \"Aciclovirum\", \"Activir\", \"AcycloFoam\", \"Acycloguanosine\", \"Acyclovir\", \"Acyclovir Lauriad\", \"ACYCLOVIR SODIUM\", \"Avirax\", \"Cargosil\", \"Cyclovir\", \"Genvir\", \"Gerpevir\", \"Hascovir\", \"Herpevir\", \"Maynar\", \"Poviral\", \"Sitavig\", \"Sitavir\", \"Vipral\", \"Virolex\", \"Viropump\", \"Virorax\", \"Zovirax\", \"Zovirax topical\", \"Zyclir\")" 4 "g" 4 "g"
|
||||
"J05AF08" 60871 "Adefovir dipivoxil" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Adefovir di ester\", \"Adefovir dipivoxil\", \"Adefovir Dipivoxil\", \"Adefovir dipivoxyl\", \"Adefovir pivoxil\", \"Adefovirdipivoxl\", \"Bisadenine\", \"BISADENINE\", \"BisPMEA\", \"Hepsera\", \"Preveon\", \"YouHeDing\")" 10 "mg"
|
||||
"J05AE05" 65016 "Amprenavir" "Protease inhibitors" "c(\"Agenerase\", \"Amprenavir\", \"Amprenavirum\", \"Prozei\", \"Vertex\")" 1.2 "g"
|
||||
"J05AP06" 16076883 "Asunaprevir" "Antivirals for treatment of HCV infections" "c(\"Asunaprevir\", \"Sunvepra\")"
|
||||
"J05AE08" 148192 "Atazanavir" "Protease inhibitors" "c(\"Atazanavir\", \"Atazanavir Base\", \"Latazanavir\", \"Reyataz\", \"Zrivada\")" 0.3 "g"
|
||||
"J05AR15" 86583336 "Atazanavir and cobicistat" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR23" "Atazanavir and ritonavir" "Antivirals for treatment of HIV infections, combinations" "" 0.3 "g"
|
||||
"J05AP03" 10324367 "Boceprevir" "Antivirals for treatment of HCV infections" "c(\"Bocepravir\", \"Boceprevir\", \"Victrelis\")" 2.4 "g"
|
||||
"J05AB15" 446727 "Brivudine" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Bridic\", \"Brivox\", \"Brivudin\", \"Brivudina\", \"Brivudine\", \"Brivudinum\", \"BrVdUrd\", \"Helpin\", \"Zerpex\", \"Zostex\")" 0.125 "g"
|
||||
"J05AB12" 60613 "Cidofovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Cidofovir\", \"Cidofovir anhydrous\", \"Cidofovir gel\", \"Cidofovirum\", \"Forvade\", \"Vistide\")" 25 "mg"
|
||||
"J05AF12" 73115 "Clevudine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Clevudine\", \"Levovir\", \"Revovir\")" 30 "mg"
|
||||
"J05AP07" 25154714 "Daclatasvir" "Antivirals for treatment of HCV infections" "c(\"Daclatasvir\", \"Daklinza\")" 60 "mg"
|
||||
"J05AE10" 213039 "Darunavir" "Protease inhibitors" "c(\"Darunavir\", \"Darunavirum\", \"Prezista\", \"Prezista Naive\")" 1.2 "g"
|
||||
"J05AR14" "Darunavir and cobicistat" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AP09" 56640146 "Dasabuvir" "Antivirals for treatment of HCV infections" "Dasabuvir" 0.5 "g"
|
||||
"J05AP52" "Dasabuvir, ombitasvir, paritaprevir and ritonavir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AG02" 5625 "Delavirdine" "Non-nucleoside reverse transcriptase inhibitors" "c(\"BHAP der\", \"Delavirdin\", \"Delavirdina\", \"Delavirdine\", \"Delavirdinum\", \"PIPERAZINE\", \"Rescriptor\")" 1.2 "g"
|
||||
"J05AF02" 135398739 "Didanosine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Didanosina\", \"Didanosine\", \"Didanosinum\", \"Dideoxyinosine\", \"DIDEOXYINOSINE\", \"Hypoxanthine ddN\", \"Videx\", \"Videx EC\")" 0.4 "g"
|
||||
"J05AX12" 54726191 "Dolutegravir" "Other antivirals" "c(\"Dolutegravir\", \"Dolutegravir Sodium\", \"Soltegravir\", \"Tivicay\")" 50 "mg"
|
||||
"J05AR21" 131801472 "Dolutegravir and rilpivirine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AG06" 58460047 "Doravirine" "Non-nucleoside reverse transcriptase inhibitors" "c(\"Doravirine\", \"Pifeltro\")"
|
||||
"J05AG03" 64139 "Efavirenz" "Non-nucleoside reverse transcriptase inhibitors" "c(\"Efavirenz\", \"Efavirenzum\", \"Eravirenz\", \"Stocrin\", \"Strocin\", \"Sustiva\")" 0.6 "g"
|
||||
"J05AP54" 91669168 "Elbasvir and grazoprevir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AX11" 5277135 "Elvitegravir" "Other antivirals" "c(\"Elvitegravir\", \"Vitekta\")"
|
||||
"J05AF09" 60877 "Emtricitabine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Coviracil\", \"Emtricitabin\", \"Emtricitabina\", \"Emtricitabine\", \"Emtricitabinum\", \"Emtritabine\", \"Emtriva\", \"Racivir\")" 0.2 "g"
|
||||
"J05AR17" 90469070 "Emtricitabine and tenofovir alafenamide" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR20" "Emtricitabine, tenofovir alafenamide and bictegravir" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR19" "Emtricitabine, tenofovir alafenamide and rilpivirine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR22" "Emtricitabine, tenofovir alafenamide, darunavir and cobicistat" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR18" "Emtricitabine, tenofovir alafenamide, elvitegravir and cobicistat" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR06" "Emtricitabine, tenofovir disoproxil and efavirenz" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR08" "Emtricitabine, tenofovir disoproxil and rilpivirine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR09" "Emtricitabine, tenofovir disoproxil, elvitegravir and cobicistat" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AX07" 16130199 "Enfuvirtide" "Other antivirals" "c(\"Enfurvitide\", \"Enfuvirtide\", \"Fuzeon\", \"Pentafuside\")" 0.18 "g"
|
||||
"J05AX17" 10089466 "Enisamium iodide" "Other antivirals" "Enisamium iodide" 1.5 "g"
|
||||
"J05AF10" 135398508 "Entecavir" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Baraclude\", \"Entecavir\", \"Entecavir anhydrous\", \"Entecavirum\")" 0.5 "mg"
|
||||
"J05AG04" 193962 "Etravirine" "Non-nucleoside reverse transcriptase inhibitors" "c(\"DAPY deriv\", \"Etravine\", \"Etravirine\", \"Intelence\")" 0.4 "g"
|
||||
"J05AP04" 42601552 "Faldaprevir" "Antivirals for treatment of HCV infections" "Faldaprevir"
|
||||
"J05AB09" 3324 "Famciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Famciclovir\", \"Famciclovirum\", \"Famvir\", \"Oravir\")" 0.75 "g"
|
||||
"J05AE07" 131536 "Fosamprenavir" "Protease inhibitors" "c(\"Amprenavir phosphate\", \"Fosamprenavir\", \"Lexiva\", \"Telzir\")" 1.4 "g"
|
||||
"J05AD01" 3415 "Foscarnet" "Phosphonic acid derivatives" "c(\"Forscarnet\", \"Forscarnet sodium\", \"Foscarmet\", \"Foscarnet\", \"Phosphonoformate\", \"Phosphonoformic acid\")" 6.5 "g"
|
||||
"J05AD02" 546 "Fosfonet" "Phosphonic acid derivatives" "c(\"Fosfonet\", \"Fosfonet sodium\", \"Fosfonet Sodium\", \"Fosfonoacetate\", \"Fosfonoacetic acid\", \"Phosphonacetate\", \"Phosphonacetic acid\")"
|
||||
"J05AB06" 135398740 "Ganciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Citovirax\", \"Cymevan\", \"Cymeven\", \"Cymevene\", \"Cytovene\", \"Cytovene IV\", \"Ganciclovir\", \"Ganciclovirum\", \"Gancyclovir\", \"Hydroxyacyclovir\", \"Virgan\", \"Vitrasert\", \"Zirgan\")" 3 "g" 0.5 "g"
|
||||
"J05AP57" "Glecaprevir and pibrentasvir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AX23" "Ibalizumab" "Other antivirals" ""
|
||||
"J05AB02" 5905 "Idoxuridine" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Antizona\", \"Dendrid\", \"Emanil\", \"Heratil\", \"Herpesil\", \"Herpid\", \"Herpidu\", \"Herplex\", \"HERPLEX\", \"Herplex liquifilm\", \"Idexur\", \"Idossuridina\", \"Idoxene\", \"Idoxuridin\", \"Idoxuridina\", \"Idoxuridine\", \"Idoxuridinum\", \"Idu Oculos\", \"Iducher\", \"Idulea\", \"Iduoculos\", \"Iduridin\", \"Iduviran\", \"Iododeoxyridine\", \"Iododeoxyuridine\", \"Iodoxuridine\", \"Joddeoxiuridin\", \"Kerecid\", \"Kerecide\", \"Ophthalmadine\", \"Spectanefran\", \"Stoxil\", \"Synmiol\", \"Virudox\")"
|
||||
"J05AE02" 5362440 "Indinavir" "Protease inhibitors" "c(\"Compound J\", \"Crixivan\", \"Indinavir\", \"Indinavir anhydrous\", \"Propolis+Indinavir\")" 2.4 "g"
|
||||
"J05AX05" 135449284 "Inosine pranobex" "Other antivirals" "c(\"Aviral\", \"Delimmun\", \"Immunovir\", \"Imunovir\", \"Inosine pranobex\", \"Inosiplex\", \"Isoprinosin\", \"Isoprinosina\", \"Isoprinosine\", \"Isoviral\", \"Methisoprinol\", \"Methysoprinol\", \"Metisoprinol\", \"Viruxan\")" 3 "g"
|
||||
"J05AF05" 60825 "Lamivudine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Epivir\", \"Hepitec\", \"Heptivir\", \"Heptodin\", \"Heptovir\", \"Lamivir\", \"Lamivudin\", \"Lamivudina\", \"Lamivudine\", \"Lamivudinum\", \"Zeffix\")" 0.3 "g"
|
||||
"J05AR02" "Lamivudine and abacavir" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR16" 73386700 "Lamivudine and raltegravir" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR12" "Lamivudine and tenofovir disoproxil" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR13" "Lamivudine, abacavir and dolutegravir" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR24" "Lamivudine, tenofovir disoproxil and doravirine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR11" "Lamivudine, tenofovir disoproxil and efavirenz" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AX18" 45138674 "Letermovir" "Other antivirals" "c(\"Letermovir\", \"Prevymis\")" 0.48 "g" 0.48 "g"
|
||||
"J05AR10" 11979606 "Lopinavir and ritonavir" "Antivirals for treatment of HIV infections, combinations" "c(\"Aluvia\", \"Kaletra\")" 0.8 "g"
|
||||
"J05AX02" 24839946 "Lysozyme" "Other antivirals" "c(\"Lysozyme chloride\", \"Lysozyme Chloride\", \"Lysozyme G\")"
|
||||
"J05AX09" 3002977 "Maraviroc" "Other antivirals" "c(\"Celsentri\", \"Maraviroc\", \"Selzentry\")" 0.6 "g"
|
||||
"J05AX10" 471161 "Maribavir" "Other antivirals" "c(\"Benzimidavir\", \"Camvia\", \"Maribavir\")"
|
||||
"J05AA01" 667492 "Metisazone" "Thiosemicarbazones" "c(\"Kemoviran\", \"Marboran\", \"Marborane\", \"Methisazon\", \"Methisazone\", \"Methsazone\", \"Metisazon\", \"Metisazona\", \"Metisazone\", \"Metisazonum\", \"Viruzona\")"
|
||||
"J05AX01" 71655 "Moroxydine" "Other antivirals" "c(\"Bimolin\", \"Flumidine\", \"Influmine\", \"Moroxidina\", \"Moroxydine\", \"Moroxydinum\", \"Vironil\", \"Virugon\", \"Virumin\", \"Wirumin\")" 0.3 "g"
|
||||
"J05AE04" 64143 "Nelfinavir" "Protease inhibitors" "c(\"Nelfinavir\", \"Viracept\")" 2.25 "g"
|
||||
"J05AG01" 4463 "Nevirapine" "Non-nucleoside reverse transcriptase inhibitors" "c(\"Nevirapine\", \"Nevirapine anhydrous\", \"Viramune\", \"Viramune IR\", \"Viramune XR\")" 0.4 "g"
|
||||
"J05AP53" "Ombitasvir, paritaprevir and ritonavir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AH02" 65028 "Oseltamivir" "Neuraminidase inhibitors" "c(\"Agucort\", \"Oseltamivir\", \"Tamiflu\", \"Tamvir\")" 0.15 "g"
|
||||
"J05AB13" 135398748 "Penciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Adenovir\", \"Denavir\", \"Penciceovir\", \"Penciclovir\", \"Penciclovirum\", \"Pencyclovir\", \"Vectavir\")"
|
||||
"J05AX21" 9942657 "Pentanedioic acid imidazolyl ethanamide" "Other antivirals" "Ingamine" 90 "mg"
|
||||
"J05AH03" 154234 "Peramivir" "Neuraminidase inhibitors" "c(\"PeramiFlu\", \"Peramivir\", \"Rapiacta\", \"RAPIVAB\")"
|
||||
"J05AX06" 1684 "Pleconaril" "Other antivirals" "c(\"Picovir\", \"Pleconaril\", \"Pleconarilis\")"
|
||||
"J05AX08" 54671008 "Raltegravir" "Other antivirals" "c(\"Isentress\", \"Raltegravir\")" 0.8 "g"
|
||||
"J05AP01" 37542 "Ribavirin" "Antivirals for treatment of HCV infections" "c(\"Copegus\", \"Cotronak\", \"Drug: Ribavirin\", \"Ravanex\", \"Rebetol\", \"Rebetron\", \"Rebretron\", \"Ribacine\", \"Ribamide\", \"Ribamidil\", \"Ribamidyl\", \"Ribasphere\", \"Ribavirin\", \"Ribavirin Capsules\", \"Ribavirina\", \"Ribavirine\", \"Ribavirinum\", \"Ribovirin\", \"Tribavirin\", \"Varazid\", \"Vilona\", \"Viramid\", \"Viramide\", \"Virazid\", \"Virazide\", \"Virazole\")" 1 "g"
|
||||
"J05AG05" 6451164 "Rilpivirine" "Non-nucleoside reverse transcriptase inhibitors" "c(\"Edurant\", \"Rilpivirine\")" 25 "mg"
|
||||
"J05AC02" 5071 "Rimantadine" "Cyclic amines" "c(\"Remantadine\", \"Riamantadine\", \"Rimant\", \"RIMANTADIN\", \"Rimantadin A\", \"Rimantadina\", \"Rimantadine\", \"Rimantadinum\")" 0.2 "g"
|
||||
"J05AE03" 392622 "Ritonavir" "Protease inhibitors" "c(\"Norvir\", \"Norvir Sec\", \"Norvir Softgel\", \"Ritonavir\", \"Ritonavire\", \"Ritonavirum\")" 1.2 "g"
|
||||
"J05AE01" 441243 "Saquinavir" "Protease inhibitors" "c(\"Fortovase\", \"Invirase\", \"Saquinavir\")" 1.8 "g"
|
||||
"J05AP05" 24873435 "Simeprevir" "Antivirals for treatment of HCV infections" "c(\"Olysio\", \"Simeprevir sodium\")" 0.15 "g"
|
||||
"J05AP08" 45375808 "Sofosbuvir" "Antivirals for treatment of HCV infections" "c(\"Hepcinat\", \"Hepcvir\", \"Sofosbuvir\", \"Sovaldi\", \"SOVALDI\", \"SoviHep\")" 0.4 "g"
|
||||
"J05AP51" 72734365 "Sofosbuvir and ledipasvir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AP55" 91885554 "Sofosbuvir and velpatasvir" "Antivirals for treatment of HCV infections" "Epclusa Tablet"
|
||||
"J05AP56" "Sofosbuvir, velpatasvir and voxilaprevir" "Antivirals for treatment of HCV infections" ""
|
||||
"J05AF04" 18283 "Stavudine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Estavudina\", \"Sanilvudine\", \"Stavudin\", \"Stavudine\", \"Stavudinum\", \"Zerit Xr\", \"Zerut XR\")" 80 "mg"
|
||||
"J05AR07" 15979285 "Stavudine, lamivudine and nevirapine" "Antivirals for treatment of HIV infections, combinations" "STAVUDIINE"
|
||||
"J05AP02" 3010818 "Telaprevir" "Antivirals for treatment of HCV infections" "c(\"Incivek\", \"Incivo\", \"Telaprevir\", \"Telavic\")" 2.25 "g"
|
||||
"J05AF11" 159269 "Telbivudine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Epavudine\", \"Sebivo\", \"Telbivudin\", \"Telbivudine\", \"Tyzeka\")" 0.6 "g"
|
||||
"J05AF13" 9574768 "Tenofovir alafenamide" "Nucleoside and nucleotide reverse transcriptase inhibitors" "Vemlidy" 25 "mg"
|
||||
"J05AF07" 5481350 "Tenofovir disoproxil" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"BisPMPA\", \"PMPA prodrug\", \"Tenofovir\", \"Viread\")" 0.245 "g"
|
||||
"J05AR03" "Tenofovir disoproxil and emtricitabine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AX19" 5475 "Tilorone" "Other antivirals" "c(\"Amiksin\", \"Amixin\", \"Amixin IC\", \"Amyxin\", \"Tiloron\", \"Tilorona\", \"Tilorone\", \"Tiloronum\")" 0.125 "g"
|
||||
"J05AE09" 54682461 "Tipranavir" "Protease inhibitors" "c(\"Aptivus\", \"Tipranavir\")" 1 "g"
|
||||
"J05AC03" 64377 "Tromantadine" "Cyclic amines" "c(\"Tromantadina\", \"Tromantadine\", \"Tromantadinum\", \"Viruserol\")"
|
||||
"J05AX13" 131411 "Umifenovir" "Other antivirals" "c(\"Arbidol\", \"Arbidol base\", \"Umifenovir\")" 0.8 "g"
|
||||
"J05AB11" 135398742 "Valaciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Talavir\", \"Valaciclovir\", \"Valaciclovirum\", \"ValACV\", \"Valcivir\", \"Valcyclovir\", \"Valtrex\", \"Virval\", \"Zelitrex\")" 3 "g"
|
||||
"J05AB14" 135413535 "Valganciclovir" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Cymeval\", \"Valganciclovir\")" 0.9 "g"
|
||||
"J05AB03" 21704 "Vidarabine" "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "c(\"Adenine arabinoside\", \"Araadenosine\", \"Arabinoside adenine\", \"Arabinosyl adenine\", \"Arabinosyladenine\", \"Spongoadenosine\", \"Vidarabin\", \"Vidarabina\", \"Vidarabine\", \"Vidarabine anhydrous\", \"Vidarabinum\", \"Vira A\", \"Vira ATM\")"
|
||||
"J05AF03" 24066 "Zalcitabine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Dideoxycytidine\", \"Interferon AD + ddC\", \"Zalcitabine\", \"Zalcitibine\")" 2.25 "mg"
|
||||
"J05AH01" 60855 "Zanamivir" "Neuraminidase inhibitors" "c(\"MODIFIED SIALIC ACID\", \"Relenza\", \"Zanamavir\", \"Zanamir\", \"Zanamivi\", \"Zanamivir\", \"Zanamivir hydrate\")"
|
||||
"J05AF01" 35370 "Zidovudine" "Nucleoside and nucleotide reverse transcriptase inhibitors" "c(\"Azidothymidine\", \"AZT Antiviral\", \"Beta interferon\", \"Compound S\", \"Propolis+AZT\", \"Retrovir\", \"Zidovudina\", \"Zidovudine\", \"ZIDOVUDINE\", \"Zidovudine EP III\", \"Zidovudinum\")" 0.6 "g" 0.6 "g"
|
||||
"J05AR01" "Zidovudine and lamivudine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR04" "Zidovudine, lamivudine and abacavir" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"J05AR05" "Zidovudine, lamivudine and nevirapine" "Antivirals for treatment of HIV infections, combinations" ""
|
||||
"av" "name" "atc" "cid" "atc_group" "synonyms" "oral_ddd" "oral_units" "iv_ddd" "iv_units" "loinc"
|
||||
"ABA" "Abacavir" "J05AF06" 441300 "Nucleoside and nucleotide reverse transcriptase inhibitors" "abacavir sulfate,avacavir,ziagen" 0.6 "g" "29113-8,78772-1,78773-9,79134-3,80118-3"
|
||||
"ACI" "Aciclovir" "J05AB01" 135398513 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "acicloftal,aciclovier,aciclovirum,activir,acyclofoam,acycloguanosine,acyclovir,acyclovir lauriad,avaclyr,cargosil,cyclovir,genvir,gerpevir,hascovir,maynar,novirus,poviral,sitavig,sitavir,vipral,viropump,virorax,zovirax,zyclir" 4 "g" 4 "g" ""
|
||||
"ADD" "Adefovir dipivoxil" "J05AF08" 60871 "Nucleoside and nucleotide reverse transcriptase inhibitors" "adefovir di,adefovir di ester,adefovir dipivoxyl,adefovir pivoxil,adefovirdipivoxl,bisadenine,bispmea,hepsera,preveon,youheding" 10 "mg" ""
|
||||
"AME" "Amenamevir" "J05AX26" 11397521 "Other antivirals" "amenalief" 0.4 "g" ""
|
||||
"AMP" "Amprenavir" "J05AE05" 65016 "Protease inhibitors" "agenerase,carbamate,prozei" 1.2 "g" "29114-6,31028-4,78791-1"
|
||||
"ASU" "Asunaprevir" "J05AP06" 16076883 "Antivirals for treatment of HCV infections" "sunvepra,sunvepratrade" 0.2 "g" ""
|
||||
"ATA" "Atazanavir" "J05AE08" 148192 "Protease inhibitors" "atazanavir base,latazanavir,reyataz,zrivada" 0.3 "g" "41470-6,78796-0,78797-8,80142-3,80143-1"
|
||||
"ATA+COBI" "Atazanavir/cobicistat" "J05AR15" 86583336 "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"ATA+RIT" "Atazanavir/ritonavir" "J05AR23" 25134325 "Antivirals for treatment of HIV infections, combinations" "" 0.3 "g" ""
|
||||
"BAM" "Baloxavir marboxil" "J05AX25" 124081896 "Other antivirals" "xofluza" 40 "mg" ""
|
||||
"BOC" "Boceprevir" "J05AP03" 10324367 "Antivirals for treatment of HCV infections" "victrelis" 2.4 "g" ""
|
||||
"BRIN" "Brincidofovir" "J05AB17" 483477 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "cidofovir prodrug,tembexa" ""
|
||||
"BRIV" "Brivudine" "J05AB15" 446727 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "bridic,brivox,brivudin,brivudina,brivudinum,brvdurd,helpin,zerpex,zostex" 0.125 "g" ""
|
||||
"BUL" "Bulevirtide" "J05AX28" "Other antivirals" "" ""
|
||||
"CAB" "Cabotegravir" "J05AJ04" 54713659 "Integrase inhibitors" "cabenuva" 30 "mg" 10 "mg" ""
|
||||
"CID" "Cidofovir" "J05AB12" 60613 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "cidofovir anhydrous,cidofovir gel,cidofovir hydrate,cidofovirum,forvade,hpmpc dihydrate,phosphonic acid,vistide" 25 "mg" ""
|
||||
"CLE" "Clevudine" "J05AF12" 73115 "Nucleoside and nucleotide reverse transcriptase inhibitors" "levovir,revovir" 30 "mg" ""
|
||||
"COBL" "Coblopasvir" "J05AP12" 58316387 "Antivirals for treatment of HCV infections" "" ""
|
||||
"DAC" "Daclatasvir" "J05AP07" 25154714 "Antivirals for treatment of HCV infections" "daklinza" 60 "mg" ""
|
||||
"DAC+ASU+BEC" "Daclatasvir/asunaprevir/beclabuvir" "J05AP58" "Antivirals for treatment of HCV infections" "" ""
|
||||
"DAR" "Darunavir" "J05AE10" 213039 "Protease inhibitors" "carbamate,darunavirum,derunavir,prezista,prezista naive" 1.2 "g" "57954-0"
|
||||
"DAR+COBI" "Darunavir/cobicistat" "J05AR14" 57327017 "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"DAR+RIT" "Darunavir/ritonavir" "J05AR26" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"DAS" "Dasabuvir" "J05AP09" 56640146 "Antivirals for treatment of HCV infections" "" 0.5 "g" ""
|
||||
"DAS+OMB+PAR+RIT" "Dasabuvir/ombitasvir/paritaprevir/ritonavir" "J05AP52" "Antivirals for treatment of HCV infections" "" ""
|
||||
"DEL" "Delavirdine" "J05AG02" 5625 "Non-nucleoside reverse transcriptase inhibitors" "piperazine,rescriptor" 1.2 "g" "27082-7,29115-3"
|
||||
"DID" "Didanosine" "J05AF02" 135398739 "Nucleoside and nucleotide reverse transcriptase inhibitors" "didanosina,didanosinum,dideoxyinosine,hypoxanthine ddn,videx ec" 0.4 "g" "29116-1,48307-3"
|
||||
"DOL" "Dolutegravir" "J05AJ03" 54726191 "Integrase inhibitors" "dolutegravir dtg,soltegravir,tivicay" 50 "mg" ""
|
||||
"DOL+RIL" "Dolutegravir/rilpivirine" "J05AR21" 131801472 "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"DOR" "Doravirine" "J05AG06" 58460047 "Non-nucleoside reverse transcriptase inhibitors" "pifeltro" 0.1 "g" ""
|
||||
"EFA" "Efavirenz" "J05AG03" 64139 "Non-nucleoside reverse transcriptase inhibitors" "efavirenz teva,efavirenzum,eravirenz,stocrin,strocin,sustiva,viraday" 0.6 "g" "29117-9,33928-3,51907-4,51908-2"
|
||||
"ELB" "Elbasvir" "J05AP10" 71661251 "Antivirals for treatment of HCV infections" "methyl carbamate" 50 "mg" ""
|
||||
"ELB+GRA" "Elbasvir/grazoprevir" "J05AP54" 91669168 "Antivirals for treatment of HCV infections" "zepatier" ""
|
||||
"ELV" "Elvitegravir" "J05AJ02" 5277135 "Integrase inhibitors" "vitekta" "88986-5"
|
||||
"EMT" "Emtricitabine" "J05AF09" 60877 "Nucleoside and nucleotide reverse transcriptase inhibitors" "coviracil,emtricitabinum,emtritabine,emtriva,racivir" 0.2 "g" ""
|
||||
"EMT+TEA" "Emtricitabine/tenofovir alafenamide" "J05AR17" 90469070 "Antivirals for treatment of HIV infections, combinations" "descovy" ""
|
||||
"EMT+TEA+BIC" "Emtricitabine/tenofovir alafenamide/bictegravir" "J05AR20" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TEA+RIL" "Emtricitabine/tenofovir alafenamide/rilpivirine" "J05AR19" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TEA+DAR+COBI" "Emtricitabine/tenofovir alafenamide/darunavir/cobicistat" "J05AR22" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TEA+ELV+COBI" "Emtricitabine/tenofovir alafenamide/elvitegravir/cobicistat" "J05AR18" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TED+EFA" "Emtricitabine/tenofovir disoproxil/efavirenz" "J05AR06" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TED+RIL" "Emtricitabine/tenofovir disoproxil/rilpivirine" "J05AR08" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"EMT+TED+ELV+COBI" "Emtricitabine/tenofovir disoproxil/elvitegravir/cobicistat" "J05AR09" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"ENF" "Enfuvirtide" "J05AX07" 16130199 "Other antivirals" "enfurvitide,fuzeon,pentafuside" 0.18 "g" ""
|
||||
"ENI" "Enisamium iodide" "J05AX17" 10089466 "Other antivirals" "amizon" 1.5 "g" ""
|
||||
"ENT" "Entecavir" "J05AF10" 135398508 "Nucleoside and nucleotide reverse transcriptase inhibitors" "baraclude,entecavir anhydrous" 0.5 "mg" ""
|
||||
"ETR" "Etravirine" "J05AG04" 193962 "Non-nucleoside reverse transcriptase inhibitors" "dapy deriv,etravine,intelence" 0.4 "g" "57961-5"
|
||||
"FAL" "Faldaprevir" "J05AP04" 42601552 "Antivirals for treatment of HCV infections" "" ""
|
||||
"FAM" "Famciclovir" "J05AB09" 3324 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "famciclovirum,famvir,oravir" 0.75 "g" ""
|
||||
"FAV" "Favipiravir" "J05AX27" 492405 "Other antivirals" "avigan,fapilavir,favilavir" 1.6 "g" ""
|
||||
"FOSA" "Fosamprenavir" "J05AE07" 131536 "Protease inhibitors" "amprenavir phosphate,carbamate,lexiva,telzir" 1.4 "g" ""
|
||||
"FOSC" "Foscarnet" "J05AD01" 3415 "Phosphonic acid derivatives" "forscarnet,foscarmet,foscavir,phosphonoformate,phosphonoformic acid" 6.5 "g" ""
|
||||
"FOSF" "Fosfonet" "J05AD02" 546 "Phosphonic acid derivatives" "fosfonet sodium,fosfonoacetate,fosfonoacetic acid,phosphonacetate,phosphonacetic acid,phosphonoaceticacid" ""
|
||||
"FOST" "Fostemsavir" "J05AX29" 11319217 "Other antivirals" "rukobia" 1.2 "g" ""
|
||||
"GAN" "Ganciclovir" "J05AB06" 135398740 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "citovirax,cymevan,cymeven,cymevene,cytovene,ganciclovirum,gancyclovir,hydroxyacyclovir,virgan,vitrasert,zirgan" 3 "g" 0.5 "g" "15367-6,25256-9,59798-9,59799-7,60077-5,60078-3"
|
||||
"GLE+PIB" "Glecaprevir/pibrentasvir" "J05AP57" 85471918 "Antivirals for treatment of HCV infections" "" ""
|
||||
"GRA" "Grazoprevir" "J05AP11" 44603531 "Antivirals for treatment of HCV infections" "" 0.1 "g" ""
|
||||
"IBA" "Ibalizumab" "J05AX23" "Other antivirals" "" ""
|
||||
"IDO" "Idoxuridine" "J05AB02" 5905 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "antizona,dendrid,heratil,herplex,idossuridina,idoxene,idoxuridin,idoxuridina,idoxuridinum,iduoculos,iduridin,iododeoxyridine,iododeoxyuridine,iodoxuridine,joddeoxiuridin,kerecid,stoxil,virudox" ""
|
||||
"IND" "Indinavir" "J05AE02" 5362440 "Protease inhibitors" "compound j,crixivan,indinavir anhydrous,propolis+indinavir" 2.4 "g" "29118-7,31033-4,51918-1"
|
||||
"INP" "Inosine pranobex" "J05AX05" 135449284 "Other antivirals" "aviral,delimmun,groprinosin,immunovir,imunovir,imunoviral,inosiplex,isoprinosin,isoprinosina,isoprinosine,isoviral,methisoprinol,modimmunal,pranosina,pranosine,viruxan" 3 "g" ""
|
||||
"LAM" "Lamivudine" "J05AF05" 60825 "Nucleoside and nucleotide reverse transcriptase inhibitors" "epivir,hepitec,heptivir,heptodin,heptovir,lamivir,lamivudeine,lamivudine teva,lamivudinum,virolam,zeffix" 0.3 "g" "29119-5,49226-4"
|
||||
"LAM+ABA" "Lamivudine/abacavir" "J05AR02" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+DOL" "Lamivudine/dolutegravir" "J05AR25" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+RAL" "Lamivudine/raltegravir" "J05AR16" 73386700 "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+TED" "Lamivudine/tenofovir disoproxil" "J05AR12" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+ABA+DOL" "Lamivudine/abacavir/dolutegravir" "J05AR13" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+TED+DOL" "Lamivudine/tenofovir disoproxil/dolutegravir" "J05AR27" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+TED+DOR" "Lamivudine/tenofovir disoproxil/doravirine" "J05AR24" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAM+TED+EFA" "Lamivudine/tenofovir disoproxil/efavirenz" "J05AR11" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"LAN" "Laninamivir" "J05AH04" 502272 "Neuraminidase inhibitors" "" ""
|
||||
"LEN" "Lenacapavir" "J05AX31" 133082658 "Other antivirals" "" ""
|
||||
"LET" "Letermovir" "J05AX18" 45138674 "Other antivirals" "acetic acid,prevymis" 0.48 "g" 0.48 "g" ""
|
||||
"LOP+RIT" "Lopinavir/ritonavir" "J05AR10" 11979606 "Antivirals for treatment of HIV infections, combinations" "aluvia,kaletra,lopimune" 0.8 "g" ""
|
||||
"LYS" "Lysozyme" "J05AX02" 16130991 "Other antivirals" "" ""
|
||||
"MARA" "Maraviroc" "J05AX09" 3002977 "Other antivirals" "celsentri,selzentry" 0.6 "g" "88987-3"
|
||||
"MARI" "Maribavir" "J05AX10" 471161 "Other antivirals" "benzimidavir,camvia" ""
|
||||
"MET" "Metisazone" "J05AA01" 667492 "Thiosemicarbazones" "kemoviran,marboran,marborane,methisazon,methisazone,methsazone,metisazon,metisazona,metisazonum,viruzona" ""
|
||||
"MOR" "Moroxydine" "J05AX01" 71655 "Other antivirals" "bimolin,moroxidina,moroxydinum,virugon,virumin,wirumin" 0.3 "g" ""
|
||||
"NEL" "Nelfinavir" "J05AE04" 64143 "Protease inhibitors" "viracept" 2.25 "g" "29120-3,32647-0,35113-0,51923-1"
|
||||
"NEV" "Nevirapine" "J05AG01" 4463 "Non-nucleoside reverse transcriptase inhibitors" "nevirapine anhydrous,nevirapine teva,nevirapine),viramune,viramune ir,viramune xr" 0.4 "g" "29121-1,32646-2,51925-6"
|
||||
"OMB+PAR+RIT" "Ombitasvir/paritaprevir/ritonavir" "J05AP53" "Antivirals for treatment of HCV infections" "" ""
|
||||
"OSE" "Oseltamivir" "J05AH02" 65028 "Neuraminidase inhibitors" "agucort,tamiflu,tamvir" 0.15 "g" ""
|
||||
"PEN" "Penciclovir" "J05AB13" 135398748 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "adenovir,denavir,penciceovir,penciclovirum,pencyclovir,vectavir" "60140-1,60141-9"
|
||||
"PAIE" "Pentanedioic acid imidazolyl ethanamide" "J05AX21" 9942657 "Other antivirals" "ingamine" 90 "mg" ""
|
||||
"PER" "Peramivir" "J05AH03" 154234 "Neuraminidase inhibitors" "peramiflu,peramivir anhydrous,rapiacta,rapivab" 0.6 "g" ""
|
||||
"PLE" "Pleconaril" "J05AX06" 1684 "Other antivirals" "picovir,pleconarilis" ""
|
||||
"RAL" "Raltegravir" "J05AJ01" 54671008 "Integrase inhibitors" "isentress" 0.8 "g" "72835-2"
|
||||
"REM" "Remdesivir" "J05AB16" 121304016 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "veklury" 0.1 "g" ""
|
||||
"RIB" "Ribavirin" "J05AP01" 37542 "Antivirals for treatment of HCV infections" "copegus,cotronak,ravanex,rebetol,rebetron,rebretron,ribacine,ribamide,ribamidil,ribamidyl,ribasphere,ribavirin capsules,ribavirin mylan,ribavirin teva,ribavirina,ribavirine,ribavirinum,tribavirin,varazid,vilona,viramid,virazid,virazide,virazole" 1 "g" "41469-8"
|
||||
"RIL" "Rilpivirine" "J05AG05" 6451164 "Non-nucleoside reverse transcriptase inhibitors" "edurant,rilpivirina" 25 "mg" 15 "mg" "80547-3"
|
||||
"RIM" "Rimantadine" "J05AC02" 5071 "Cyclic amines" "ethanamine,rimant,rimantadin,rimantadin a,rimantadina,rimantadinum" 0.2 "g" ""
|
||||
"RIT" "Ritonavir" "J05AE03" 392622 "Protease inhibitors" "empetus,norvir,norvir softgel,ritomune,ritonavirum,ritovir,viekirax,viriton" 1.2 "g" "29122-9,31027-6,51929-8,51930-6"
|
||||
"SAQ" "Saquinavir" "J05AE01" 441243 "Protease inhibitors" "fortovase,invirase,saquinavirum" 1.8 "g" "19051-2,29123-7,51932-2"
|
||||
"SIM" "Simeprevir" "J05AP05" 24873435 "Antivirals for treatment of HCV infections" "olysio,simeprevir sodium" 0.15 "g" ""
|
||||
"SOF" "Sofosbuvir" "J05AP08" 45375808 "Antivirals for treatment of HCV infections" "hepcinat,hepcvir,sovaldi,sovihep" 0.4 "g" ""
|
||||
"SOF+LED" "Sofosbuvir/ledipasvir" "J05AP51" 72734365 "Antivirals for treatment of HCV infections" "harvoni" ""
|
||||
"SOF+VEL" "Sofosbuvir/velpatasvir" "J05AP55" 91885554 "Antivirals for treatment of HCV infections" "epclusa,epclusa tablet" ""
|
||||
"SOF+VEL+VOX" "Sofosbuvir/velpatasvir/voxilaprevir" "J05AP56" "Antivirals for treatment of HCV infections" "" ""
|
||||
"STA" "Stavudine" "J05AF04" 18283 "Nucleoside and nucleotide reverse transcriptase inhibitors" "estavudina,sanilvudine,stavudinum,zerit xr,zerut xr" 80 "mg" "29124-5,49227-2"
|
||||
"STA+LAM+NEV" "Stavudine/lamivudine/nevirapine" "J05AR07" 15979285 "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"TEC" "Tecovirimat" "J05AX24" 16124688 "Other antivirals" "" ""
|
||||
"TELA" "Telaprevir" "J05AP02" 3010818 "Antivirals for treatment of HCV infections" "incivek,incivo,telavic" 2.25 "g" ""
|
||||
"TELB" "Telbivudine" "J05AF11" 159269 "Nucleoside and nucleotide reverse transcriptase inhibitors" "epavudine,sebivo,telbivudin,tyzeka" 0.6 "g" ""
|
||||
"TEA" "Tenofovir alafenamide" "J05AF13" 9574768 "Nucleoside and nucleotide reverse transcriptase inhibitors" "vemlidy" 25 "mg" ""
|
||||
"TED" "Tenofovir disoproxil" "J05AF07" 5481350 "Nucleoside and nucleotide reverse transcriptase inhibitors" "bispmpa,pmpa prodrug,tenofovir,tenofovir bis,tenofovirdisoproxil,viread" 0.245 "g" ""
|
||||
"TED+EMT" "Tenofovir disoproxil/emtricitabine" "J05AR03" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"TIL" "Tilorone" "J05AX19" 5475 "Other antivirals" "amixin ic,tiloron,tilorona,tiloronum" 0.125 "g" ""
|
||||
"TIP" "Tipranavir" "J05AE09" 54682461 "Protease inhibitors" "aptivus" 1 "g" "57383-2"
|
||||
"TRO" "Tromantadine" "J05AC03" 64377 "Cyclic amines" "tromantadina,tromantadinum" ""
|
||||
"UMI" "Umifenovir" "J05AX13" 131411 "Other antivirals" "arbidol,arbidol base" 0.8 "g" ""
|
||||
"VALA" "Valaciclovir" "J05AB11" 135398742 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "talavir,valacv,valacyclovir,valcivir,valcyclovir,valtrex,virval,zelitrex" 3 "g" ""
|
||||
"VALG" "Valganciclovir" "J05AB14" 135413535 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "cymeval" 0.9 "g" "74960-6"
|
||||
"VID" "Vidarabine" "J05AB03" 21704 "Nucleosides and nucleotides excl. reverse transcriptase inhibitors" "adenine arabinoside,araadenosine,arabinoside adenine,arabinosyl adenine,arabinosyladenine,spongoadenosine,vidarabin,vidarabina,vidarabine anhydrous,vidarabinum,vira a,vira atm" 0.7 "g" ""
|
||||
"ZAL" "Zalcitabine" "J05AF03" 24066 "Nucleoside and nucleotide reverse transcriptase inhibitors" "dideoxycytidine,interferon ad + ddc,zalcitibine" 2.25 "mg" "29125-2"
|
||||
"ZAN" "Zanamivir" "J05AH01" 60855 "Neuraminidase inhibitors" "modified sialic acid,relenza,zanamavir,zanamivi,zanamivirhydrate" 1.2 "g" ""
|
||||
"ZID" "Zidovudine" "J05AF01" 35370 "Nucleoside and nucleotide reverse transcriptase inhibitors" "azidothymidine,beta interferon,compound s,propolis+azt,retrovir,trizivir,zidovudina,zidovudinum" 0.6 "g" 0.6 "g" "29126-0,6894-0"
|
||||
"ZID+LAM" "Zidovudine/lamivudine" "J05AR01" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"ZID+LAM+ABA" "Zidovudine/lamivudine/abacavir" "J05AR04" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
"ZID+LAM+NEV" "Zidovudine/lamivudine/nevirapine" "J05AR05" "Antivirals for treatment of HIV infections, combinations" "" ""
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
246da79545e045edac7c3ec445b3a04e
|
||||
009fea3738cdb6390dccd470cb27f015
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
21f4808065fcad26bdf869a693b074d2
|
||||
9a9fad0100acf4738f3f66b25ed3d8ef
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user