mirror of https://github.com/msberends/AMR.git
guess_mo deprecation
This commit is contained in:
parent
5c6ff1bbda
commit
0205b6178d
70
DESCRIPTION
70
DESCRIPTION
|
@ -1,70 +0,0 @@
|
|||
Package: AMR
|
||||
Version: 0.5.0.9009
|
||||
Date: 2019-01-05
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(
|
||||
given = c("Matthijs", "S."),
|
||||
family = "Berends",
|
||||
email = "m.s.berends@umcg.nl",
|
||||
role = c("aut", "cre"),
|
||||
comment = c(ORCID = "0000-0001-7620-1800")),
|
||||
person(
|
||||
given = c("Christian", "F."),
|
||||
family = "Luz",
|
||||
email = "c.f.luz@umcg.nl",
|
||||
role = c("aut", "rev"),
|
||||
comment = c(ORCID = "0000-0001-5809-5995")),
|
||||
person(
|
||||
given = c("Erwin", "E.", "A."),
|
||||
family = "Hassing",
|
||||
email = "e.hassing@certe.nl",
|
||||
role = "ctb"),
|
||||
person(
|
||||
given = "Corinna",
|
||||
family = "Glasner",
|
||||
email = "c.glasner@umcg.nl",
|
||||
role = c("aut", "ths"),
|
||||
comment = c(ORCID = "0000-0003-1241-1328")),
|
||||
person(
|
||||
given = c("Alex", "W."),
|
||||
family = "Friedrich",
|
||||
email = "alex.friedrich@umcg.nl",
|
||||
role = c("aut", "ths"),
|
||||
comment = c(ORCID = "0000-0003-4881-038X")),
|
||||
person(
|
||||
given = c("Bhanu", "N.", "M."),
|
||||
family = "Sinha",
|
||||
email = "b.sinha@umcg.nl",
|
||||
role = c("aut", "ths"),
|
||||
comment = c(ORCID = "0000-0003-1634-0010")))
|
||||
Description: Functions to simplify the analysis and prediction of Antimicrobial
|
||||
Resistance (AMR) and to work with microbial and antimicrobial properties by
|
||||
using evidence-based methods.
|
||||
Depends:
|
||||
R (>= 3.1.0)
|
||||
Imports:
|
||||
backports,
|
||||
curl,
|
||||
crayon (>= 1.3.0),
|
||||
data.table (>= 1.9.0),
|
||||
dplyr (>= 0.7.0),
|
||||
hms,
|
||||
knitr (>= 1.0.0),
|
||||
rlang (>= 0.2.0),
|
||||
rvest (>= 0.3.2),
|
||||
tidyr (>= 0.7.0),
|
||||
xml2 (>= 1.0.0)
|
||||
Suggests:
|
||||
covr (>= 3.0.1),
|
||||
ggplot2,
|
||||
rmarkdown,
|
||||
rstudioapi,
|
||||
testthat (>= 1.0.2)
|
||||
VignetteBuilder: knitr
|
||||
URL: https://msberends.gitlab.io/AMR, https://gitlab.com/msberends/AMR
|
||||
BugReports: https://gitlab.com/msberends/AMR/issues
|
||||
License: GPL-2 | file LICENSE
|
||||
Encoding: UTF-8
|
||||
LazyData: true
|
||||
RoxygenNote: 6.1.1
|
1
NEWS.md
1
NEWS.md
|
@ -28,6 +28,7 @@
|
|||
* New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the *G*-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.
|
||||
|
||||
#### Changed
|
||||
* Function `guess_mo()` is now deprecated in favour of `as.mo()` and will be remover in future versions
|
||||
* Fixed a critical bug in `eucast_rules()` where some rules that depend on previous applied rules would not be applied adequately
|
||||
* Improvements for `as.mo()`:
|
||||
* Finds better results when input is in other languages
|
||||
|
|
|
@ -46,3 +46,10 @@ ratio <- function(x, ratio) {
|
|||
}
|
||||
sum(x, na.rm = TRUE) * (ratio / sum(ratio, na.rm = TRUE))
|
||||
}
|
||||
|
||||
#' @rdname AMR-deprecated
|
||||
#' @exported
|
||||
guess_mo <- function(...) {
|
||||
.Deprecated(new = "as.mo", package = "AMR")
|
||||
as.mo(...)
|
||||
}
|
||||
|
|
14
R/mo.R
14
R/mo.R
|
@ -76,7 +76,6 @@
|
|||
#' \item{\code{"D. spartina"}. This is the abbreviation of an old taxonomic name: \emph{Didymosphaeria spartinae} (the last "e" was missing from the input). This fungus was renamed to \emph{Leptosphaeria obiones}, so a warning will be thrown that this result (\code{F_LPTSP_OBI}) needs review.}
|
||||
#' }
|
||||
#'
|
||||
#' \code{guess_mo} is an alias of \code{as.mo}.
|
||||
#' @inheritSection itis ITIS
|
||||
# (source as a section, so it can be inherited by other man pages)
|
||||
#' @section Source:
|
||||
|
@ -109,12 +108,11 @@
|
|||
#' as.mo("GAS") # Group A Streptococci
|
||||
#' as.mo("GBS") # Group B Streptococci
|
||||
#'
|
||||
#' # guess_mo is an alias of as.mo and works the same
|
||||
#' guess_mo("S. epidermidis") # will remain species: B_STPHY_EPI
|
||||
#' guess_mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CNS
|
||||
#' as.mo("S. epidermidis") # will remain species: B_STPHY_EPI
|
||||
#' as.mo("S. epidermidis", Becker = TRUE) # will not remain species: B_STPHY_CNS
|
||||
#'
|
||||
#' guess_mo("S. pyogenes") # will remain species: B_STRPTC_PYO
|
||||
#' guess_mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA
|
||||
#' as.mo("S. pyogenes") # will remain species: B_STRPTC_PYO
|
||||
#' as.mo("S. pyogenes", Lancefield = TRUE) # will not remain species: B_STRPTC_GRA
|
||||
#'
|
||||
#' # Use mo_* functions to get a specific property based on `mo`
|
||||
#' Ecoli <- as.mo("E. coli") # returns `B_ESCHR_COL`
|
||||
|
@ -154,10 +152,6 @@ is.mo <- function(x) {
|
|||
identical(class(x), "mo")
|
||||
}
|
||||
|
||||
#' @rdname as.mo
|
||||
#' @export
|
||||
guess_mo <- as.mo
|
||||
|
||||
#' @importFrom dplyr %>% pull left_join n_distinct progress_estimated
|
||||
#' @importFrom data.table data.table as.data.table setkey
|
||||
#' @importFrom crayon magenta red italic
|
||||
|
|
|
@ -71,6 +71,12 @@ navbar:
|
|||
href: 'LICENSE-text.html'
|
||||
|
||||
reference:
|
||||
- title: Backround information
|
||||
desc: >
|
||||
Some pages about our package and its external sources.
|
||||
contents:
|
||||
- 'AMR'
|
||||
- itis
|
||||
- title: Cleaning your data
|
||||
desc: >
|
||||
Functions for cleaning and optimising your data, to be able
|
||||
|
@ -79,6 +85,7 @@ reference:
|
|||
contents:
|
||||
- starts_with("as.")
|
||||
- '`eucast_rules`'
|
||||
- '`guess_ab`'
|
||||
- '`read.4D`'
|
||||
- title: Adding variables to your data
|
||||
desc: >
|
||||
|
|
|
@ -102,36 +102,36 @@ test_that("as.mo works", {
|
|||
c(NA_character_, NA_character_, "B_STNTR_MAL", "B_KLBSL_PNE_RHI", "B_ESCHR_COL"))
|
||||
|
||||
# check for Becker classification
|
||||
expect_identical(as.character(guess_mo("S. epidermidis", Becker = FALSE)), "B_STPHY_EPI")
|
||||
expect_identical(as.character(guess_mo("S. epidermidis", Becker = TRUE)), "B_STPHY_CNS")
|
||||
expect_identical(as.character(guess_mo("STAEPI", Becker = TRUE)), "B_STPHY_CNS")
|
||||
expect_identical(as.character(guess_mo("S. intermedius", Becker = FALSE)), "B_STRPTC_INT") # Strep (!) intermedius
|
||||
expect_identical(as.character(guess_mo("Sta intermedius",Becker = FALSE)), "B_STPHY_INT")
|
||||
expect_identical(as.character(guess_mo("Sta intermedius",Becker = TRUE)), "B_STPHY_CPS")
|
||||
expect_identical(as.character(guess_mo("STAINT", Becker = TRUE)), "B_STPHY_CPS")
|
||||
expect_identical(as.character(as.mo("S. epidermidis", Becker = FALSE)), "B_STPHY_EPI")
|
||||
expect_identical(as.character(as.mo("S. epidermidis", Becker = TRUE)), "B_STPHY_CNS")
|
||||
expect_identical(as.character(as.mo("STAEPI", Becker = TRUE)), "B_STPHY_CNS")
|
||||
expect_identical(as.character(as.mo("S. intermedius", Becker = FALSE)), "B_STRPTC_INT") # Strep (!) intermedius
|
||||
expect_identical(as.character(as.mo("Sta intermedius",Becker = FALSE)), "B_STPHY_INT")
|
||||
expect_identical(as.character(as.mo("Sta intermedius",Becker = TRUE)), "B_STPHY_CPS")
|
||||
expect_identical(as.character(as.mo("STAINT", Becker = TRUE)), "B_STPHY_CPS")
|
||||
# aureus must only be influenced if Becker = "all"
|
||||
expect_identical(as.character(guess_mo("STAAUR", Becker = FALSE)), "B_STPHY_AUR")
|
||||
expect_identical(as.character(guess_mo("STAAUR", Becker = TRUE)), "B_STPHY_AUR")
|
||||
expect_identical(as.character(guess_mo("STAAUR", Becker = "all")), "B_STPHY_CPS")
|
||||
expect_identical(as.character(as.mo("STAAUR", Becker = FALSE)), "B_STPHY_AUR")
|
||||
expect_identical(as.character(as.mo("STAAUR", Becker = TRUE)), "B_STPHY_AUR")
|
||||
expect_identical(as.character(as.mo("STAAUR", Becker = "all")), "B_STPHY_CPS")
|
||||
|
||||
# check for Lancefield classification
|
||||
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = FALSE)), "B_STRPTC_PYO")
|
||||
expect_identical(as.character(guess_mo("S. pyogenes", Lancefield = TRUE)), "B_STRPTC_GRA")
|
||||
expect_identical(as.character(guess_mo("STCPYO", Lancefield = TRUE)), "B_STRPTC_GRA") # group A
|
||||
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = FALSE)), "B_STRPTC_AGA")
|
||||
expect_identical(as.character(guess_mo("S. agalactiae", Lancefield = TRUE)), "B_STRPTC_GRB") # group B
|
||||
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = FALSE)), "B_STRPTC_DYS_EQU")
|
||||
expect_identical(as.character(guess_mo("S. equisimilis", Lancefield = TRUE)), "B_STRPTC_GRC") # group C
|
||||
expect_identical(as.character(as.mo("S. pyogenes", Lancefield = FALSE)), "B_STRPTC_PYO")
|
||||
expect_identical(as.character(as.mo("S. pyogenes", Lancefield = TRUE)), "B_STRPTC_GRA")
|
||||
expect_identical(as.character(as.mo("STCPYO", Lancefield = TRUE)), "B_STRPTC_GRA") # group A
|
||||
expect_identical(as.character(as.mo("S. agalactiae", Lancefield = FALSE)), "B_STRPTC_AGA")
|
||||
expect_identical(as.character(as.mo("S. agalactiae", Lancefield = TRUE)), "B_STRPTC_GRB") # group B
|
||||
expect_identical(as.character(as.mo("S. equisimilis", Lancefield = FALSE)), "B_STRPTC_DYS_EQU")
|
||||
expect_identical(as.character(as.mo("S. equisimilis", Lancefield = TRUE)), "B_STRPTC_GRC") # group C
|
||||
# Enterococci must only be influenced if Lancefield = "all"
|
||||
expect_identical(as.character(guess_mo("E. faecium", Lancefield = FALSE)), "B_ENTRC_IUM")
|
||||
expect_identical(as.character(guess_mo("E. faecium", Lancefield = TRUE)), "B_ENTRC_IUM")
|
||||
expect_identical(as.character(guess_mo("E. faecium", Lancefield = "all")), "B_STRPTC_GRD") # group D
|
||||
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = FALSE)), "B_STRPTC_ANG")
|
||||
expect_identical(as.character(guess_mo("S. anginosus", Lancefield = TRUE)), "B_STRPTC_GRF") # group F
|
||||
expect_identical(as.character(guess_mo("S. sanguinis", Lancefield = FALSE)), "B_STRPTC_SAN")
|
||||
expect_identical(as.character(guess_mo("S. sanguinis", Lancefield = TRUE)), "B_STRPTC_GRH") # group H
|
||||
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = FALSE)), "B_STRPTC_SAL")
|
||||
expect_identical(as.character(guess_mo("S. salivarius", Lancefield = TRUE)), "B_STRPTC_GRK") # group K
|
||||
expect_identical(as.character(as.mo("E. faecium", Lancefield = FALSE)), "B_ENTRC_IUM")
|
||||
expect_identical(as.character(as.mo("E. faecium", Lancefield = TRUE)), "B_ENTRC_IUM")
|
||||
expect_identical(as.character(as.mo("E. faecium", Lancefield = "all")), "B_STRPTC_GRD") # group D
|
||||
expect_identical(as.character(as.mo("S. anginosus", Lancefield = FALSE)), "B_STRPTC_ANG")
|
||||
expect_identical(as.character(as.mo("S. anginosus", Lancefield = TRUE)), "B_STRPTC_GRF") # group F
|
||||
expect_identical(as.character(as.mo("S. sanguinis", Lancefield = FALSE)), "B_STRPTC_SAN")
|
||||
expect_identical(as.character(as.mo("S. sanguinis", Lancefield = TRUE)), "B_STRPTC_GRH") # group H
|
||||
expect_identical(as.character(as.mo("S. salivarius", Lancefield = FALSE)), "B_STRPTC_SAL")
|
||||
expect_identical(as.character(as.mo("S. salivarius", Lancefield = TRUE)), "B_STRPTC_GRK") # group K
|
||||
|
||||
library(dplyr)
|
||||
|
||||
|
@ -166,7 +166,7 @@ test_that("as.mo works", {
|
|||
|
||||
# helper function
|
||||
expect_identical(as.mo("B_ESCHR_COL"),
|
||||
guess_mo("B_ESCHR_COL"))
|
||||
as.mo("B_ESCHR_COL"))
|
||||
|
||||
# test pull
|
||||
expect_equal(nrow(septic_patients %>% mutate(mo = as.mo(mo))),
|
||||
|
|
Loading…
Reference in New Issue