mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 19:41:58 +02:00
Compare commits
27 Commits
v1.8.1
...
4da32e3d40
Author | SHA1 | Date | |
---|---|---|---|
4da32e3d40 | |||
e05d0365a9 | |||
5501cffbb0 | |||
d3000a9492 | |||
2cbce2cefa | |||
53c4b37252 | |||
bdbc112f99 | |||
d6676e9443 | |||
952d16de33 | |||
7226b70c3d | |||
3f2f60ab77 | |||
4b19c3dc5e | |||
ab97268f4c | |||
7f981e7778 | |||
b84d647cac | |||
1b84564d36 | |||
70a07bad39 | |||
2c5bc73ed6 | |||
58ed15e7ac | |||
6de5375256 | |||
859224e9d0 | |||
680e8e7a41 | |||
d4e22069bc | |||
1c891cc90c | |||
152db9d1b5 | |||
4754848e96 | |||
641b88c814 |
@ -23,14 +23,15 @@
|
||||
^data-raw$
|
||||
^\.lintr$
|
||||
^tests/testthat/_snaps$
|
||||
^vignettes/AMR.Rmd$
|
||||
^vignettes/benchmarks.Rmd$
|
||||
^vignettes/datasets.Rmd$
|
||||
^vignettes/EUCAST.Rmd$
|
||||
^vignettes/MDR.Rmd$
|
||||
^vignettes/PCA.Rmd$
|
||||
^vignettes/resistance_predict.Rmd$
|
||||
^vignettes/SPSS.Rmd$
|
||||
^vignettes/WHONET.Rmd$
|
||||
^vignettes/AMR\.Rmd$
|
||||
^vignettes/benchmarks\.Rmd$
|
||||
^vignettes/*\.not$
|
||||
^vignettes/datasets\.Rmd$
|
||||
^vignettes/EUCAST\.Rmd$
|
||||
^vignettes/MDR\.Rmd$
|
||||
^vignettes/PCA\.Rmd$
|
||||
^vignettes/resistance_predict\.Rmd$
|
||||
^vignettes/SPSS\.Rmd$
|
||||
^vignettes/WHONET\.Rmd$
|
||||
^logo.svg$
|
||||
^CRAN-SUBMISSION$
|
||||
|
6
.gitattributes
vendored
Normal file
6
.gitattributes
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
*.dta filter=lfs diff=lfs merge=lfs -text
|
||||
*.sas filter=lfs diff=lfs merge=lfs -text
|
||||
*.sav filter=lfs diff=lfs merge=lfs -text
|
||||
data-raw/*.dta filter=lfs diff=lfs merge=lfs -text
|
||||
data-raw/*.sas filter=lfs diff=lfs merge=lfs -text
|
||||
data-raw/*.sav filter=lfs diff=lfs merge=lfs -text
|
3
.github/prehooks/post-checkout
vendored
Executable file
3
.github/prehooks/post-checkout
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; }
|
||||
git lfs post-checkout "$@"
|
3
.github/prehooks/post-commit
vendored
Executable file
3
.github/prehooks/post-commit
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; }
|
||||
git lfs post-commit "$@"
|
3
.github/prehooks/post-merge
vendored
Executable file
3
.github/prehooks/post-merge
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
|
||||
git lfs post-merge "$@"
|
74
.github/prehooks/pre-commit
vendored
Executable file
74
.github/prehooks/pre-commit
vendored
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running pre-commit hook..."
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating R documentation..."
|
||||
if command -v Rscript > /dev/null; then
|
||||
if [ "$(Rscript -e 'cat(all(c('"'roxygen2'"', '"'pkgload'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
|
||||
Rscript -e "suppressMessages(roxygen2::roxygenise())"
|
||||
currentpkg=`Rscript -e "cat(pkgload::pkg_name())"`
|
||||
git add man/*
|
||||
echo ">> done."
|
||||
else
|
||||
echo ">> R packages 'roxygen2' and 'pkgload' are not installed!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
else
|
||||
echo ">> R is not available on your system!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
echo ">> "
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating semantic versioning and date..."
|
||||
|
||||
# get tags from remote, and remove tags not on remote:
|
||||
git fetch origin --prune --prune-tags --quiet
|
||||
currenttagfull=`git describe --tags --abbrev=0`
|
||||
currenttag=`git describe --tags --abbrev=0 | sed 's/v//'`
|
||||
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 some using v(x).(y).(z)"
|
||||
currenttag="0.0.1"
|
||||
currentcommit=`git rev-list --count HEAD`
|
||||
else
|
||||
# there is a tag, so base version number on that
|
||||
currentcommit=`git rev-list --count ${currenttagfull}..HEAD`
|
||||
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"
|
||||
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}"
|
||||
|
||||
# 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"
|
||||
# remove leftover on macOS
|
||||
rm -f DESCRIPTION--
|
||||
# add to commit
|
||||
git add DESCRIPTION
|
||||
|
||||
# set version number to NEWS file
|
||||
if [ -e "NEWS.md" ]; then
|
||||
if [ "$currentpkg" = "your" ]; then
|
||||
currentpkg=""
|
||||
fi
|
||||
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
|
||||
echo ">> - updated NEWS.md"
|
||||
# remove leftover on macOS
|
||||
rm -f NEWS.md--
|
||||
# add to commit
|
||||
git add NEWS.md
|
||||
else
|
||||
echo ">> - no NEWS.md found!"
|
||||
fi
|
||||
echo ">> "
|
71
.github/prehooks/pre-commit.save
vendored
Executable file
71
.github/prehooks/pre-commit.save
vendored
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running pre-commit hook..."
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating R documentation..."
|
||||
if command -v Rscript > /dev/null; then
|
||||
if [ "$(Rscript -e 'cat(all(c('"'roxygen2'"', '"'pkgload'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
|
||||
Rscript -e "suppressMessages(roxygen2::roxygenise())"
|
||||
currentpkg=`Rscript -e "cat(pkgload::pkg_name())"`
|
||||
git add man/*
|
||||
echo ">> done."
|
||||
else
|
||||
echo ">> R packages 'roxygen2' and 'pkgload' are not installed!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
else
|
||||
echo ">> R is not available on your system!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
echo ">> "
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating semantic versioning and date..."
|
||||
|
||||
# get tags from remote, and remove tags not on remote:
|
||||
git fetch origin --prune --prune-tags --quiet
|
||||
currenttagfull=`git describe --tags --abbrev=0`
|
||||
currenttag=`git describe --tags --abbrev=0 | sed 's/v//'`
|
||||
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 some using v(x).(y).(z)"
|
||||
currenttag="0.0.1"
|
||||
currentcommit=`git rev-list --count HEAD`
|
||||
else
|
||||
# there is a tag, so base version number on that
|
||||
currentcommit=`git rev-list --count ${currenttagfull}..HEAD`
|
||||
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"
|
||||
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}"
|
||||
|
||||
# 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"
|
||||
# remove leftover on macOS
|
||||
rm -f DESCRIPTION--
|
||||
# add to commit
|
||||
git add DESCRIPTION
|
||||
|
||||
# set version number to NEWS file
|
||||
if [ -e "NEWS.md" ]; then
|
||||
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" 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!"
|
||||
fi
|
||||
echo ">> "
|
3
.github/prehooks/pre-push
vendored
Executable file
3
.github/prehooks/pre-push
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
|
||||
git lfs pre-push "$@"
|
45
.github/workflows/check.yaml
vendored
45
.github/workflows/check.yaml
vendored
@ -25,12 +25,8 @@
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
# run after a git push on any branch in this repo
|
||||
branches: '**'
|
||||
schedule:
|
||||
# run a schedule everyday at 1 AM.
|
||||
# this is to check that all dependencies are still available (see R/zzz.R)
|
||||
@ -55,32 +51,21 @@ jobs:
|
||||
- {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: macOS-latest, r: '3.5', allowfail: false}
|
||||
- {os: macOS-latest, r: '3.4', allowfail: false}
|
||||
- {os: macOS-latest, r: '3.3', allowfail: false}
|
||||
- {os: macOS-latest, r: '3.2', allowfail: false}
|
||||
# - {os: macOS-latest, r: '3.1', allowfail: true}
|
||||
# - {os: macOS-latest, r: '3.0', allowfail: true}
|
||||
- {os: ubuntu-20.04, r: 'devel', allowfail: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '4.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '4.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.6', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.5', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.4', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.3', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.2', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.1', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {os: ubuntu-20.04, r: '3.0', allowfail: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
|
||||
- {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: false, rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
|
||||
- {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.1', allowfail: false}
|
||||
- {os: windows-latest, r: '4.0', allowfail: false}
|
||||
- {os: windows-latest, r: '3.6', allowfail: false}
|
||||
- {os: windows-latest, r: '3.5', allowfail: false}
|
||||
- {os: windows-latest, r: '3.4', allowfail: false}
|
||||
- {os: windows-latest, r: '3.3', allowfail: false}
|
||||
# - {os: windows-latest, r: '3.2', allowfail: true}
|
||||
# - {os: windows-latest, r: '3.1', allowfail: true}
|
||||
# - {os: windows-latest, r: '3.0', allowfail: true}
|
||||
env:
|
||||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
||||
RSPM: ${{ matrix.config.rspm }}
|
||||
@ -99,9 +84,9 @@ jobs:
|
||||
if: runner.os == 'Linux'
|
||||
# update the below with sysreqs::sysreqs("DESCRIPTION") and check the "DEB" entries (for Ubuntu).
|
||||
# we don't want to depend on the sysreqs pkg here, as it requires quite a recent R version
|
||||
# as of May 2021: https://sysreqs.r-hub.io/pkg/AMR,R,cleaner,curl,dplyr,ggplot2,ggtext,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
|
||||
# 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 libicu-dev libcurl4-openssl-dev libpng-dev
|
||||
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
|
||||
|
60
.github/workflows/website.yaml
vendored
Normal file
60
.github/workflows/website.yaml
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# ==================================================================== #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Create a website from the R documentation using pkgdown
|
||||
# Git commit and push to the 'gh-pages' branch
|
||||
|
||||
on:
|
||||
push:
|
||||
# only on main
|
||||
branches: 'main'
|
||||
|
||||
name: Update website
|
||||
|
||||
jobs:
|
||||
update-website:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
# Set up R (current stable version) and developer tools
|
||||
- uses: actions/checkout@v3
|
||||
- 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
|
||||
- name: Set up R dependencies
|
||||
uses: r-lib/actions/setup-r-dependencies@v2
|
||||
with:
|
||||
extra-packages: any::pkgdown
|
||||
|
||||
# Send updates to repo using GH Actions bot
|
||||
- name: Create website in separate branch
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE, install = TRUE, branch = "gh-pages")'
|
85
DESCRIPTION
85
DESCRIPTION
@ -1,72 +1,30 @@
|
||||
Package: AMR
|
||||
Version: 1.8.1
|
||||
Date: 2022-03-17
|
||||
Version: 1.8.1.9027
|
||||
Date: 2022-08-26
|
||||
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>.
|
||||
Authors@R: c(
|
||||
person(given = c("Matthijs", "S."),
|
||||
family = "Berends",
|
||||
email = "m.berends@certe.nl",
|
||||
role = c("aut", "cre"),
|
||||
comment = c(ORCID = "0000-0001-7620-1800")),
|
||||
person(given = c("Christian", "F."),
|
||||
family = "Luz",
|
||||
role = c("aut", "ctb"),
|
||||
comment = c(ORCID = "0000-0001-5809-5995")),
|
||||
person(given = "Dennis",
|
||||
family = "Souverein",
|
||||
role = c("aut", "ctb"),
|
||||
comment = c(ORCID = "0000-0003-0455-0336")),
|
||||
person(given = c("Erwin", "E.", "A."),
|
||||
family = "Hassing",
|
||||
role = c("aut", "ctb")),
|
||||
person(given = c("Casper", "J."),
|
||||
family = "Albers",
|
||||
role = "ths",
|
||||
comment = c(ORCID = "0000-0002-9213-6743")),
|
||||
person(given = c("Judith", "M."),
|
||||
family = "Fonville",
|
||||
role = "ctb"),
|
||||
person(given = c("Alex", "W."),
|
||||
family = "Friedrich",
|
||||
role = "ths",
|
||||
comment = c(ORCID = "0000-0003-4881-038X")),
|
||||
person(given = "Corinna",
|
||||
family = "Glasner",
|
||||
role = "ths",
|
||||
comment = c(ORCID = "0000-0003-1241-1328")),
|
||||
person(given = c("Eric", "H.", "L.", "C.", "M."),
|
||||
family = "Hazenberg",
|
||||
role = "ctb"),
|
||||
person(given = "Gwen",
|
||||
family = "Knight",
|
||||
role = "ctb",
|
||||
comment = c(ORCID = "0000-0002-7263-9896")),
|
||||
person(given = "Annick",
|
||||
family = "Lenglet",
|
||||
role = "ctb",
|
||||
comment = c(ORCID = "0000-0003-2013-8405")),
|
||||
person(given = c("Bart", "C."),
|
||||
family = "Meijer",
|
||||
role = "ctb"),
|
||||
person(given = "Sofia",
|
||||
family = "Ny",
|
||||
role = "ctb",
|
||||
comment = c(ORCID = "0000-0002-2017-1363")),
|
||||
person(given = c("Rogier", "P."),
|
||||
family = "Schade",
|
||||
role = "ctb"),
|
||||
person(given = c("Bhanu", "N.", "M."),
|
||||
family = "Sinha",
|
||||
role = "ths",
|
||||
comment = c(ORCID = "0000-0003-1634-0010")),
|
||||
person(given = "Anthony",
|
||||
family = "Underwood",
|
||||
role = "ctb",
|
||||
comment = c(ORCID = "0000-0002-8547-4277")))
|
||||
person(c("Matthijs", "S."), "Berends", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7620-1800"), email = "m.berends@certe.nl"),
|
||||
person(c("Christian", "F."), "Luz", role = c("aut", "ctb"), comment = c(ORCID = "0000-0001-5809-5995")),
|
||||
person("Dennis", "Souverein", role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-0455-0336")),
|
||||
person(c("Erwin", "E.", "A."), "Hassing", role = c("aut", "ctb")),
|
||||
person("Casper", "Albers", role = "ths", comment = c(ORCID = "0000-0002-9213-6743")),
|
||||
person("Peter", "Dutey-Magni", role = "ctb", comment = c(ORCID = "0000-0002-8942-9836")),
|
||||
person("Judith", "Fonville", role = "ctb"),
|
||||
person("Alex", "Friedrich", role = "ths", comment = c(ORCID = "0000-0003-4881-038X")),
|
||||
person("Corinna", "Glasner", role = "ths", comment = c(ORCID = "0000-0003-1241-1328")),
|
||||
person("Eric", "Hazenberg", role = "ctb"),
|
||||
person("Gwen", "Knight", role = "ctb", comment = c(ORCID = "0000-0002-7263-9896")),
|
||||
person("Annick", "Lenglet", role = "ctb", comment = c(ORCID = "0000-0003-2013-8405")),
|
||||
person("Bart", "Meijer", role = "ctb"),
|
||||
person("Anton", "Mymrikov", role = "ctb"),
|
||||
person("Sofia", "Ny", role = "ctb", comment = c(ORCID = "0000-0002-2017-1363")),
|
||||
person("Rogier", "Schade", role = "ctb"),
|
||||
person("Bhanu", "Sinha", role = "ths", comment = c(ORCID = "0000-0003-1634-0010")),
|
||||
person("Anthony", "Underwood", role = "ctb", comment = c(ORCID = "0000-0002-8547-4277")))
|
||||
Depends: R (>= 3.0.0)
|
||||
Enhances:
|
||||
cleaner,
|
||||
@ -76,7 +34,6 @@ Enhances:
|
||||
Suggests:
|
||||
curl,
|
||||
dplyr,
|
||||
ggtext,
|
||||
knitr,
|
||||
progress,
|
||||
readxl,
|
||||
@ -90,5 +47,5 @@ BugReports: https://github.com/msberends/AMR/issues
|
||||
License: GPL-2 | file LICENSE
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
RoxygenNote: 7.1.2
|
||||
RoxygenNote: 7.2.1
|
||||
Roxygen: list(markdown = TRUE)
|
||||
|
@ -50,7 +50,6 @@ S3method(any,mic)
|
||||
S3method(as.data.frame,ab)
|
||||
S3method(as.data.frame,mo)
|
||||
S3method(as.double,mic)
|
||||
S3method(as.integer,mic)
|
||||
S3method(as.list,custom_eucast_rules)
|
||||
S3method(as.list,custom_mdro_guideline)
|
||||
S3method(as.matrix,mic)
|
||||
@ -310,6 +309,7 @@ export(quinolones)
|
||||
export(random_disk)
|
||||
export(random_mic)
|
||||
export(random_rsi)
|
||||
export(reset_AMR_locale)
|
||||
export(resistance)
|
||||
export(resistance_predict)
|
||||
export(right_join_microorganisms)
|
||||
@ -318,6 +318,7 @@ export(rsi_predict)
|
||||
export(scale_rsi_colours)
|
||||
export(scale_y_percent)
|
||||
export(semi_join_microorganisms)
|
||||
export(set_AMR_locale)
|
||||
export(set_ab_names)
|
||||
export(set_mo_source)
|
||||
export(skewness)
|
||||
@ -325,6 +326,7 @@ export(streptogramins)
|
||||
export(susceptibility)
|
||||
export(tetracyclines)
|
||||
export(theme_rsi)
|
||||
export(translate_AMR)
|
||||
export(trimethoprims)
|
||||
export(ureidopenicillins)
|
||||
importFrom(graphics,arrows)
|
||||
|
25
NEWS.md
25
NEWS.md
@ -1,8 +1,27 @@
|
||||
# AMR 1.8.1.9027
|
||||
|
||||
### New
|
||||
* EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.
|
||||
* Support for the following languages: Chinese, Greek, Japanese, Polish, Turkish and Ukrainian. The `AMR` package is now available in 16 languages.
|
||||
|
||||
### Changed
|
||||
* Fix for `as.rsi()` on certain EUCAST breakpoints for MIC values
|
||||
* Removed `as.integer()` for MIC values, since MIC are not integer values and running `table()` on MIC values consequently failed for not being able to retrieve the level position (as that's how normally `as.integer()` on `factor`s work)
|
||||
* `droplevels()` on MIC will now return a common `factor` at default and will lose the `<mic>` class. Use `droplevels(..., as.mic = TRUE)` to keep the `<mic>` class.
|
||||
* Small fix for using `ab_from_text()`
|
||||
* Fixes for reading in text files using `set_mo_source()`, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package
|
||||
* Using any `random_*()` function (such as `random_mic()`) is now possible by directly calling the package without loading it first: `AMR::random_mic(10)`
|
||||
* Added *Toxoplasma gondii* (`P_TXPL_GOND`) to the `microorganisms` data set, together with its genus, family, and order
|
||||
* Changed value in column `prevalence` of the `microorganisms` data set from 3 to 2 for these genera: *Acholeplasma*, *Alistipes*, *Alloprevotella*, *Bergeyella*, *Borrelia*, *Brachyspira*, *Butyricimonas*, *Cetobacterium*, *Chlamydia*, *Chlamydophila*, *Deinococcus*, *Dysgonomonas*, *Elizabethkingia*, *Empedobacter*, *Haloarcula*, *Halobacterium*, *Halococcus*, *Myroides*, *Odoribacter*, *Ornithobacterium*, *Parabacteroides*, *Pedobacter*, *Phocaeicola*, *Porphyromonas*, *Riemerella*, *Sphingobacterium*, *Streptobacillus*, *Tenacibaculum*, *Terrimonas*, *Victivallis*, *Wautersiella*, *Weeksella*
|
||||
* Fix for using the form `df[carbapenems() == "R", ]` using the latest `vctrs` package
|
||||
* Fix for using `info = FALSE` in `mdro()`
|
||||
|
||||
### Other
|
||||
* New website to make use of the new Bootstrap 5 and pkgdown v2.0. The website now contains results for all examples and will be automatically regenerated with every change to our repository, using GitHub Actions
|
||||
* Added Peter Dutey-Magni and Anton Mymrikov as contributors, to thank them for their valuable input
|
||||
|
||||
# `AMR` 1.8.1
|
||||
|
||||
|
||||
All functions in this package are considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months.
|
||||
|
||||
### Changed
|
||||
* Fix for using `as.rsi()` on values containing capped values (such as `>=`), sometimes leading to `NA`
|
||||
* Support for antibiotic interpretations of the MIPS laboratory system: `"U"` for S ('susceptible urine'), `"D"` for I ('susceptible dose-dependent')
|
||||
|
@ -638,7 +638,7 @@ vector_or <- function(v, quotes = TRUE, reverse = FALSE, sort = TRUE, initial_ca
|
||||
if (isTRUE(initial_captital)) {
|
||||
v[1] <- gsub("^([a-z])", "\\U\\1", v[1], perl = TRUE)
|
||||
}
|
||||
if (length(v) == 1) {
|
||||
if (length(v) <= 1) {
|
||||
return(paste0(quotes, v, quotes))
|
||||
}
|
||||
if (identical(v, c("I", "R", "S"))) {
|
||||
|
10
R/ab.R
10
R/ab.R
@ -26,7 +26,6 @@
|
||||
#' 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).
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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 info a [logical] to indicate whether a progress bar should be printed, defaults to `TRUE` only in interactive mode
|
||||
@ -55,7 +54,6 @@
|
||||
#' * [antibiotics] for the [data.frame] that is being used to determine ATCs
|
||||
#' * [ab_from_text()] for a function to retrieve antimicrobial drugs from clinical text (from health care records)
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # these examples all return "ERY", the ID of erythromycin:
|
||||
@ -282,9 +280,9 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
x_new[i] <- note_if_more_than_one_found(found, i, from_text)
|
||||
next
|
||||
}
|
||||
|
||||
|
||||
# INITIAL SEARCH - More uncertain results ----
|
||||
|
||||
|
||||
if (initial_search == TRUE && fast_mode == FALSE) {
|
||||
# only run on first try
|
||||
|
||||
@ -313,7 +311,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
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"],
|
||||
!isFALSE(TRANSLATIONS$fixed)), "pattern"],
|
||||
y[i])
|
||||
}
|
||||
}
|
||||
@ -463,7 +461,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = interactive(), ...) {
|
||||
warning_("in `as.ab()`: these values could not be coerced to a valid antimicrobial ID: ",
|
||||
vector_and(x_unknown), ".")
|
||||
}
|
||||
|
||||
|
||||
x_result <- x_new[match(x_bak_clean, x)]
|
||||
if (length(x_result) == 0) {
|
||||
x_result <- NA_character_
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Retrieve Antimicrobial 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 antimicrobial drugs, doses and forms of administration found in the texts.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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*
|
||||
@ -53,7 +52,6 @@
|
||||
#' `df %>% mutate(abx = ab_from_text(clinical_text, collapse = "|"))`
|
||||
#' @export
|
||||
#' @return A [list], or a [character] if `collapse` is not `NULL`
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # mind the bad spelling of amoxicillin in this line,
|
||||
#' # straight from a true health care record:
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' 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()].
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x any (vector of) text that can be coerced to a valid antibiotic 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)`.
|
||||
@ -54,7 +53,6 @@
|
||||
#' @export
|
||||
#' @seealso [antibiotics]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # all properties:
|
||||
#' ab_name("AMX") # "Amoxicillin"
|
||||
@ -101,15 +99,18 @@
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' set_ab_names()
|
||||
#' set_ab_names() %>%
|
||||
#' head()
|
||||
#'
|
||||
#' # this does the same:
|
||||
#' example_isolates %>%
|
||||
#' rename_with(set_ab_names)
|
||||
#' rename_with(set_ab_names)%>%
|
||||
#' head()
|
||||
#'
|
||||
#' # set_ab_names() works with any AB property:
|
||||
#' example_isolates %>%
|
||||
#' set_ab_names(property = "atc")
|
||||
#' set_ab_names(property = "atc")%>%
|
||||
#' head()
|
||||
#'
|
||||
#' example_isolates %>%
|
||||
#' set_ab_names(where(is.rsi)) %>%
|
||||
@ -125,7 +126,7 @@ ab_name <- function(x, language = get_AMR_locale(), tolower = FALSE, ...) {
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
meet_criteria(tolower, allow_class = "logical", has_length = 1)
|
||||
|
||||
x <- translate_AMR(ab_validate(x = x, property = "name", ...), language = language, only_affect_ab_names = TRUE)
|
||||
x <- translate_into_language(ab_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"
|
||||
@ -166,7 +167,7 @@ ab_tradenames <- function(x, ...) {
|
||||
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)
|
||||
translate_AMR(ab_validate(x = x, property = "group", ...), language = language, only_affect_ab_names = TRUE)
|
||||
translate_into_language(ab_validate(x = x, property = "group", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
@ -204,7 +205,7 @@ ab_atc <- function(x, only_first = FALSE, ...) {
|
||||
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)
|
||||
translate_AMR(ab_validate(x = x, property = "atc_group1", ...), language = language, only_affect_ab_names = TRUE)
|
||||
translate_into_language(ab_validate(x = x, property = "atc_group1", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
@ -212,7 +213,7 @@ ab_atc_group1 <- function(x, language = get_AMR_locale(), ...) {
|
||||
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)
|
||||
translate_AMR(ab_validate(x = x, property = "atc_group2", ...), language = language, only_affect_ab_names = TRUE)
|
||||
translate_into_language(ab_validate(x = x, property = "atc_group2", ...), language = language, only_affect_ab_names = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
@ -331,7 +332,7 @@ 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(language, is_in = c(LANGUAGES_SUPPORTED, ""), has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
|
||||
translate_AMR(ab_validate(x = x, property = property, ...), language = language)
|
||||
translate_into_language(ab_validate(x = x, property = property, ...), language = language)
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
@ -430,7 +431,7 @@ ab_validate <- function(x, property, ...) {
|
||||
# so the 'call.' can be set to FALSE
|
||||
tryCatch(x[1L] %in% antibiotics[1, property],
|
||||
error = function(e) stop(e$message, call. = FALSE))
|
||||
|
||||
|
||||
if (!all(x %in% AB_lookup[, property])) {
|
||||
x <- as.ab(x, ...)
|
||||
x <- AB_lookup[match(x, AB_lookup$ab), property, drop = TRUE]
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' 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()].
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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()]
|
||||
@ -46,103 +45,105 @@
|
||||
#' @return (internally) a [character] vector of column names, with additional class `"ab_selector"`
|
||||
#' @export
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @examples
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#' df <- example_isolates[ , c("hospital_id", "mo",
|
||||
#' "AMP", "AMC", "TZP", "CXM", "CRO", "GEN",
|
||||
#' "TOB", "COL", "IPM", "MEM", "TEC", "VAN")]
|
||||
#'
|
||||
#' # base R ------------------------------------------------------------------
|
||||
#'
|
||||
#' # select columns 'IPM' (imipenem) and 'MEM' (meropenem)
|
||||
#' example_isolates[, carbapenems()]
|
||||
#' df[, carbapenems()]
|
||||
#'
|
||||
#' # select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB'
|
||||
#' example_isolates[, c("mo", aminoglycosides())]
|
||||
#' df[, c("mo", aminoglycosides())]
|
||||
#'
|
||||
#' # select only antibiotic columns with DDDs for oral treatment
|
||||
#' example_isolates[, administrable_per_os()]
|
||||
#' df[, administrable_per_os()]
|
||||
#'
|
||||
#' # filter using any() or all()
|
||||
#' example_isolates[any(carbapenems() == "R"), ]
|
||||
#' subset(example_isolates, any(carbapenems() == "R"))
|
||||
#' df[any(carbapenems() == "R"), ]
|
||||
#' subset(df, any(carbapenems() == "R"))
|
||||
#'
|
||||
#' # filter on any or all results in the carbapenem columns (i.e., IPM, MEM):
|
||||
#' example_isolates[any(carbapenems()), ]
|
||||
#' example_isolates[all(carbapenems()), ]
|
||||
#' df[any(carbapenems()), ]
|
||||
#' df[all(carbapenems()), ]
|
||||
#'
|
||||
#' # filter with multiple antibiotic selectors using c()
|
||||
#' example_isolates[all(c(carbapenems(), aminoglycosides()) == "R"), ]
|
||||
#' df[all(c(carbapenems(), aminoglycosides()) == "R"), ]
|
||||
#'
|
||||
#' # filter + select in one go: get penicillins in carbapenems-resistant strains
|
||||
#' example_isolates[any(carbapenems() == "R"), penicillins()]
|
||||
#' df[any(carbapenems() == "R"), penicillins()]
|
||||
#'
|
||||
#' # You can combine selectors with '&' to be more specific. For example,
|
||||
#' # penicillins() would select benzylpenicillin ('peni G') and
|
||||
#' # administrable_per_os() would select erythromycin. Yet, when combined these
|
||||
#' # drugs are both omitted since benzylpenicillin is not administrable per os
|
||||
#' # and erythromycin is not a penicillin:
|
||||
#' example_isolates[, penicillins() & administrable_per_os()]
|
||||
#' df[, penicillins() & administrable_per_os()]
|
||||
#'
|
||||
#' # ab_selector() applies a filter in the `antibiotics` data set and is thus very
|
||||
#' # flexible. For instance, to select antibiotic columns with an oral DDD of at
|
||||
#' # least 1 gram:
|
||||
#' example_isolates[, ab_selector(oral_ddd > 1 & oral_units == "g")]
|
||||
#' df[, ab_selector(oral_ddd > 1 & oral_units == "g")]
|
||||
#'
|
||||
#' # dplyr -------------------------------------------------------------------
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#'
|
||||
#' # get AMR for all aminoglycosides e.g., per hospital:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' summarise(across(aminoglycosides(), resistance))
|
||||
#'
|
||||
#' # You can combine selectors with '&' to be more specific:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' select(penicillins() & administrable_per_os())
|
||||
#'
|
||||
#' # get AMR for only drugs that matter - no intrinsic resistance:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' filter(mo_genus() %in% c("Escherichia", "Klebsiella")) %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' summarise(across(not_intrinsic_resistant(), resistance))
|
||||
#'
|
||||
#' # get susceptibility for antibiotics whose name contains "trim":
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' filter(first_isolate()) %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' summarise(across(ab_selector(name %like% "trim"), susceptibility))
|
||||
#'
|
||||
#' # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' select(carbapenems())
|
||||
#'
|
||||
#' # this will select columns 'mo', 'AMK', 'GEN', 'KAN' and 'TOB':
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' select(mo, aminoglycosides())
|
||||
#'
|
||||
#' # any() and all() work in dplyr's filter() too:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' filter(any(aminoglycosides() == "R"),
|
||||
#' all(cephalosporins_2nd() == "R"))
|
||||
#'
|
||||
#' # also works with c():
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' filter(any(c(carbapenems(), aminoglycosides()) == "R"))
|
||||
#'
|
||||
#' # not setting any/all will automatically apply all():
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' filter(aminoglycosides() == "R")
|
||||
#' #> i Assuming a filter on all 4 aminoglycosides.
|
||||
#'
|
||||
#' # this will select columns 'mo' and all antimycobacterial drugs ('RIF'):
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' select(mo, ab_class("mycobact"))
|
||||
#'
|
||||
#' # get bug/drug combinations for only macrolides in Gram-positives:
|
||||
#' example_isolates %>%
|
||||
#' # get bug/drug combinations for only glycopeptides in Gram-positives:
|
||||
#' df %>%
|
||||
#' filter(mo_is_gram_positive()) %>%
|
||||
#' select(mo, macrolides()) %>%
|
||||
#' select(mo, glycopeptides()) %>%
|
||||
#' bug_drug_combinations() %>%
|
||||
#' format()
|
||||
#'
|
||||
@ -151,10 +152,12 @@
|
||||
#' select(penicillins()) # only the 'J01CA01' column will be selected
|
||||
#'
|
||||
#'
|
||||
#' # with dplyr 1.0.0 and higher (that adds 'across()'), this is all equal:
|
||||
#' example_isolates[carbapenems() == "R", ]
|
||||
#' example_isolates %>% filter(carbapenems() == "R")
|
||||
#' example_isolates %>% filter(across(carbapenems(), ~.x == "R"))
|
||||
#' # with recent versions of dplyr this is all equal:
|
||||
#' x <- df[carbapenems() == "R", ]
|
||||
#' y <- df %>% filter(carbapenems() == "R")
|
||||
#' z <- df %>% filter(if_all(carbapenems(), ~.x == "R"))
|
||||
#' identical(x, y)
|
||||
#' identical(y, z)
|
||||
#' }
|
||||
#' }
|
||||
ab_class <- function(ab_class,
|
||||
|
23
R/age.R
23
R/age.R
@ -25,8 +25,7 @@
|
||||
|
||||
#' Age in Years of Individuals
|
||||
#'
|
||||
#' Calculates age in years based on a reference date, which is the sytem date at default.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' Calculates age in years based on a reference date, which is the system date at default.
|
||||
#' @param x date(s), [character] (vectors) will be coerced with [as.POSIXlt()]
|
||||
#' @param reference reference date(s) (defaults to today), [character] (vectors) will be coerced with [as.POSIXlt()]
|
||||
#' @param exact a [logical] to indicate whether age calculation should be exact, i.e. with decimals. It divides the number of days of [year-to-date](https://en.wikipedia.org/wiki/Year-to-date) (YTD) of `x` by the number of days in the year of `reference` (either 365 or 366).
|
||||
@ -37,15 +36,19 @@
|
||||
#' This function vectorises over both `x` and `reference`, meaning that either can have a length of 1 while the other argument has a larger length.
|
||||
#' @return An [integer] (no decimals) if `exact = FALSE`, a [double] (with decimals) otherwise
|
||||
#' @seealso To split ages into groups, use the [age_groups()] function.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # 10 random birth dates
|
||||
#' df <- data.frame(birth_date = Sys.Date() - runif(10) * 25000)
|
||||
#' # 10 random pre-Y2K birth dates
|
||||
#' df <- data.frame(birth_date = as.Date("2000-01-01") - runif(10) * 25000)
|
||||
#'
|
||||
#' # add ages
|
||||
#' df$age <- age(df$birth_date)
|
||||
#'
|
||||
#' # add exact ages
|
||||
#' df$age_exact <- age(df$birth_date, exact = TRUE)
|
||||
#'
|
||||
#' # add age at millenium switch
|
||||
#' df$age_at_y2k <- age(df$birth_date, "2000-01-01")
|
||||
#'
|
||||
#' df
|
||||
age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
@ -115,7 +118,6 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#' Split Ages into Age Groups
|
||||
#'
|
||||
#' Split ages into age groups defined by the `split` argument. This allows for easier demographic (antimicrobial resistance) analysis.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x age, e.g. calculated with [age()]
|
||||
#' @param split_at values to split `x` at, defaults to age groups 0-11, 12-24, 25-54, 55-74 and 75+. See *Details*.
|
||||
#' @param na.rm a [logical] to indicate whether missing values should be removed
|
||||
@ -131,7 +133,7 @@ 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
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @examples
|
||||
#' ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
|
||||
#'
|
||||
@ -150,7 +152,7 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#' age_groups(ages, split_at = "fives")
|
||||
#'
|
||||
#' # split specifically for children
|
||||
#' age_groups(ages, c(1, 2, 4, 6, 13, 17))
|
||||
#' age_groups(ages, c(1, 2, 4, 6, 13, 18))
|
||||
#' age_groups(ages, "children")
|
||||
#'
|
||||
#' \donttest{
|
||||
@ -161,7 +163,10 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
|
||||
#' filter(mo == as.mo("E. coli")) %>%
|
||||
#' group_by(age_group = age_groups(age)) %>%
|
||||
#' select(age_group, CIP) %>%
|
||||
#' ggplot_rsi(x = "age_group", minimum = 0)
|
||||
#' ggplot_rsi(x = "age_group",
|
||||
#' minimum = 0,
|
||||
#' x.title = "Age Group",
|
||||
#' title = "Ciprofloxacin resistance per age group")
|
||||
#' }
|
||||
#' }
|
||||
age_groups <- function(x, split_at = c(12, 25, 55, 75), na.rm = FALSE) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Get ATC Properties from WHOCC Website
|
||||
#'
|
||||
#' Gets data from the WHOCC website to determine properties of an Anatomical Therapeutic Chemical (ATC) (e.g. an antibiotic), such as the name, defined daily dose (DDD) or standard unit.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param atc_code a [character] (vector) with ATC code(s) of antibiotics, will be coerced with [as.ab()] and [ab_atc()] internally if not a valid ATC code
|
||||
#' @param property property of an ATC code. Valid values are `"ATC"`, `"Name"`, `"DDD"`, `"U"` (`"unit"`), `"Adm.R"`, `"Note"` and `groups`. For this last option, all hierarchical groups of an ATC code will be returned, see *Examples*.
|
||||
#' @param administration type of administration when using `property = "Adm.R"`, see *Details*
|
||||
@ -51,7 +50,7 @@
|
||||
#'
|
||||
#' - `"g"` = gram
|
||||
#' - `"mg"` = milligram
|
||||
#' - `"mcg"`` = microgram
|
||||
#' - `"mcg"` = microgram
|
||||
#' - `"U"` = unit
|
||||
#' - `"TU"` = thousand units
|
||||
#' - `"MU"` = million units
|
||||
@ -61,7 +60,6 @@
|
||||
#' **N.B. This function requires an internet connection and only works if the following packages are installed: `curl`, `rvest`, `xml2`.**
|
||||
#' @export
|
||||
#' @rdname atc_online
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @source <https://www.whocc.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/>
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
|
@ -26,12 +26,10 @@
|
||||
#' Check Availability of Columns
|
||||
#'
|
||||
#' Easy check for data availability of all columns in a data set. This makes it easy to get an idea of which antimicrobial combinations can be used for calculation with e.g. [susceptibility()] and [resistance()].
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param tbl a [data.frame] or [list]
|
||||
#' @param width number of characters to present the visual availability, defaults to filling the width of the console
|
||||
#' @details The function returns a [data.frame] with columns `"resistant"` and `"visual_resistance"`. The values in that columns are calculated with [resistance()].
|
||||
#' @return [data.frame] with column names of `tbl` as row names
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' availability(example_isolates)
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Determine Bug-Drug Combinations
|
||||
#'
|
||||
#' 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*.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @inheritParams eucast_rules
|
||||
#' @param combine_IR a [logical] to indicate whether values R and I should be summed
|
||||
#' @param add_ab_group a [logical] to indicate where the group of the antimicrobials must be included as a first column
|
||||
@ -41,11 +40,10 @@
|
||||
#' @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/>.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' x <- bug_drug_combinations(example_isolates)
|
||||
#' x
|
||||
#' head(x)
|
||||
#' format(x, translate_ab = "name (atc)")
|
||||
#'
|
||||
#' # Use FUN to change to transformation of microorganism codes
|
||||
@ -285,7 +283,7 @@ format.bug_drug_combinations <- function(x,
|
||||
y <- y %pm>%
|
||||
pm_select(-ab_group) %pm>%
|
||||
pm_rename("Drug" = ab_txt)
|
||||
colnames(y)[1] <- translate_AMR(colnames(y)[1], language, only_unknown = FALSE)
|
||||
colnames(y)[1] <- translate_into_language(colnames(y)[1], language, only_unknown = FALSE)
|
||||
} else {
|
||||
y <- y %pm>%
|
||||
pm_rename("Group" = ab_group,
|
||||
@ -293,7 +291,7 @@ format.bug_drug_combinations <- function(x,
|
||||
}
|
||||
|
||||
if (!is.null(language)) {
|
||||
colnames(y) <- translate_AMR(colnames(y), language, only_unknown = FALSE)
|
||||
colnames(y) <- translate_into_language(colnames(y), language, only_unknown = FALSE)
|
||||
}
|
||||
|
||||
if (remove_intrinsic_resistant == TRUE) {
|
||||
|
@ -59,7 +59,6 @@ format_included_data_number <- function(data) {
|
||||
#' 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>.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @name catalogue_of_life
|
||||
#' @rdname catalogue_of_life
|
||||
#' @seealso Data set [microorganisms] for the actual data. \cr
|
||||
@ -71,28 +70,19 @@ format_included_data_number <- function(data) {
|
||||
#'
|
||||
#' # Get a note when a species was renamed
|
||||
#' mo_shortname("Chlamydophila psittaci")
|
||||
#' # Note: 'Chlamydophila psittaci' (Everett et al., 1999) was renamed back to
|
||||
#' # 'Chlamydia psittaci' (Page, 1968)
|
||||
#' #> [1] "C. psittaci"
|
||||
#'
|
||||
#' # Get any property from the entire taxonomic tree for all included species
|
||||
#' mo_class("E. coli")
|
||||
#' #> [1] "Gammaproteobacteria"
|
||||
#'
|
||||
#' mo_family("E. coli")
|
||||
#' #> [1] "Enterobacteriaceae"
|
||||
#'
|
||||
#' mo_gramstain("E. coli") # based on kingdom and phylum, see ?mo_gramstain
|
||||
#' #> [1] "Gram-negative"
|
||||
#'
|
||||
#' mo_ref("E. coli")
|
||||
#' #> [1] "Castellani et al., 1919"
|
||||
#'
|
||||
#' # Do not get mistaken - this package is about microorganisms
|
||||
#' mo_kingdom("C. elegans")
|
||||
#' #> [1] "Fungi" # Fungi?!
|
||||
#' mo_name("C. elegans")
|
||||
#' #> [1] "Cladosporium elegans" # Because a microorganism was found
|
||||
NULL
|
||||
|
||||
#' Version info of included Catalogue of Life
|
||||
@ -102,7 +92,6 @@ NULL
|
||||
#' @details For LPSN, see [microorganisms].
|
||||
#' @return a [list], which prints in pretty format
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
catalogue_of_life_version <- function() {
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#' @description These functions can be used to count resistant/susceptible microbial isolates. All functions support quasiquotation with pipes, can be used in `summarise()` from the `dplyr` package and also support grouped variables, see *Examples*.
|
||||
#'
|
||||
#' [count_resistant()] should be used to count resistant isolates, [count_susceptible()] should be used to count susceptible isolates.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param ... one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with [as.rsi()] if needed.
|
||||
#' @inheritParams proportion
|
||||
#' @inheritSection as.rsi Interpretation of R and S/I
|
||||
@ -45,11 +44,11 @@
|
||||
#' @rdname count
|
||||
#' @name count
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # example_isolates is a data set available in the AMR package.
|
||||
#' ?example_isolates
|
||||
#' # run ?example_isolates for more info.
|
||||
#'
|
||||
#' # base R ------------------------------------------------------------
|
||||
#' count_resistant(example_isolates$AMX) # counts "R"
|
||||
#' count_susceptible(example_isolates$AMX) # counts "S" and "I"
|
||||
#' count_all(example_isolates$AMX) # counts "S", "I" and "R"
|
||||
@ -72,6 +71,7 @@
|
||||
#' count_susceptible(example_isolates$AMX)
|
||||
#' susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
|
||||
#'
|
||||
#' # dplyr -------------------------------------------------------------
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
|
@ -26,82 +26,67 @@
|
||||
#' Define Custom EUCAST Rules
|
||||
#'
|
||||
#' Define custom EUCAST rules for your organisation or specific analysis and use the output of this function in [eucast_rules()].
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param ... rules in formula notation, see *Examples*
|
||||
#' @param ... rules in [formula][`~`()] notation, see *Examples*
|
||||
#' @details
|
||||
#' Some organisations have their own adoption of EUCAST rules. This function can be used to define custom EUCAST rules to be used in the [eucast_rules()] function.
|
||||
#'
|
||||
#' @section How it works:
|
||||
#'
|
||||
#' ### Basics
|
||||
#'
|
||||
#' 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}
|
||||
#' 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}
|
||||
#' 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:
|
||||
#'
|
||||
#' ```
|
||||
#' df <- data.frame(mo = c("E. coli", "K. pneumoniae"),
|
||||
#' TZP = "R",
|
||||
#' amox = "",
|
||||
#' AMP = "")
|
||||
#' ```{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 amox AMP
|
||||
#' #> 1 E. coli R
|
||||
#' #> 2 K. pneumoniae R
|
||||
#'
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = x)
|
||||
#' #> mo TZP amox AMP
|
||||
#' #> 1 E. coli R R R
|
||||
#' #> 2 K. pneumoniae R R R
|
||||
#'
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = x, info = FALSE)
|
||||
#' ```
|
||||
#'
|
||||
#' ### 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), quote = "``", sort = FALSE)`. Thus, this next example will work as well, despite the fact that the `df` data set does not contain a column `genus`:
|
||||
#' 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}
|
||||
#' y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
|
||||
#' TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
|
||||
#'
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = y)
|
||||
#' #> mo TZP amox AMP
|
||||
#' #> 1 E. coli R
|
||||
#' #> 2 K. pneumoniae R R R
|
||||
#' eucast_rules(df, rules = "custom", custom_rules = y, info = FALSE)
|
||||
#' ```
|
||||
#'
|
||||
#' ### 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.
|
||||
#'
|
||||
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("``", tolower(gsub("^AB_", "", x)), "``\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
|
||||
#' `r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("\"", tolower(gsub("^AB_", "", x)), "\"\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")`
|
||||
#' @returns A [list] containing the custom rules
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
|
||||
#' AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I")
|
||||
#' x
|
||||
#'
|
||||
#' # run the custom rule set (verbose = TRUE will return a logbook instead of the data set):
|
||||
#' eucast_rules(example_isolates,
|
||||
#' rules = "custom",
|
||||
#' custom_rules = x,
|
||||
#' info = FALSE)
|
||||
#' info = FALSE,
|
||||
#' verbose = TRUE)
|
||||
#'
|
||||
#' # combine rule sets
|
||||
#' x2 <- c(x,
|
||||
|
51
R/data.R
51
R/data.R
@ -72,8 +72,10 @@
|
||||
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: <https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm>
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection WHOCC WHOCC
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [microorganisms], [intrinsic_resistant]
|
||||
#' @examples
|
||||
#' head(antibiotics)
|
||||
#' head(antivirals)
|
||||
"antibiotics"
|
||||
|
||||
#' @rdname antibiotics
|
||||
@ -104,6 +106,7 @@
|
||||
#' - 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
|
||||
@ -111,13 +114,10 @@
|
||||
#' - 6 families under the Enterobacterales order, according to Adeolu *et al.* (2016, PMID 27620848), that are not (yet) in the Catalogue of Life
|
||||
#'
|
||||
#' ## Direct download
|
||||
#' This data set is available as 'flat file' for use even without \R - you can find the file here:
|
||||
#' This data set is available as 'flat file' for use even without \R - you can find the file here: <https://github.com/msberends/AMR/raw/main/data-raw/microorganisms.txt>.
|
||||
#'
|
||||
#' * <https://github.com/msberends/AMR/raw/main/data-raw/microorganisms.txt>
|
||||
#' The file in \R format (with preserved data structure) can be found here: <https://github.com/msberends/AMR/raw/main/data/microorganisms.rda>.
|
||||
#'
|
||||
#' The file in \R format (with preserved data structure) can be found here:
|
||||
#'
|
||||
#' * <https://github.com/msberends/AMR/raw/main/data/microorganisms.rda>
|
||||
#' @section About the Records from LPSN (see *Source*):
|
||||
#' 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.
|
||||
#'
|
||||
@ -138,8 +138,9 @@
|
||||
#'
|
||||
#' * Retrieved from the `r SNOMED_VERSION$title`, OID `r SNOMED_VERSION$current_oid`, version `r SNOMED_VERSION$current_version`; url: <`r SNOMED_VERSION$url`>
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [as.mo()], [mo_property()], [microorganisms.codes], [intrinsic_resistant]
|
||||
#' @examples
|
||||
#' head(microorganisms)
|
||||
"microorganisms"
|
||||
|
||||
#' Data Set with Previously Accepted Taxonomic Names
|
||||
@ -155,8 +156,9 @@
|
||||
#'
|
||||
#' 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}
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [as.mo()] [mo_property()] [microorganisms]
|
||||
#' @examples
|
||||
#' head(microorganisms.old)
|
||||
"microorganisms.old"
|
||||
|
||||
#' Data Set with `r format(nrow(microorganisms.codes), big.mark = ",")` Common Microorganism Codes
|
||||
@ -167,8 +169,9 @@
|
||||
#' - `mo`\cr ID of the microorganism in the [microorganisms] data set
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [as.mo()] [microorganisms]
|
||||
#' @examples
|
||||
#' head(microorganisms.codes)
|
||||
"microorganisms.codes"
|
||||
|
||||
#' Data Set with `r format(nrow(example_isolates), big.mark = ",")` Example Isolates
|
||||
@ -186,7 +189,8 @@
|
||||
#' - `mo`\cr ID of microorganism created with [as.mo()], see also [microorganisms]
|
||||
#' - `PEN:RIF`\cr `r sum(vapply(FUN.VALUE = logical(1), example_isolates, is.rsi))` different antibiotics with class [`rsi`] (see [as.rsi()]); these column names occur in the [antibiotics] data set and can be translated with [ab_name()]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' head(example_isolates)
|
||||
"example_isolates"
|
||||
|
||||
#' Data Set with Unclean Data
|
||||
@ -199,7 +203,8 @@
|
||||
#' - `bacteria`\cr info about microorganism that can be transformed with [as.mo()], see also [microorganisms]
|
||||
#' - `AMX:GEN`\cr 4 different antibiotics that have to be transformed with [as.rsi()]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' head(example_isolates_unclean)
|
||||
"example_isolates_unclean"
|
||||
|
||||
#' Data Set with `r format(nrow(WHONET), big.mark = ",")` Isolates - WHONET Example
|
||||
@ -233,7 +238,8 @@
|
||||
#' - `Date of data entry`\cr [Date] this data was entered in WHONET
|
||||
#' - `AMP_ND10:CIP_EE`\cr `r sum(vapply(FUN.VALUE = logical(1), WHONET, is.rsi))` different antibiotics. You can lookup the abbreviations in the [antibiotics] data set, or use e.g. [`ab_name("AMP")`][ab_name()] to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using [as.rsi()].
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' head(WHONET)
|
||||
"WHONET"
|
||||
|
||||
#' Data Set for R/SI Interpretation
|
||||
@ -251,10 +257,12 @@
|
||||
#' - `breakpoint_S`\cr Lowest MIC value or highest number of millimetres that leads to "S"
|
||||
#' - `breakpoint_R`\cr Highest MIC value or lowest number of millimetres that leads to "R"
|
||||
#' - `uti`\cr A [logical] value (`TRUE`/`FALSE`) to indicate whether the rule applies to a urinary tract infection (UTI)
|
||||
#' @details The repository of this `AMR` package contains a file comprising this exact data set: <https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt>. This file **allows for machine reading EUCAST and CLSI guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the `mo` and `ab` columns have been transformed to contain the full official names instead of codes.
|
||||
#' @details
|
||||
#' The repository of this `AMR` package contains a file comprising this exact data set: <https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt>. This file **allows for machine reading EUCAST and CLSI guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the `mo` and `ab` columns have been transformed to contain the full official names instead of codes.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @seealso [intrinsic_resistant]
|
||||
#' @examples
|
||||
#' head(rsi_translation)
|
||||
"rsi_translation"
|
||||
|
||||
#' Data Set with Bacterial Intrinsic Resistance
|
||||
@ -267,18 +275,8 @@
|
||||
#'
|
||||
#' This data set is based on `r format_eucast_version_nr(3.3)`.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' intrinsic_resistant %>%
|
||||
#' mutate(mo = mo_name(mo),
|
||||
#' ab = ab_name(mo))
|
||||
#' filter(ab == "Vancomycin" & mo %like% "Enterococcus") %>%
|
||||
#' pull(mo)
|
||||
#' #> [1] "Enterococcus casseliflavus" "Enterococcus gallinarum"
|
||||
#' }
|
||||
#' }
|
||||
#' head(intrinsic_resistant)
|
||||
"intrinsic_resistant"
|
||||
|
||||
#' Data Set with Treatment Dosages as Defined by EUCAST
|
||||
@ -296,5 +294,6 @@
|
||||
#' - `eucast_version`\cr Version number of the EUCAST Clinical Breakpoints guideline to which these dosages apply
|
||||
#' @details `r format_eucast_version_nr(11.0)` are based on the dosages in this data set.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' head(dosage)
|
||||
"dosage"
|
||||
|
@ -26,8 +26,6 @@
|
||||
#' Deprecated Functions
|
||||
#'
|
||||
#' These functions are so-called '[Deprecated]'. **They will be removed in a future release.** Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
|
||||
#' @inheritSection lifecycle Retired Lifecycle
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @keywords internal
|
||||
#' @name AMR-deprecated
|
||||
# @export
|
||||
|
24
R/disk.R
24
R/disk.R
@ -26,7 +26,6 @@
|
||||
#' Transform Input to Disk Diffusion Diameters
|
||||
#'
|
||||
#' This transforms a vector to a new class [`disk`], which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @rdname as.disk
|
||||
#' @param x vector
|
||||
#' @param na.rm a [logical] indicating whether missing values should be removed
|
||||
@ -35,27 +34,31 @@
|
||||
#' @aliases disk
|
||||
#' @export
|
||||
#' @seealso [as.rsi()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' # transform existing disk zones to the `disk` class
|
||||
#' df <- data.frame(microorganism = "E. coli",
|
||||
#' # transform existing disk zones to the `disk` class (using base R)
|
||||
#' df <- data.frame(microorganism = "Escherichia coli",
|
||||
#' AMP = 20,
|
||||
#' CIP = 14,
|
||||
#' GEN = 18,
|
||||
#' TOB = 16)
|
||||
#' df[, 2:5] <- lapply(df[, 2:5], as.disk)
|
||||
#' # same with dplyr:
|
||||
#' # df %>% mutate(across(AMP:TOB, as.disk))
|
||||
#' str(df)
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # transforming is easier with dplyr:
|
||||
#' if (require("dplyr")) {
|
||||
#' df %>% mutate(across(AMP:TOB, as.disk))
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' # interpret disk values, see ?as.rsi
|
||||
#' as.rsi(x = as.disk(18),
|
||||
#' mo = "Strep pneu", # `mo` will be coerced with as.mo()
|
||||
#' ab = "ampicillin", # and `ab` with as.ab()
|
||||
#' guideline = "EUCAST")
|
||||
#'
|
||||
#' as.rsi(df)
|
||||
#' }
|
||||
#'
|
||||
#' # interpret whole data set, pretend to be all from urinary tract infections:
|
||||
#' as.rsi(df, uti = TRUE)
|
||||
as.disk <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(x, allow_class = c("disk", "character", "numeric", "integer"), allow_NA = TRUE)
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
@ -65,6 +68,7 @@ as.disk <- function(x, na.rm = FALSE) {
|
||||
if (na.rm == TRUE) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
x[trimws(x) == ""] <- NA
|
||||
x.bak <- x
|
||||
|
||||
na_before <- length(x[is.na(x)])
|
||||
|
37
R/episode.R
37
R/episode.R
@ -26,7 +26,6 @@
|
||||
#' Determine (New) Episodes for Patients
|
||||
#'
|
||||
#' These functions determine which items in a vector can be considered (the start of) a new episode, based on the argument `episode_days`. This can be used to determine clinical episodes for any epidemiological analysis. The [get_episode()] function returns the index number of the episode per group, while the [is_new_episode()] function returns values `TRUE`/`FALSE` to indicate whether an item in a vector is the start of a new episode.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x vector of dates (class `Date` or `POSIXt`), will be sorted internally to determine episodes
|
||||
#' @param episode_days required episode length in days, can also be less than a day or `Inf`, see *Details*
|
||||
#' @param ... ignored, only in place to allow future extensions
|
||||
@ -42,16 +41,16 @@
|
||||
#' @seealso [first_isolate()]
|
||||
#' @rdname get_episode
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#' # See ?example_isolates
|
||||
#' df <- example_isolates[sample(seq_len(2000), size = 200), ]
|
||||
#'
|
||||
#' get_episode(example_isolates$date, episode_days = 60) # indices
|
||||
#' is_new_episode(example_isolates$date, episode_days = 60) # TRUE/FALSE
|
||||
#' get_episode(df$date, episode_days = 60) # indices
|
||||
#' is_new_episode(df$date, episode_days = 60) # TRUE/FALSE
|
||||
#'
|
||||
#' # filter on results from the third 60-day episode only, using base R
|
||||
#' example_isolates[which(get_episode(example_isolates$date, 60) == 3), ]
|
||||
#' df[which(get_episode(df$date, 60) == 3), ]
|
||||
#'
|
||||
#' # the functions also work for less than a day, e.g. to include one per hour:
|
||||
#' get_episode(c(Sys.time(),
|
||||
@ -62,24 +61,24 @@
|
||||
#' if (require("dplyr")) {
|
||||
#' # is_new_episode() can also be used in dplyr verbs to determine patient
|
||||
#' # episodes based on any (combination of) grouping variables:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' mutate(condition = sample(x = c("A", "B", "C"),
|
||||
#' size = 2000,
|
||||
#' replace = TRUE)) %>%
|
||||
#' group_by(condition) %>%
|
||||
#' mutate(new_episode = is_new_episode(date, 365))
|
||||
#' mutate(new_episode = is_new_episode(date, 365)) %>%
|
||||
#' select(patient_id, date, condition, new_episode)
|
||||
#'
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' group_by(hospital_id, patient_id) %>%
|
||||
#' transmute(date,
|
||||
#' patient_id,
|
||||
#' new_index = get_episode(date, 60),
|
||||
#' new_logical = is_new_episode(date, 60))
|
||||
#'
|
||||
#'
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' summarise(patients = n_distinct(patient_id),
|
||||
#' summarise(n_patients = n_distinct(patient_id),
|
||||
#' n_episodes_365 = sum(is_new_episode(date, episode_days = 365)),
|
||||
#' n_episodes_60 = sum(is_new_episode(date, episode_days = 60)),
|
||||
#' n_episodes_30 = sum(is_new_episode(date, episode_days = 30)))
|
||||
@ -87,21 +86,23 @@
|
||||
#'
|
||||
#' # grouping on patients and microorganisms leads to the same
|
||||
#' # results as first_isolate() when using 'episode-based':
|
||||
#' x <- example_isolates %>%
|
||||
#' x <- df %>%
|
||||
#' filter_first_isolate(include_unknown = TRUE,
|
||||
#' method = "episode-based")
|
||||
#'
|
||||
#' y <- example_isolates %>%
|
||||
#' y <- df %>%
|
||||
#' group_by(patient_id, mo) %>%
|
||||
#' filter(is_new_episode(date, 365))
|
||||
#' filter(is_new_episode(date, 365)) %>%
|
||||
#' ungroup()
|
||||
#'
|
||||
#' identical(x$patient_id, y$patient_id)
|
||||
#' identical(x, y)
|
||||
#'
|
||||
#' # but is_new_episode() has a lot more flexibility than first_isolate(),
|
||||
#' # since you can now group on anything that seems relevant:
|
||||
#' example_isolates %>%
|
||||
#' df %>%
|
||||
#' group_by(patient_id, mo, hospital_id, ward_icu) %>%
|
||||
#' mutate(flag_episode = is_new_episode(date, 365))
|
||||
#' mutate(flag_episode = is_new_episode(date, 365)) %>%
|
||||
#' select(group_vars(.), flag_episode)
|
||||
#' }
|
||||
#' }
|
||||
get_episode <- function(x, episode_days, ...) {
|
||||
|
@ -52,7 +52,6 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' 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.
|
||||
#'
|
||||
#' To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see *Details*.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x data with antibiotic columns, such as `amox`, `AMX` and `AMC`
|
||||
#' @param info a [logical] to indicate whether progress should be printed to the console, defaults to only print while in interactive sessions
|
||||
#' @param rules a [character] vector that specifies which rules should be applied. Must be one or more of `"breakpoints"`, `"expert"`, `"other"`, `"custom"`, `"all"`, and defaults to `c("breakpoints", "expert")`. The default value can be set to another value, e.g. using `options(AMR_eucastrules = "all")`. If using `"custom"`, be sure to fill in argument `custom_rules` too. Custom rules can be created with [custom_eucast_rules()].
|
||||
@ -76,11 +75,11 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#'
|
||||
#' Custom rules can be created using [custom_eucast_rules()], e.g.:
|
||||
#'
|
||||
#' ```
|
||||
#' ```{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)
|
||||
#' eucast_rules(example_isolates, rules = "custom", custom_rules = x, info = FALSE)
|
||||
#' ```
|
||||
#'
|
||||
#'
|
||||
@ -113,8 +112,9 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' - EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 9.0, 2019. [(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_9.0_Breakpoint_Tables.xlsx)
|
||||
#' - EUCAST Breakpoint tables for interpretation of MICs and zone diameters. Version 10.0, 2020. [(link)](https://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Breakpoint_tables/v_10.0_Breakpoint_Tables.xlsx)
|
||||
#' - 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
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' a <- data.frame(mo = c("Staphylococcus aureus",
|
||||
@ -131,33 +131,26 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
|
||||
#' FOX = "S", # Cefoxitin
|
||||
#' stringsAsFactors = FALSE)
|
||||
#'
|
||||
#' a
|
||||
#' # mo VAN AMX COL CAZ CXM PEN FOX
|
||||
#' # 1 Staphylococcus aureus - - - - - S S
|
||||
#' # 2 Enterococcus faecalis - - - - - S S
|
||||
#' # 3 Escherichia coli - - - - - S S
|
||||
#' # 4 Klebsiella pneumoniae - - - - - S S
|
||||
#' # 5 Pseudomonas aeruginosa - - - - - S S
|
||||
#' head(a)
|
||||
#'
|
||||
#'
|
||||
#' # apply EUCAST rules: some results wil be changed
|
||||
#' b <- eucast_rules(a)
|
||||
#'
|
||||
#' b
|
||||
#' # mo VAN AMX COL CAZ CXM PEN FOX
|
||||
#' # 1 Staphylococcus aureus - S R R S S S
|
||||
#' # 2 Enterococcus faecalis - - R R R S R
|
||||
#' # 3 Escherichia coli R - - - - R S
|
||||
#' # 4 Klebsiella pneumoniae R R - - - R S
|
||||
#' # 5 Pseudomonas aeruginosa R R - - R R R
|
||||
#' head(b)
|
||||
#'
|
||||
#'
|
||||
#' # do not apply EUCAST rules, but rather get a data.frame
|
||||
#' # containing all details about the transformations:
|
||||
#' c <- eucast_rules(a, verbose = TRUE)
|
||||
#' head(c)
|
||||
#' }
|
||||
#'
|
||||
#' # Dosage guidelines:
|
||||
#'
|
||||
#' eucast_dosage(c("tobra", "genta", "cipro"), "iv")
|
||||
#'
|
||||
#' eucast_dosage(c("tobra", "genta", "cipro"), "iv", version_breakpoints = 10)
|
||||
eucast_rules <- function(x,
|
||||
col_mo = NULL,
|
||||
info = interactive(),
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Determine First Isolates
|
||||
#'
|
||||
#' Determine first isolates of all microorganisms of every patient per episode and (if needed) per specimen type. These functions support all four methods as summarised by Hindler *et al.* in 2007 (\doi{10.1086/511864}). To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [data.frame] containing isolates. Can be left blank for automatic determination, see *Examples*.
|
||||
#' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class
|
||||
#' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive)
|
||||
@ -126,7 +125,6 @@
|
||||
#' - **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/>.
|
||||
#'
|
||||
#' - 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}
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
@ -134,7 +132,7 @@
|
||||
#' example_isolates[first_isolate(), ]
|
||||
#' \donttest{
|
||||
#' # get all first Gram-negatives
|
||||
#' example_isolates[which(first_isolate() & mo_is_gram_negative()), ]
|
||||
#' example_isolates[which(first_isolate(info = FALSE) & mo_is_gram_negative()), ]
|
||||
#'
|
||||
#' if (require("dplyr")) {
|
||||
#' # filter on first isolates using dplyr:
|
||||
@ -143,12 +141,13 @@
|
||||
#'
|
||||
#' # short-hand version:
|
||||
#' example_isolates %>%
|
||||
#' filter_first_isolate()
|
||||
#' filter_first_isolate(info = FALSE)
|
||||
#'
|
||||
#' # grouped determination of first isolates (also prints group names):
|
||||
#' # flag the first isolates per group:
|
||||
#' example_isolates %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' mutate(first = first_isolate())
|
||||
#' mutate(first = first_isolate()) %>%
|
||||
#' select(hospital_id, date, patient_id, mo, first)
|
||||
#'
|
||||
#' # now let's see if first isolates matter:
|
||||
#' A <- example_isolates %>%
|
||||
@ -163,6 +162,9 @@
|
||||
#' resistance = resistance(GEN)) # gentamicin resistance
|
||||
#'
|
||||
#' # Have a look at A and B.
|
||||
#' A
|
||||
#' B
|
||||
#'
|
||||
#' # B is more reliable because every isolate is counted only once.
|
||||
#' # Gentamicin resistance in hospital D appears to be 4.2% higher than
|
||||
#' # when you (erroneously) would have used all isolates for analysis.
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' *G*-test for Count Data
|
||||
#'
|
||||
#' [g.test()] performs chi-squared contingency table tests and goodness-of-fit tests, just like [chisq.test()] but is more reliable (1). A *G*-test can be used to see whether the number of observations in each category fits a theoretical expectation (called a ***G*-test of goodness-of-fit**), or to see whether the proportions of one variable are different for different values of the other variable (called a ***G*-test of independence**).
|
||||
#' @inheritSection lifecycle Questioning Lifecycle
|
||||
#' @inherit stats::chisq.test params return
|
||||
#' @details If `x` is a [matrix] with one row or column, or if `x` is a vector and `y` is not given, then a *goodness-of-fit test* is performed (`x` is treated as a one-dimensional contingency table). The entries of `x` must be non-negative integers. In this case, the hypothesis tested is whether the population probabilities equal those in `p`, or are all equal if `p` is not given.
|
||||
#'
|
||||
@ -76,7 +75,6 @@
|
||||
#' - The possibility to simulate p values with `simulate.p.value` was removed
|
||||
#' @export
|
||||
#' @importFrom stats pchisq complete.cases
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # = EXAMPLE 1 =
|
||||
#' # Shivrain et al. (2006) crossed clearfield rice (which are resistant
|
||||
@ -88,8 +86,7 @@
|
||||
#' # ratio.
|
||||
#'
|
||||
#' x <- c(772, 1611, 737)
|
||||
#' G <- g.test(x, p = c(1, 2, 1) / 4)
|
||||
#' # G$p.value = 0.12574.
|
||||
#' g.test(x, p = c(1, 2, 1) / 4)
|
||||
#'
|
||||
#' # There is no significant difference from a 1:2:1 ratio.
|
||||
#' # Meaning: resistance controlled by a single gene with two co-dominant
|
||||
@ -105,11 +102,9 @@
|
||||
#'
|
||||
#' x <- c(1752, 1895)
|
||||
#' g.test(x)
|
||||
#' # p = 0.01787343
|
||||
#'
|
||||
#' # There is a significant difference from a 1:1 ratio.
|
||||
#' # Meaning: there are significantly more left-billed birds.
|
||||
#'
|
||||
g.test <- function(x,
|
||||
y = NULL,
|
||||
# correct = TRUE,
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' PCA Biplot with `ggplot2`
|
||||
#'
|
||||
#' Produces a `ggplot2` variant of a so-called [biplot](https://en.wikipedia.org/wiki/Biplot) for PCA (principal component analysis), but is more flexible and more appealing than the base \R [biplot()] function.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x an object returned by [pca()], [prcomp()] or [princomp()]
|
||||
#' @inheritParams stats::biplot.prcomp
|
||||
#' @param labels an optional vector of labels for the observations. If set, the labels will be placed below their respective points. When using the [pca()] function as input for `x`, this will be determined automatically based on the attribute `non_numeric_cols`, see [pca()].
|
||||
@ -64,23 +63,28 @@
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
#'
|
||||
#' # See ?pca for more info about Principal Component Analysis (PCA).
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' pca_model <- example_isolates %>%
|
||||
#' filter(mo_genus(mo) == "Staphylococcus") %>%
|
||||
#' group_by(species = mo_shortname(mo)) %>%
|
||||
#' summarise_if (is.rsi, resistance) %>%
|
||||
#' pca(FLC, AMC, CXM, GEN, TOB, TMP, SXT, CIP, TEC, TCY, ERY)
|
||||
#' # calculate the resistance per group first
|
||||
#' resistance_data <- example_isolates %>%
|
||||
#' group_by(order = mo_order(mo), # group on anything, like order
|
||||
#' genus = mo_genus(mo)) %>% # and genus as we do here;
|
||||
#' filter(n() >= 30) %>% # filter on only 30 results per group
|
||||
#' summarise_if(is.rsi, resistance) # then get resistance of all drugs
|
||||
#'
|
||||
#' # old (base R)
|
||||
#' biplot(pca_model)
|
||||
#' # now conduct PCA for certain antimicrobial agents
|
||||
#' pca_result <- resistance_data %>%
|
||||
#' pca(AMC, CXM, CTX, CAZ, GEN, TOB, TMP, SXT)
|
||||
#'
|
||||
#' summary(pca_result)
|
||||
#'
|
||||
#' # new
|
||||
#' ggplot_pca(pca_model)
|
||||
#' # 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_model) +
|
||||
#' ggplot_pca(pca_result) +
|
||||
#' scale_colour_viridis_d() +
|
||||
#' labs(title = "Title here")
|
||||
#' }
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' AMR Plots with `ggplot2`
|
||||
#'
|
||||
#' Use these functions to create bar plots for AMR data analysis. All functions rely on [ggplot2][ggplot2::ggplot()] functions.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param data a [data.frame] with column(s) of class [`rsi`] (see [as.rsi()])
|
||||
#' @param position position adjustment of bars, either `"fill"`, `"stack"` or `"dodge"`
|
||||
#' @param x variable to show on x axis, either `"antibiotic"` (default) or `"interpretation"` or a grouping variable
|
||||
@ -65,7 +64,6 @@
|
||||
#' [ggplot_rsi()] is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (`%>%`). See *Examples*.
|
||||
#' @rdname ggplot_rsi
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' if (require("ggplot2") & require("dplyr")) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Guess Antibiotic Column
|
||||
#'
|
||||
#' This tries to find a column name in a data set based on information from the [antibiotics] data set. Also supports WHONET abbreviations.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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
|
||||
@ -34,7 +33,6 @@
|
||||
#' @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. **Longer columns names take precedence over shorter column names.**
|
||||
#' @return A column name of `x`, or `NULL` when no result is found.
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' df <- data.frame(amox = "S",
|
||||
#' tetr = "R")
|
||||
|
@ -25,8 +25,7 @@
|
||||
|
||||
#' Italicise Taxonomic Families, Genera, Species, Subspecies
|
||||
#'
|
||||
#' According to the binomial nomenclature, the lowest four taxonomic levels (family, genus, species, subspecies) should be printed in italic. This function finds taxonomic names within strings and makes them italic.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' According to the binomial nomenclature, the lowest four taxonomic levels (family, genus, species, subspecies) should be printed in italics. This function finds taxonomic names within strings and makes them italic.
|
||||
#' @param string a [character] (vector)
|
||||
#' @param type type of conversion of the taxonomic names, either "markdown" or "ansi", see *Details*
|
||||
#' @details
|
||||
@ -35,23 +34,12 @@
|
||||
#' The taxonomic names can be italicised using markdown (the default) by adding `*` before and after the taxonomic names, or using ANSI colours by adding `\033[3m` before and `\033[23m` after the taxonomic names. If multiple ANSI colours are not available, no conversion will occur.
|
||||
#'
|
||||
#' This function also supports abbreviation of the genus if it is followed by a species, such as "E. coli" and "K. pneumoniae ozaenae".
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' italicise_taxonomy("An overview of Staphylococcus aureus isolates")
|
||||
#' italicise_taxonomy("An overview of S. aureus isolates")
|
||||
#'
|
||||
#' cat(italicise_taxonomy("An overview of S. aureus isolates", type = "ansi"))
|
||||
#'
|
||||
#' # since ggplot2 supports no markdown (yet), use
|
||||
#' # italicise_taxonomy() and the `ggtext` package for titles:
|
||||
#' \donttest{
|
||||
#' if (require("ggplot2") && require("ggtext")) {
|
||||
#' autoplot(example_isolates$AMC,
|
||||
#' title = italicise_taxonomy("Amoxi/clav in E. coli")) +
|
||||
#' theme(plot.title = ggtext::element_markdown())
|
||||
#' }
|
||||
#' }
|
||||
italicise_taxonomy <- function(string, type = c("markdown", "ansi")) {
|
||||
if (missing(type)) {
|
||||
type <- "markdown"
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Join [microorganisms] to a Data Set
|
||||
#'
|
||||
#' Join the data set [microorganisms] easily to an existing data set or to a [character] vector.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @rdname join
|
||||
#' @name join
|
||||
#' @aliases join inner_join
|
||||
@ -37,7 +36,6 @@
|
||||
#' @details **Note:** As opposed to the `join()` functions of `dplyr`, [character] vectors are supported and at default existing columns will get a suffix `"2"` and the newly joined columns will not get a suffix.
|
||||
#'
|
||||
#' If the `dplyr` package is installed, their join functions will be used. Otherwise, the much slower [merge()] and [interaction()] functions from base \R will be used.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @return a [data.frame]
|
||||
#' @export
|
||||
#' @examples
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' (Key) Antimicrobials for First Weighted Isolates
|
||||
#'
|
||||
#' These functions can be used to determine first weighted isolates by considering the phenotype for isolate selection (see [first_isolate()]). Using a phenotype-based method to determine first isolates is more reliable than methods that disregard phenotypes.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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
|
||||
@ -82,7 +81,6 @@
|
||||
#' @rdname key_antimicrobials
|
||||
#' @export
|
||||
#' @seealso [first_isolate()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
@ -110,7 +108,7 @@
|
||||
#' first_weighted = first_isolate(col_keyantimicrobials = "keyab")
|
||||
#' )
|
||||
#'
|
||||
#' # Check the difference, in this data set it results in more isolates:
|
||||
#' # Check the difference in this data set, 'weighted' results in more isolates:
|
||||
#' sum(my_patients$first_regular, na.rm = TRUE)
|
||||
#' sum(my_patients$first_weighted, na.rm = TRUE)
|
||||
#' }
|
||||
|
@ -26,14 +26,15 @@
|
||||
#' Kurtosis of the Sample
|
||||
#'
|
||||
#' @description Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. A normal distribution has a kurtosis of 3 and a excess kurtosis of 0.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a vector of values, a [matrix] or a [data.frame]
|
||||
#' @param na.rm a [logical] to indicate whether `NA` values should be stripped before the computation proceeds
|
||||
#' @param excess a [logical] to indicate whether the *excess kurtosis* should be returned, defined as the kurtosis minus 3.
|
||||
#' @seealso [skewness()]
|
||||
#' @rdname kurtosis
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' kurtosis(rnorm(10000))
|
||||
#' kurtosis(rnorm(10000), excess = TRUE)
|
||||
kurtosis <- 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)
|
||||
|
@ -1,54 +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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
###############
|
||||
# NOTE TO SELF: could also have done this with the 'lifecycle' package, but why add a package dependency for such an easy job??
|
||||
###############
|
||||
|
||||
#' Lifecycles of Functions in the `AMR` Package
|
||||
#' @name lifecycle
|
||||
#' @rdname lifecycle
|
||||
#' @description Functions in this `AMR` package are categorised using [the lifecycle circle of the Tidyverse as found on www.tidyverse.org/lifecycle](https://lifecycle.r-lib.org/articles/stages.html).
|
||||
#'
|
||||
#' \if{html}{\figure{lifecycle_tidyverse.svg}{options: height="200" style=margin-bottom:"5"} \cr}
|
||||
#' This page contains a section for every lifecycle (with text borrowed from the aforementioned Tidyverse website), so they can be used in the manual pages of the functions.
|
||||
#' @section Experimental Lifecycle:
|
||||
#' \if{html}{\figure{lifecycle_experimental.svg}{options: style=margin-bottom:"5"} \cr}
|
||||
#' The [lifecycle][AMR::lifecycle] of this function is **experimental**. An experimental function is in early stages of development. The unlying code might be changing frequently. Experimental functions might be removed without deprecation, so you are generally best off waiting until a function is more mature before you use it in production code. Experimental functions are only available in development versions of this `AMR` package and will thus not be included in releases that are submitted to CRAN, since such functions have not yet matured enough.
|
||||
#' @section Maturing Lifecycle:
|
||||
#' \if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:"5"} \cr}
|
||||
#' The [lifecycle][AMR::lifecycle] of this function is **maturing**. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome [to suggest changes at our repository](https://github.com/msberends/AMR/issues) or [write us an email (see section 'Contact Us')][AMR::AMR].
|
||||
#' @section Stable Lifecycle:
|
||||
#' \if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:"5"} \cr}
|
||||
#' The [lifecycle][AMR::lifecycle] of this function is **stable**. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
|
||||
#'
|
||||
#' If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit a message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
|
||||
#' @section Retired Lifecycle:
|
||||
#' \if{html}{\figure{lifecycle_retired.svg}{options: style=margin-bottom:"5"} \cr}
|
||||
#' The [lifecycle][AMR::lifecycle] of this function is **retired**. A retired function is no longer under active development, and (if appropiate) a better alternative is available. No new arguments will be added, and only the most critical bugs will be fixed. In a future version, this function will be removed.
|
||||
#' @section Questioning Lifecycle:
|
||||
#' \if{html}{\figure{lifecycle_questioning.svg}{options: style=margin-bottom:"5"} \cr}
|
||||
#' The [lifecycle][AMR::lifecycle] of this function is **questioning**. This function might be no longer be optimal approach, or is it questionable whether this function should be in this `AMR` package at all.
|
||||
NULL
|
9
R/like.R
9
R/like.R
@ -26,7 +26,6 @@
|
||||
#' Vectorised Pattern Matching with Keyboard Shortcut
|
||||
#'
|
||||
#' Convenient wrapper around [grepl()] to match a pattern: `x %like% pattern`. It always returns a [`logical`] vector and is always case-insensitive (use `x %like_case% pattern` for case-sensitive matching). Also, `pattern` can be as long as `x` to compare items of each index in both vectors, or they both can have the same length to iterate over all cases.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [character] vector where matches are sought, or an object which can be coerced by [as.character()] to a [character] vector.
|
||||
#' @param pattern a [character] vector containing regular expressions (or a [character] string for `fixed = TRUE`) to be matched in the given [character] vector. Coerced by [as.character()] to a [character] string if possible.
|
||||
#' @param ignore.case if `FALSE`, the pattern matching is *case sensitive* and if `TRUE`, case is ignored during matching.
|
||||
@ -44,27 +43,21 @@
|
||||
#' Using RStudio? The `%like%`/`%unlike%` functions can also be directly inserted in your code from the Addins menu and can have its own keyboard shortcut like `Shift+Ctrl+L` or `Shift+Cmd+L` (see menu `Tools` > `Modify Keyboard Shortcuts...`). If you keep pressing your shortcut, the inserted text will be iterated over `%like%` -> `%unlike%` -> `%like_case%` -> `%unlike_case%`.
|
||||
#' @source Idea from the [`like` function from the `data.table` package](https://github.com/Rdatatable/data.table/blob/ec1259af1bf13fc0c96a1d3f9e84d55d8106a9a4/R/like.R), although altered as explained in *Details*.
|
||||
#' @seealso [grepl()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @examples
|
||||
#' a <- "This is a test"
|
||||
#' b <- "TEST"
|
||||
#' a %like% b
|
||||
#' #> TRUE
|
||||
#' b %like% a
|
||||
#' #> FALSE
|
||||
#'
|
||||
#' # also supports multiple patterns
|
||||
#' a <- c("Test case", "Something different", "Yet another thing")
|
||||
#' b <- c( "case", "diff", "yet")
|
||||
#' a %like% b
|
||||
#' #> TRUE TRUE TRUE
|
||||
#' a %unlike% b
|
||||
#' #> FALSE FALSE FALSE
|
||||
#'
|
||||
#' a[1] %like% b
|
||||
#' #> TRUE FALSE FALSE
|
||||
#' a %like% b[1]
|
||||
#' #> TRUE FALSE FALSE
|
||||
#'
|
||||
#' # get isolates whose name start with 'Ent' or 'ent'
|
||||
#' example_isolates[which(mo_name(example_isolates$mo) %like% "^ent"), ]
|
||||
|
27
R/mdro.R
27
R/mdro.R
@ -26,7 +26,6 @@
|
||||
#' Determine Multidrug-Resistant Organisms (MDRO)
|
||||
#'
|
||||
#' Determine which isolates are multidrug-resistant organisms (MDRO) according to international, national and custom guidelines.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [data.frame] with antibiotics columns, like `AMX` or `amox`. Can be left blank for automatic determination.
|
||||
#' @param guideline a specific guideline to follow, see sections *Supported international / national guidelines* and *Using Custom Guidelines* below. When left empty, the publication by Magiorakos *et al.* (see below) will be followed.
|
||||
#' @param ... in case of [custom_mdro_guideline()]: a set of rules, see section *Using Custom Guidelines* below. Otherwise: column name of an antibiotic, see section *Antibiotics* below.
|
||||
@ -137,15 +136,17 @@
|
||||
#' @rdname mdro
|
||||
#' @aliases MDR XDR PDR BRMO 3MRGN 4MRGN
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @source
|
||||
#' See the supported guidelines above for the [list] of publications used for this function.
|
||||
#' @examples
|
||||
#' mdro(example_isolates, guideline = "EUCAST")
|
||||
#' out <- mdro(example_isolates, guideline = "EUCAST")
|
||||
#' str(out)
|
||||
#' table(out)
|
||||
#'
|
||||
#' mdro(example_isolates,
|
||||
#' guideline = custom_mdro_guideline(AMX == "R" ~ "Custom MDRO 1",
|
||||
#' VAN == "R" ~ "Custom MDRO 2"))
|
||||
#' out <- mdro(example_isolates,
|
||||
#' guideline = custom_mdro_guideline(AMX == "R" ~ "Custom MDRO 1",
|
||||
#' VAN == "R" ~ "Custom MDRO 2"))
|
||||
#' table(out)
|
||||
#'
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
@ -155,10 +156,10 @@
|
||||
#'
|
||||
#' # no need to define `x` when used inside dplyr verbs:
|
||||
#' example_isolates %>%
|
||||
#' mutate(MDRO = mdro(),
|
||||
#' EUCAST = eucast_exceptional_phenotypes(),
|
||||
#' BRMO = brmo(),
|
||||
#' MRGN = mrgn())
|
||||
#' mutate(MDRO = mdro()) %>%
|
||||
#' pull(MDRO) %>%
|
||||
#' table()
|
||||
#'
|
||||
#' }
|
||||
#' }
|
||||
mdro <- function(x = NULL,
|
||||
@ -191,8 +192,10 @@ mdro <- function(x = NULL,
|
||||
|
||||
info.bak <- info
|
||||
# don't thrown info's more than once per call
|
||||
info <- message_not_thrown_before("mdro")
|
||||
|
||||
if (isTRUE(info)) {
|
||||
info <- message_not_thrown_before("mdro")
|
||||
}
|
||||
|
||||
if (interactive() & verbose == TRUE & info == TRUE) {
|
||||
txt <- paste0("WARNING: In Verbose mode, the mdro() function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.",
|
||||
"\n\nThis may overwrite your existing data if you use e.g.:",
|
||||
|
45
R/mic.R
45
R/mic.R
@ -43,11 +43,11 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
|
||||
#' Transform Input to Minimum Inhibitory Concentrations (MIC)
|
||||
#'
|
||||
#' This transforms vectors to a new class [`mic`], which treats the input as decimal numbers, while maintaining operators (such as ">=") and only allowing valid MIC values known to the field of (medical) microbiology.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @rdname as.mic
|
||||
#' @param x a [character] or [numeric] vector
|
||||
#' @param na.rm a [logical] indicating whether missing values should be removed
|
||||
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST and CLSI.
|
||||
#' @param ... arguments passed on to methods
|
||||
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from 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)))`).
|
||||
#'
|
||||
#' This class for MIC values is a quite a special data type: formally it is an ordered [factor] with valid MIC values as [factor] levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
|
||||
#'
|
||||
@ -86,36 +86,43 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
|
||||
#' ```
|
||||
#'
|
||||
#' The following [generic functions][groupGeneric()] are implemented for the MIC class: `!`, `!=`, `%%`, `%/%`, `&`, `*`, `+`, `-`, `/`, `<`, `<=`, `==`, `>`, `>=`, `^`, `|`, [abs()], [acos()], [acosh()], [all()], [any()], [asin()], [asinh()], [atan()], [atanh()], [ceiling()], [cos()], [cosh()], [cospi()], [cummax()], [cummin()], [cumprod()], [cumsum()], [digamma()], [exp()], [expm1()], [floor()], [gamma()], [lgamma()], [log()], [log1p()], [log2()], [log10()], [max()], [mean()], [min()], [prod()], [range()], [round()], [sign()], [signif()], [sin()], [sinh()], [sinpi()], [sqrt()], [sum()], [tan()], [tanh()], [tanpi()], [trigamma()] and [trunc()]. Some functions of the `stats` package are also implemented: [median()], [quantile()], [mad()], [IQR()], [fivenum()]. Also, [boxplot.stats()] is supported. Since [sd()] and [var()] are non-generic functions, these could not be extended. Use [mad()] as an alternative, or use e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
|
||||
#'
|
||||
#' Using [as.double()] or [as.numeric()] on MIC values will remove the operators and return a numeric vector. Do **not** use [as.integer()] on MIC values as by the \R convention on [factor]s, it will return the index of the factor levels (which is often useless for regular users).
|
||||
#'
|
||||
#' Use [droplevels()] to drop unused levels. At default, it will return a plain factor. Use `droplevels(..., as.mic = TRUE)` to maintain the `<mic>` class.
|
||||
#' @return Ordered [factor] with additional class [`mic`], that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a [numeric] value.
|
||||
#' @aliases mic
|
||||
#' @export
|
||||
#' @seealso [as.rsi()]
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
||||
#' mic_data
|
||||
#' is.mic(mic_data)
|
||||
#'
|
||||
#' # this can also coerce combined MIC/RSI values:
|
||||
#' as.mic("<=0.002; S") # will return <=0.002
|
||||
#' as.mic("<=0.002; S")
|
||||
#'
|
||||
#' # mathematical processing treats MICs as [numeric] values
|
||||
#' # mathematical processing treats MICs as numeric values
|
||||
#' fivenum(mic_data)
|
||||
#' quantile(mic_data)
|
||||
#' all(mic_data < 512)
|
||||
#'
|
||||
#' # interpret MIC values
|
||||
#' as.rsi(x = as.mic(2),
|
||||
#' mo = as.mo("S. pneumoniae"),
|
||||
#' mo = as.mo("Streptococcus pneumoniae"),
|
||||
#' ab = "AMX",
|
||||
#' guideline = "EUCAST")
|
||||
#' as.rsi(x = as.mic(4),
|
||||
#' mo = as.mo("S. pneumoniae"),
|
||||
#' as.rsi(x = as.mic(c(0.01, 2, 4, 8)),
|
||||
#' mo = as.mo("Streptococcus pneumoniae"),
|
||||
#' ab = "AMX",
|
||||
#' guideline = "EUCAST")
|
||||
#'
|
||||
#' # plot MIC values, see ?plot
|
||||
#' plot(mic_data)
|
||||
#' plot(mic_data, mo = "E. coli", ab = "cipro")
|
||||
#' autoplot(mic_data, mo = "E. coli", ab = "cipro")
|
||||
#' autoplot(mic_data, mo = "E. coli", ab = "cipro", language = "nl") # Dutch
|
||||
#' autoplot(mic_data, mo = "E. coli", ab = "cipro", language = "uk") # Ukrainian
|
||||
as.mic <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(x, allow_class = c("mic", "character", "numeric", "integer", "factor"), allow_NA = TRUE)
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
@ -127,6 +134,7 @@ as.mic <- function(x, na.rm = FALSE) {
|
||||
if (na.rm == TRUE) {
|
||||
x <- x[!is.na(x)]
|
||||
}
|
||||
x[trimws(x) == ""] <- NA
|
||||
x.bak <- x
|
||||
|
||||
# comma to period
|
||||
@ -196,7 +204,8 @@ all_valid_mics <- function(x) {
|
||||
}
|
||||
|
||||
#' @rdname as.mic
|
||||
#' @details `NA_mic_` is a missing value of the new `<mic>` class.
|
||||
#' @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),
|
||||
new_class = c("mic", "ordered", "factor"))
|
||||
@ -214,13 +223,6 @@ as.double.mic <- function(x, ...) {
|
||||
as.double(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @method as.integer mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
as.integer.mic <- function(x, ...) {
|
||||
as.integer(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @method as.numeric mic
|
||||
#' @export
|
||||
#' @noRd
|
||||
@ -228,11 +230,12 @@ as.numeric.mic <- function(x, ...) {
|
||||
as.numeric(gsub("[<=>]+", "", as.character(x), perl = TRUE))
|
||||
}
|
||||
|
||||
#' @rdname as.mic
|
||||
#' @method droplevels mic
|
||||
#' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE`
|
||||
#' @export
|
||||
#' @noRd
|
||||
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = TRUE, ...) {
|
||||
x <- droplevels.factor(x, exclude = exclude, ...)
|
||||
droplevels.mic <- function(x, as.mic = FALSE, ...) {
|
||||
x <- droplevels.factor(x, ...)
|
||||
if (as.mic == TRUE) {
|
||||
class(x) <- c("mic", "ordered", "factor")
|
||||
}
|
||||
@ -260,7 +263,9 @@ type_sum.mic <- function(x, ...) {
|
||||
#' @export
|
||||
#' @noRd
|
||||
print.mic <- function(x, ...) {
|
||||
cat("Class <mic>\n")
|
||||
cat("Class <mic>",
|
||||
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""),
|
||||
"\n", sep = "")
|
||||
print(as.character(x), quote = FALSE)
|
||||
att <- attributes(x)
|
||||
if ("na.action" %in% names(att)) {
|
||||
|
357
R/mo.R
357
R/mo.R
@ -26,7 +26,6 @@
|
||||
#' Transform Input to a Microorganism Code
|
||||
#'
|
||||
#' Use this function to determine a valid microorganism code ([`mo`]). Determination is done using intelligent rules and the complete taxonomic kingdoms Bacteria, Chromista, Protozoa, Archaea and most microbial species from the kingdom Fungi (see *Source*). The input can be almost anything: a full name (like `"Staphylococcus aureus"`), an abbreviated name (such as `"S. aureus"`), an abbreviation known in the field (such as `"MRSA"`), or just a genus. See *Examples*.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [character] vector or a [data.frame] with one or two columns
|
||||
#' @param Becker a [logical] to indicate whether staphylococci should be categorised into coagulase-negative staphylococci ("CoNS") and coagulase-positive staphylococci ("CoPS") instead of their own species, according to Karsten Becker *et al.* (1,2,3).
|
||||
#'
|
||||
@ -116,7 +115,6 @@
|
||||
#'
|
||||
#' The [`mo_*`][mo_property()] functions (such as [mo_genus()], [mo_gramstain()]) to get properties based on the returned code.
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' # These examples all return "B_STPHY_AURS", the ID of S. aureus:
|
||||
@ -174,7 +172,7 @@ as.mo <- function(x,
|
||||
meet_criteria(info, allow_class = "logical", has_length = 1)
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
|
||||
if (tryCatch(all(x[!is.na(x)] %in% MO_lookup$mo)
|
||||
& isFALSE(Becker)
|
||||
& isFALSE(Lancefield), error = function(e) FALSE)) {
|
||||
@ -182,19 +180,19 @@ as.mo <- function(x,
|
||||
# is.mo() won't work - MO codes might change between package versions
|
||||
return(set_clean_class(x, new_class = c("mo", "character")))
|
||||
}
|
||||
|
||||
|
||||
# start off with replaced language-specific non-ASCII characters with ASCII characters
|
||||
x <- parse_and_convert(x)
|
||||
# replace mo codes used in older package versions
|
||||
x <- replace_old_mo_codes(x, property = "mo")
|
||||
# ignore cases that match the ignore pattern
|
||||
x <- replace_ignore_pattern(x, ignore_pattern)
|
||||
|
||||
|
||||
# WHONET: xxx = no growth
|
||||
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
|
||||
# Laboratory systems: remove (translated) entries like "no growth", etc.
|
||||
x[trimws2(x) %like% translate_AMR("no .*growth", language = language)] <- NA_character_
|
||||
x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
|
||||
x[trimws2(x) %like% translate_into_language("no .*growth", language = language)] <- NA_character_
|
||||
x[trimws2(x) %like% paste0("^(", translate_into_language("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
|
||||
uncertainty_level <- translate_allow_uncertain(allow_uncertain)
|
||||
|
||||
if (tryCatch(all(x == "" | gsub(".*(unknown ).*", "unknown name", tolower(x), perl = TRUE) %in% MO_lookup$fullname_lower, na.rm = TRUE)
|
||||
@ -204,25 +202,25 @@ as.mo <- function(x,
|
||||
return(set_clean_class(MO_lookup[match(gsub(".*(unknown ).*", "unknown name", tolower(x), perl = TRUE), MO_lookup$fullname_lower), "mo", drop = TRUE],
|
||||
new_class = c("mo", "character")))
|
||||
}
|
||||
|
||||
|
||||
if (!is.null(reference_df)
|
||||
&& check_validity_mo_source(reference_df)
|
||||
&& isFALSE(Becker)
|
||||
&& isFALSE(Lancefield)
|
||||
&& all(x %in% unlist(reference_df), na.rm = TRUE)) {
|
||||
|
||||
|
||||
reference_df <- repair_reference_df(reference_df)
|
||||
suppressWarnings(
|
||||
y <- data.frame(x = x, stringsAsFactors = FALSE) %pm>%
|
||||
pm_left_join(reference_df, by = "x") %pm>%
|
||||
pm_pull(mo)
|
||||
)
|
||||
|
||||
|
||||
} else if (all(x[!is.na(x)] %in% MO_lookup$mo)
|
||||
& isFALSE(Becker)
|
||||
& isFALSE(Lancefield)) {
|
||||
y <- x
|
||||
|
||||
|
||||
} else {
|
||||
# will be checked for mo class in validation and uses exec_as.mo internally if necessary
|
||||
y <- mo_validate(x = x, property = "mo",
|
||||
@ -282,7 +280,7 @@ exec_as.mo <- function(x,
|
||||
meet_criteria(actual_uncertainty, allow_class = "numeric", has_length = 1)
|
||||
meet_criteria(actual_input, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
if (isTRUE(debug) && initial_search == TRUE) {
|
||||
@ -297,13 +295,13 @@ exec_as.mo <- function(x,
|
||||
initial = initial_search,
|
||||
uncertainty = actual_uncertainty,
|
||||
input_actual = actual_input) {
|
||||
|
||||
|
||||
if (!is.null(input_actual)) {
|
||||
input <- input_actual
|
||||
} else {
|
||||
input <- tryCatch(x_backup[i], error = function(e) "")
|
||||
}
|
||||
|
||||
|
||||
# `column` can be NULL for all columns, or a selection
|
||||
# returns a [character] (vector) - if `column` > length 1 then with columns as names
|
||||
if (isTRUE(debug_mode)) {
|
||||
@ -360,19 +358,19 @@ exec_as.mo <- function(x,
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# start off with replaced language-specific non-ASCII characters with ASCII characters
|
||||
x <- parse_and_convert(x)
|
||||
# replace mo codes used in older package versions
|
||||
x <- replace_old_mo_codes(x, property)
|
||||
# ignore cases that match the ignore pattern
|
||||
x <- replace_ignore_pattern(x, ignore_pattern)
|
||||
|
||||
|
||||
# WHONET: xxx = no growth
|
||||
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
|
||||
# Laboratory systems: remove (translated) entries like "no growth", etc.
|
||||
x[trimws2(x) %like% translate_AMR("no .*growth", language = language)] <- NA_character_
|
||||
x[trimws2(x) %like% paste0("^(", translate_AMR("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
|
||||
x[trimws2(x) %like% translate_into_language("no .*growth", language = language)] <- NA_character_
|
||||
x[trimws2(x) %like% paste0("^(", translate_into_language("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
|
||||
|
||||
if (initial_search == TRUE) {
|
||||
# keep track of time - give some hints to improve speed if it takes a long time
|
||||
@ -383,7 +381,7 @@ exec_as.mo <- function(x,
|
||||
pkg_env$mo_renamed <- NULL
|
||||
}
|
||||
pkg_env$mo_renamed_last_run <- NULL
|
||||
|
||||
|
||||
failures <- character(0)
|
||||
uncertainty_level <- translate_allow_uncertain(allow_uncertain)
|
||||
uncertainties <- data.frame(uncertainty = integer(0),
|
||||
@ -393,7 +391,7 @@ exec_as.mo <- function(x,
|
||||
mo = character(0),
|
||||
candidates = character(0),
|
||||
stringsAsFactors = FALSE)
|
||||
|
||||
|
||||
x_input <- x
|
||||
# already strip leading and trailing spaces
|
||||
x <- trimws(x)
|
||||
@ -405,7 +403,7 @@ exec_as.mo <- function(x,
|
||||
& !is.null(x)
|
||||
& !identical(x, "")
|
||||
& !identical(x, "xxx")]
|
||||
|
||||
|
||||
# defined df to check for
|
||||
if (!is.null(reference_df)) {
|
||||
check_validity_mo_source(reference_df)
|
||||
@ -420,27 +418,27 @@ exec_as.mo <- function(x,
|
||||
} else {
|
||||
return(rep(NA_character_, length(x_input)))
|
||||
}
|
||||
|
||||
|
||||
} else if (all(x %in% reference_df[, 1][[1]])) {
|
||||
# all in reference df
|
||||
colnames(reference_df)[1] <- "x"
|
||||
suppressWarnings(
|
||||
x <- MO_lookup[match(reference_df[match(x, reference_df$x), "mo", drop = TRUE], MO_lookup$mo), property, drop = TRUE]
|
||||
)
|
||||
|
||||
|
||||
} else if (all(x %in% reference_data_to_use$mo)) {
|
||||
x <- MO_lookup[match(x, MO_lookup$mo), property, drop = TRUE]
|
||||
|
||||
|
||||
} else if (all(tolower(x) %in% reference_data_to_use$fullname_lower)) {
|
||||
# we need special treatment for very prevalent full names, they are likely!
|
||||
# e.g. as.mo("Staphylococcus aureus")
|
||||
x <- MO_lookup[match(tolower(x), MO_lookup$fullname_lower), property, drop = TRUE]
|
||||
|
||||
|
||||
} else if (all(x %in% reference_data_to_use$fullname)) {
|
||||
# we need special treatment for very prevalent full names, they are likely!
|
||||
# e.g. as.mo("Staphylococcus aureus")
|
||||
x <- MO_lookup[match(x, MO_lookup$fullname), property, drop = TRUE]
|
||||
|
||||
|
||||
} else if (all(toupper(x) %in% microorganisms.codes$code)) {
|
||||
# commonly used MO codes
|
||||
x <- MO_lookup[match(microorganisms.codes[match(toupper(x),
|
||||
@ -450,9 +448,9 @@ exec_as.mo <- function(x,
|
||||
MO_lookup$mo),
|
||||
property,
|
||||
drop = TRUE]
|
||||
|
||||
|
||||
} else if (!all(x %in% microorganisms[, property])) {
|
||||
|
||||
|
||||
strip_whitespace <- function(x, dyslexia_mode) {
|
||||
# all whitespaces (tab, new lines, etc.) should be one space
|
||||
# and spaces before and after should be left blank
|
||||
@ -465,7 +463,7 @@ exec_as.mo <- function(x,
|
||||
}
|
||||
trimmed
|
||||
}
|
||||
|
||||
|
||||
x_backup_untouched <- x
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
# translate 'unknown' names back to English
|
||||
@ -514,7 +512,7 @@ exec_as.mo <- function(x,
|
||||
|
||||
# when ending in SPE instead of SPP and preceded by 2-4 characters
|
||||
x <- gsub("^([a-z]{2,4})(spe.?)$", "\\1", x, perl = TRUE)
|
||||
|
||||
|
||||
x_backup_without_spp <- x
|
||||
# translate to English for supported languages of mo_property
|
||||
x <- gsub("(gruppe|groep|grupo|gruppo|groupe)", "group", x, perl = TRUE)
|
||||
@ -1222,7 +1220,7 @@ exec_as.mo <- function(x,
|
||||
cat(font_bold("\n[ UNCERTAINTY LEVEL", now_checks_for_uncertainty_level, "] (6) remove non-taxonomic prefix and suffix\n"))
|
||||
}
|
||||
x_without_nontax <- gsub("(^[a-zA-Z]+[./-]+[a-zA-Z]+[^a-zA-Z]* )([a-zA-Z.]+ [a-zA-Z]+.*)",
|
||||
"\\2", a.x_backup, perl = TRUE)
|
||||
"\\2", a.x_backup, perl = TRUE)
|
||||
x_without_nontax <- gsub("( *[(].*[)] *)[^a-zA-Z]*$", "", x_without_nontax, perl = TRUE)
|
||||
if (isTRUE(debug)) {
|
||||
message("Running '", x_without_nontax, "'")
|
||||
@ -1572,15 +1570,15 @@ exec_as.mo <- function(x,
|
||||
# 'MO_CONS' and 'MO_COPS' are <mo> vectors created in R/zzz.R
|
||||
CoNS <- MO_lookup[which(MO_lookup$mo %in% MO_CONS), property, drop = TRUE]
|
||||
x[x %in% CoNS] <- lookup(mo == "B_STPHY_CONS", uncertainty = -1)
|
||||
|
||||
|
||||
CoPS <- MO_lookup[which(MO_lookup$mo %in% MO_COPS), property, drop = TRUE]
|
||||
x[x %in% CoPS] <- lookup(mo == "B_STPHY_COPS", uncertainty = -1)
|
||||
|
||||
|
||||
if (Becker == "all") {
|
||||
x[x %in% lookup(fullname %like_case% "^Staphylococcus aureus", n = Inf)] <- lookup(mo == "B_STPHY_COPS", uncertainty = -1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Lancefield ----
|
||||
if (Lancefield == TRUE | Lancefield == "all") {
|
||||
# group A - S. pyogenes
|
||||
@ -1602,15 +1600,15 @@ exec_as.mo <- function(x,
|
||||
# group K - S. salivarius
|
||||
x[x %in% lookup(genus == "Streptococcus" & species == "salivarius", n = Inf)] <- lookup(fullname == "Streptococcus group K", uncertainty = -1)
|
||||
}
|
||||
|
||||
|
||||
# Wrap up ----------------------------------------------------------------
|
||||
|
||||
|
||||
# comply to x, which is also unique and without empty values
|
||||
x_input_unique_nonempty <- unique(x_input[!is.na(x_input)
|
||||
& !is.null(x_input)
|
||||
& !identical(x_input, "")
|
||||
& !identical(x_input, "xxx")])
|
||||
|
||||
|
||||
x <- x[match(x_input, x_input_unique_nonempty)]
|
||||
if (property == "mo") {
|
||||
x <- set_clean_class(x, new_class = c("mo", "character"))
|
||||
@ -1618,11 +1616,11 @@ exec_as.mo <- function(x,
|
||||
|
||||
# keep track of time
|
||||
end_time <- Sys.time()
|
||||
|
||||
|
||||
if (length(mo_renamed()) > 0) {
|
||||
print(mo_renamed())
|
||||
}
|
||||
|
||||
|
||||
if (initial_search == FALSE) {
|
||||
# we got here from uncertain_fn().
|
||||
if (NROW(uncertainties) == 0) {
|
||||
@ -1656,7 +1654,7 @@ exec_as.mo <- function(x,
|
||||
if (isTRUE(debug) && initial_search == TRUE) {
|
||||
cat("Finished function", time_track(), "\n")
|
||||
}
|
||||
|
||||
|
||||
x
|
||||
}
|
||||
|
||||
@ -2208,3 +2206,282 @@ strip_words <- function(text, n, side = "right") {
|
||||
})
|
||||
vapply(FUN.VALUE = character(1), out, paste, collapse = " ")
|
||||
}
|
||||
|
||||
|
||||
as.mo2 <- function(x,
|
||||
Becker = FALSE,
|
||||
Lancefield = FALSE,
|
||||
allow_uncertain = TRUE,
|
||||
reference_df = get_mo_source(),
|
||||
info = interactive(),
|
||||
property = "mo",
|
||||
initial_search = TRUE,
|
||||
dyslexia_mode = FALSE,
|
||||
debug = FALSE,
|
||||
ignore_pattern = getOption("AMR_ignore_pattern"),
|
||||
reference_data_to_use = MO_lookup,
|
||||
actual_uncertainty = 1,
|
||||
actual_input = NULL,
|
||||
language = get_AMR_locale()) {
|
||||
meet_criteria(x, allow_class = c("mo", "data.frame", "list", "character", "numeric", "integer", "factor"), allow_NA = TRUE)
|
||||
meet_criteria(Becker, allow_class = c("logical", "character"), has_length = 1)
|
||||
meet_criteria(Lancefield, allow_class = c("logical", "character"), has_length = 1)
|
||||
meet_criteria(allow_uncertain, allow_class = c("logical", "numeric", "integer"), has_length = 1)
|
||||
meet_criteria(reference_df, allow_class = "data.frame", allow_NULL = TRUE)
|
||||
meet_criteria(property, allow_class = "character", has_length = 1, is_in = colnames(microorganisms))
|
||||
meet_criteria(initial_search, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(dyslexia_mode, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(debug, allow_class = "logical", has_length = 1)
|
||||
meet_criteria(ignore_pattern, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(reference_data_to_use, allow_class = "data.frame")
|
||||
meet_criteria(actual_uncertainty, allow_class = "numeric", has_length = 1)
|
||||
meet_criteria(actual_input, allow_class = "character", allow_NULL = TRUE)
|
||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
if (isTRUE(debug) && initial_search == TRUE) {
|
||||
time_start_tracking()
|
||||
}
|
||||
|
||||
lookup <- function(needle,
|
||||
column = property,
|
||||
haystack = reference_data_to_use,
|
||||
n = 1,
|
||||
debug_mode = debug,
|
||||
initial = initial_search,
|
||||
uncertainty = actual_uncertainty,
|
||||
input_actual = actual_input) {
|
||||
|
||||
if (!is.null(input_actual)) {
|
||||
input <- input_actual
|
||||
} else {
|
||||
input <- tryCatch(x_backup[i], error = function(e) "")
|
||||
}
|
||||
|
||||
# `column` can be NULL for all columns, or a selection
|
||||
# returns a [character] (vector) - if `column` > length 1 then with columns as names
|
||||
if (isTRUE(debug_mode)) {
|
||||
cat(font_silver("Looking up: ", substitute(needle), collapse = ""),
|
||||
"\n ", time_track())
|
||||
}
|
||||
if (length(column) == 1) {
|
||||
res_df <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
|
||||
if (NROW(res_df) > 1 & uncertainty != -1) {
|
||||
# sort the findings on matching score
|
||||
scores <- mo_matching_score(x = input,
|
||||
n = res_df[, "fullname", drop = TRUE])
|
||||
res_df <- res_df[order(scores, decreasing = TRUE), , drop = FALSE]
|
||||
}
|
||||
res <- as.character(res_df[, column, drop = TRUE])
|
||||
if (length(res) == 0) {
|
||||
if (isTRUE(debug_mode)) {
|
||||
cat(font_red(" (no match)\n"))
|
||||
}
|
||||
NA_character_
|
||||
} else {
|
||||
if (isTRUE(debug_mode)) {
|
||||
cat(font_green(paste0(" MATCH (", NROW(res_df), " results)\n")))
|
||||
}
|
||||
if ((length(res) > n | uncertainty > 1) & uncertainty != -1) {
|
||||
# save the other possible results as well, but not for forced certain results (then uncertainty == -1)
|
||||
uncertainties <<- rbind(uncertainties,
|
||||
format_uncertainty_as_df(uncertainty_level = uncertainty,
|
||||
input = input,
|
||||
result_mo = res_df[1, "mo", drop = TRUE],
|
||||
candidates = as.character(res_df[, "fullname", drop = TRUE])),
|
||||
stringsAsFactors = FALSE)
|
||||
}
|
||||
res[seq_len(min(n, length(res)))]
|
||||
}
|
||||
} else {
|
||||
if (is.null(column)) {
|
||||
column <- names(haystack)
|
||||
}
|
||||
res <- haystack[which(eval(substitute(needle), envir = haystack, enclos = parent.frame())), , drop = FALSE]
|
||||
res <- res[seq_len(min(n, nrow(res))), column, drop = TRUE]
|
||||
if (NROW(res) == 0) {
|
||||
if (isTRUE(debug_mode)) {
|
||||
cat(font_red(" (no rows)\n"))
|
||||
}
|
||||
res <- rep(NA_character_, length(column))
|
||||
} else {
|
||||
if (isTRUE(debug_mode)) {
|
||||
cat(font_green(paste0(" MATCH (", NROW(res), " rows)\n")))
|
||||
}
|
||||
}
|
||||
res <- as.character(res)
|
||||
names(res) <- column
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
# start off with replaced language-specific non-ASCII characters with ASCII characters
|
||||
x <- parse_and_convert(x)
|
||||
# replace mo codes used in older package versions
|
||||
x <- replace_old_mo_codes(x, property)
|
||||
# ignore cases that match the ignore pattern
|
||||
x <- replace_ignore_pattern(x, ignore_pattern)
|
||||
|
||||
# WHONET: xxx = no growth
|
||||
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
|
||||
# Laboratory systems: remove (translated) entries like "no growth", etc.
|
||||
x[trimws2(x) %like% translate_into_language("no .*growth", language = language)] <- NA_character_
|
||||
x[trimws2(x) %like% paste0("^(", translate_into_language("no|not", language = language), ") [a-z]+")] <- "UNKNOWN"
|
||||
|
||||
if (initial_search == TRUE) {
|
||||
# keep track of time - give some hints to improve speed if it takes a long time
|
||||
start_time <- Sys.time()
|
||||
|
||||
pkg_env$mo_failures <- NULL
|
||||
pkg_env$mo_uncertainties <- NULL
|
||||
pkg_env$mo_renamed <- NULL
|
||||
}
|
||||
pkg_env$mo_renamed_last_run <- NULL
|
||||
|
||||
failures <- character(0)
|
||||
uncertainty_level <- translate_allow_uncertain(allow_uncertain)
|
||||
uncertainties <- data.frame(uncertainty = integer(0),
|
||||
input = character(0),
|
||||
fullname = character(0),
|
||||
renamed_to = character(0),
|
||||
mo = character(0),
|
||||
candidates = character(0),
|
||||
stringsAsFactors = FALSE)
|
||||
|
||||
x_input <- x
|
||||
# already strip leading and trailing spaces
|
||||
x <- trimws(x)
|
||||
# only check the uniques, which is way faster
|
||||
x <- unique(x)
|
||||
# remove empty values (to later fill them in again with NAs)
|
||||
# ("xxx" is WHONET code for 'no growth')
|
||||
x <- x[!is.na(x)
|
||||
& !is.null(x)
|
||||
& !identical(x, "")
|
||||
& !identical(x, "xxx")]
|
||||
|
||||
# defined df to check for
|
||||
if (!is.null(reference_df)) {
|
||||
check_validity_mo_source(reference_df)
|
||||
reference_df <- repair_reference_df(reference_df)
|
||||
}
|
||||
|
||||
# all empty
|
||||
if (all(identical(trimws(x_input), "") | is.na(x_input) | length(x) == 0)) {
|
||||
if (property == "mo") {
|
||||
return(set_clean_class(rep(NA_character_, length(x_input)),
|
||||
new_class = c("mo", "character")))
|
||||
} else {
|
||||
return(rep(NA_character_, length(x_input)))
|
||||
}
|
||||
|
||||
} else if (all(x %in% reference_df[, 1][[1]])) {
|
||||
# all in reference df
|
||||
colnames(reference_df)[1] <- "x"
|
||||
suppressWarnings(
|
||||
x <- MO_lookup[match(reference_df[match(x, reference_df$x), "mo", drop = TRUE], MO_lookup$mo), property, drop = TRUE]
|
||||
)
|
||||
|
||||
} else if (all(x %in% reference_data_to_use$mo)) {
|
||||
x <- MO_lookup[match(x, MO_lookup$mo), property, drop = TRUE]
|
||||
|
||||
} else if (all(tolower(x) %in% reference_data_to_use$fullname_lower)) {
|
||||
# we need special treatment for very prevalent full names, they are likely!
|
||||
# e.g. as.mo("Staphylococcus aureus")
|
||||
x <- MO_lookup[match(tolower(x), MO_lookup$fullname_lower), property, drop = TRUE]
|
||||
|
||||
} else if (all(x %in% reference_data_to_use$fullname)) {
|
||||
# we need special treatment for very prevalent full names, they are likely!
|
||||
# e.g. as.mo("Staphylococcus aureus")
|
||||
x <- MO_lookup[match(x, MO_lookup$fullname), property, drop = TRUE]
|
||||
|
||||
} else if (all(toupper(x) %in% microorganisms.codes$code)) {
|
||||
# commonly used MO codes
|
||||
x <- MO_lookup[match(microorganisms.codes[match(toupper(x),
|
||||
microorganisms.codes$code),
|
||||
"mo",
|
||||
drop = TRUE],
|
||||
MO_lookup$mo),
|
||||
property,
|
||||
drop = TRUE]
|
||||
|
||||
} else if (!all(x %in% microorganisms[, property])) {
|
||||
|
||||
strip_whitespace <- function(x, dyslexia_mode) {
|
||||
# all whitespaces (tab, new lines, etc.) should be one space
|
||||
# and spaces before and after should be left blank
|
||||
trimmed <- trimws2(x)
|
||||
# also, make sure the trailing and leading characters are a-z or 0-9
|
||||
# in case of non-regex
|
||||
if (dyslexia_mode == FALSE) {
|
||||
trimmed <- gsub("^[^a-zA-Z0-9)(]+", "", trimmed, perl = TRUE)
|
||||
trimmed <- gsub("[^a-zA-Z0-9)(]+$", "", trimmed, perl = TRUE)
|
||||
}
|
||||
trimmed
|
||||
}
|
||||
|
||||
x_backup_untouched <- x
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
# translate 'unknown' names back to English
|
||||
if (any(tolower(x) %like_case% "unbekannt|onbekend|desconocid|sconosciut|iconnu|desconhecid", na.rm = TRUE)) {
|
||||
trns <- subset(TRANSLATIONS, pattern %like% "unknown")
|
||||
langs <- LANGUAGES_SUPPORTED[LANGUAGES_SUPPORTED != "en"]
|
||||
for (l in langs) {
|
||||
for (i in seq_len(nrow(trns))) {
|
||||
if (!is.na(trns[i, l, drop = TRUE])) {
|
||||
x <- gsub(pattern = trns[i, l, drop = TRUE],
|
||||
replacement = trns$pattern[i],
|
||||
x = x,
|
||||
ignore.case = TRUE,
|
||||
perl = TRUE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# remove spp and species
|
||||
x <- gsub("(^| )[ .]*(spp|ssp|ss|sp|subsp|subspecies|biovar|biotype|serovar|species)[ .]*( |$)", "", x, ignore.case = TRUE, perl = TRUE)
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
|
||||
x_backup <- x
|
||||
|
||||
# from here on case-insensitive
|
||||
x <- tolower(x)
|
||||
|
||||
x_backup[x %like_case% "^(fungus|fungi)$"] <- "(unknown fungus)" # will otherwise become the kingdom
|
||||
x_backup[x_backup_untouched == "Fungi"] <- "Fungi" # is literally the kingdom
|
||||
|
||||
# Fill in fullnames and MO codes directly
|
||||
known_names <- tolower(x_backup) %in% MO_lookup$fullname_lower
|
||||
x[known_names] <- MO_lookup[match(tolower(x_backup)[known_names], MO_lookup$fullname_lower), property, drop = TRUE]
|
||||
known_codes_mo <- toupper(x_backup) %in% MO_lookup$mo
|
||||
x[known_codes_mo] <- MO_lookup[match(toupper(x_backup)[known_codes_mo], MO_lookup$mo), property, drop = TRUE]
|
||||
known_codes_lis <- toupper(x_backup) %in% microorganisms.codes$code
|
||||
x[known_codes_lis] <- MO_lookup[match(microorganisms.codes[match(toupper(x_backup)[known_codes_lis],
|
||||
microorganisms.codes$code), "mo", drop = TRUE],
|
||||
MO_lookup$mo), property, drop = TRUE]
|
||||
already_known <- known_names | known_codes_mo | known_codes_lis
|
||||
|
||||
# now only continue where the right taxonomic output is not already known
|
||||
if (any(!already_known)) {
|
||||
x_unknown <- x[!already_known]
|
||||
x_unknown <- gsub(" ?[(].*[)] ?", "", x_unknown, perl = TRUE)
|
||||
x_unknown <- gsub("[^a-z ]", " ", x_unknown, perl = TRUE)
|
||||
x_unknown <- gsub(" +", " ", x_unknown, perl = TRUE)
|
||||
print(x_unknown)
|
||||
x_search <- gsub("([a-z])[a-z]*( ([a-z])[a-z]*)?( ([a-z])[a-z]*)?", "^\\1.* \\3.* \\5.*", x_unknown, perl = TRUE)
|
||||
x_search <- gsub("( [.][*])+$", "", x_search, perl = TRUE)
|
||||
print(x_search)
|
||||
for (i in seq_len(length(x_unknown))) {
|
||||
# search first, second and third part
|
||||
mos_to_search <- MO_lookup[which(MO_lookup$fullname_lower %like_case% x_search[i]), "fullname", drop = TRUE]
|
||||
score <- mo_matching_score(x_unknown[i], mos_to_search)
|
||||
out <- mos_to_search[order(score, decreasing = TRUE)][1:25] # keep first 25
|
||||
print(score[order(score, decreasing = TRUE)][1])
|
||||
x[!already_known][i] <- MO_lookup$mo[match(out[1], MO_lookup$fullname)]
|
||||
}
|
||||
}
|
||||
}
|
||||
x
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Calculate the Matching Score for Microorganisms
|
||||
#'
|
||||
#' This algorithm is used by [as.mo()] and all the [`mo_*`][mo_property()] functions to determine the most probable match of taxonomic records based on user input.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @author Dr Matthijs Berends
|
||||
#' @param x Any user input value(s)
|
||||
#' @param n A full taxonomic name, that exists in [`microorganisms$fullname`][microorganisms]
|
||||
@ -53,7 +52,6 @@
|
||||
#' 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
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' as.mo("E. coli")
|
||||
#' mo_uncertainties()
|
||||
|
149
R/mo_property.R
149
R/mo_property.R
@ -26,7 +26,6 @@
|
||||
#' Get Properties of a Microorganism
|
||||
#'
|
||||
#' 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*.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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.
|
||||
@ -67,93 +66,91 @@
|
||||
#' @export
|
||||
#' @seealso Data set [microorganisms]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # taxonomic tree -----------------------------------------------------------
|
||||
#' mo_kingdom("E. coli") # "Bacteria"
|
||||
#' mo_phylum("E. coli") # "Proteobacteria"
|
||||
#' mo_class("E. coli") # "Gammaproteobacteria"
|
||||
#' mo_order("E. coli") # "Enterobacterales"
|
||||
#' mo_family("E. coli") # "Enterobacteriaceae"
|
||||
#' mo_genus("E. coli") # "Escherichia"
|
||||
#' mo_species("E. coli") # "coli"
|
||||
#' mo_subspecies("E. coli") # ""
|
||||
#' mo_kingdom("Klebsiella pneumoniae")
|
||||
#' mo_phylum("Klebsiella pneumoniae")
|
||||
#' mo_class("Klebsiella pneumoniae")
|
||||
#' mo_order("Klebsiella pneumoniae")
|
||||
#' mo_family("Klebsiella pneumoniae")
|
||||
#' mo_genus("Klebsiella pneumoniae")
|
||||
#' mo_species("Klebsiella pneumoniae")
|
||||
#' mo_subspecies("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # colloquial properties ----------------------------------------------------
|
||||
#' mo_name("E. coli") # "Escherichia coli"
|
||||
#' mo_fullname("E. coli") # "Escherichia coli" - same as mo_name()
|
||||
#' mo_shortname("E. coli") # "E. coli"
|
||||
#' mo_name("Klebsiella pneumoniae")
|
||||
#' mo_fullname("Klebsiella pneumoniae")
|
||||
#' mo_shortname("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # other properties ---------------------------------------------------------
|
||||
#' mo_gramstain("E. coli") # "Gram-negative"
|
||||
#' mo_snomed("E. coli") # 112283007, 116395006, ... (SNOMED codes)
|
||||
#' mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated)
|
||||
#' mo_rank("E. coli") # "species"
|
||||
#' mo_url("E. coli") # get the direct url to the online database entry
|
||||
#' mo_synonyms("E. coli") # get previously accepted taxonomic names
|
||||
#' mo_gramstain("Klebsiella pneumoniae")
|
||||
#' mo_snomed("Klebsiella pneumoniae")
|
||||
#' mo_type("Klebsiella pneumoniae")
|
||||
#' mo_rank("Klebsiella pneumoniae")
|
||||
#' mo_url("Klebsiella pneumoniae")
|
||||
#' mo_synonyms("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # scientific reference -----------------------------------------------------
|
||||
#' mo_ref("E. coli") # "Castellani et al., 1919"
|
||||
#' mo_authors("E. coli") # "Castellani et al."
|
||||
#' mo_year("E. coli") # 1919
|
||||
#' mo_lpsn("E. coli") # 776057 (LPSN record ID)
|
||||
#' mo_ref("Klebsiella pneumoniae")
|
||||
#' mo_authors("Klebsiella pneumoniae")
|
||||
#' mo_year("Klebsiella pneumoniae")
|
||||
#' mo_lpsn("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # abbreviations known in the field -----------------------------------------
|
||||
#' mo_genus("MRSA") # "Staphylococcus"
|
||||
#' mo_species("MRSA") # "aureus"
|
||||
#' mo_shortname("VISA") # "S. aureus"
|
||||
#' mo_gramstain("VISA") # "Gram-positive"
|
||||
#' mo_genus("MRSA")
|
||||
#' mo_species("MRSA")
|
||||
#' mo_shortname("VISA")
|
||||
#' mo_gramstain("VISA")
|
||||
#'
|
||||
#' mo_genus("EHEC") # "Escherichia"
|
||||
#' mo_species("EHEC") # "coli"
|
||||
#' mo_genus("EHEC")
|
||||
#' mo_species("EHEC")
|
||||
#'
|
||||
#' # known subspecies ---------------------------------------------------------
|
||||
#' mo_name("doylei") # "Campylobacter jejuni doylei"
|
||||
#' mo_genus("doylei") # "Campylobacter"
|
||||
#' mo_species("doylei") # "jejuni"
|
||||
#' mo_subspecies("doylei") # "doylei"
|
||||
#' mo_name("doylei")
|
||||
#' mo_genus("doylei")
|
||||
#' mo_species("doylei")
|
||||
#' mo_subspecies("doylei")
|
||||
#'
|
||||
#' mo_fullname("K. pneu rh") # "Klebsiella pneumoniae rhinoscleromatis"
|
||||
#' mo_shortname("K. pneu rh") # "K. pneumoniae"
|
||||
#' mo_fullname("K. pneu rh")
|
||||
#' mo_shortname("K. pneu rh")
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # Becker classification, see ?as.mo ----------------------------------------
|
||||
#' mo_fullname("S. epi") # "Staphylococcus epidermidis"
|
||||
#' mo_fullname("S. epi", Becker = TRUE) # "Coagulase-negative Staphylococcus (CoNS)"
|
||||
#' mo_shortname("S. epi") # "S. epidermidis"
|
||||
#' mo_shortname("S. epi", Becker = TRUE) # "CoNS"
|
||||
#' mo_fullname("S. epi")
|
||||
#' mo_fullname("S. epi", Becker = TRUE)
|
||||
#' mo_shortname("S. epi")
|
||||
#' mo_shortname("S. epi", Becker = TRUE)
|
||||
#'
|
||||
#' # Lancefield classification, see ?as.mo ------------------------------------
|
||||
#' mo_fullname("S. pyo") # "Streptococcus pyogenes"
|
||||
#' mo_fullname("S. pyo", Lancefield = TRUE) # "Streptococcus group A"
|
||||
#' mo_shortname("S. pyo") # "S. pyogenes"
|
||||
#' mo_shortname("S. pyo", Lancefield = TRUE) # "GAS" (='Group A Streptococci')
|
||||
#' mo_fullname("S. pyo")
|
||||
#' mo_fullname("S. pyo", Lancefield = TRUE)
|
||||
#' mo_shortname("S. pyo")
|
||||
#' mo_shortname("S. pyo", Lancefield = TRUE)
|
||||
#'
|
||||
#'
|
||||
#' # language support --------------------------------------------------------
|
||||
#' mo_gramstain("E. coli", language = "de") # "Gramnegativ"
|
||||
#' mo_gramstain("E. coli", language = "nl") # "Gram-negatief"
|
||||
#' mo_gramstain("E. coli", language = "es") # "Gram negativo"
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "de")
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "nl")
|
||||
#' mo_gramstain("Klebsiella pneumoniae", language = "es")
|
||||
#'
|
||||
#' # mo_type is equal to mo_kingdom, but mo_kingdom will remain official
|
||||
#' mo_kingdom("E. coli") # "Bacteria" on a German system
|
||||
#' mo_type("E. coli") # "Bakterien" on a German system
|
||||
#' mo_type("E. coli") # "Bacteria" on an English system
|
||||
#' mo_kingdom("Klebsiella pneumoniae")
|
||||
#' mo_type("Klebsiella pneumoniae")
|
||||
#' mo_type("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' mo_fullname("S. pyogenes",
|
||||
#' Lancefield = TRUE,
|
||||
#' language = "de") # "Streptococcus Gruppe A"
|
||||
#' language = "de")
|
||||
#' mo_fullname("S. pyogenes",
|
||||
#' Lancefield = TRUE,
|
||||
#' language = "nl") # "Streptococcus groep A"
|
||||
#' language = "nl")
|
||||
#'
|
||||
#'
|
||||
#' # other --------------------------------------------------------------------
|
||||
#'
|
||||
#' mo_is_yeast(c("Candida", "E. coli")) # TRUE, FALSE
|
||||
#' mo_is_yeast(c("Candida", "Trichophyton", "Klebsiella"))
|
||||
#'
|
||||
#' # gram stains and intrinsic resistance can also be used as a filter in dplyr verbs
|
||||
#' \donttest{
|
||||
#' # gram stains and intrinsic resistance can be used as a filter in dplyr verbs
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
#' filter(mo_is_gram_positive())
|
||||
@ -164,11 +161,11 @@
|
||||
#'
|
||||
#'
|
||||
#' # get a list with the complete taxonomy (from kingdom to subspecies)
|
||||
#' mo_taxonomy("E. coli")
|
||||
#' mo_taxonomy("Klebsiella pneumoniae")
|
||||
#'
|
||||
#' # get a list with the taxonomy, the authors, Gram-stain,
|
||||
#' # SNOMED codes, and URL to the online database
|
||||
#' mo_info("E. coli")
|
||||
#' }
|
||||
#' # SNOMED codes, and URL to the online database
|
||||
#' mo_info("Klebsiella pneumoniae")
|
||||
#' }
|
||||
mo_name <- function(x, language = get_AMR_locale(), ...) {
|
||||
if (missing(x)) {
|
||||
@ -178,10 +175,10 @@ mo_name <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "fullname", language = language, ...),
|
||||
language = language,
|
||||
only_unknown = FALSE,
|
||||
only_affect_mo_names = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "fullname", language = language, ...),
|
||||
language = language,
|
||||
only_unknown = FALSE,
|
||||
only_affect_mo_names = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -223,7 +220,7 @@ mo_shortname <- function(x, language = get_AMR_locale(), ...) {
|
||||
|
||||
shortnames[is.na(x.mo)] <- NA_character_
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
translate_AMR(shortnames, language = language, only_unknown = FALSE, only_affect_mo_names = TRUE)
|
||||
translate_into_language(shortnames, language = language, only_unknown = FALSE, only_affect_mo_names = TRUE)
|
||||
}
|
||||
|
||||
|
||||
@ -238,7 +235,7 @@ mo_subspecies <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "subspecies", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "subspecies", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -251,7 +248,7 @@ mo_species <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "species", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "species", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -264,7 +261,7 @@ mo_genus <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "genus", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "genus", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -277,7 +274,7 @@ mo_family <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "family", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "family", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -290,7 +287,7 @@ mo_order <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "order", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "order", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -303,7 +300,7 @@ mo_class <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "class", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "class", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -316,7 +313,7 @@ mo_phylum <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "phylum", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "phylum", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -329,7 +326,7 @@ mo_kingdom <- 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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = "kingdom", language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = "kingdom", language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -349,7 +346,7 @@ mo_type <- function(x, language = get_AMR_locale(), ...) {
|
||||
x.mo <- as.mo(x, language = language, ...)
|
||||
out <- mo_kingdom(x.mo, language = NULL)
|
||||
out[which(mo_is_yeast(x.mo))] <- "Yeasts"
|
||||
translate_AMR(out, language = language, only_unknown = FALSE)
|
||||
translate_into_language(out, language = language, only_unknown = FALSE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -380,7 +377,7 @@ mo_gramstain <- function(x, language = get_AMR_locale(), ...) {
|
||||
| x.mo == "B_GRAMP"] <- "Gram-positive"
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
translate_AMR(x, language = language, only_unknown = FALSE)
|
||||
translate_into_language(x, language = language, only_unknown = FALSE)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
@ -435,9 +432,7 @@ mo_is_yeast <- function(x, language = get_AMR_locale(), ...) {
|
||||
metadata <- get_mo_failures_uncertainties_renamed()
|
||||
|
||||
x.kingdom <- mo_kingdom(x.mo, language = NULL)
|
||||
x.phylum <- mo_phylum(x.mo, language = NULL)
|
||||
x.class <- mo_class(x.mo, language = NULL)
|
||||
x.order <- mo_order(x.mo, language = NULL)
|
||||
|
||||
load_mo_failures_uncertainties_renamed(metadata)
|
||||
|
||||
@ -705,7 +700,7 @@ mo_property <- function(x, property = "fullname", language = get_AMR_locale(), .
|
||||
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)
|
||||
|
||||
translate_AMR(mo_validate(x = x, property = property, language = language, ...), language = language, only_unknown = TRUE)
|
||||
translate_into_language(mo_validate(x = x, property = property, language = language, ...), language = language, only_unknown = TRUE)
|
||||
}
|
||||
|
||||
mo_validate <- function(x, property, language, ...) {
|
||||
@ -724,7 +719,7 @@ mo_validate <- function(x, property, language, ...) {
|
||||
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]
|
||||
|
||||
|
||||
} else {
|
||||
# try to catch an error when inputting an invalid argument
|
||||
# so the 'call.' can be set to FALSE
|
||||
|
@ -28,17 +28,16 @@
|
||||
#' @description These functions can be used to predefine your own reference to be used in [as.mo()] and consequently all [`mo_*`][mo_property()] functions (such as [mo_genus()] and [mo_gramstain()]).
|
||||
#'
|
||||
#' This is **the fastest way** to have your organisation (or analysis) specific codes picked up and translated by this package, since you don't have to bother about it again after setting it up once.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param path location of your reference file, see *Details*. Can be `""`, `NULL` or `FALSE` to delete the reference file.
|
||||
#' @param path location of your reference file, this can be any text file (comma-, tab- or pipe-separated) or an Excel file (see *Details*). Can also be `""`, `NULL` or `FALSE` to delete the reference file.
|
||||
#' @param destination destination of the compressed data file, default to the user's home directory.
|
||||
#' @rdname mo_source
|
||||
#' @name mo_source
|
||||
#' @aliases set_mo_source get_mo_source
|
||||
#' @details The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an \R object file (extension '.rds'). To use an Excel file, you will need to have the `readxl` package installed.
|
||||
#'
|
||||
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
|
||||
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] or [`microorganisms$fullname`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
|
||||
#'
|
||||
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
|
||||
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an [attribute][base::attributes()] to the compressed data file.
|
||||
#'
|
||||
#' The function [get_mo_source()] will return the data set by reading `"mo_source.rds"` with [readRDS()]. If the original file has changed (by checking the location and timestamp of the original file), it will call [set_mo_source()] to update the data file automatically if used in an interactive session.
|
||||
#'
|
||||
@ -46,15 +45,15 @@
|
||||
#'
|
||||
#' @section How to Setup:
|
||||
#'
|
||||
#' Imagine this data on a sheet of an Excel file (mo codes were looked up in the [microorganisms] data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:
|
||||
#' Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:
|
||||
#'
|
||||
#' ```
|
||||
#' | A | B |
|
||||
#' --|--------------------|--------------|
|
||||
#' 1 | Organisation XYZ | mo |
|
||||
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
|
||||
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
|
||||
#' 4 | | |
|
||||
#' | A | B |
|
||||
#' --|--------------------|-----------------------|
|
||||
#' 1 | Organisation XYZ | mo |
|
||||
#' 2 | lab_mo_ecoli | Escherichia coli |
|
||||
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
|
||||
#' 4 | | |
|
||||
#' ```
|
||||
#'
|
||||
#' We save it as `"home/me/ourcodes.xlsx"`. Now we have to set it as a source:
|
||||
@ -89,13 +88,13 @@
|
||||
#' If we edit the Excel file by, let's say, adding row 4 like this:
|
||||
#'
|
||||
#' ```
|
||||
#' | A | B |
|
||||
#' --|--------------------|--------------|
|
||||
#' 1 | Organisation XYZ | mo |
|
||||
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
|
||||
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
|
||||
#' 4 | lab_Staph_aureus | B_STPHY_AURS |
|
||||
#' 5 | | |
|
||||
#' | A | B |
|
||||
#' --|--------------------|-----------------------|
|
||||
#' 1 | Organisation XYZ | mo |
|
||||
#' 2 | lab_mo_ecoli | Escherichia coli |
|
||||
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
|
||||
#' 4 | lab_Staph_aureus | Staphylococcus aureus |
|
||||
#' 5 | | |
|
||||
#' ```
|
||||
#'
|
||||
#' ...any new usage of an MO function in this package will update your data file:
|
||||
@ -121,7 +120,6 @@
|
||||
#'
|
||||
#' If the original file (in the previous case an Excel file) is moved or deleted, the `mo_source.rds` file will be removed upon the next use of [as.mo()] or any [`mo_*`][mo_property()] function.
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_source.rds")) {
|
||||
meet_criteria(path, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
meet_criteria(destination, allow_class = "character", has_length = 1)
|
||||
@ -144,6 +142,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
|
||||
stop_ifnot(file.exists(path), "file not found: ", path)
|
||||
|
||||
df <- NULL
|
||||
if (path %like% "[.]rds$") {
|
||||
df <- readRDS(path)
|
||||
|
||||
@ -153,28 +152,34 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
df <- readxl::read_excel(path)
|
||||
|
||||
} else if (path %like% "[.]tsv$") {
|
||||
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE)
|
||||
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
|
||||
|
||||
} else if (path %like% "[.]csv$") {
|
||||
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE)
|
||||
|
||||
} else {
|
||||
# try comma first
|
||||
try(
|
||||
df <- utils::read.table(header = TRUE, sep = ",", stringsAsFactors = FALSE),
|
||||
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE),
|
||||
silent = TRUE)
|
||||
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
|
||||
# try tab
|
||||
try(
|
||||
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE),
|
||||
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE),
|
||||
silent = TRUE)
|
||||
}
|
||||
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
|
||||
# try pipe
|
||||
try(
|
||||
df <- utils::read.table(header = TRUE, sep = "|", stringsAsFactors = FALSE),
|
||||
df <- utils::read.table(file = path, header = TRUE, sep = "|", stringsAsFactors = FALSE),
|
||||
silent = TRUE)
|
||||
}
|
||||
}
|
||||
|
||||
# check integrity
|
||||
if (is.null(df)) {
|
||||
stop_("the path '", path, "' could not be imported as a dataset.")
|
||||
}
|
||||
check_validity_mo_source(df)
|
||||
|
||||
df <- subset(df, !is.na(mo))
|
||||
@ -187,7 +192,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
|
||||
}
|
||||
|
||||
df <- as.data.frame(df, stringAsFactors = FALSE)
|
||||
df[, "mo"] <- set_clean_class(df[, "mo", drop = TRUE], c("mo", "character"))
|
||||
df[, "mo"] <- as.mo(df[, "mo", drop = TRUE])
|
||||
|
||||
# success
|
||||
if (file.exists(mo_source_destination)) {
|
||||
@ -275,9 +280,9 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
|
||||
return(FALSE)
|
||||
}
|
||||
}
|
||||
if (!all(x$mo %in% c("", microorganisms$mo), na.rm = TRUE)) {
|
||||
if (!all(x$mo %in% c("", microorganisms$mo, microorganisms$fullname), na.rm = TRUE)) {
|
||||
if (stop_on_error == TRUE) {
|
||||
invalid <- x[which(!x$mo %in% c("", microorganisms$mo)), , drop = FALSE]
|
||||
invalid <- x[which(!x$mo %in% c("", microorganisms$mo, microorganisms$fullname)), , drop = FALSE]
|
||||
if (nrow(invalid) > 1) {
|
||||
plural <- "s"
|
||||
} else {
|
||||
|
14
R/pca.R
14
R/pca.R
@ -26,7 +26,6 @@
|
||||
#' Principal Component Analysis (for AMR)
|
||||
#'
|
||||
#' Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels, and automatic filtering on only suitable (i.e. non-empty and numeric) variables.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a [data.frame] containing [numeric] columns
|
||||
#' @param ... columns of `x` to be selected for PCA, can be unquoted since it supports quasiquotation.
|
||||
#' @inheritParams stats::prcomp
|
||||
@ -36,7 +35,6 @@
|
||||
#' @return An object of classes [pca] and [prcomp]
|
||||
#' @importFrom stats prcomp
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # `example_isolates` is a data set available in the AMR package.
|
||||
#' # See ?example_isolates.
|
||||
@ -47,6 +45,7 @@
|
||||
#' resistance_data <- example_isolates %>%
|
||||
#' group_by(order = mo_order(mo), # group on anything, like order
|
||||
#' genus = mo_genus(mo)) %>% # and genus as we do here;
|
||||
#' 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
|
||||
@ -55,8 +54,17 @@
|
||||
#'
|
||||
#' pca_result
|
||||
#' summary(pca_result)
|
||||
#'
|
||||
#' # old base R plotting method:
|
||||
#' biplot(pca_result)
|
||||
#' ggplot_pca(pca_result) # a new and convenient plot function
|
||||
#' # new ggplot2 plotting method using this package:
|
||||
#' ggplot_pca(pca_result)
|
||||
#'
|
||||
#' if (require("ggplot2")) {
|
||||
#' ggplot_pca(pca_result) +
|
||||
#' scale_colour_viridis_d() +
|
||||
#' labs(title = "Title here")
|
||||
#' }
|
||||
#' }
|
||||
#' }
|
||||
pca <- function(x,
|
||||
|
85
R/plot.R
85
R/plot.R
@ -26,8 +26,7 @@
|
||||
#' Plotting for Classes `rsi`, `mic` and `disk`
|
||||
#'
|
||||
#' Functions to plot classes `rsi`, `mic` and `disk`, with support for base \R and `ggplot2`.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @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()]
|
||||
@ -61,6 +60,7 @@
|
||||
#' # when providing the microorganism and antibiotic, colours will show interpretations:
|
||||
#' plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
#' plot(some_disk_values, mo = "Escherichia coli", ab = "cipro", language = "uk")
|
||||
#'
|
||||
#' \donttest{
|
||||
#' if (require("ggplot2")) {
|
||||
@ -79,7 +79,7 @@ plot.mic <- function(x,
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
main = paste("MIC values of", deparse(substitute(x))),
|
||||
main = deparse(substitute(x)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
@ -98,10 +98,10 @@ plot.mic <- function(x,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
@ -149,7 +149,7 @@ plot.mic <- function(x,
|
||||
|
||||
legend("top",
|
||||
x.intersp = 0.5,
|
||||
legend = translate_AMR(legend_txt, language = language),
|
||||
legend = translate_into_language(legend_txt, language = language),
|
||||
fill = legend_col,
|
||||
horiz = TRUE,
|
||||
cex = 0.75,
|
||||
@ -166,7 +166,7 @@ barplot.mic <- function(height,
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
main = paste("MIC values of", deparse(substitute(height))),
|
||||
main = deparse(substitute(height)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
@ -185,10 +185,10 @@ barplot.mic <- function(height,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
@ -211,7 +211,7 @@ autoplot.mic <- function(object,
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
title = paste("MIC values of", deparse(substitute(object))),
|
||||
title = deparse(substitute(object)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
@ -231,10 +231,10 @@ autoplot.mic <- function(object,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
@ -259,8 +259,8 @@ autoplot.mic <- function(object,
|
||||
df$cols[df$cols == colours_RSI[1]] <- "Resistant"
|
||||
df$cols[df$cols == colours_RSI[2]] <- "Susceptible"
|
||||
df$cols[df$cols == colours_RSI[3]] <- plot_name_of_I(cols_sub$guideline)
|
||||
df$cols <- factor(translate_AMR(df$cols, language = language),
|
||||
levels = translate_AMR(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
df$cols <- factor(translate_into_language(df$cols, language = language),
|
||||
levels = translate_into_language(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
language = language),
|
||||
ordered = TRUE)
|
||||
p <- ggplot2::ggplot(df)
|
||||
@ -270,7 +270,7 @@ autoplot.mic <- function(object,
|
||||
"Susceptible" = colours_RSI[2],
|
||||
"Susceptible, incr. exp." = colours_RSI[3],
|
||||
"Intermediate" = colours_RSI[3])
|
||||
names(vals) <- translate_AMR(names(vals), language = language)
|
||||
names(vals) <- translate_into_language(names(vals), language = language)
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = mic, y = count, fill = cols)) +
|
||||
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
|
||||
@ -299,7 +299,7 @@ fortify.mic <- function(object, ...) {
|
||||
#' @importFrom graphics barplot axis mtext legend
|
||||
#' @rdname plot
|
||||
plot.disk <- function(x,
|
||||
main = paste("Disk zones of", deparse(substitute(x))),
|
||||
main = deparse(substitute(x)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
@ -321,10 +321,10 @@ plot.disk <- function(x,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
@ -372,7 +372,7 @@ plot.disk <- function(x,
|
||||
}
|
||||
legend("top",
|
||||
x.intersp = 0.5,
|
||||
legend = translate_AMR(legend_txt, language = language),
|
||||
legend = translate_into_language(legend_txt, language = language),
|
||||
fill = legend_col,
|
||||
horiz = TRUE,
|
||||
cex = 0.75,
|
||||
@ -386,7 +386,7 @@ plot.disk <- function(x,
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.disk <- function(height,
|
||||
main = paste("Disk zones of", deparse(substitute(height))),
|
||||
main = deparse(substitute(height)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
mo = NULL,
|
||||
@ -408,10 +408,10 @@ barplot.disk <- function(height,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
@ -433,7 +433,7 @@ barplot.disk <- function(height,
|
||||
autoplot.disk <- function(object,
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
title = paste("Disk zones of", deparse(substitute(object))),
|
||||
title = deparse(substitute(object)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
guideline = "EUCAST",
|
||||
@ -454,10 +454,10 @@ autoplot.disk <- function(object,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
@ -483,8 +483,8 @@ autoplot.disk <- function(object,
|
||||
df$cols[df$cols == colours_RSI[1]] <- "Resistant"
|
||||
df$cols[df$cols == colours_RSI[2]] <- "Susceptible"
|
||||
df$cols[df$cols == colours_RSI[3]] <- plot_name_of_I(cols_sub$guideline)
|
||||
df$cols <- factor(translate_AMR(df$cols, language = language),
|
||||
levels = translate_AMR(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
df$cols <- factor(translate_into_language(df$cols, language = language),
|
||||
levels = translate_into_language(c("Susceptible", plot_name_of_I(cols_sub$guideline), "Resistant"),
|
||||
language = language),
|
||||
ordered = TRUE)
|
||||
p <- ggplot2::ggplot(df)
|
||||
@ -494,7 +494,7 @@ autoplot.disk <- function(object,
|
||||
"Susceptible" = colours_RSI[2],
|
||||
"Susceptible, incr. exp." = colours_RSI[3],
|
||||
"Intermediate" = colours_RSI[3])
|
||||
names(vals) <- translate_AMR(names(vals), language = language)
|
||||
names(vals) <- translate_into_language(names(vals), language = language)
|
||||
p <- p +
|
||||
ggplot2::geom_col(ggplot2::aes(x = disk, y = count, fill = cols)) +
|
||||
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
|
||||
@ -525,12 +525,21 @@ fortify.disk <- function(object, ...) {
|
||||
plot.rsi <- function(x,
|
||||
ylab = "Percentage",
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
main = paste("Resistance Overview of", deparse(substitute(x))),
|
||||
main = deparse(substitute(x)),
|
||||
language = get_AMR_locale(),
|
||||
...) {
|
||||
meet_criteria(ylab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(xlab, allow_class = "character", has_length = 1)
|
||||
meet_criteria(main, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
data <- as.data.frame(table(x), stringsAsFactors = FALSE)
|
||||
colnames(data) <- c("x", "n")
|
||||
data$s <- round((data$n / sum(data$n)) * 100, 1)
|
||||
@ -576,7 +585,7 @@ plot.rsi <- function(x,
|
||||
#' @export
|
||||
#' @noRd
|
||||
barplot.rsi <- function(height,
|
||||
main = paste("Resistance Overview of", deparse(substitute(height))),
|
||||
main = deparse(substitute(height)),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
@ -592,10 +601,10 @@ barplot.rsi <- function(height,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
@ -620,7 +629,7 @@ barplot.rsi <- function(height,
|
||||
#' @rdname plot
|
||||
# will be exported using s3_register() in R/zzz.R
|
||||
autoplot.rsi <- function(object,
|
||||
title = paste("Resistance Overview of", deparse(substitute(object))),
|
||||
title = deparse(substitute(object)),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
@ -634,10 +643,10 @@ autoplot.rsi <- function(object,
|
||||
|
||||
# translate if not specifically set
|
||||
if (missing(ylab)) {
|
||||
ylab <- translate_AMR(ylab, language = language)
|
||||
ylab <- translate_into_language(ylab, language = language)
|
||||
}
|
||||
if (missing(xlab)) {
|
||||
xlab <- translate_AMR(xlab, language = language)
|
||||
xlab <- translate_into_language(xlab, language = language)
|
||||
}
|
||||
|
||||
if ("main" %in% names(list(...))) {
|
||||
@ -738,7 +747,11 @@ plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_RSI, f
|
||||
ab_name(ab, language = NULL, tolower = TRUE), " in ", moname)
|
||||
guideline_txt <- ""
|
||||
} else {
|
||||
guideline_txt <- paste0("(", guideline, ")")
|
||||
guideline_txt <- guideline
|
||||
if (isTRUE(list(...)$uti)) {
|
||||
guideline_txt <- paste("UTIs,", guideline_txt)
|
||||
}
|
||||
guideline_txt <- paste0("(", guideline_txt, ")")
|
||||
}
|
||||
sub <- bquote(.(abname)~"-"~italic(.(moname))~.(guideline_txt))
|
||||
} else {
|
||||
|
@ -28,7 +28,6 @@
|
||||
#' @description These functions can be used to calculate the (co-)resistance or susceptibility of microbial isolates (i.e. percentage of S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in `summarise()` from the `dplyr` package and also support grouped variables, see *Examples*.
|
||||
#'
|
||||
#' [resistance()] should be used to calculate resistance, [susceptibility()] should be used to calculate susceptibility.\cr
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param ... one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with [as.rsi()] if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See *Examples*.
|
||||
#' @param minimum the minimum allowed number of available (tested) isolates. Any isolate count lower than `minimum` will return `NA` with a warning. The default number of `30` isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see *Source*.
|
||||
#' @param as_percent a [logical] to indicate whether the output must be returned as a hundred fold with % sign (a character). A value of `0.123456` will then be returned as `"12.3%"`.
|
||||
@ -88,11 +87,11 @@
|
||||
#' @aliases portion
|
||||
#' @name proportion
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' # example_isolates is a data set available in the AMR package.
|
||||
#' ?example_isolates
|
||||
#' # run ?example_isolates for more info.
|
||||
#'
|
||||
#' # base R ------------------------------------------------------------
|
||||
#' resistance(example_isolates$AMX) # determines %R
|
||||
#' susceptibility(example_isolates$AMX) # determines %S+I
|
||||
#'
|
||||
@ -103,6 +102,7 @@
|
||||
#' proportion_IR(example_isolates$AMX)
|
||||
#' proportion_R(example_isolates$AMX)
|
||||
#'
|
||||
#' # dplyr -------------------------------------------------------------
|
||||
#' \donttest{
|
||||
#' if (require("dplyr")) {
|
||||
#' example_isolates %>%
|
||||
@ -157,10 +157,11 @@
|
||||
#' proportion_df(translate = FALSE)
|
||||
#'
|
||||
#' # It also supports grouping variables
|
||||
#' # (use rsi_df to also include the count)
|
||||
#' example_isolates %>%
|
||||
#' select(hospital_id, AMX, CIP) %>%
|
||||
#' group_by(hospital_id) %>%
|
||||
#' proportion_df(translate = FALSE)
|
||||
#' rsi_df(translate = FALSE)
|
||||
#' }
|
||||
#' }
|
||||
resistance <- function(...,
|
||||
|
25
R/random.R
25
R/random.R
@ -25,8 +25,7 @@
|
||||
|
||||
#' 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.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' 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.
|
||||
#' @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()]
|
||||
@ -34,26 +33,25 @@
|
||||
#' @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 latest EUCAST guideline implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
|
||||
#' 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()])
|
||||
#' @name random
|
||||
#' @rdname random
|
||||
#' @export
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' random_mic(100)
|
||||
#' random_disk(100)
|
||||
#' random_rsi(100)
|
||||
#' random_mic(25)
|
||||
#' random_disk(25)
|
||||
#' random_rsi(25)
|
||||
#'
|
||||
#' \donttest{
|
||||
#' # make the random generation more realistic by setting a bug and/or drug:
|
||||
#' random_mic(100, "Klebsiella pneumoniae") # range 0.0625-64
|
||||
#' random_mic(100, "Klebsiella pneumoniae", "meropenem") # range 0.0625-16
|
||||
#' random_mic(100, "Streptococcus pneumoniae", "meropenem") # range 0.0625-4
|
||||
#' random_mic(25, "Klebsiella pneumoniae") # range 0.0625-64
|
||||
#' random_mic(25, "Klebsiella pneumoniae", "meropenem") # range 0.0625-16
|
||||
#' random_mic(25, "Streptococcus pneumoniae", "meropenem") # range 0.0625-4
|
||||
#'
|
||||
#' random_disk(100, "Klebsiella pneumoniae") # range 8-50
|
||||
#' random_disk(100, "Klebsiella pneumoniae", "ampicillin") # range 11-17
|
||||
#' random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 12-27
|
||||
#' random_disk(25, "Klebsiella pneumoniae") # range 8-50
|
||||
#' random_disk(25, "Klebsiella pneumoniae", "ampicillin") # range 11-17
|
||||
#' random_disk(25, "Streptococcus pneumoniae", "ampicillin") # range 12-27
|
||||
#' }
|
||||
random_mic <- function(size = NULL, mo = NULL, ab = NULL, ...) {
|
||||
meet_criteria(size, allow_class = c("numeric", "integer"), has_length = 1, is_positive = TRUE, is_finite = TRUE, allow_NULL = TRUE)
|
||||
@ -89,6 +87,7 @@ 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>%
|
||||
|
@ -26,7 +26,6 @@
|
||||
#' Predict Antimicrobial Resistance
|
||||
#'
|
||||
#' Create a prediction model to predict antimicrobial resistance for the next years on statistical solid ground. Standard errors (SE) will be returned as columns `se_min` and `se_max`. See *Examples* for a real live example.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param object model data to be plotted
|
||||
#' @param col_ab column name of `x` containing antimicrobial interpretations (`"R"`, `"I"` and `"S"`)
|
||||
#' @param col_date column name of the date, will be used to calculate years if this column doesn't consist of years already, defaults to the first column of with a date class
|
||||
@ -34,7 +33,7 @@
|
||||
#' @param year_max highest year to use in the prediction model, defaults to 10 years after today
|
||||
#' @param year_every unit of sequence between lowest year found in the data and `year_max`
|
||||
#' @param minimum minimal amount of available isolates per year to include. Years containing less observations will be estimated by the model.
|
||||
#' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)``, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See *Details* for all valid options.
|
||||
#' @param model the statistical model of choice. This could be a generalised linear regression model with binomial distribution (i.e. using `glm(..., family = binomial)`, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance. See *Details* for all valid options.
|
||||
#' @param I_as_S a [logical] to indicate whether values `"I"` should be treated as `"S"` (will otherwise be treated as `"R"`). The default, `TRUE`, follows the redefinition by EUCAST about the interpretation of I (increased exposure) in 2019, see section *Interpretation of S, I and R* below.
|
||||
#' @param preserve_measurements a [logical] to indicate whether predictions of years that are actually available in the data should be overwritten by the original data. The standard errors of those years will be `NA`.
|
||||
#' @param info a [logical] to indicate whether textual analysis should be printed with the name and [summary()] of the statistical model.
|
||||
@ -64,7 +63,6 @@
|
||||
#' @rdname resistance_predict
|
||||
#' @export
|
||||
#' @importFrom stats predict glm lm
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' x <- resistance_predict(example_isolates,
|
||||
#' col_ab = "AMX",
|
||||
@ -99,24 +97,8 @@
|
||||
#' model = "binomial",
|
||||
#' info = FALSE,
|
||||
#' minimum = 15)
|
||||
#'
|
||||
#' head(data)
|
||||
#' autoplot(data)
|
||||
#'
|
||||
#' ggplot(data,
|
||||
#' aes(x = year)) +
|
||||
#' geom_col(aes(y = value),
|
||||
#' fill = "grey75") +
|
||||
#' geom_errorbar(aes(ymin = se_min,
|
||||
#' ymax = se_max),
|
||||
#' colour = "grey50") +
|
||||
#' scale_y_continuous(limits = c(0, 1),
|
||||
#' breaks = seq(0, 1, 0.1),
|
||||
#' labels = paste0(seq(0, 100, 10), "%")) +
|
||||
#' labs(title = expression(paste("Forecast of Amoxicillin Resistance in ",
|
||||
#' italic("E. coli"))),
|
||||
#' y = "%R",
|
||||
#' x = "Year") +
|
||||
#' theme_minimal(base_size = 13)
|
||||
#' }
|
||||
#' }
|
||||
resistance_predict <- function(x,
|
||||
|
30
R/rsi.R
30
R/rsi.R
@ -26,14 +26,13 @@
|
||||
#' Interpret MIC and Disk Values, or Clean Raw R/SI Data
|
||||
#'
|
||||
#' Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class [`rsi`], which is an ordered [factor] with levels `S < I < R`.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @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 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 the latest included EUCAST guideline, see *Details* for all options
|
||||
#' @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 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.
|
||||
@ -98,15 +97,10 @@
|
||||
#' @export
|
||||
#' @seealso [as.mic()], [as.disk()], [as.mo()]
|
||||
#' @inheritSection AMR Reference Data Publicly Available
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @examples
|
||||
#' example_isolates
|
||||
#' summary(example_isolates) # see all R/SI results at a glance
|
||||
#' \donttest{
|
||||
#' if (require("skimr")) {
|
||||
#' # class <rsi> supported in skim() too:
|
||||
#' skim(example_isolates)
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' # For INTERPRETING disk diffusion and MIC values -----------------------
|
||||
#'
|
||||
#' # a whole data set, even with combined MIC values and disk zones
|
||||
@ -179,7 +173,7 @@
|
||||
#' example_isolates %>%
|
||||
#' mutate_if(is.rsi.eligible, as.rsi)
|
||||
#'
|
||||
#' # note: from dplyr 1.0.0 on, this will be:
|
||||
#' # since dplyr 1.0.0, this can also be:
|
||||
#' # example_isolates %>%
|
||||
#' # mutate(across(where(is.rsi.eligible), as.rsi))
|
||||
#' }
|
||||
@ -189,7 +183,7 @@ as.rsi <- function(x, ...) {
|
||||
}
|
||||
|
||||
#' @rdname as.rsi
|
||||
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class.
|
||||
#' @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"))
|
||||
@ -796,7 +790,7 @@ exec_as.rsi <- function(method,
|
||||
lookup_lancefield[i],
|
||||
lookup_other[i]))
|
||||
|
||||
if (any(get_record$uti == TRUE, na.rm = TRUE) && message_not_thrown_before("as.rsi", "msg3", ab)) {
|
||||
if (any(get_record$uti == TRUE, na.rm = TRUE) && !any(uti == TRUE, na.rm = TRUE) && message_not_thrown_before("as.rsi", "msg3", ab)) {
|
||||
warning_("in `as.rsi()`: interpretation of ", font_bold(ab_name(ab, 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
|
||||
}
|
||||
@ -818,18 +812,20 @@ exec_as.rsi <- function(method,
|
||||
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) & x[i] %like% "^<[0-9]" ~ "S",
|
||||
isTRUE(conserve_capped_values) & x[i] %like% "^>[0-9]" ~ "R",
|
||||
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()`:
|
||||
x[i] <= get_record$breakpoint_S ~ "S",
|
||||
x[i] >= get_record$breakpoint_R ~ "R",
|
||||
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",
|
||||
# and NA otherwise
|
||||
TRUE ~ NA_character_)
|
||||
} else if (method == "disk") {
|
||||
new_rsi[i] <- quick_case_when(isTRUE(as.double(x[i]) >= as.double(get_record$breakpoint_S)) ~ "S",
|
||||
isTRUE(as.double(x[i]) <= as.double(get_record$breakpoint_R)) ~ "R",
|
||||
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",
|
||||
# and NA otherwise
|
||||
|
@ -28,13 +28,13 @@
|
||||
#' @description Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean.
|
||||
#'
|
||||
#' When negative ('left-skewed'): the left tail is longer; the mass of the distribution is concentrated on the right of a histogram. When positive ('right-skewed'): the right tail is longer; the mass of the distribution is concentrated on the left of a histogram. A normal distribution has a skewness of 0.
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @param x a vector of values, a [matrix] or a [data.frame]
|
||||
#' @param na.rm a [logical] value indicating whether `NA` values should be stripped before the computation proceeds
|
||||
#' @seealso [kurtosis()]
|
||||
#' @rdname skewness
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @export
|
||||
#' @examples
|
||||
#' skewness(runif(1000))
|
||||
skewness <- function(x, na.rm = FALSE) {
|
||||
meet_criteria(na.rm, allow_class = "logical", has_length = 1)
|
||||
UseMethod("skewness")
|
||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
216
R/translate.R
216
R/translate.R
@ -23,132 +23,133 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
#' Translate Strings from AMR Package
|
||||
#' Translate Strings from the AMR Package
|
||||
#'
|
||||
#' For language-dependent output of AMR functions, like [mo_name()], [mo_gramstain()], [mo_type()] and [ab_name()].
|
||||
#' @inheritSection lifecycle Stable Lifecycle
|
||||
#' @details Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: <https://github.com/msberends/AMR/blob/main/data-raw/translations.tsv>. This file will be read by all functions where a translated output can be desired, like all [`mo_*`][mo_property()] functions (such as [mo_name()], [mo_gramstain()], [mo_type()], etc.) and [`ab_*`][ab_property()] functions (such as [ab_name()], [ab_group()], etc.).
|
||||
#' @param x text to translate
|
||||
#' @param lang 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.
|
||||
#'
|
||||
#' Currently supported languages are: `r vector_and(names(LANGUAGES_SUPPORTED), quotes = FALSE)`. All these languages have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
#'
|
||||
#' Please suggest your own translations [by creating a new issue on our repository](https://github.com/msberends/AMR/issues/new?title=Translations).
|
||||
#' Please read about adding or updating a language in [our Wiki](https://github.com/msberends/AMR/wiki/).
|
||||
#'
|
||||
#' ## 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()]), if that language is supported. But the language to be used can be overwritten in two ways and will be checked in this order:
|
||||
#' The system language will be used at default (as returned by `Sys.getenv("LANG")` or, if `LANG` is not set, [Sys.getlocale("LC_COLLATE")]), 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`, e.g. by running `options(AMR_locale = "de")`
|
||||
#' 2. Setting the system variable `LANGUAGE` or `LANG`, e.g. by adding `LANGUAGE="de_DE.utf8"` to your `.Renviron` file in your home directory
|
||||
#' 1. Setting the R option `AMR_locale`, either by using `set_AMR_locale()` or by running e.g. `options(AMR_locale = "de")`.
|
||||
#'
|
||||
#' 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.
|
||||
#' 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.
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
#' @rdname translate
|
||||
#' @name translate
|
||||
#' @export
|
||||
#' @examples
|
||||
#' # The 'language' argument of below functions
|
||||
#' # will be set automatically to your system language
|
||||
#' # with get_AMR_locale()
|
||||
#' # Current settings (based on system language)
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#'
|
||||
#' # English
|
||||
#' mo_name("CoNS", language = "en")
|
||||
#' #> "Coagulase-negative Staphylococcus (CoNS)"
|
||||
#'
|
||||
#' # Danish
|
||||
#' mo_name("CoNS", language = "da")
|
||||
#' #> "Koagulase-negative stafylokokker (KNS)"
|
||||
#' # setting another language
|
||||
#' set_AMR_locale("Greek")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#'
|
||||
#' # Dutch
|
||||
#' mo_name("CoNS", language = "nl")
|
||||
#' #> "Coagulase-negatieve Staphylococcus (CNS)"
|
||||
#' set_AMR_locale("Spanish")
|
||||
#' ab_name("Ciprofloxacin")
|
||||
#' mo_name("Coagulase-negative Staphylococcus")
|
||||
#'
|
||||
#' # set_AMR_locale() understands endonyms, English exonyms, and ISO-639-1:
|
||||
#' set_AMR_locale("Deutsch")
|
||||
#' set_AMR_locale("German")
|
||||
#' set_AMR_locale("de")
|
||||
#'
|
||||
#' # German
|
||||
#' mo_name("CoNS", language = "de")
|
||||
#' #> "Koagulase-negative Staphylococcus (KNS)"
|
||||
#'
|
||||
#' # Italian
|
||||
#' mo_name("CoNS", language = "it")
|
||||
#' #> "Staphylococcus negativo coagulasi (CoNS)"
|
||||
#'
|
||||
#' # Portuguese
|
||||
#' mo_name("CoNS", language = "pt")
|
||||
#' #> "Staphylococcus coagulase negativo (CoNS)"
|
||||
#'
|
||||
#' # Spanish
|
||||
#' mo_name("CoNS", language = "es")
|
||||
#' #> "Staphylococcus coagulasa negativo (SCN)"
|
||||
#' # reset to system default
|
||||
#' reset_AMR_locale()
|
||||
get_AMR_locale <- function() {
|
||||
# AMR versions 1.3.0 and prior used the environmental variable:
|
||||
if (!identical("", Sys.getenv("AMR_locale"))) {
|
||||
options(AMR_locale = Sys.getenv("AMR_locale"))
|
||||
}
|
||||
|
||||
if (!is.null(getOption("AMR_locale", default = NULL))) {
|
||||
lang <- getOption("AMR_locale")
|
||||
if (lang %in% LANGUAGES_SUPPORTED) {
|
||||
return(lang)
|
||||
} else {
|
||||
stop_("unsupported language set as option 'AMR_locale': \"", lang, "\" - use either ",
|
||||
vector_or(paste0('"', LANGUAGES_SUPPORTED, '" (', names(LANGUAGES_SUPPORTED), ")"), quotes = FALSE))
|
||||
}
|
||||
} else {
|
||||
# now check the LANGUAGE system variable - return it if set
|
||||
if (!identical("", Sys.getenv("LANGUAGE"))) {
|
||||
return(coerce_language_setting(Sys.getenv("LANGUAGE")))
|
||||
}
|
||||
if (!identical("", Sys.getenv("LANG"))) {
|
||||
return(coerce_language_setting(Sys.getenv("LANG")))
|
||||
}
|
||||
return(validate_language(getOption("AMR_locale"), extra_txt = "set with `options(AMR_locale = ...)`"))
|
||||
}
|
||||
|
||||
# fallback - automatic determination based on LC_COLLATE
|
||||
if (interactive() && message_not_thrown_before("get_AMR_locale", entire_session = TRUE)) {
|
||||
lang <- coerce_language_setting(Sys.getlocale("LC_COLLATE"))
|
||||
if (lang != "en") {
|
||||
message_("Assuming the ", names(LANGUAGES_SUPPORTED)[LANGUAGES_SUPPORTED == lang],
|
||||
" language for the AMR package. Change this with `options(AMR_locale = \"...\")` or see `?get_AMR_locale()`. ",
|
||||
"Supported languages are ", vector_and(names(LANGUAGES_SUPPORTED), quotes = FALSE),
|
||||
". This note will be shown once per session.")
|
||||
}
|
||||
return(lang)
|
||||
lang <- ""
|
||||
# now check the LANGUAGE system variable - return it if set
|
||||
if (!identical("", Sys.getenv("LANGUAGE"))) {
|
||||
lang <- Sys.getenv("LANGUAGE")
|
||||
}
|
||||
coerce_language_setting(Sys.getlocale("LC_COLLATE"))
|
||||
if (!identical("", Sys.getenv("LANG"))) {
|
||||
lang <- Sys.getenv("LANG")
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
coerce_language_setting <- function(lang) {
|
||||
# grepl() with ignore.case = FALSE is 8x faster than %like_case%
|
||||
if (grepl("^(English|en_|EN_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
# as first option to optimise speed
|
||||
"en"
|
||||
} else if (grepl("^(German|Deutsch|de_|DE_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"de"
|
||||
} else if (grepl("^(Dutch|Nederlands|nl_|NL_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"nl"
|
||||
} else if (grepl("^(Danish|Dansk|da_|DA_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"da"
|
||||
} else if (grepl("^(Spanish|Espa.+ol|es_|ES_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"es"
|
||||
} else if (grepl("^(Italian|Italiano|it_|IT_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"it"
|
||||
} else if (grepl("^(French|Fran.+ais|fr_|FR_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"fr"
|
||||
} else if (grepl("^(Portuguese|Portugu.+s|pt_|PT_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"pt"
|
||||
} else if (grepl("^(Russian|pycc|ru_|RU_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"ru"
|
||||
} else if (grepl("^(Swedish|Svenskt|sv_|SV_)", lang, ignore.case = FALSE, perl = TRUE)) {
|
||||
"sv"
|
||||
} else {
|
||||
# other language -> set to English
|
||||
"en"
|
||||
#' @rdname translate
|
||||
#' @export
|
||||
set_AMR_locale <- function(lang) {
|
||||
lang <- validate_language(lang)
|
||||
options(AMR_locale = lang)
|
||||
message_("Using the ", LANGUAGES_SUPPORTED_NAMES[[lang]]$exonym, " language (", LANGUAGES_SUPPORTED_NAMES[[lang]]$endonym, ") for the AMR package for this session.")
|
||||
}
|
||||
|
||||
#' @rdname translate
|
||||
#' @export
|
||||
reset_AMR_locale <- function() {
|
||||
options(AMR_locale = NULL)
|
||||
}
|
||||
|
||||
#' @rdname translate
|
||||
#' @export
|
||||
translate_AMR <- function(x, language = get_AMR_locale()) {
|
||||
translate_into_language(x, language = language)
|
||||
}
|
||||
|
||||
validate_language <- function(language, extra_txt = character(0)) {
|
||||
if (trimws(tolower(language)) %in% c("en", "english", "", "false", NA)) {
|
||||
return("en")
|
||||
}
|
||||
lang <- find_language(language, 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]]),
|
||||
'" ("' , LANGUAGES_SUPPORTED, '")', collapse = ", "),
|
||||
call = FALSE)
|
||||
lang
|
||||
}
|
||||
|
||||
find_language <- function(lang, fallback = TRUE) {
|
||||
lang <- Map(function(l, n, check = lang) {
|
||||
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)
|
||||
lang <- names(which(lang == TRUE))
|
||||
if (isTRUE(fallback) && length(lang) == 0) {
|
||||
# other language -> set to English
|
||||
lang <- "en"
|
||||
}
|
||||
lang
|
||||
}
|
||||
|
||||
# translate strings based on inst/translations.tsv
|
||||
translate_AMR <- function(from,
|
||||
language = get_AMR_locale(),
|
||||
only_unknown = FALSE,
|
||||
only_affect_ab_names = FALSE,
|
||||
only_affect_mo_names = FALSE) {
|
||||
translate_into_language <- function(from,
|
||||
language = get_AMR_locale(),
|
||||
only_unknown = FALSE,
|
||||
only_affect_ab_names = FALSE,
|
||||
only_affect_mo_names = FALSE) {
|
||||
|
||||
if (is.null(language)) {
|
||||
return(from)
|
||||
@ -162,15 +163,12 @@ translate_AMR <- function(from,
|
||||
from_unique <- unique(from)
|
||||
from_unique_translated <- from_unique
|
||||
|
||||
stop_ifnot(language %in% LANGUAGES_SUPPORTED,
|
||||
"unsupported language: \"", language, "\" - use either ",
|
||||
vector_or(LANGUAGES_SUPPORTED, quotes = TRUE),
|
||||
call = FALSE)
|
||||
|
||||
# get ISO-639-1 of language
|
||||
lang <- validate_language(language)
|
||||
# only keep lines where translation is available for this language
|
||||
df_trans <- df_trans[which(!is.na(df_trans[, language, drop = TRUE])), , drop = FALSE]
|
||||
df_trans <- df_trans[which(!is.na(df_trans[, lang, drop = TRUE])), , drop = FALSE]
|
||||
# and where the original string is not equal to the string in the target language
|
||||
df_trans <- df_trans[which(df_trans[, "pattern", drop = TRUE] != df_trans[, language, drop = TRUE]), , drop = FALSE]
|
||||
df_trans <- df_trans[which(df_trans[, "pattern", drop = TRUE] != df_trans[, lang, drop = TRUE]), , drop = FALSE]
|
||||
if (only_unknown == TRUE) {
|
||||
df_trans <- subset(df_trans, pattern %like% "unknown")
|
||||
}
|
||||
@ -203,7 +201,7 @@ translate_AMR <- function(from,
|
||||
|
||||
lapply(seq_len(nrow(df_trans)),
|
||||
function(i) from_unique_translated <<- gsub(pattern = df_trans$pattern[i],
|
||||
replacement = df_trans[i, language, drop = TRUE],
|
||||
replacement = df_trans[i, lang, drop = TRUE],
|
||||
x = from_unique_translated,
|
||||
ignore.case = !df_trans$case_sensitive[i] & df_trans$regular_expr[i],
|
||||
fixed = !df_trans$regular_expr[i],
|
||||
@ -211,7 +209,7 @@ translate_AMR <- function(from,
|
||||
|
||||
# force UTF-8 for diacritics
|
||||
from_unique_translated <- enc2utf8(from_unique_translated)
|
||||
|
||||
|
||||
# a kind of left join to get all results back
|
||||
from_unique_translated[match(from.bak, from_unique)]
|
||||
}
|
||||
|
14
R/vctrs.R
14
R/vctrs.R
@ -28,8 +28,9 @@
|
||||
# They are to convert AMR-specific classes to bare characters and integers.
|
||||
# All of them will be exported using s3_register() in R/zzz.R when loading the package.
|
||||
|
||||
# S3: ab_selector
|
||||
# see https://github.com/tidyverse/dplyr/issues/5955 why this is required
|
||||
|
||||
# S3: ab_selector
|
||||
vec_ptype2.character.ab_selector <- function(x, y, ...) {
|
||||
x
|
||||
}
|
||||
@ -40,6 +41,17 @@ vec_cast.character.ab_selector <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
}
|
||||
|
||||
# S3: ab_selector_any_all
|
||||
vec_ptype2.logical.ab_selector_any_all <- function(x, y, ...) {
|
||||
x
|
||||
}
|
||||
vec_ptype2.ab_selector_any_all.logical <- function(x, y, ...) {
|
||||
y
|
||||
}
|
||||
vec_cast.logical.ab_selector_any_all <- function(x, to, ...) {
|
||||
unclass(x)
|
||||
}
|
||||
|
||||
# S3: ab
|
||||
vec_ptype2.character.ab <- function(x, y, ...) {
|
||||
x
|
||||
|
@ -35,7 +35,7 @@
|
||||
#' The WHOCC is located in Oslo at the Norwegian Institute of Public Health and funded by the Norwegian government. The European Commission is the executive of the European Union and promotes its general interest.
|
||||
#'
|
||||
#' **NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package.** See <https://www.whocc.no/copyright_disclaimer/.>
|
||||
#' @inheritSection AMR Read more on Our Website!
|
||||
|
||||
#' @name WHOCC
|
||||
#' @rdname WHOCC
|
||||
#' @examples
|
||||
|
15
R/zzz.R
15
R/zzz.R
@ -87,6 +87,9 @@ if (utf8_supported && !is_latex) {
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector.character")
|
||||
s3_register("vctrs::vec_ptype2", "character.ab_selector")
|
||||
s3_register("vctrs::vec_cast", "character.ab_selector")
|
||||
s3_register("vctrs::vec_ptype2", "ab_selector_any_all.logical")
|
||||
s3_register("vctrs::vec_ptype2", "logical.ab_selector_any_all")
|
||||
s3_register("vctrs::vec_cast", "logical.ab_selector_any_all")
|
||||
s3_register("vctrs::vec_ptype2", "disk.integer")
|
||||
s3_register("vctrs::vec_ptype2", "integer.disk")
|
||||
s3_register("vctrs::vec_cast", "integer.disk")
|
||||
@ -106,11 +109,6 @@ if (utf8_supported && !is_latex) {
|
||||
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"))
|
||||
|
||||
# for building the website, only print first 5 rows of a data set
|
||||
# if (Sys.getenv("IN_PKGDOWN") != "" && !interactive()) {
|
||||
# ...
|
||||
# }
|
||||
}
|
||||
|
||||
# Helper functions --------------------------------------------------------
|
||||
@ -131,7 +129,12 @@ create_MO_lookup <- function() {
|
||||
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.
|
||||
MO_lookup$fullname_lower <- MO_FULLNAME_LOWER
|
||||
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/_internals.R\")", call. = FALSE)
|
||||
}
|
||||
|
||||
# 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)
|
||||
|
@ -8,9 +8,7 @@
|
||||
|
||||
<img src="https://msberends.github.io/AMR/AMR_intro.svg" align="center" height="300px" />
|
||||
|
||||
The latest built **source package** (`AMR_latest.tar.gz`) can be found in folder [/data-raw/](https://github.com/msberends/AMR/tree/main/data-raw).
|
||||
|
||||
`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 150 countries.
|
||||
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. It is currently being used in over 175 countries.
|
||||
|
||||
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.
|
||||
|
||||
|
61
_pkgdown.yml
61
_pkgdown.yml
@ -26,14 +26,40 @@
|
||||
title: "AMR (for R)"
|
||||
url: "https://msberends.github.io/AMR/"
|
||||
|
||||
development:
|
||||
mode: "release" # improves indexing by search engines
|
||||
version_tooltip: "Latest development version"
|
||||
template:
|
||||
bootstrap: 5
|
||||
bootswatch: "flatly"
|
||||
assets: "pkgdown/logos" # use logos in this folder
|
||||
bslib:
|
||||
code_font: {google: "Fira Code"}
|
||||
# body-text-align: "justify"
|
||||
line-height-base: 1.75
|
||||
# the green "success" colour of this bootstrap theme should be the same as the green in our logo
|
||||
success: "#128f76"
|
||||
link-color: "#128f76"
|
||||
navbar-padding-y: "0.5rem"
|
||||
opengraph:
|
||||
twitter:
|
||||
creator: "@msberends"
|
||||
site: "@univgroningen"
|
||||
card: summary_large_image
|
||||
|
||||
news:
|
||||
one_page: true
|
||||
cran_dates: true
|
||||
|
||||
footer:
|
||||
structure:
|
||||
left: [devtext]
|
||||
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.png" style="max-width: 200px;"></a>'
|
||||
|
||||
home:
|
||||
sidebar:
|
||||
structure: [toc, links, authors, citation]
|
||||
|
||||
navbar:
|
||||
title: "AMR (for R)"
|
||||
left:
|
||||
@ -73,9 +99,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: "Other: benchmarks"
|
||||
# icon: "fa-shipping-fast"
|
||||
# href: "articles/benchmarks.html"
|
||||
- text: "Manual"
|
||||
icon: "fa-book-open"
|
||||
href: "reference/index.html"
|
||||
@ -102,7 +128,7 @@ reference:
|
||||
- "`as.mo`"
|
||||
- "`mo_property`"
|
||||
- "`mo_source`"
|
||||
|
||||
|
||||
- title: "Preparing data: antibiotics"
|
||||
desc: >
|
||||
Use these functions to get valid properties of antibiotics from any input or to clean your input.
|
||||
@ -112,7 +138,7 @@ reference:
|
||||
- "`ab_property`"
|
||||
- "`ab_from_text`"
|
||||
- "`atc_online_property`"
|
||||
|
||||
|
||||
- title: "Preparing data: antimicrobial resistance"
|
||||
desc: >
|
||||
With `as.mic()` and `as.disk()` you can transform your raw input to valid MIC or disk diffusion values.
|
||||
@ -124,7 +150,7 @@ reference:
|
||||
- "`as.disk`"
|
||||
- "`eucast_rules`"
|
||||
- "`custom_eucast_rules`"
|
||||
|
||||
|
||||
- title: "Analysing data: antimicrobial resistance"
|
||||
desc: >
|
||||
Use these function for the analysis part. You can use `susceptibility()` or `resistance()` on any antibiotic column.
|
||||
@ -161,11 +187,10 @@ reference:
|
||||
- "`catalogue_of_life`"
|
||||
- "`catalogue_of_life_version`"
|
||||
- "`WHOCC`"
|
||||
- "`lifecycle`"
|
||||
- "`example_isolates_unclean`"
|
||||
- "`rsi_translation`"
|
||||
- "`WHONET`"
|
||||
|
||||
|
||||
- title: "Other: miscellaneous functions"
|
||||
desc: >
|
||||
These functions are mostly for internal use, but some of
|
||||
@ -183,7 +208,7 @@ reference:
|
||||
- "`mo_matching_score`"
|
||||
- "`pca`"
|
||||
- "`random`"
|
||||
|
||||
|
||||
- title: "Other: statistical tests"
|
||||
desc: >
|
||||
Some statistical tests or methods are not part of base R and were added to this package for convenience.
|
||||
@ -199,15 +224,3 @@ reference:
|
||||
in a future version.
|
||||
contents:
|
||||
- "`AMR-deprecated`"
|
||||
|
||||
template:
|
||||
bootstrap: 3
|
||||
opengraph:
|
||||
twitter:
|
||||
creator: "@msberends"
|
||||
site: "@univgroningen"
|
||||
card: summary_large_image
|
||||
assets: "pkgdown/logos" # use logos in this folder
|
||||
params:
|
||||
noindex: false
|
||||
bootswatch: "flatly"
|
||||
|
Binary file not shown.
@ -25,7 +25,8 @@
|
||||
|
||||
# some old R instances have trouble installing tinytest, so we ship it too
|
||||
install.packages("data-raw/tinytest_1.3.1.tar.gz", dependencies = c("Depends", "Imports", "LinkingTo"))
|
||||
install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
|
||||
install.packages(getwd(), repos = NULL, type = "source")
|
||||
# install.packages("data-raw/AMR_latest.tar.gz", dependencies = FALSE)
|
||||
|
||||
pkg_suggests <- gsub("[^a-zA-Z0-9]+", "",
|
||||
unlist(strsplit(unlist(packageDescription("AMR",
|
||||
|
@ -29,18 +29,20 @@
|
||||
library(dplyr, warn.conflicts = FALSE)
|
||||
devtools::load_all(quiet = TRUE)
|
||||
|
||||
set_AMR_locale("en")
|
||||
|
||||
old_globalenv <- ls(envir = globalenv())
|
||||
|
||||
# Save internal data to R/sysdata.rda -------------------------------------
|
||||
|
||||
# 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,
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
strip.white = TRUE,
|
||||
na = c(NA, "", NULL)) %>%
|
||||
skip = 10,
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
strip.white = TRUE,
|
||||
na = c(NA, "", NULL)) %>%
|
||||
# take the order of the reference.rule_group column in the original data file
|
||||
mutate(reference.rule_group = factor(reference.rule_group,
|
||||
levels = unique(reference.rule_group),
|
||||
@ -53,34 +55,6 @@ EUCAST_RULES_DF <- utils::read.delim(file = "data-raw/eucast_rules.tsv",
|
||||
mutate(reference.rule_group = as.character(reference.rule_group)) %>%
|
||||
select(-sorting_rule)
|
||||
|
||||
# Translations
|
||||
TRANSLATIONS <- utils::read.delim(file = "data-raw/translations.tsv",
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
blank.lines.skip = TRUE,
|
||||
fill = TRUE,
|
||||
strip.white = TRUE,
|
||||
encoding = "UTF-8",
|
||||
fileEncoding = "UTF-8",
|
||||
na.strings = c(NA, "", NULL),
|
||||
allowEscapes = TRUE, # else "\\1" will be imported as "\\\\1"
|
||||
quote = "")
|
||||
|
||||
# for checking input in `language` argument in e.g. mo_*() and ab_*() functions
|
||||
LANGUAGES_SUPPORTED <- c(Danish = "da",
|
||||
German = "de",
|
||||
English = "en",
|
||||
Spanish = "es",
|
||||
French = "fr",
|
||||
Italian = "it",
|
||||
Dutch = "nl",
|
||||
Portuguese = "pt",
|
||||
Russian = "ru",
|
||||
Swedish = "sv")
|
||||
|
||||
# EXAMPLE_ISOLATES <- readRDS("data-raw/example_isolates.rds")
|
||||
|
||||
# vectors of CoNS and CoPS, improves speed in as.mo()
|
||||
create_species_cons_cops <- function(type = c("CoNS", "CoPS")) {
|
||||
# Determination of which staphylococcal species are CoNS/CoPS according to:
|
||||
@ -137,6 +111,29 @@ 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_FULLNAME_LOWER <- create_MO_fullname_lower()
|
||||
MO_PREVALENT_GENERA <- c("Absidia", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", "Alloprevotella",
|
||||
"Alternaria", "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",
|
||||
"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",
|
||||
"Nectria", "Ochroconis", "Odoribacter", "Oesophagostomum", "Oidiodendron", "Opisthorchis",
|
||||
"Ornithobacterium", "Parabacteroides", "Pediculus", "Pedobacter", "Phlebotomus", "Phocaeicola",
|
||||
"Phocanema", "Phoma", "Piedraia", "Pithomyces", "Pityrosporum", "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",
|
||||
"Weeksella", "Wuchereria")
|
||||
|
||||
# antibiotic groups
|
||||
# (these will also be used for eucast_rules() and understanding data-raw/eucast_rules.tsv)
|
||||
@ -193,13 +190,11 @@ AB_LOOKUP <- create_AB_lookup()
|
||||
|
||||
# Export to package as internal data ----
|
||||
usethis::use_data(EUCAST_RULES_DF,
|
||||
TRANSLATIONS,
|
||||
LANGUAGES_SUPPORTED,
|
||||
# EXAMPLE_ISOLATES,
|
||||
MO_CONS,
|
||||
MO_COPS,
|
||||
MO_STREP_ABCG,
|
||||
MO_FULLNAME_LOWER,
|
||||
MO_PREVALENT_GENERA,
|
||||
AB_LOOKUP,
|
||||
AB_AMINOGLYCOSIDES,
|
||||
AB_AMINOPENICILLINS,
|
||||
@ -252,7 +247,9 @@ changed_md5 <- function(object) {
|
||||
}
|
||||
|
||||
# give official names to ABs and MOs
|
||||
rsi <- dplyr::mutate(rsi_translation, ab = ab_name(ab), mo = mo_name(mo))
|
||||
rsi <- AMR::rsi_translation %>%
|
||||
mutate(mo_name = mo_name(mo, language = NULL), .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/')}"))
|
||||
write_md5(rsi)
|
||||
@ -273,7 +270,7 @@ if (changed_md5(mo)) {
|
||||
try(haven::write_sas(dplyr::select(mo, -snomed), "data-raw/microorganisms.sas"), silent = TRUE)
|
||||
try(haven::write_sav(dplyr::select(mo, -snomed), "data-raw/microorganisms.sav"), silent = TRUE)
|
||||
try(haven::write_dta(dplyr::select(mo, -snomed), "data-raw/microorganisms.dta"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(mo, "data-raw/microorganisms.xlsx"), silent = TRUE)
|
||||
try(openxlsx::write.xlsx(dplyr::select(mo, -snomed), "data-raw/microorganisms.xlsx"), silent = TRUE)
|
||||
}
|
||||
|
||||
if (changed_md5(microorganisms.old)) {
|
||||
@ -312,8 +309,8 @@ if (changed_md5(av)) {
|
||||
}
|
||||
|
||||
# give official names to ABs and MOs
|
||||
intrinsicR <- data.frame(microorganism = mo_name(intrinsic_resistant$mo),
|
||||
antibiotic = ab_name(intrinsic_resistant$ab),
|
||||
intrinsicR <- data.frame(microorganism = mo_name(intrinsic_resistant$mo, language = NULL),
|
||||
antibiotic = ab_name(intrinsic_resistant$ab, language = NULL),
|
||||
stringsAsFactors = FALSE)
|
||||
if (changed_md5(intrinsicR)) {
|
||||
usethis::ui_info(paste0("Saving {usethis::ui_value('intrinsic_resistant')} to {usethis::ui_value('/data-raw/')}"))
|
||||
@ -337,6 +334,8 @@ if (changed_md5(dosage)) {
|
||||
try(openxlsx::write.xlsx(dosage, "data-raw/dosage.xlsx"), silent = TRUE)
|
||||
}
|
||||
|
||||
reset_AMR_locale()
|
||||
|
||||
# remove leftovers from global env
|
||||
current_globalenv <- ls(envir = globalenv())
|
||||
rm(list = current_globalenv[!current_globalenv %in% old_globalenv])
|
||||
|
82
data-raw/_language_update.R
Normal file
82
data-raw/_language_update.R
Normal file
@ -0,0 +1,82 @@
|
||||
# ==================================================================== #
|
||||
# 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/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Run this file to update the languages used in the packages:
|
||||
# source("data-raw/_language_update.R")
|
||||
|
||||
if (!file.exists("DESCRIPTION") || !"Package: AMR" %in% readLines("DESCRIPTION")) {
|
||||
stop("Be sure to run this script in the root location of the AMR package folder.\n",
|
||||
"Working directory expected to contain the DESCRIPTION file of the AMR package.\n",
|
||||
"Current working directory: ", getwd(),
|
||||
call. = FALSE)
|
||||
}
|
||||
|
||||
# save old global env to restore later
|
||||
lang_env <- new.env(hash = FALSE)
|
||||
|
||||
# load current internal data into new env
|
||||
load("R/sysdata.rda", envir = lang_env)
|
||||
|
||||
# replace language objects with updates
|
||||
message("Reading translation file...")
|
||||
lang_env$TRANSLATIONS <- utils::read.delim(file = "data-raw/translations.tsv",
|
||||
sep = "\t",
|
||||
stringsAsFactors = FALSE,
|
||||
header = TRUE,
|
||||
blank.lines.skip = TRUE,
|
||||
fill = TRUE,
|
||||
strip.white = TRUE,
|
||||
encoding = "UTF-8",
|
||||
fileEncoding = "UTF-8",
|
||||
na.strings = c(NA, "", NULL),
|
||||
allowEscapes = TRUE, # else "\\1" will be imported as "\\\\1"
|
||||
quote = "")
|
||||
|
||||
lang_env$LANGUAGES_SUPPORTED_NAMES <- c(list(en = list(exonym = "English", endonym = "English")),
|
||||
lapply(lang_env$TRANSLATIONS[, which(nchar(colnames(lang_env$TRANSLATIONS)) == 2)],
|
||||
function(x) list(exonym = x[1], endonym = x[2])))
|
||||
|
||||
lang_env$LANGUAGES_SUPPORTED <- names(lang_env$LANGUAGES_SUPPORTED_NAMES)
|
||||
|
||||
# save env to internal package data
|
||||
# usethis::use_data() does not allow to save a list :(
|
||||
message("Saving to internal data...")
|
||||
save(list = names(lang_env),
|
||||
file = "R/sysdata.rda",
|
||||
ascii = FALSE,
|
||||
version = 2,
|
||||
compress = "xz",
|
||||
envir = lang_env)
|
||||
|
||||
rm(lang_env)
|
||||
|
||||
if ("roxygen2" %in% utils::installed.packages()) {
|
||||
message("Updating package documentation...")
|
||||
suppressMessages(roxygen2::roxygenise(package.dir = "."))
|
||||
} else {
|
||||
message("NOTE: please install the roxygen2 package to update package documentation, and run this script again.")
|
||||
}
|
||||
|
||||
message("Done!")
|
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.
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.
Binary file not shown.
@ -1 +1 @@
|
||||
ee4434541c7b6529b391d2684748e28b
|
||||
19af89838b60bc8549d4474609629e8d
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -278,9 +278,9 @@
|
||||
"Adelosina duthiersi" "Quinqueloculina duthiersi" "Schlumberger, 1886" 3
|
||||
"Adelosina linneiana" "Pseudotriloculina linneiana" "DOrbigny, 1839" 3
|
||||
"Aecidium ipomoeae-panduratae" "Albugo ipomoeae-panduratae" "Schwein, 1822" 3
|
||||
"Aedimorphus alboannulatus" "Aedes alboannulatus" "Theobald, 1905" 3
|
||||
"Aedimorphus albotaeniatus" "Aedes albotaeniatus" "Theobald, 1903" 3
|
||||
"Aedimorphus australis" "Aedes australis" "Taylor, 1914" 3
|
||||
"Aedimorphus alboannulatus" "Aedes alboannulatus" "Theobald, 1905" 2
|
||||
"Aedimorphus albotaeniatus" "Aedes albotaeniatus" "Theobald, 1903" 2
|
||||
"Aedimorphus australis" "Aedes australis" "Taylor, 1914" 2
|
||||
"Aegyria angustata" "Dysteria angustata" "Claparede et al., 1859" 3
|
||||
"Aegyria astyla" "Dysteria astyla" "Maskell, 1887" 3
|
||||
"Aegyria distyla" "Dysteria distyla" "Maskell, 1887" 3
|
||||
@ -880,7 +880,7 @@
|
||||
"Astacolus subaculeata" "Vaginulinopsis subaculeata" "Cushman, 1923" 3
|
||||
"Astacolus sublegumen" "Vaginulinopsis sublegumen" "Parr, 1950" 3
|
||||
"Asterellina pulchella" "Eoeponidella pulchella" "Parker, 1952" 3
|
||||
"Asterias ocellifera" "Nectria ocellifera" "Lamarck, 1816" 3
|
||||
"Asterias ocellifera" "Nectria ocellifera" "Lamarck, 1816" 2
|
||||
"Asterigerinata pulchella" "Eoeponidella pulchella" "Parker, 1952" 3
|
||||
"Asteromella anthemidis" "Phoma anthemidis" "Ruppr, 1958" 2
|
||||
"Asteromella longissima" "Phoma longissima" "Petr" 2
|
||||
@ -1324,8 +1324,8 @@
|
||||
"Bacteriovorax marinus" "Halobacteriovorax marinus" "Baer et al., 2004" 2
|
||||
"Bacteriovorax starrii" "Peredibacter starrii" "Baer et al., 2000" 2
|
||||
"Bacteroides amylophilus" "Ruminobacter amylophilus" "Hamlin et al., 1956" 1
|
||||
"Bacteroides asaccharolyticus" "Porphyromonas asaccharolytica" "Finegold et al., 1977" 3
|
||||
"Bacteroides barnesiae" "Phocaeicola barnesiae" "Lan et al., 2006" 3
|
||||
"Bacteroides asaccharolyticus" "Porphyromonas asaccharolytica" "Finegold et al., 1977" 2
|
||||
"Bacteroides barnesiae" "Phocaeicola barnesiae" "Lan et al., 2006" 2
|
||||
"Bacteroides bivius" "Prevotella bivia" "Holdeman et al., 1977" 2
|
||||
"Bacteroides buccae" "Prevotella buccae" "Holdeman et al., 1982" 2
|
||||
"Bacteroides buccalis" "Prevotella buccalis" "Shah et al., 1982" 2
|
||||
@ -1333,32 +1333,32 @@
|
||||
"Bacteroides capillus" "Prevotella buccae" "Kornman et al., 1982" 2
|
||||
"Bacteroides cellulosolvens" "Pseudobacteroides cellulosolvens" "Murray et al., 1984" 2
|
||||
"Bacteroides chinchillae" "Bacteroides sartorii" "Kitahara et al., 2011"
|
||||
"Bacteroides chinchillae" "Phocaeicola sartorii" "Kitahara et al., 2011" 3
|
||||
"Bacteroides chinchillae" "Phocaeicola sartorii" "Kitahara et al., 2011" 2
|
||||
"Bacteroides coagulans" "Ezakiella coagulans" "Eggerth et al., 1933" 2
|
||||
"Bacteroides coprocola" "Phocaeicola coprocola" "Kitahara et al., 2005" 3
|
||||
"Bacteroides coprophilus" "Phocaeicola coprophilus" "Hayashi et al., 2016" 3
|
||||
"Bacteroides coprocola" "Phocaeicola coprocola" "Kitahara et al., 2005" 2
|
||||
"Bacteroides coprophilus" "Phocaeicola coprophilus" "Hayashi et al., 2016" 2
|
||||
"Bacteroides corporis" "Prevotella corporis" "Johnson et al., 1983" 2
|
||||
"Bacteroides denticola" "Prevotella denticola" "Shah et al., 1982" 2
|
||||
"Bacteroides disiens" "Prevotella disiens" "Holdeman et al., 1977" 2
|
||||
"Bacteroides distasonis" "Parabacteroides distasonis" "Eggerth et al., 1933" 3
|
||||
"Bacteroides dorei" "Phocaeicola dorei" "Bakir et al., 2016" 3
|
||||
"Bacteroides endodontalis" "Porphyromonas endodontalis" "Van Steenbergen et al., 1984" 3
|
||||
"Bacteroides distasonis" "Parabacteroides distasonis" "Eggerth et al., 1933" 2
|
||||
"Bacteroides dorei" "Phocaeicola dorei" "Bakir et al., 2016" 2
|
||||
"Bacteroides endodontalis" "Porphyromonas endodontalis" "Van Steenbergen et al., 1984" 2
|
||||
"Bacteroides forsythus" "Tannerella forsythia" "Tanner et al., 1986" 3
|
||||
"Bacteroides furcosus" "Anaerorhabdus furcosa" "Hauduroy et al., 1937" 2
|
||||
"Bacteroides gingivalis" "Porphyromonas gingivalis" "Coykendall et al., 1980" 3
|
||||
"Bacteroides goldsteinii" "Parabacteroides goldsteinii" "Song et al., 2006" 3
|
||||
"Bacteroides gingivalis" "Porphyromonas gingivalis" "Coykendall et al., 1980" 2
|
||||
"Bacteroides goldsteinii" "Parabacteroides goldsteinii" "Song et al., 2006" 2
|
||||
"Bacteroides gracilis" "Campylobacter gracilis" "Tanner et al., 1981" 2
|
||||
"Bacteroides heparinolyticus" "Prevotella heparinolytica" "Okuda et al., 1985" 2
|
||||
"Bacteroides hypermegas" "Megamonas hypermegale" "Harrison et al., 1963" 2
|
||||
"Bacteroides intermedius" "Prevotella intermedia" "Johnson et al., 1983" 2
|
||||
"Bacteroides levii" "Porphyromonas levii" "Johnson et al., 1983" 3
|
||||
"Bacteroides levii" "Porphyromonas levii" "Johnson et al., 1983" 2
|
||||
"Bacteroides loescheii" "Prevotella loescheii" "Holdeman et al., 1982" 2
|
||||
"Bacteroides macacae" "Porphyromonas macacae" "Coykendall et al., 1980" 3
|
||||
"Bacteroides massiliensis" "Phocaeicola massiliensis" "Fenner et al., 2016" 3
|
||||
"Bacteroides macacae" "Porphyromonas macacae" "Coykendall et al., 1980" 2
|
||||
"Bacteroides massiliensis" "Phocaeicola massiliensis" "Fenner et al., 2016" 2
|
||||
"Bacteroides melaninogenicus" "Prevotella melaninogenica" "Roy et al., 1982" 2
|
||||
"Bacteroides melaninogenicus intermedius" "Prevotella intermedia" "Holdeman et al., 1970" 2
|
||||
"Bacteroides melaninogenicus macacae" "Porphyromonas macacae" "Slots et al., 1980" 3
|
||||
"Bacteroides merdae" "Parabacteroides merdae" "Johnson et al., 1986" 3
|
||||
"Bacteroides melaninogenicus macacae" "Porphyromonas macacae" "Slots et al., 1980" 2
|
||||
"Bacteroides merdae" "Parabacteroides merdae" "Johnson et al., 1986" 2
|
||||
"Bacteroides microfusus" "Rikenella microfusus" "Kaneuchi et al., 1978" 3
|
||||
"Bacteroides multiacidus" "Mitsuokella multacida" "Mitsuoka et al., 1974" 2
|
||||
"Bacteroides nodosus" "Dichelobacter nodosus" "Mraz, 1963" 1
|
||||
@ -1366,19 +1366,19 @@
|
||||
"Bacteroides oralis" "Prevotella oralis" "Loesche et al., 1964" 2
|
||||
"Bacteroides oris" "Prevotella oris" "Holdeman et al., 1982" 2
|
||||
"Bacteroides oulorum" "Prevotella oulorum" "Shah et al., 1985" 2
|
||||
"Bacteroides paurosaccharolyticus" "Phocaeicola paurosaccharolyticus" "Ueki et al., 2011" 3
|
||||
"Bacteroides paurosaccharolyticus" "Phocaeicola paurosaccharolyticus" "Ueki et al., 2011" 2
|
||||
"Bacteroides pentosaceus" "Prevotella buccae" "Shah et al., 1982" 2
|
||||
"Bacteroides plebeius" "Phocaeicola plebeius" "Kitahara et al., 2005" 3
|
||||
"Bacteroides plebeius" "Phocaeicola plebeius" "Kitahara et al., 2005" 2
|
||||
"Bacteroides pneumosintes" "Dialister pneumosintes" "Holdeman et al., 1970" 2
|
||||
"Bacteroides praeacutus" "Tissierella praeacuta" "Holdeman et al., 1970" 2
|
||||
"Bacteroides putredinis" "Alistipes putredinis" "Kelly, 1957" 3
|
||||
"Bacteroides putredinis" "Alistipes putredinis" "Kelly, 1957" 2
|
||||
"Bacteroides ruminicola" "Prevotella ruminicola" "Bryant et al., 1958" 2
|
||||
"Bacteroides ruminicola brevis" "Prevotella brevis" "Bryant et al., 1958" 2
|
||||
"Bacteroides salanitronis" "Phocaeicola salanitronis" "Lan et al., 2006" 3
|
||||
"Bacteroides salivosus" "Porphyromonas macacae" "Love et al., 1987" 3
|
||||
"Bacteroides salanitronis" "Phocaeicola salanitronis" "Lan et al., 2006" 2
|
||||
"Bacteroides salivosus" "Porphyromonas macacae" "Love et al., 1987" 2
|
||||
"Bacteroides salyersae" "Bacteroides salyersiae" "Song et al., 2005" 2
|
||||
"Bacteroides sartorii" "Phocaeicola sartorii" "Clavel et al., 2012" 3
|
||||
"Bacteroides splanchnicus" "Odoribacter splanchnicus" "Werner et al., 1975" 3
|
||||
"Bacteroides sartorii" "Phocaeicola sartorii" "Clavel et al., 2012" 2
|
||||
"Bacteroides splanchnicus" "Odoribacter splanchnicus" "Werner et al., 1975" 2
|
||||
"Bacteroides succinogenes" "Fibrobacter succinogenes" "Hungate, 1950" 3
|
||||
"Bacteroides suis" "Bacteroides pyogenes" "Benno et al., 1983" 2
|
||||
"Bacteroides tectum" "Bacteroides pyogenes" "Love et al., 2019" 2
|
||||
@ -1386,7 +1386,7 @@
|
||||
"Bacteroides termitidis" "Sebaldella termitidis" "Holdeman et al., 1970" 3
|
||||
"Bacteroides ureolyticus" "Campylobacter ureolyticus" "Jackson et al., 1978" 2
|
||||
"Bacteroides veroralis" "Prevotella veroralis" "Watabe et al., 1983" 2
|
||||
"Bacteroides vulgatus" "Phocaeicola vulgatus" "Hahnke et al., 2016" 3
|
||||
"Bacteroides vulgatus" "Phocaeicola vulgatus" "Hahnke et al., 2016" 2
|
||||
"Bacteroides xylanolyticus" "Hungatella xylanolytica" "Scholten-Koerselman et al., 1988" 2
|
||||
"Bacteroides zoogleoformans" "Prevotella zoogleoformans" "Cato et al., 1982"
|
||||
"Bacteroides zoogleoformans" "Capsularis zoogleoformans" "Cato et al., 1982" 3
|
||||
@ -1650,27 +1650,27 @@
|
||||
"Bolivinita subangularis" "Saidovina subangularis" "Brady, 1881" 3
|
||||
"Bolivinita subangularis lineata" "Saidovina subangularis lineata" "Cushman, 1933" 3
|
||||
"Borelis (Fasciolites) pygmaea" "Neoalveolina pygmaea" "Hanzawa, 1930" 3
|
||||
"Borrelia baltazardi" "Borrelia baltazardii" "Karimi et al., 1983" 3
|
||||
"Borrelia bavariensis" "Borrelia garinii bavariensis" "Margos et al., 2020" 3
|
||||
"Borrelia turdae" "Borrelia turdi" "Fukunaga et al., 1997" 3
|
||||
"Borreliella" "Borrelia" "Adeolu et al., 2015" 3
|
||||
"Borreliella afzelii" "Borrelia afzelii" "Adeolu et al., 2018" 3
|
||||
"Borreliella americana" "Borrelia americana" "Adeolu et al., 2018" 3
|
||||
"Borrelia baltazardi" "Borrelia baltazardii" "Karimi et al., 1983" 2
|
||||
"Borrelia bavariensis" "Borrelia garinii bavariensis" "Margos et al., 2020" 2
|
||||
"Borrelia turdae" "Borrelia turdi" "Fukunaga et al., 1997" 2
|
||||
"Borreliella" "Borrelia" "Adeolu et al., 2015" 2
|
||||
"Borreliella afzelii" "Borrelia afzelii" "Adeolu et al., 2018" 2
|
||||
"Borreliella americana" "Borrelia americana" "Adeolu et al., 2018" 2
|
||||
"Borreliella bavariensis" "Borrelia bavariensis" "Adeolu et al., 2015"
|
||||
"Borreliella bavariensis" "Borrelia garinii bavariensis" "Adeolu et al., 2015" 3
|
||||
"Borreliella bissettiae" "Borrelia bissettiae" "Gupta, 2020" 3
|
||||
"Borreliella burgdorferi" "Borrelia burgdorferi" "Adeolu et al., 2015" 3
|
||||
"Borreliella californiensis" "Borrelia californiensis" "Gupta, 2020" 3
|
||||
"Borreliella carolinensis" "Borrelia carolinensis" "Adeolu et al., 2015" 3
|
||||
"Borreliella garinii" "Borrelia garinii" "Adeolu et al., 2015" 3
|
||||
"Borreliella japonica" "Borrelia japonica" "Adeolu et al., 2015" 3
|
||||
"Borreliella kurtenbachii" "Borrelia kurtenbachii" "Adeolu et al., 2015" 3
|
||||
"Borreliella lanei" "Borrelia lanei" "Gupta, 2020" 3
|
||||
"Borreliella mayonii" "Borrelia mayonii" "Gupta, 2020" 3
|
||||
"Borreliella sinica" "Borrelia sinica" "Adeolu et al., 2015" 3
|
||||
"Borreliella spielmanii" "Borrelia spielmanii" "Adeolu et al., 2015" 3
|
||||
"Borreliella valaisiana" "Borrelia valaisiana" "Adeolu et al., 2018" 3
|
||||
"Borreliella yangtzensis" "Borrelia yangtzensis" "Gupta, 2020" 3
|
||||
"Borreliella bavariensis" "Borrelia garinii bavariensis" "Adeolu et al., 2015" 2
|
||||
"Borreliella bissettiae" "Borrelia bissettiae" "Gupta, 2020" 2
|
||||
"Borreliella burgdorferi" "Borrelia burgdorferi" "Adeolu et al., 2015" 2
|
||||
"Borreliella californiensis" "Borrelia californiensis" "Gupta, 2020" 2
|
||||
"Borreliella carolinensis" "Borrelia carolinensis" "Adeolu et al., 2015" 2
|
||||
"Borreliella garinii" "Borrelia garinii" "Adeolu et al., 2015" 2
|
||||
"Borreliella japonica" "Borrelia japonica" "Adeolu et al., 2015" 2
|
||||
"Borreliella kurtenbachii" "Borrelia kurtenbachii" "Adeolu et al., 2015" 2
|
||||
"Borreliella lanei" "Borrelia lanei" "Gupta, 2020" 2
|
||||
"Borreliella mayonii" "Borrelia mayonii" "Gupta, 2020" 2
|
||||
"Borreliella sinica" "Borrelia sinica" "Adeolu et al., 2015" 2
|
||||
"Borreliella spielmanii" "Borrelia spielmanii" "Adeolu et al., 2015" 2
|
||||
"Borreliella valaisiana" "Borrelia valaisiana" "Adeolu et al., 2018" 2
|
||||
"Borreliella yangtzensis" "Borrelia yangtzensis" "Gupta, 2020" 2
|
||||
"Botryonipha aurantiaca" "Nectria aurantiaca" "Kuntze, 1891" 2
|
||||
"Botryonipha flavipes" "Trichoderma flavipes" "Kuntze, 1891" 2
|
||||
"Botryopyle setosa" "Amphimelissa setosa" "Cleve, 1899" 3
|
||||
@ -1857,9 +1857,9 @@
|
||||
"Buliminoides curta" "Seiglieina curta" "Seiglie, 1965" 3
|
||||
"Buliminoides laevigata" "Fredsmithia laevigata" "Seiglie, 1964" 3
|
||||
"Buliminoides milletti" "Floresina milletti" "Cushman, 1933" 3
|
||||
"Buliminus mantongensis" "Giardia mantongensis" "Kobelt, 1899" 3
|
||||
"Buliminus pharangensis" "Giardia pharangensis" "Dautzenberg et al., 1905" 3
|
||||
"Bulimus siamensis" "Giardia siamensis" "Redfield, 1853" 3
|
||||
"Buliminus mantongensis" "Giardia mantongensis" "Kobelt, 1899" 2
|
||||
"Buliminus pharangensis" "Giardia pharangensis" "Dautzenberg et al., 1905" 2
|
||||
"Bulimus siamensis" "Giardia siamensis" "Redfield, 1853" 2
|
||||
"Bulla ovum" "Ovum ovum" "Linnaeus, 1758" 3
|
||||
"Bullera aurantiaca" "Dioszegia aurantiaca" "Johri et al., 1984" 3
|
||||
"Bullera begoniae" "Bulleribasidium begoniae" "Nakase et al., 2004" 3
|
||||
@ -2009,7 +2009,7 @@
|
||||
"Caliciopsis calicioides" "Exophiala calicioides" "Fitzp, 1920" 2
|
||||
"Calidifontibacillus azotoformans" "Schinkia azotoformans" "Adiguzel et al., 2020" 2
|
||||
"Calidifontibacillus oryziterrae" "Schinkia oryziterrae" "Adiguzel et al., 2020" 2
|
||||
"Calliphora bicolor" "Lucilia bicolor" "Macquart, 1843" 3
|
||||
"Calliphora bicolor" "Lucilia bicolor" "Macquart, 1843" 2
|
||||
"Calomyxa longifila" "Minakatella longifila" "LGKrieglst, 1990" 3
|
||||
"Calonectria calami" "Nectria calami" "Henn et al., 1900" 2
|
||||
"Calonectria citrinoaurantia" "Nectria citrinoaurantia" "Sacc, 1883" 2
|
||||
@ -2302,7 +2302,7 @@
|
||||
"Cavostelium bisporum" "Echinostelium bisporum" "LSOlive et al., 1966" 3
|
||||
"Celeribacter manganoxidans" "Pacificitalea manganoxidans" "Wang et al., 2015" 2
|
||||
"Cellanthus biperforatus" "Elphidium biperforatus" "Whittaker et al., 1979" 3
|
||||
"Cellia pretoriensis" "Anopheles pretoriensis" "Gough, 1910" 3
|
||||
"Cellia pretoriensis" "Anopheles pretoriensis" "Gough, 1910" 2
|
||||
"Cellulomonas cartae" "Cellulosimicrobium cellulans" "Stackebrandt et al., 1980" 2
|
||||
"Cellulomonas cellulans" "Cellulosimicrobium cellulans" "Stackebrandt et al., 1988" 2
|
||||
"Cellulomonas fermentans" "Actinotalea fermentans" "Bagnara et al., 1985" 2
|
||||
@ -2522,11 +2522,11 @@
|
||||
"Chlamydonella distyla" "Wilbertella distyla" "Jankowski, 2007" 3
|
||||
"Chlamydonella polonica" "Chlamydonellopsis polonica" "Foissner et al., 1981" 3
|
||||
"Chlamydonella stricta" "Wilbertiella stricta" "Deroux, 1976" 3
|
||||
"Chlamydophila abortus" "Chlamydia abortus" "Everett et al., 1999" 3
|
||||
"Chlamydophila felis" "Chlamydia felis" "Everett et al., 1999" 3
|
||||
"Chlamydophila pecorum" "Chlamydia pecorum" "Everett et al., 1999" 3
|
||||
"Chlamydophila pneumoniae" "Chlamydia pneumoniae" "Everett et al., 1999" 3
|
||||
"Chlamydophila psittaci" "Chlamydia psittaci" "Everett et al., 1999" 3
|
||||
"Chlamydophila abortus" "Chlamydia abortus" "Everett et al., 1999" 2
|
||||
"Chlamydophila felis" "Chlamydia felis" "Everett et al., 1999" 2
|
||||
"Chlamydophila pecorum" "Chlamydia pecorum" "Everett et al., 1999" 2
|
||||
"Chlamydophila pneumoniae" "Chlamydia pneumoniae" "Everett et al., 1999" 2
|
||||
"Chlamydophila psittaci" "Chlamydia psittaci" "Everett et al., 1999" 2
|
||||
"Chlamydotomus beigelii" "Geotrichum beigelii" "Trevis, 1879" 3
|
||||
"Chlamydozyma pulcherrima" "Metschnikowia pulcherrima" "Wick, 1964" 3
|
||||
"Chlamydozyma reukaufii" "Metschnikowia reukaufii" "Wick, 1964" 3
|
||||
@ -2599,8 +2599,8 @@
|
||||
"Chrysalogonium piramidale" "Acostina piramidale" "Acosta, 1940" 3
|
||||
"Chryseobacterium arothri" "Chryseobacterium hominis" "Campbell et al., 2008" 2
|
||||
"Chryseobacterium greenlandense" "Chryseobacterium aquaticum greenlandense" "Loveland-Curtze et al., 2016" 2
|
||||
"Chryseobacterium meningosepticum" "Elizabethkingia meningoseptica" "Vandamme et al., 1994" 3
|
||||
"Chryseobacterium miricola" "Elizabethkingia miricola" "Li et al., 2004" 3
|
||||
"Chryseobacterium meningosepticum" "Elizabethkingia meningoseptica" "Vandamme et al., 1994" 2
|
||||
"Chryseobacterium miricola" "Elizabethkingia miricola" "Li et al., 2004" 2
|
||||
"Chryseomonas" "Pseudomonas" "Holmes et al., 1987" 1
|
||||
"Chryseomonas luteola" "Pseudomonas luteola" "Holmes et al., 1987" 1
|
||||
"Chryseomonas polytricha" "Pseudomonas luteola" "Holmes et al., 1986" 1
|
||||
@ -3331,11 +3331,11 @@
|
||||
"Cucurbitaria urceolus" "Nectria urceolus" "Kuntze, 1898" 2
|
||||
"Cucurbitaria uredinicola" "Nectria uredinicola" "Kuntze, 1898" 2
|
||||
"Cucurbitaria verrucosa" "Nectria verrucosa" "Kuntze, 1898" 2
|
||||
"Culex auratus" "Aedes auratus" "Leicester, 1908" 3
|
||||
"Culex sticticus" "Aedes sticticus" "Meigen, 1838" 3
|
||||
"Culex sudanensis" "Aedes sudanensis" "Theobald, 1911" 3
|
||||
"Culex sylvaticus" "Aedes sylvaticus" "Meigen, 1818" 3
|
||||
"Culicada annulipes" "Aedes annulipes" "Taylor, 1914" 3
|
||||
"Culex auratus" "Aedes auratus" "Leicester, 1908" 2
|
||||
"Culex sticticus" "Aedes sticticus" "Meigen, 1838" 2
|
||||
"Culex sudanensis" "Aedes sudanensis" "Theobald, 1911" 2
|
||||
"Culex sylvaticus" "Aedes sylvaticus" "Meigen, 1818" 2
|
||||
"Culicada annulipes" "Aedes annulipes" "Taylor, 1914" 2
|
||||
"Cuneolina angusta" "Textulariella angusta" "Cushman, 1919" 3
|
||||
"Cunninghamia infundibulifera" "Choanephora infundibulifera" "Curr, 1873" 3
|
||||
"Cupravidus yeoncheonense" "Cupriavidus yeoncheonensis" "Singh et al., 2015" 2
|
||||
@ -3456,11 +3456,11 @@
|
||||
"Cytophaga diffluens" "Persicobacter diffluens" "Reichenbach, 1989" 3
|
||||
"Cytophaga fermentans" "Saccharicrinis fermentans" "Bachmann, 1955" 3
|
||||
"Cytophaga flevensis" "Flavobacterium flevense" "Van der Meulen et al., 1974" 2
|
||||
"Cytophaga heparina" "Pedobacter heparinus" "Christensen, 1980" 3
|
||||
"Cytophaga heparina" "Pedobacter heparinus" "Christensen, 1980" 2
|
||||
"Cytophaga johnsonae" "Flavobacterium johnsoniae" "Stanier, 1947" 2
|
||||
"Cytophaga latercula" "Aquimarina latercula" "Lewin, 1969" 3
|
||||
"Cytophaga lytica" "Cellulophaga lytica" "Lewin, 1969" 3
|
||||
"Cytophaga marina" "Tenacibaculum maritimum" "Reichenbach, 1989" 3
|
||||
"Cytophaga marina" "Tenacibaculum maritimum" "Reichenbach, 1989" 2
|
||||
"Cytophaga marinoflava" "Leeuwenhoekiella marinoflava" "Reichenbach, 1989" 3
|
||||
"Cytophaga pectinovora" "Flavobacterium pectinovorum" "Reichenbach, 1989" 2
|
||||
"Cytophaga psychrophila" "Flavobacterium psychrophilum" "Reichenbach, 1989" 2
|
||||
@ -3514,11 +3514,11 @@
|
||||
"Defluviimonas pyrenivorans" "Acidimangrovimonas pyrenivorans" "Zhang et al., 2018" 2
|
||||
"Dehalospirillum" "Sulfurospirillum" "Scholz-Muramatsu et al., 2002" 2
|
||||
"Dehalospirillum multivorans" "Sulfurospirillum multivorans" "Scholz-Muramatsu et al., 2002" 2
|
||||
"Deinobacter" "Deinococcus" "Oyaizu et al., 1987" 3
|
||||
"Deinobacter grandis" "Deinococcus grandis" "Oyaizu et al., 1987" 3
|
||||
"Deinobacter" "Deinococcus" "Oyaizu et al., 1987" 2
|
||||
"Deinobacter grandis" "Deinococcus grandis" "Oyaizu et al., 1987" 2
|
||||
"Deinococcus erythromyxa" "Kocuria rosea" "Brooks et al., 1981" 2
|
||||
"Deinococcus mumbaiensis" "Deinococcus ficus" "Shashidhar et al., 2006" 3
|
||||
"Deinococcus xibeiensis" "Deinococcus wulumuqiensis" "Wang et al., 2010" 3
|
||||
"Deinococcus mumbaiensis" "Deinococcus ficus" "Shashidhar et al., 2006" 2
|
||||
"Deinococcus xibeiensis" "Deinococcus wulumuqiensis" "Wang et al., 2010" 2
|
||||
"Dekkeromyces aestuarii" "Kluyveromyces aestuarii" "Kock-Krat, 1982" 3
|
||||
"Dekkeromyces delphensis" "Nakaseomyces delphensis" "Novak et al., 1961" 3
|
||||
"Dekkeromyces dobzhanskii" "Kluyveromyces dobzhanskii" "Santa Maria et al., 1970" 3
|
||||
@ -3745,7 +3745,7 @@
|
||||
"Deuterammina williamsoni" "Lepidodeuterammina williamsoni" "Bronnimann et al., 1988" 3
|
||||
"Devosia nitraria" "Devosia nitrariae" "Xu et al., 2018" 2
|
||||
"Devosia subaequoris" "Devosia soli" "Lee, 2007" 2
|
||||
"Dexiogonimus ciureanus" "Metagonimus ciureanus" "Witenberg, 1929" 3
|
||||
"Dexiogonimus ciureanus" "Metagonimus ciureanus" "Witenberg, 1929" 2
|
||||
"Dexiotricha centralis" "Dexiotrichides centralis" "Stokes, 1885" 3
|
||||
"Diacanthocapsa brevithorax" "Theocapsomma brevithorax" "Dumitrica, 1970" 3
|
||||
"Diachaeella bulbillosa" "Diachea bulbillosa" "Hohn, 1909" 3
|
||||
@ -3772,11 +3772,11 @@
|
||||
"Diaphorobacter polyhydroxybutyrativorans" "Diaphorobacter nitroreducens" "Qiu et al., 2015" 2
|
||||
"Diatoma anceps" "Meridion anceps" "Kirchn" 3
|
||||
"Diatoma hyalina" "Fragilaria hyalina" "Kutzing" 3
|
||||
"Dibothriocephalus archeri" "Diphyllobothrium archeri" "Leiper et al., 1914" 3
|
||||
"Dibothriocephalus hians" "Diphyllobothrium hians" "Luhe, 1899" 3
|
||||
"Dibothriocephalus lashleyi" "Diphyllobothrium lashleyi" "Leiper et al., 1914" 3
|
||||
"Dibothriocephalus pygoscelis" "Diphyllobothrium pygoscelis" "Rennie et al., 1912" 3
|
||||
"Dibothriocephalus schistochilus" "Diphyllobothrium schistochilus" "Germanos, 1895" 3
|
||||
"Dibothriocephalus archeri" "Diphyllobothrium archeri" "Leiper et al., 1914" 2
|
||||
"Dibothriocephalus hians" "Diphyllobothrium hians" "Luhe, 1899" 2
|
||||
"Dibothriocephalus lashleyi" "Diphyllobothrium lashleyi" "Leiper et al., 1914" 2
|
||||
"Dibothriocephalus pygoscelis" "Diphyllobothrium pygoscelis" "Rennie et al., 1912" 2
|
||||
"Dibothriocephalus schistochilus" "Diphyllobothrium schistochilus" "Germanos, 1895" 2
|
||||
"Dicaeoma brassicae" "Alternaria brassicae" "Kuntze, 1898" 2
|
||||
"Dichotomomyces cejpii" "Aspergillus cejpii" "Scott, 1970" 2
|
||||
"Dickeya dieffenbachiae" "Dickeya dadantii dieffenbachiae" "Samson et al., 2005" 1
|
||||
@ -3938,7 +3938,7 @@
|
||||
"Diplodina pedicularis" "Leptosphaeria pedicularis" "Lind, 1924" 2
|
||||
"Diplodinium lunula" "Gymnodinium lunula" "Klebs, 1912" 3
|
||||
"Diplodinium uncinata" "Blepharocorys uncinata" "Fiorentini, 1890" 3
|
||||
"Diplogonoporus balaenopterae" "Diphyllobothrium balaenopterae" "Lonnberg, 1892" 3
|
||||
"Diplogonoporus balaenopterae" "Diphyllobothrium balaenopterae" "Lonnberg, 1892" 2
|
||||
"Diplophrys stercorea" "Sorodiplophrys stercorea" "Cienk, 1876" 3
|
||||
"Diplophysa saprolegniae" "Olpidiopsis saprolegniae" "Schrot, 1886" 3
|
||||
"Diploplenodomus piskorzii" "Phoma piskorzii" "Petr, 1923" 2
|
||||
@ -4105,7 +4105,7 @@
|
||||
"Drechslera spicifera" "Curvularia spicifera" "Arx, 1975" 2
|
||||
"Drechslera subpapendorfii" "Curvularia subpapendorfii" "Mouch, 1975" 2
|
||||
"Drechslera tripogonis" "Curvularia tripogonis" "Patil et al., 1972" 2
|
||||
"Drepanidotaenia dusmeti" "Hymenolepis dusmeti" "Lopez-Neyra, 1942" 3
|
||||
"Drepanidotaenia dusmeti" "Hymenolepis dusmeti" "Lopez-Neyra, 1942" 2
|
||||
"Drepanomonas simulans" "Microthorax simulans" "Kahl, 1926" 3
|
||||
"Drulanta edenshawi" "Parahsuum edenshawi" "Carter, 1988" 3
|
||||
"Drulanta mostleri" "Parahsuum mostleri" "Yeh, 1987" 3
|
||||
@ -4174,8 +4174,8 @@
|
||||
"Eidamia viridescens" "Trichoderma viridescens" "Horne et al., 1923" 2
|
||||
"Eilohedra weddellensis" "Alabaminella weddellensis" "Earland, 1936" 3
|
||||
"Electothigma acuminatus" "Metopus acuminatus" "Jankowski, 1967" 3
|
||||
"Elizabethkingia anophelis endophytica" "Elizabethkingia anophelis" "Garcia-Lopez et al., 2020" 3
|
||||
"Elizabethkingia endophytica" "Elizabethkingia anophelis" "Kampfer et al., 2015" 3
|
||||
"Elizabethkingia anophelis endophytica" "Elizabethkingia anophelis" "Garcia-Lopez et al., 2020" 2
|
||||
"Elizabethkingia endophytica" "Elizabethkingia anophelis" "Kampfer et al., 2015" 2
|
||||
"Elkelangia" "Novosphingopyxis" "Hordt et al., 2020" 2
|
||||
"Elkelangia baekryungensis" "Novosphingopyxis baekryungensis" "Hordt et al., 2020" 2
|
||||
"Ellipsolagena bidens" "Parafissurina bidens" "Cushman, 1930" 3
|
||||
@ -4255,7 +4255,7 @@
|
||||
"Emericella spectabilis" "Aspergillus spectabilis" "Chr, 1978" 2
|
||||
"Emericella unguis" "Aspergillus unguis" "Malloch et al., 1972" 2
|
||||
"Emmonsia crescens" "Ajellomyces crescens" "Emmons et al., 1960" 3
|
||||
"Empedobacter falsenii" "Wautersiella falsenii" "Zhang et al., 2014" 3
|
||||
"Empedobacter falsenii" "Wautersiella falsenii" "Zhang et al., 2014" 2
|
||||
"Enantiocristellaria navicula" "Saracenaria navicula" "DOrbigny, 1840" 3
|
||||
"Encephalitozoon cuniculi" "Nosema cuniculi" "Levaditi et al., 1923" 3
|
||||
"Encephalitozoon ixodis" "Unikaryon ixodis" "Weiser et al., 1975" 3
|
||||
@ -4341,7 +4341,7 @@
|
||||
"Enteridium splendens" "Reticularia splendens" "TMacbr, 1899" 3
|
||||
"Enterobacter aerogenes" "Klebsiella aerogenes" "Hormaeche et al., 1960" 1
|
||||
"Enterobacter agglomerans" "Pantoea agglomerans" "Ewing et al., 1972" 1
|
||||
"Enterobacter amnigenus" "Lelliottia amnigena" "Izard et al., 1981" 1
|
||||
"Enterobacter amnigenus" "Lelliottia amnigena" "Izard et al., 1981" 2
|
||||
"Enterobacter arachidis" "Kosakonia arachidis" "Madhaiyan et al., 2010" 1
|
||||
"Enterobacter cowanii" "Kosakonia cowanii" "Inoue et al., 2001" 1
|
||||
"Enterobacter dissolvens" "Enterobacter cloacae dissolvens" "Brenner et al., 1988" 1
|
||||
@ -4352,7 +4352,7 @@
|
||||
"Enterobacter massiliensis" "Metakosakonia massiliensis" "Lagier et al., 2014"
|
||||
"Enterobacter massiliensis" "Phytobacter massiliensis" "Lagier et al., 2014" 1
|
||||
"Enterobacter muelleri" "Enterobacter asburiae" "Kampfer et al., 2015" 1
|
||||
"Enterobacter nimipressuralis" "Lelliottia nimipressuralis" "Brenner et al., 1988" 1
|
||||
"Enterobacter nimipressuralis" "Lelliottia nimipressuralis" "Brenner et al., 1988" 2
|
||||
"Enterobacter oligotrophica" "Enterobacter oligotrophicus" "Akita et al., 2020" 1
|
||||
"Enterobacter oryzae" "Kosakonia oryzae" "Peng et al., 2009" 1
|
||||
"Enterobacter oryzendophyticus" "Kosakonia oryzendophytica" "Hardoim et al., 2015" 1
|
||||
@ -4527,7 +4527,7 @@
|
||||
"Erwinia herbicola" "Pantoea agglomerans" "Dye, 1964" 1
|
||||
"Erwinia milletiae" "Pantoea agglomerans" "Magrou, 1937" 1
|
||||
"Erwinia nigrifluens" "Brenneria nigrifluens" "Wilson et al., 1957" 1
|
||||
"Erwinia nimipressuralis" "Lelliottia nimipressuralis" "Dye, 1969" 1
|
||||
"Erwinia nimipressuralis" "Lelliottia nimipressuralis" "Dye, 1969" 2
|
||||
"Erwinia paradisiaca" "Dickeya paradisiaca" "Fernandez-Borrero et al., 1970" 1
|
||||
"Erwinia persicinus" "Erwinia persicina" "Hao et al., 1990" 1
|
||||
"Erwinia quercina" "Lonsdalea quercina" "Hildebrand et al., 1967" 1
|
||||
@ -4844,33 +4844,33 @@
|
||||
"Flaviramulus ichthyoenteri" "Wocania ichthyoenteri" "Zhang et al., 2013" 3
|
||||
"Flavirhabdus" "Lacinutrix" "Shakeela et al., 2015" 3
|
||||
"Flavirhabdus iliipiscaria" "Lacinutrix iliipiscaria" "Shakeela et al., 2015" 3
|
||||
"Flavobacterium anatoliense" "Myroides anatoliensis" "Kacagan et al., 2013" 3
|
||||
"Flavobacterium anatoliense" "Myroides anatoliensis" "Kacagan et al., 2013" 2
|
||||
"Flavobacterium balustinum" "Chryseobacterium balustinum" "Harrison, 1929" 2
|
||||
"Flavobacterium bomensis" "Flavobacterium bomense" "Liu et al., 2019" 2
|
||||
"Flavobacterium branchiophila" "Flavobacterium branchiophilum" "Wakabayashi et al., 1989" 2
|
||||
"Flavobacterium breve" "Empedobacter brevis" "Holmes et al., 1982" 3
|
||||
"Flavobacterium breve" "Empedobacter brevis" "Holmes et al., 1982" 2
|
||||
"Flavobacterium capsulatum" "Novosphingobium capsulatum" "Leifson, 1962" 2
|
||||
"Flavobacterium ceti" "Myroides ceti" "Vela et al., 2013" 3
|
||||
"Flavobacterium cloacae" "Myroides cloacae" "Liu et al., 2017" 3
|
||||
"Flavobacterium ceti" "Myroides ceti" "Vela et al., 2013" 2
|
||||
"Flavobacterium cloacae" "Myroides cloacae" "Liu et al., 2017" 2
|
||||
"Flavobacterium daemonensis" "Flavobacterium daemonense" "Ngo et al., 2015" 2
|
||||
"Flavobacterium esteraromaticum" "Microbacterium esteraromaticum" "Bergey et al., 1930" 2
|
||||
"Flavobacterium ferrugineum" "Terrimonas ferruginea" "Sickles et al., 1934" 3
|
||||
"Flavobacterium ferrugineum" "Terrimonas ferruginea" "Sickles et al., 1934" 2
|
||||
"Flavobacterium gleum" "Chryseobacterium gleum" "Holmes et al., 1984" 2
|
||||
"Flavobacterium gondwanense" "Psychroflexus gondwanensis" "Dobson et al., 1993" 3
|
||||
"Flavobacterium halmephilium" "Halomonas halmophila" "Elazari-Volcani, 1940" 1
|
||||
"Flavobacterium halmophilum" "Halomonas halmophila" "Corrig Elazari-Volcani, 1940" 1
|
||||
"Flavobacterium heparinum" "Pedobacter heparinus" "Payza et al., 1956" 3
|
||||
"Flavobacterium heparinum" "Pedobacter heparinus" "Payza et al., 1956" 2
|
||||
"Flavobacterium indologenes" "Chryseobacterium indologenes" "Yabuuchi et al., 1983" 2
|
||||
"Flavobacterium indoltheticum" "Chryseobacterium indoltheticum" "Campbell et al., 1951" 2
|
||||
"Flavobacterium jejuensis" "Flavobacterium jejuense" "Park et al., 2016" 2
|
||||
"Flavobacterium johnsonae" "Flavobacterium johnsoniae" "Bernardet et al., 1996" 2
|
||||
"Flavobacterium kyungheensis" "Flavobacterium kyungheense" "Son et al., 2014" 2
|
||||
"Flavobacterium marinotypicum" "Microbacterium maritypicum" "ZoBell et al., 1944" 2
|
||||
"Flavobacterium marinum" "Myroides aquimaris" "Song et al., 2013" 3
|
||||
"Flavobacterium meningosepticum" "Elizabethkingia meningoseptica" "King, 1959" 3
|
||||
"Flavobacterium mizutaii" "Sphingobacterium mizutaii" "Holmes et al., 1988" 3
|
||||
"Flavobacterium multivorum" "Sphingobacterium multivorum" "Holmes et al., 1981" 3
|
||||
"Flavobacterium odoratum" "Myroides odoratus" "Stutzer, 1929" 3
|
||||
"Flavobacterium marinum" "Myroides aquimaris" "Song et al., 2013" 2
|
||||
"Flavobacterium meningosepticum" "Elizabethkingia meningoseptica" "King, 1959" 2
|
||||
"Flavobacterium mizutaii" "Sphingobacterium mizutaii" "Holmes et al., 1988" 2
|
||||
"Flavobacterium multivorum" "Sphingobacterium multivorum" "Holmes et al., 1981" 2
|
||||
"Flavobacterium odoratum" "Myroides odoratus" "Stutzer, 1929" 2
|
||||
"Flavobacterium okeanokoites" "Planomicrobium okeanokoites" "ZoBell et al., 1944"
|
||||
"Flavobacterium okeanokoites" "Planococcus okeanokoites" "ZoBell et al., 1944" 2
|
||||
"Flavobacterium qiangtangensis" "Flavobacterium qiangtangense" "Huang et al., 2015" 2
|
||||
@ -4878,12 +4878,12 @@
|
||||
"Flavobacterium salegens" "Salegentibacter salegens" "Dobson et al., 1993" 3
|
||||
"Flavobacterium scophthalmum" "Chryseobacterium scophthalmum" "Mudarris et al., 1994" 2
|
||||
"Flavobacterium spartansii" "Flavobacterium tructae" "Loch et al., 2019" 2
|
||||
"Flavobacterium spiritivorum" "Sphingobacterium spiritivorum" "Holmes et al., 1982" 3
|
||||
"Flavobacterium spiritivorum" "Sphingobacterium spiritivorum" "Holmes et al., 1982" 2
|
||||
"Flavobacterium tangerina" "Flavobacterium tangerinum" "Li et al., 2020" 2
|
||||
"Flavobacterium thalpophilum" "Sphingobacterium thalpophilum" "Holmes et al., 1983" 3
|
||||
"Flavobacterium thalpophilum" "Sphingobacterium thalpophilum" "Holmes et al., 1983" 2
|
||||
"Flavobacterium uliginosum" "Zobellia uliginosa" "ZoBell et al., 1944" 3
|
||||
"Flavobacterium viscosus" "Flavobacterium viscosum" "Li et al., 2020" 2
|
||||
"Flavobacterium yabuuchiae" "Sphingobacterium spiritivorum" "Holmes et al., 1988" 3
|
||||
"Flavobacterium yabuuchiae" "Sphingobacterium spiritivorum" "Holmes et al., 1988" 2
|
||||
"Flavobacterium zhairuonensis" "Flavobacterium zhairuonense" "Debnath et al., 2020" 2
|
||||
"Flectobacillus glomeratus" "Polaribacter glomeratus" "McGuire et al., 1988" 3
|
||||
"Flectobacillus marinus" "Cyclobacterium marinum" "Borrall et al., 1978" 3
|
||||
@ -4895,8 +4895,8 @@
|
||||
"Flexibacter filiformis" "Chitinophaga filiformis" "Reichenbach, 1989" 3
|
||||
"Flexibacter japonensis" "Chitinophaga japonensis" "Fujita et al., 1997" 3
|
||||
"Flexibacter litoralis" "Bernardetia litoralis" "Lewin, 1969" 3
|
||||
"Flexibacter maritimus" "Tenacibaculum maritimum" "Wakabayashi et al., 1989" 3
|
||||
"Flexibacter ovolyticus" "Tenacibaculum ovolyticum" "Hansen et al., 1992" 3
|
||||
"Flexibacter maritimus" "Tenacibaculum maritimum" "Wakabayashi et al., 1989" 2
|
||||
"Flexibacter ovolyticus" "Tenacibaculum ovolyticum" "Hansen et al., 1992" 2
|
||||
"Flexibacter polymorphus" "Garritya polymorpha" "Lewin, 1974" 3
|
||||
"Flexibacter psychrophilus" "Flavobacterium psychrophilum" "Bernardet et al., 1989" 2
|
||||
"Flexibacter roseolus" "Hugenholtzia roseola" "Lewin et al., 2016" 3
|
||||
@ -5338,7 +5338,7 @@
|
||||
"Gordonia rubropertinctus" "Gordonia rubripertincta" "Stackebrandt et al., 1989" 2
|
||||
"Gordonibacter faecihominis" "Gordonibacter urolithinfaciens" "Jin et al., 2015" 2
|
||||
"Gottfriedia acidiceler" "Gottfriedia acidiceleris" "Gupta et al., 2020" 2
|
||||
"Grabhamia australis" "Aedes australis" "Strickland, 1911" 3
|
||||
"Grabhamia australis" "Aedes australis" "Strickland, 1911" 2
|
||||
"Grahamella" "Bartonella" "Ristic et al., 1984" 2
|
||||
"Grahamella peromysci" "Bartonella peromysci" "Ristic et al., 1984" 2
|
||||
"Grahamella talpae" "Bartonella talpae" "Ristic et al., 1984" 2
|
||||
@ -5486,20 +5486,20 @@
|
||||
"Haloarcobacter ebronensis" "Halarcobacter ebronensis" "Perez-Cataluna et al., 2019"
|
||||
"Haloarcobacter ebronensis" "Arcobacter ebronensis" "Perez-Cataluna et al., 2019" 2
|
||||
"Haloarcula mukohataei" "Halomicrobium mukohataei" "Ihara et al., 1997" 3
|
||||
"Halobacterium cutirubrum" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
|
||||
"Halobacterium cutirubrum" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
|
||||
"Halobacterium denitrificans" "Haloferax denitrificans" "Tomlinson et al., 1986" 3
|
||||
"Halobacterium distributum" "Halorubrum distributum" "Zvyagintseva et al., 1989" 3
|
||||
"Halobacterium distributus" "Halorubrum distributum" "Zvyagintseva et al., 1989" 3
|
||||
"Halobacterium halobium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
|
||||
"Halobacterium halobium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
|
||||
"Halobacterium lacusprofundi" "Halorubrum lacusprofundi" "Franzmann et al., 1989" 3
|
||||
"Halobacterium mediterranei" "Haloferax mediterranei" "Rodriguez-Valera et al., 1983" 3
|
||||
"Halobacterium pharaonis" "Natronomonas pharaonis" "Soliman et al., 1983" 3
|
||||
"Halobacterium piscisalsi" "Halobacterium salinarum" "Yachai et al., 2008" 3
|
||||
"Halobacterium piscisalsi" "Halobacterium salinarum" "Yachai et al., 2008" 2
|
||||
"Halobacterium saccharovorum" "Halorubrum saccharovorum" "Tomlinson et al., 1977" 3
|
||||
"Halobacterium salinarium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 3
|
||||
"Halobacterium salinarium" "Halobacterium salinarum" "Elazari-Volcani, 1957" 2
|
||||
"Halobacterium sodomense" "Halorubrum sodomense" "Oren, 1983" 3
|
||||
"Halobacterium trapanicum" "Halorubrum trapanicum" "Elazari-Volcani, 1957" 3
|
||||
"Halobacterium vallismortis" "Haloarcula vallismortis" "Gonzalez et al., 1979" 3
|
||||
"Halobacterium vallismortis" "Haloarcula vallismortis" "Gonzalez et al., 1979" 2
|
||||
"Halobacterium volcanii" "Haloferax volcanii" "Mullakhanbhai et al., 1975" 3
|
||||
"Halobacteroides acetoethylicus" "Halanaerobium acetethylicum" "Rengpipat et al., 1989" 2
|
||||
"Halobacteroides lacunaris" "Halanaerobacter lacunarum" "Zhilina et al., 1992" 2
|
||||
@ -5780,7 +5780,7 @@
|
||||
"Hendersonia pinicola" "Hendersonula pinicola" "Trotter, 1972" 2
|
||||
"Hendersonia symploci" "Hendersonula symploci" "Berk et al., 1873" 2
|
||||
"Hennebertia ovalis" "Wardomyces ovalis" "Morelet, 1969" 3
|
||||
"Hepatiarius longissimus" "Opisthorchis longissimus" "Feizullaev, 1961" 3
|
||||
"Hepatiarius longissimus" "Opisthorchis longissimus" "Feizullaev, 1961" 2
|
||||
"Heptameria acuta" "Leptosphaeria acuta" "Cooke, 1889" 2
|
||||
"Heptameria albopunctata" "Leptosphaeria albopunctata" "Cooke, 1889" 2
|
||||
"Heptameria artemisiae" "Leptosphaeria artemisiae" "Cooke, 1889" 2
|
||||
@ -5853,7 +5853,7 @@
|
||||
"Heteroconium chaetospira" "Cladophialophora chaetospira" "Ellis, 1976" 2
|
||||
"Heterolepa haidingeri" "Cibicides haidingeri" "DOrbigny, 1846" 3
|
||||
"Heteropatellina frustratiformis" "Ungulatelloides frustratiformis" "McCulloch, 1977" 3
|
||||
"Heterophyes yokogawai" "Metagonimus yokogawai" "Katsurada, 1912" 3
|
||||
"Heterophyes yokogawai" "Metagonimus yokogawai" "Katsurada, 1912" 2
|
||||
"Heterospiroloculina bikiniensis" "Inaequalina bikiniensis" "McCulloch, 1977" 3
|
||||
"Heterospiroloculina culebraensis" "Inaequalina culebraensis" "McCulloch, 1977" 3
|
||||
"Heterosporium algarum" "Cladosporium algarum" "Cooke et al., 1890" 2
|
||||
@ -5972,8 +5972,8 @@
|
||||
"Huaishuia" "Celeribacter" "Wang et al., 2012" 2
|
||||
"Huaishuia halophila" "Celeribacter halophilus" "Wang et al., 2012" 2
|
||||
"Hughesiella euricoi" "Ceratocystis euricoi" "Bat et al., 1956" 3
|
||||
"Hulecoeteomyia fluviatilis" "Aedes fluviatilis" "Leicester, 1908" 3
|
||||
"Hulecoeteomyia milsoni" "Aedes milsoni" "Taylor, 1916" 3
|
||||
"Hulecoeteomyia fluviatilis" "Aedes fluviatilis" "Leicester, 1908" 2
|
||||
"Hulecoeteomyia milsoni" "Aedes milsoni" "Taylor, 1916" 2
|
||||
"Humicoccus" "Nakamurella" "Yoon et al., 2007" 2
|
||||
"Humicoccus flavidus" "Nakamurella flavida" "Yoon et al., 2007" 2
|
||||
"Humicola minima" "Ochroconis minima" "Fassat, 1967" 2
|
||||
@ -6942,7 +6942,7 @@
|
||||
"Leifsonia pindariensis" "Microterricola pindariensis" "Reddy et al., 2008" 2
|
||||
"Leiotrocha serpularum" "Cyclochaeta serpularum" "Fabre-Domergue, 1888" 3
|
||||
"Leisingera nanhaiensis" "Sedimentitalea nanhaiensis" "Sun et al., 2014" 2
|
||||
"Lelliottia aquatilis" "Lelliottia jeotgali" "Kampfer et al., 2018" 1
|
||||
"Lelliottia aquatilis" "Lelliottia jeotgali" "Kampfer et al., 2018" 2
|
||||
"Lembus armatus" "Philasterides armatus" "Kahl, 1926" 3
|
||||
"Lembus kenti" "Cohnilembus kenti" "Kahl, 1931" 3
|
||||
"Lembus pusillus" "Pseudocohnilembus pusillus" "Quennerstedt, 1869" 3
|
||||
@ -7208,7 +7208,7 @@
|
||||
"Lonsdalea quercina iberica" "Lonsdalea iberica" "Brady et al., 2012" 1
|
||||
"Lonsdalea quercina populi" "Lonsdalea populi" "Toth et al., 2013" 1
|
||||
"Lonsdalea quercina quercina" "Lonsdalea quercina" "Brady et al., 2012" 1
|
||||
"Loossia dobrogiensis" "Metagonimus dobrogiensis" "Ciurea, 1915" 3
|
||||
"Loossia dobrogiensis" "Metagonimus dobrogiensis" "Ciurea, 1915" 2
|
||||
"Lophocorys neatum" "Lophocyrtis neatum" "Sanfilippo, 1990" 3
|
||||
"Lophophyton gallinae" "Microsporum gallinae" "Matr et al., 1899" 3
|
||||
"Loxocephalus colpidiopsis" "Dexiotricha colpidiopsis" "Kahl, 1926" 3
|
||||
@ -7490,7 +7490,7 @@
|
||||
"Mesoflavibacter sabulilitoris" "Mesoflavibacter zeaxanthinifaciens sabulilitoris" "Park et al., 2014" 3
|
||||
"Mesomycoplasma molaris" "Mesomycoplasma molare" "Gupta et al., 2018" 3
|
||||
"Mesonia maritimus" "Mesonia maritima" "Sung et al., 2017" 3
|
||||
"Mesoplasma pleciae" "Acholeplasma pleciae" "Tully et al., 1994" 3
|
||||
"Mesoplasma pleciae" "Acholeplasma pleciae" "Tully et al., 1994" 2
|
||||
"Metacarinina charlesensis" "Laticarinina charlesensis" "McCulloch, 1977" 3
|
||||
"Metacarinina chathamensis" "Laticarinina chathamensis" "McCulloch, 1977" 3
|
||||
"Metacarinina hoodensis" "Laticarinina hoodensis" "McCulloch, 1977" 3
|
||||
@ -7882,7 +7882,7 @@
|
||||
"Monosporium sclerotiale" "Scedosporium sclerotiale" "Pepere, 1914" 3
|
||||
"Monosporium sepedonioides" "Chrysosporium sepedonioides" "Harz, 1872" 3
|
||||
"Moorella thermoautotrophica" "Moorella thermoacetica" "Collins et al., 1994" 2
|
||||
"Moraxella anatipestifer" "Riemerella anatipestifer" "Bruner et al., 1954" 3
|
||||
"Moraxella anatipestifer" "Riemerella anatipestifer" "Bruner et al., 1954" 2
|
||||
"Moraxella phenylpyruvica" "Psychrobacter phenylpyruvicus" "Bovre et al., 1967" 1
|
||||
"Moraxella urethralis" "Oligella urethralis" "Lautrop et al., 1970" 2
|
||||
"Morella entamoebae" "Sphaerita entamoebae" "Perez Reyes, 1964" 3
|
||||
@ -7898,7 +7898,7 @@
|
||||
"Mrazekia niphargi" "Microsporidium niphargi" "Poisson, 1924" 3
|
||||
"Mrazekia piscicola" "Jirovecia piscicola" "Cepede, 1924" 3
|
||||
"Mrazekia tetraspora" "Scipionospora tetraspora" "Leger et al., 1922" 3
|
||||
"Mucidus africanus" "Aedes africanus" "Theobald, 1901" 3
|
||||
"Mucidus africanus" "Aedes africanus" "Theobald, 1901" 2
|
||||
"Mucor angarensis" "Circinella angarensis" "Schostak, 1897" 3
|
||||
"Mucor arrhizus" "Rhizopus arrhizus" "Hagem, 1908" 2
|
||||
"Mucor assamensis" "Hyphomucor assamensis" "Mehrotra et al., 1970" 3
|
||||
@ -7926,7 +7926,7 @@
|
||||
"Muricauda antarctica" "Muricauda taeanensis" "Wu et al., 2013" 3
|
||||
"Muricauda lutea" "Croceivirga lutea" "Wang et al., 2017" 3
|
||||
"Muriicola lacisalsi" "Maritimibacter lacisalsi" "Wang et al., 2021" 2
|
||||
"Musca azurea" "Lucilia azurea" "Doleschall, 1858" 3
|
||||
"Musca azurea" "Lucilia azurea" "Doleschall, 1858" 2
|
||||
"Mya nitens" "Ervilia nitens" "Montagu, 1808" 3
|
||||
"Myceloblastanon albicans" "Candida albicans" "Ota, 1927" 2
|
||||
"Myceloblastanon guilliermondii" "Meyerozyma guilliermondii" "Ota, 1927" 3
|
||||
@ -8221,7 +8221,7 @@
|
||||
"Mycterotrix ovata" "Maryna ovata" "Gelei, 1950" 3
|
||||
"Myllocercion rhodanon" "Schadelfusslerus rhodanon" "Foreman, 1968" 3
|
||||
"Myrionecta rubrum" "Mesodinium rubrum" "Jankowski, 1976" 3
|
||||
"Myroides xuanwuensis" "Myroides odoratimimus xuanwuensis" "Zhang et al., 2014" 3
|
||||
"Myroides xuanwuensis" "Myroides odoratimimus xuanwuensis" "Zhang et al., 2014" 2
|
||||
"Myxococcus coralloides" "Corallococcus coralloides" "Thaxter, 1892" 2
|
||||
"Myxococcus disciformis" "Archangium disciforme" "Thaxter, 1904" 2
|
||||
"Myxococcus flavescens" "Myxococcus virescens" "Yamanaka et al., 1990" 2
|
||||
@ -8231,8 +8231,8 @@
|
||||
"Myxotrichum johnstonii" "Gymnoascus johnstonii" "Massee et al., 1902" 3
|
||||
"Myzocytium humicola" "Myzocytiopsis humicola" "Barron et al., 1975" 3
|
||||
"Myzocytium vermicola" "Myzocytiopsis vermicola" "Fisch, 1892" 3
|
||||
"Myzorhynchus minutus" "Anopheles minutus" "Theobald, 1903" 3
|
||||
"Myzorhynchus pallidus" "Anopheles pallidus" "Swellengrebel, 1919" 3
|
||||
"Myzorhynchus minutus" "Anopheles minutus" "Theobald, 1903" 2
|
||||
"Myzorhynchus pallidus" "Anopheles pallidus" "Swellengrebel, 1919" 2
|
||||
"Mzabimyces" "Halopolyspora" "Saker et al., 2015" 2
|
||||
"Mzabimyces algeriensis" "Halopolyspora algeriensis" "Saker et al., 2015" 2
|
||||
"Naematelia aurantia" "Tremella aurantia" "Burt, 1921" 3
|
||||
@ -9265,8 +9265,8 @@
|
||||
"Orcadella operculata" "Licea operculata" "Wingate, 1889" 3
|
||||
"Orcadella parasitica" "Licea parasitica" "Hagelst, 1942" 3
|
||||
"Orcadella pusilla" "Licea pusilla" "Hagelst, 1942" 3
|
||||
"Oribaculum" "Porphyromonas" "Moore et al., 1994" 3
|
||||
"Oribaculum catoniae" "Porphyromonas catoniae" "Moore et al., 1994" 3
|
||||
"Oribaculum" "Porphyromonas" "Moore et al., 1994" 2
|
||||
"Oribaculum catoniae" "Porphyromonas catoniae" "Moore et al., 1994" 2
|
||||
"Ornatispora frondicola" "Stachybotrys frondicola" "Hyde et al., 1999" 2
|
||||
"Ornatispora gamsii" "Stachybotrys gamsii" "Hyde et al., 1999" 2
|
||||
"Ornatispora nepalensis" "Stachybotrys nepalensis" "Whitton et al., 2012" 2
|
||||
@ -9602,7 +9602,7 @@
|
||||
"Pedobacter huanghensis" "Daejeonella huanghensis" "Qiu et al., 2014" 3
|
||||
"Pedobacter luteus" "Daejeonella lutea" "Oh et al., 2013" 3
|
||||
"Pedobacter oryzae" "Daejeonella oryzae" "Jeon et al., 2009" 3
|
||||
"Pedobacter piscium" "Pedobacter antarcticus" "Steyn et al., 2014" 3
|
||||
"Pedobacter piscium" "Pedobacter antarcticus" "Steyn et al., 2014" 2
|
||||
"Pedobacter ruber" "Daejeonella rubra" "Margesin et al., 2013" 3
|
||||
"Pedobacter saltans" "Pseudopedobacter saltans" "Steyn et al., 1998" 3
|
||||
"Pedobacter tournemirensis" "Arcticibacter tournemirensis" "Urios et al., 2013" 3
|
||||
@ -9828,7 +9828,7 @@
|
||||
"Petersenia andreei" "Sirolpidium andreei" "Sparrow, 1936" 3
|
||||
"Petersenia catenophlyctidis" "Cornumyces catenophlyctidis" "Sundaram, 1968" 3
|
||||
"Petersenia irregularis" "Cornumyces irregularis" "Sparrow, 1943" 3
|
||||
"Petraeus vignei" "Giardia vignei" "Rochebrune, 1882" 3
|
||||
"Petraeus vignei" "Giardia vignei" "Rochebrune, 1882" 2
|
||||
"Petriella boulangeri" "Microascus boulangeri" "Curzi, 1930" 3
|
||||
"Petriellidium boydii" "Pseudallescheria boydii" "Malloch, 1970" 2
|
||||
"Petriellidium desertorum" "Scedosporium desertorum" "Arx et al., 1973" 3
|
||||
@ -9850,8 +9850,8 @@
|
||||
"Phacellium geranii" "Graphium geranii" "Braun, 1993" 3
|
||||
"Phacellium ligulariae" "Graphium ligulariae" "Braun, 1993" 3
|
||||
"Phacellium trifolii" "Graphium trifolii" "Braun, 1993" 3
|
||||
"Phaenicia azurea" "Lucilia azurea" "Robineau-Desvoidy, 1863" 3
|
||||
"Phaenicia pallescens" "Lucilia pallescens" "Shannon, 1924" 3
|
||||
"Phaenicia azurea" "Lucilia azurea" "Robineau-Desvoidy, 1863" 2
|
||||
"Phaenicia pallescens" "Lucilia pallescens" "Shannon, 1924" 2
|
||||
"Phaenicosphaera mammilla" "Hegleria mammilla" "Sheng et al., 1985" 3
|
||||
"Phaeobacter aquaemixtae" "Leisingera aquaemixtae" "Park et al., 2014" 2
|
||||
"Phaeobacter arcticus" "Pseudophaeobacter arcticus" "Zhang et al., 2008" 2
|
||||
@ -9895,7 +9895,7 @@
|
||||
"Phloeophthora syringae" "Phytophthora syringae" "Kleb, 1906" 3
|
||||
"Phloeospora trifolii" "Leptosphaeria trifolii" "Cavara, 1878" 2
|
||||
"Phlyctospora persoonii" "Elaphomyces persoonii" "Corda, 1854" 3
|
||||
"Phocaeicola chinchillae" "Phocaeicola sartorii" "Garcia-Lopez et al., 2020" 3
|
||||
"Phocaeicola chinchillae" "Phocaeicola sartorii" "Garcia-Lopez et al., 2020" 2
|
||||
"Phoma acuta" "Leptosphaeria acuta" "Fuckel, 1870" 2
|
||||
"Phoma errabunda" "Leptosphaeria errabunda" "Desm, 1849" 2
|
||||
"Phoma macrocapsa" "Leptosphaeria macrocapsa" "Trail, 1886" 2
|
||||
@ -10127,7 +10127,7 @@
|
||||
"Plagiotricha camelus" "Trichoda camelus" "Bory, 1824" 3
|
||||
"Plagiotricha sinuata" "Trichoda sinuata" "Bory, 1824" 3
|
||||
"Plagiotricha succisa" "Psilotricha succisa" "Bory, 1824" 3
|
||||
"Planaria punctata" "Fasciola punctata" "Muller, 1776" 3
|
||||
"Planaria punctata" "Fasciola punctata" "Muller, 1776" 2
|
||||
"Planctomyces brasiliensis" "Rubinisphaera brasiliensis" "Schlesner, 1990" 3
|
||||
"Planctomyces limnophilus" "Planctopirus limnophila" "Hirsch et al., 1986" 3
|
||||
"Planctomyces maris" "Gimesia maris" "Bauld et al., 1980" 3
|
||||
@ -10432,8 +10432,8 @@
|
||||
"Porphyrobacter mercurialis" "Croceibacterium mercuriale" "Coil et al., 2016" 2
|
||||
"Porphyrobacter neustonensis" "Erythrobacter neustonensis" "Fuerst et al., 2020" 2
|
||||
"Porphyrobacter sanguineus" "Erythrobacter sanguineus" "Hiraishi et al., 2002" 2
|
||||
"Porphyromonas cansulci" "Porphyromonas crevioricanis" "Collins et al., 1994" 3
|
||||
"Porphyromonas salivosa" "Porphyromonas macacae" "Love et al., 1992" 3
|
||||
"Porphyromonas cansulci" "Porphyromonas crevioricanis" "Collins et al., 1994" 2
|
||||
"Porphyromonas salivosa" "Porphyromonas macacae" "Love et al., 1992" 2
|
||||
"Posadasia esteriformis" "Coccidioides esteriformis" "Canton, 1898" 3
|
||||
"Poseidonibacter lekithochrous" "Arcobacter lekithochrous" "Perez-Cataluna et al., 2019" 2
|
||||
"Pottsiocles hannae" "Manuelophrya hannae" "Guhl, 1985" 3
|
||||
@ -10450,7 +10450,7 @@
|
||||
"Prauserella flava" "Prauserella salsuginis" "Li et al., 2009" 2
|
||||
"Prevotella oulora" "Prevotella oulorum" "Shah et al., 1990" 2
|
||||
"Prevotella ruminicola brevis" "Prevotella brevis" "Shah et al., 1990" 2
|
||||
"Prevotella tannerae" "Alloprevotella tannerae" "Moore et al., 1994" 3
|
||||
"Prevotella tannerae" "Alloprevotella tannerae" "Moore et al., 1994" 2
|
||||
"Prevotella zoogleoformans" "Capsularis zoogleoformans" "Shah et al., 1994" 3
|
||||
"Primorskyibacter insulae" "Pseudoprimorskyibacter insulae" "Park et al., 2015" 2
|
||||
"Procandida albicans" "Candida albicans" "Novak et al., 1961" 2
|
||||
@ -11111,7 +11111,7 @@
|
||||
"Rectocibicidella robertsi" "Dyocibicides robertsi" "McLean, 1956" 3
|
||||
"Rectoglandulina rotundata" "Pseudonodosaria rotundata" "Reuss, 1850" 3
|
||||
"Recurvoides trochamminiformis" "Recurvoidatus trochamminiformis" "Saidova, 1961" 3
|
||||
"Reedomyia sudanensis" "Aedes sudanensis" "Theobald, 1913" 3
|
||||
"Reedomyia sudanensis" "Aedes sudanensis" "Theobald, 1913" 2
|
||||
"Reichenbachia" "Reichenbachiella" "Nedashkovskaya et al., 2003" 3
|
||||
"Reichenbachia agariperforans" "Reichenbachiella agariperforans" "Nedashkovskaya et al., 2003" 3
|
||||
"Remaneica gonzalezi" "Remaneicella gonzalezi" "Seiglie, 1964" 3
|
||||
@ -11462,7 +11462,7 @@
|
||||
"Rotalina truncatulinoides" "Globorotalia truncatulinoides" "DOrbigny, 1839" 3
|
||||
"Rotamorphina minuta" "Valvulineria minuta" "Schubert, 1904" 3
|
||||
"Rothia dentocariosus" "Rothia dentocariosa" "Georg et al., 1967" 2
|
||||
"Roubaudiella caerulea" "Lucilia caerulea" "Seguy, 1925" 3
|
||||
"Roubaudiella caerulea" "Lucilia caerulea" "Seguy, 1925" 2
|
||||
"Rozella itersoniliae" "Pleotrachelus itersoniliae" "Barr et al., 1980" 3
|
||||
"Rozella septigena" "Rozellopsis septigena" "Cornu, 1872" 3
|
||||
"Rozella simulans" "Rozellopsis simulans" "Fisch, 1882" 3
|
||||
@ -11790,16 +11790,16 @@
|
||||
"Septotrochammina gonzalezi" "Remaneicella gonzalezi" "Seiglie, 1964" 3
|
||||
"Serpens" "Pseudomonas" "Hespell, 1977" 1
|
||||
"Serpens flexibilis" "Pseudomonas flexibilis" "Hespell, 1977" 1
|
||||
"Serpula" "Brachyspira" "Stanton et al., 1991" 3
|
||||
"Serpula hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1991" 3
|
||||
"Serpula innocens" "Brachyspira innocens" "Stanton et al., 1991" 3
|
||||
"Serpulina" "Brachyspira" "Stanton, 1992" 3
|
||||
"Serpulina alvinipulli" "Brachyspira alvinipulli" "Stanton et al., 1998" 3
|
||||
"Serpulina hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1992" 3
|
||||
"Serpulina innocens" "Brachyspira innocens" "Stanton et al., 1992" 3
|
||||
"Serpulina intermedia" "Brachyspira intermedia" "Stanton et al., 1997" 3
|
||||
"Serpulina murdochii" "Brachyspira murdochii" "Stanton et al., 1997" 3
|
||||
"Serpulina pilosicoli" "Brachyspira pilosicoli" "Trott et al., 1996" 3
|
||||
"Serpula" "Brachyspira" "Stanton et al., 1991" 2
|
||||
"Serpula hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1991" 2
|
||||
"Serpula innocens" "Brachyspira innocens" "Stanton et al., 1991" 2
|
||||
"Serpulina" "Brachyspira" "Stanton, 1992" 2
|
||||
"Serpulina alvinipulli" "Brachyspira alvinipulli" "Stanton et al., 1998" 2
|
||||
"Serpulina hyodysenteriae" "Brachyspira hyodysenteriae" "Stanton et al., 1992" 2
|
||||
"Serpulina innocens" "Brachyspira innocens" "Stanton et al., 1992" 2
|
||||
"Serpulina intermedia" "Brachyspira intermedia" "Stanton et al., 1997" 2
|
||||
"Serpulina murdochii" "Brachyspira murdochii" "Stanton et al., 1997" 2
|
||||
"Serpulina pilosicoli" "Brachyspira pilosicoli" "Trott et al., 1996" 2
|
||||
"Serratia glossinae" "Serratia fonticola" "Geiger et al., 2010" 1
|
||||
"Serratia marcescens sakuensis" "Serratia marcescens" "Ajithkumar et al., 2003" 1
|
||||
"Serratia marinorubra" "Serratia rubidaea" "ZoBell et al., 1944" 1
|
||||
@ -12111,12 +12111,12 @@
|
||||
"Sphaerulina amicta" "Appendichordella amicta" "Kohlm, 1962" 3
|
||||
"Sphaerulina tanaceti" "Leptosphaeria tanaceti" "Shoemaker, 1976" 2
|
||||
"Sphinctocystis elliptica" "Cymatopleura elliptica" "Kuntze" 3
|
||||
"Sphingobacterium antarcticum" "Pedobacter antarcticus" "Shivaji et al., 1992" 3
|
||||
"Sphingobacterium antarcticus" "Pedobacter antarcticus" "Shivaji et al., 1992" 3
|
||||
"Sphingobacterium heparinum" "Pedobacter heparinus" "Takeuchi et al., 1993" 3
|
||||
"Sphingobacterium mizutae" "Sphingobacterium mizutaii" "Yabuuchi et al., 1983" 3
|
||||
"Sphingobacterium pakistanensis" "Sphingobacterium pakistanense" "Ahmed et al., 2015" 3
|
||||
"Sphingobacterium piscium" "Pedobacter antarcticus" "Takeuchi et al., 1993" 3
|
||||
"Sphingobacterium antarcticum" "Pedobacter antarcticus" "Shivaji et al., 1992" 2
|
||||
"Sphingobacterium antarcticus" "Pedobacter antarcticus" "Shivaji et al., 1992" 2
|
||||
"Sphingobacterium heparinum" "Pedobacter heparinus" "Takeuchi et al., 1993" 2
|
||||
"Sphingobacterium mizutae" "Sphingobacterium mizutaii" "Yabuuchi et al., 1983" 2
|
||||
"Sphingobacterium pakistanensis" "Sphingobacterium pakistanense" "Ahmed et al., 2015" 2
|
||||
"Sphingobacterium piscium" "Pedobacter antarcticus" "Takeuchi et al., 1993" 2
|
||||
"Sphingobium algicola" "Sphingobium limneticum" "Lee et al., 2017" 2
|
||||
"Sphingobium barthaii" "Sphingobium fuliginis" "Maeda et al., 2015" 2
|
||||
"Sphingobium chinhatense" "Sphingobium indicum" "Dadhwal et al., 2020" 2
|
||||
@ -12415,7 +12415,7 @@
|
||||
"Staurosphaera pusilla" "Stigmosphaerostylus pusilla" "Hinde, 1899" 3
|
||||
"Staurosphaera sedecimporata" "Emiluvia sedecimporata" "Rust, 1885" 3
|
||||
"Staurosphaera trispinosa" "Staurolonche trispinosa" "Kozur et al., 1979" 3
|
||||
"Stegomyia wellmanii" "Aedes wellmanii" "Theobald, 1910" 3
|
||||
"Stegomyia wellmanii" "Aedes wellmanii" "Theobald, 1910" 2
|
||||
"Steinia balladynula" "Oxytricha balladynula" "Kahl, 1932" 3
|
||||
"Steinia candens" "Cyrtohymena candens" "Kahl, 1932" 3
|
||||
"Steinia citrina" "Cyrtohymena citrina" "Berger et al., 1987" 3
|
||||
@ -12487,7 +12487,7 @@
|
||||
"Stemphylium uredinis" "Alternaria uredinis" "Thirum, 1947" 2
|
||||
"Stenella gynoxidicola" "Cladosporium gynoxidicola" "Mulder, 1982" 2
|
||||
"Stenopterobia delicatissima" "Surirella delicatissima" "Van Heurck, 1896" 3
|
||||
"Stenoscutus africanus" "Aedes africanus" "Theobald, 1909" 3
|
||||
"Stenoscutus africanus" "Aedes africanus" "Theobald, 1909" 2
|
||||
"Stenothermobacter" "Nonlabens" "Lau et al., 2006" 3
|
||||
"Stenothermobacter spongiae" "Nonlabens spongiae" "Lau et al., 2006" 3
|
||||
"Stenotrophomonas africana" "Stenotrophomonas maltophilia" "Drancourt et al., 1997" 1
|
||||
@ -12889,7 +12889,7 @@
|
||||
"Strombidium viride" "Limnostrombidium viride" "Kahl, 1932" 3
|
||||
"Strombilidium tonsuratum" "Strobilidium tonsuratum" "Meunier, 1907" 3
|
||||
"Strongylidium wilberti" "Hemiamphisiella wilberti" "Foissner, 1982" 3
|
||||
"Strophalosia warwicki" "Capillaria warwicki" "Maxwell, 1954" 3
|
||||
"Strophalosia warwicki" "Capillaria warwicki" "Maxwell, 1954" 2
|
||||
"Stylocapsa catenarum" "Plicaforacapsa catenarum" "Matsuoka, 1982" 3
|
||||
"Stylocapsa oblongula" "Kilinora oblongula" "Kocher, 1981" 3
|
||||
"Stylocapsa spiralis" "Kilinora spiralis" "Matsuoka, 1982" 3
|
||||
@ -12986,7 +12986,7 @@
|
||||
"Tachysoma siseris" "Oxytricha siseris" "Stiller, 1974" 3
|
||||
"Tachysoma tricornis" "Oxytricha tricornis" "Milne, 1886" 3
|
||||
"Taeniolella boppii" "Cladophialophora boppii" "Borelli, 1983" 2
|
||||
"Taeniorhynchus africanus" "Aedes africanus" "Neveu-Lemaire, 1906" 3
|
||||
"Taeniorhynchus africanus" "Aedes africanus" "Neveu-Lemaire, 1906" 2
|
||||
"Talaromyces brevicompactus" "Hamigera brevicompactus" "Kong, 1999" 3
|
||||
"Talaromyces byssochlamydoides" "Rasamsonia byssochlamydoides" "Stolk et al., 1972" 3
|
||||
"Talaromyces cejpii" "Aspergillus cejpii" "Milko, 1964" 2
|
||||
@ -13539,8 +13539,8 @@
|
||||
"Tremella simplex" "Phaeotremella simplex" "Jacks et al., 1940" 3
|
||||
"Tremella translucens" "Sirotrema translucens" "Gordon, 1938" 3
|
||||
"Treponema caldaria" "Treponema caldarium" "Abt et al., 2013" 2
|
||||
"Treponema hyodysenteriae" "Brachyspira hyodysenteriae" "Harris et al., 1972" 3
|
||||
"Treponema innocens" "Brachyspira innocens" "Kinyon et al., 1979" 3
|
||||
"Treponema hyodysenteriae" "Brachyspira hyodysenteriae" "Harris et al., 1972" 2
|
||||
"Treponema innocens" "Brachyspira innocens" "Kinyon et al., 1979" 2
|
||||
"Treponema stenostrepta" "Treponema stenostreptum" "Abt et al., 2013" 2
|
||||
"Tretomphalus bermudezi" "Cymbaloporetta bermudezi" "Sellier de Civrieux, 1976" 3
|
||||
"Tretomphalus concinnus" "Tretomphaloides concinnus" "Brady, 1884" 3
|
||||
@ -14161,7 +14161,7 @@
|
||||
"Wautersia paucula" "Cupriavidus pauculus" "Vaneechoutte et al., 2004" 2
|
||||
"Wautersia respiraculi" "Cupriavidus respiraculi" "Vaneechoutte et al., 2004" 2
|
||||
"Wautersia taiwanensis" "Cupriavidus taiwanensis" "Vaneechoutte et al., 2004" 2
|
||||
"Weeksella zoohelcum" "Bergeyella zoohelcum" "Holmes et al., 1987" 3
|
||||
"Weeksella zoohelcum" "Bergeyella zoohelcum" "Holmes et al., 1987" 2
|
||||
"Weiseria spinosa" "Golbergia spinosa" "Golberg, 1971" 3
|
||||
"Weissella jogaejeotgali" "Weissella thailandensis" "Lee et al., 2015" 2
|
||||
"Weissella kimchii" "Weissella cibaria" "Choi et al., 2002" 2
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1 +1 @@
|
||||
638a06636d8b547c2cb9d1ec243ecb7e
|
||||
348a6773a1e8e1e7255ca8961581a766
|
||||
|
@ -168,32 +168,6 @@ rm(ref_taxonomy)
|
||||
rm(data_col.bak)
|
||||
rm(data_dsmz.bak)
|
||||
|
||||
mo_found_in_NL <- c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma",
|
||||
"Angiostrongylus", "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus",
|
||||
"Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", "Beauveria",
|
||||
"Bilophilia", "Blastocystis", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Candida", "Capillaria",
|
||||
"Capnocytophaga", "Catabacter", "Cdc", "Chaetomium", "Chilomastix", "Chryseobacterium",
|
||||
"Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus",
|
||||
"Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium",
|
||||
"Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria", "Dracunculus", "Echinococcus",
|
||||
"Echinostoma", "Elisabethkingia", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala",
|
||||
"Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium",
|
||||
"Giardia", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces",
|
||||
"Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia",
|
||||
"Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", "Malassezia",
|
||||
"Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas",
|
||||
"Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", "Nanophetus", "Nattrassia",
|
||||
"Necator", "Nectria", "Novospingobium", "Ochroconis", "Oesophagostomum", "Oidiodendron", "Onchocerca",
|
||||
"Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus", "Phlebotomus",
|
||||
"Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella",
|
||||
"Pseudallescheria", "Pseudoterranova", "Pulex", "Retortamonas", "Rhizomucor", "Rhizopus",
|
||||
"Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", "Schistosoma",
|
||||
"Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys",
|
||||
"Stenotrophomononas", "Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia",
|
||||
"Ternidens", "Torulopsis", "Toxocara", "Toxoplasma", "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma",
|
||||
"Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium",
|
||||
"Trombicula", "Trypanosoma", "Tunga", "Ureaplasma", "Wuchereria")
|
||||
|
||||
MOs <- data_total %>%
|
||||
filter(
|
||||
(
|
||||
@ -205,7 +179,7 @@ MOs <- data_total %>%
|
||||
& !order %in% c("Eurotiales", "Microascales", "Mucorales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales"))
|
||||
)
|
||||
# or the genus has to be one of the genera we found in our hospitals last decades (Northern Netherlands, 2002-2018)
|
||||
| genus %in% mo_found_in_NL
|
||||
| genus %in% MO_PREVALENT_GENERA
|
||||
) %>%
|
||||
# really no Plantae (e.g. Dracunculus exist both as worm and as plant)
|
||||
filter(kingdom != "Plantae") %>%
|
||||
@ -398,7 +372,7 @@ MOs <- MOs %>%
|
||||
"Firmicutes",
|
||||
"Actinobacteria",
|
||||
"Sarcomastigophora")
|
||||
| genus %in% mo_found_in_NL
|
||||
| genus %in% MO_PREVALENT_GENERA
|
||||
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
|
||||
~ 2,
|
||||
TRUE ~ 3
|
||||
|
@ -276,18 +276,7 @@ MOs <- MOs %>%
|
||||
"Firmicutes",
|
||||
"Actinobacteria",
|
||||
"Sarcomastigophora")
|
||||
| genus %in% c("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", "Ureaplasma")
|
||||
| genus %in% MO_PREVALENT_GENERA
|
||||
| rank %in% c("kingdom", "phylum", "class", "order", "family"))
|
||||
~ 2,
|
||||
TRUE ~ 3
|
||||
|
@ -24,6 +24,7 @@
|
||||
# ==================================================================== #
|
||||
|
||||
# This script runs in under a minute and renews all guidelines of CLSI and EUCAST!
|
||||
# Run it with source("data-raw/reproduction_of_rsi_translation.R")
|
||||
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
@ -32,9 +33,9 @@ library(AMR)
|
||||
|
||||
# Install the WHONET software on Windows (http://www.whonet.org/software.html),
|
||||
# and copy the folder C:\WHONET\Codes to data-raw/WHONET/Codes
|
||||
DRGLST <- readr::read_tsv("data-raw/WHONET/Codes/DRGLST.txt", na = c("", "NA", "-"))
|
||||
DRGLST1 <- readr::read_tsv("data-raw/WHONET/Codes/DRGLST1.txt", na = c("", "NA", "-"))
|
||||
ORGLIST <- readr::read_tsv("data-raw/WHONET/Codes/ORGLIST.txt", na = c("", "NA", "-"))
|
||||
DRGLST <- read_tsv("data-raw/WHONET/Codes/DRGLST.txt", na = c("", "NA", "-"), show_col_types = FALSE)
|
||||
DRGLST1 <- read_tsv("data-raw/WHONET/Codes/DRGLST1.txt", na = c("", "NA", "-"), show_col_types = FALSE)
|
||||
ORGLIST <- read_tsv("data-raw/WHONET/Codes/ORGLIST.txt", na = c("", "NA", "-"), show_col_types = FALSE)
|
||||
|
||||
# create data set for generic rules (i.e., AB-specific but not MO-specific)
|
||||
rsi_generic <- DRGLST %>%
|
||||
@ -128,11 +129,30 @@ rsi_translation[which(rsi_translation$breakpoint_R == 257), "breakpoint_R"] <- m
|
||||
rsi_translation[which(rsi_translation$breakpoint_R == 513), "breakpoint_R"] <- m[which(m == 512) + 1]
|
||||
rsi_translation[which(rsi_translation$breakpoint_R == 1025), "breakpoint_R"] <- m[which(m == 1024) + 1]
|
||||
|
||||
# WHONET adds one log2 level to the R breakpoint for their software, e.g. in AMC in Enterobacterales:
|
||||
# EUCAST 2021 guideline: S <= 8 and R > 8
|
||||
# WHONET file: S <= 8 and R >= 16
|
||||
# this will make an MIC of 12 I, which should be R, so:
|
||||
eucast_mics <- which(rsi_translation$guideline %like% "EUCAST" &
|
||||
rsi_translation$method == "MIC" &
|
||||
log2(as.double(rsi_translation$breakpoint_R)) - log2(as.double(rsi_translation$breakpoint_S)) != 0 &
|
||||
!is.na(rsi_translation$breakpoint_R))
|
||||
old_R <- rsi_translation[eucast_mics, "breakpoint_R", drop = TRUE]
|
||||
old_S <- rsi_translation[eucast_mics, "breakpoint_S", drop = TRUE]
|
||||
new_R <- 2 ^ (log2(old_R) - 1)
|
||||
new_R[new_R < old_S | is.na(as.mic(new_R))] <- old_S[new_R < old_S | is.na(as.mic(new_R))]
|
||||
rsi_translation[eucast_mics, "breakpoint_R"] <- new_R
|
||||
eucast_disks <- which(rsi_translation$guideline %like% "EUCAST" &
|
||||
rsi_translation$method == "DISK" &
|
||||
rsi_translation$breakpoint_S - rsi_translation$breakpoint_R != 0 &
|
||||
!is.na(rsi_translation$breakpoint_R))
|
||||
rsi_translation[eucast_disks, "breakpoint_R"] <- rsi_translation[eucast_disks, "breakpoint_R", drop = TRUE] + 1
|
||||
|
||||
# Greek symbols and EM dash symbols are not allowed by CRAN, so replace them with ASCII:
|
||||
rsi_translation$disk_dose <- gsub("μ", "u", rsi_translation$disk_dose, fixed = TRUE)
|
||||
rsi_translation$disk_dose <- gsub("–", "-", rsi_translation$disk_dose, fixed = TRUE)
|
||||
|
||||
# save to package
|
||||
usethis::use_data(rsi_translation, overwrite = TRUE)
|
||||
usethis::use_data(rsi_translation, overwrite = TRUE, compress = "xz")
|
||||
rm(rsi_translation)
|
||||
devtools::load_all(".")
|
||||
|
@ -1 +1 @@
|
||||
d8083b68d4e492ea8e87c1eae4da4196
|
||||
75a10b41a8bd4f4788520f3407431e66
|
||||
|
Binary file not shown.
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