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 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 3e6c41d9..d72f6811 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 diff --git a/docs/articles/index.html b/docs/articles/index.html index 77e4bc0c..9481d0a3 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 diff --git a/docs/authors.html b/docs/authors.html index 035c6214..26f86f68 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 diff --git a/docs/index.html b/docs/index.html index fa6f87f6..57c7851b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 diff --git a/docs/news/index.html b/docs/news/index.html index c9f7e405..f79d47ba 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010 @@ -229,9 +229,9 @@ Source: NEWS.md -
-

-AMR 1.1.0.9009 Unreleased +
+

+AMR 1.1.0.9010 Unreleased

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 17cb6404..93ed1743 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: WHONET: WHONET.html benchmarks: benchmarks.html resistance_predict: resistance_predict.html -last_built: 2020-05-18T08:29Z +last_built: 2020-05-18T09:07Z urls: reference: https://msberends.gitlab.io/AMR/reference article: https://msberends.gitlab.io/AMR/articles diff --git a/docs/reference/index.html b/docs/reference/index.html index c5ef9bb9..5f914894 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.1.0.9009 + 1.1.0.9010