diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 234b6383..6a9f0c00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -101,8 +101,6 @@ R-release:
# build package
- R CMD build . --no-build-vignettes --no-manual
- PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
- - Rscript -e 'devtools::install_local("${PKG_FILE_NAME}")'
- - Rscript -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)'
- Rscript -e 'Sys.setenv(NOT_CRAN = "true")'
- R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual --as-cran
artifacts:
@@ -130,8 +128,6 @@ R-devel:
# build package
- Rdevel CMD build . --no-build-vignettes --no-manual
- PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
- - Rscript -e 'devtools::install_local("${PKG_FILE_NAME}")'
- - Rscript -e 'AMR::eucast_rules(AMR::example_isolates_unclean, info = TRUE)'
- Rscript -e 'Sys.setenv(NOT_CRAN = "true")'
- Rdevel CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual --as-cran
artifacts:
diff --git a/DESCRIPTION b/DESCRIPTION
index 3329ab74..1432cddb 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.1.0.9009
+Version: 1.1.0.9010
Date: 2020-05-18
Title: Antimicrobial Resistance Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index 522d7c4a..a74f22e7 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# AMR 1.1.0.9009
+# AMR 1.1.0.9010
## Last updated: 18-May-2020
### Breaking
diff --git a/R/eucast_rules.R b/R/eucast_rules.R
index 5cc7293a..150606c2 100755
--- a/R/eucast_rules.R
+++ b/R/eucast_rules.R
@@ -520,7 +520,7 @@ eucast_rules <- function(x,
x[, col_mo] <- as.mo(x[, col_mo, drop = TRUE])
x <- x %>%
left_join_microorganisms(by = col_mo, suffix = c("_oldcols", ""))
- x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE])
+ x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL)
x$genus_species <- paste(x$genus, x$species)
if (ab_missing(AMP) & !ab_missing(AMX)) {
@@ -658,7 +658,7 @@ eucast_rules <- function(x,
rule_group_current %like% "expert",
paste0("\nEUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (",
font_red(paste0("v", EUCAST_VERSION_EXPERT_RULES)), ")\n"),
- "\nOther rules by this AMR package\n"))))
+ "\nOther rules by this AMR package (turn on/off with 'rules' parameter)\n"))))
}
# Print rule -------------------------------------------------------------
if (rule_current != rule_previous) {
@@ -678,32 +678,27 @@ eucast_rules <- function(x,
like_is_one_of <- eucast_rules_df[i, 2]
# be sure to comprise all coagulase-negative/-positive Staphylococci when they are mentioned
- if (eucast_rules_df[i, 3] %like% "coagulase-") {
- suppressWarnings(
- all_staph <- microorganisms %>%
- filter(genus == "Staphylococcus") %>%
- mutate(CNS_CPS = mo_name(mo, Becker = "all"))
- )
- if (eucast_rules_df[i, 3] %like% "coagulase-") {
- eucast_rules_df[i, 3] <- paste0("^(",
- paste0(all_staph %>%
- filter(CNS_CPS %like% "coagulase-negative") %>%
- pull(fullname),
- collapse = "|"),
+ if (eucast_rules_df[i, 3] %like% "coagulase") {
+ all_staph <- microorganisms[which(microorganisms$genus == "Staphylococcus"), ]
+ all_staph$CNS_CPS <- suppressWarnings(mo_name(all_staph$mo, Becker = "all", language = NULL))
+ if (eucast_rules_df[i, 3] %like% "coagulase") {
+ eucast_rules_df[i, 3] <- paste0("^(", paste0(all_staph[which(all_staph$CNS_CPS %like% "negative"),
+ "fullname",
+ drop = TRUE],
+ collapse = "|"),
")$")
} else {
- eucast_rules_df[i, 3] <- paste0("^(",
- paste0(all_staph %>%
- filter(CNS_CPS %like% "coagulase-positive") %>%
- pull(fullname),
- collapse = "|"),
+ eucast_rules_df[i, 3] <- paste0("^(", paste0(all_staph[which(all_staph$CNS_CPS %like% "positive"),
+ "fullname",
+ drop = TRUE],
+ collapse = "|"),
")$")
}
like_is_one_of <- "like"
}
if (like_is_one_of == "is") {
- # so 'Enterococcus' will turn into '^Enterococcus$'
+ # so e.g. 'Enterococcus' will turn into '^Enterococcus$'
mo_value <- paste0("^", eucast_rules_df[i, 3], "$")
} else if (like_is_one_of == "one_of") {
# so 'Clostridium, Actinomyces, ...' will turn into '^(Clostridium|Actinomyces|...)$'
diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R
index f51c989d..fa152014 100755
--- a/R/guess_ab_col.R
+++ b/R/guess_ab_col.R
@@ -79,8 +79,8 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
if (search_string.ab %in% colnames(x)) {
ab_result <- colnames(x)[colnames(x) == search_string.ab][1L]
- } else if (any(tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations"))))) {
- ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations")))][1L]
+ } else if (any(tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations", language = NULL))))) {
+ ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations", language = NULL)))][1L]
} else {
# sort colnames on length - longest first
@@ -96,13 +96,13 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) {
if (length(ab_result) == 0) {
if (verbose == TRUE) {
message(paste0("No column found as input for `", search_string,
- "` (", ab_name(search_string, language = "en", tolower = TRUE), ")."))
+ "` (", ab_name(search_string, language = NULL, tolower = TRUE), ")."))
}
return(NULL)
} else {
if (verbose == TRUE) {
message(font_blue(paste0("NOTE: Using column `", font_bold(ab_result), "` as input for `", search_string,
- "` (", ab_name(search_string, language = "en", tolower = TRUE), ").")))
+ "` (", ab_name(search_string, language = NULL, tolower = TRUE), ").")))
}
return(ab_result)
}
@@ -173,11 +173,11 @@ get_column_abx <- function(x,
for (i in seq_len(length(x))) {
if (verbose == TRUE & !names(x[i]) %in% names(duplicates)) {
message(font_blue(paste0("NOTE: Using column `", font_bold(x[i]), "` as input for `", names(x)[i],
- "` (", ab_name(names(x)[i], tolower = TRUE), ").")))
+ "` (", ab_name(names(x)[i], tolower = TRUE, language = NULL), ").")))
}
if (names(x[i]) %in% names(duplicates)) {
warning(font_red(paste0("Using column `", font_bold(x[i]), "` as input for `", names(x)[i],
- "` (", ab_name(names(x)[i], tolower = TRUE),
+ "` (", ab_name(names(x)[i], tolower = TRUE, language = NULL),
"), although it was matched for multiple antibiotics or columns.")),
call. = FALSE,
immediate. = verbose)
@@ -210,7 +210,7 @@ get_column_abx <- function(x,
}
generate_warning_abs_missing <- function(missing, any = FALSE) {
- missing <- paste0(missing, " (", ab_name(missing, tolower = TRUE), ")")
+ missing <- paste0(missing, " (", ab_name(missing, tolower = TRUE, language = NULL), ")")
if (any == TRUE) {
any_txt <- c(" any of", "is")
} else {
diff --git a/appveyor.yml b/appveyor.yml
index 8c03bc80..44b4e016 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -52,10 +52,10 @@ matrix:
build_script:
# - travis_tool.sh clean_library # turn off for caching, turn on for release of new R versions
- - travis_tool.sh install_deps
+ - travis-tool.sh install_deps
test_script:
- - travis_tool.sh run_tests
+ - travis-tool.sh run_tests
on_failure:
- 7z a failure.zip *.Rcheck\*
diff --git a/docs/404.html b/docs/404.html
index 51e5383b..96528771 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-