From 44ab53128e1f14e7c4a0ca62deaa0596cd3a8404 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Tue, 11 Jun 2019 15:31:32 +0200 Subject: [PATCH] (v0.7.0.9006) ab algorithm fix for ATC codes --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/ab.R | 15 +++++++++++++-- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 8 ++++---- docs/reference/index.html | 2 +- git_premaster.sh | 18 ++++++------------ 10 files changed, 30 insertions(+), 25 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c575234d..ca2ff9eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.7.0.9005 +Version: 0.7.0.9006 Date: 2019-06-11 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 2202be29..947601a8 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.0.9005 +# AMR 0.7.0.9006 #### New * Support for all scientifically published pathotypes of *E. coli* to date. Supported are: AIEC (Adherent-Invasive *E. coli*), ATEC (Atypical Entero-pathogenic *E. coli*), DAEC (Diffusely Adhering *E. coli*), EAEC (Entero-Aggresive *E. coli*), EHEC (Entero-Haemorrhagic *E. coli*), EIEC (Entero-Invasive *E. coli*), EPEC (Entero-Pathogenic *E. coli*), ETEC (Entero-Toxigenic *E. coli*), NMEC (Neonatal Meningitis‐causing *E. coli*), STEC (Shiga-toxin producing *E. coli*) and UPEC (Uropathogenic *E. coli*). All these lead to the microbial ID of *E. coli*: diff --git a/R/ab.R b/R/ab.R index 2382ca3b..1159d505 100755 --- a/R/ab.R +++ b/R/ab.R @@ -203,7 +203,8 @@ as.ab <- function(x) { # try by removing all spaces if (x[i] %like% " ") { found <- suppressWarnings(as.ab(gsub(" +", "", x[i]))) - if (length(found) > 0) { + print(found) + if (length(found) > 0 & !is.na(found)) { x_new[i] <- found[1L] next } @@ -212,7 +213,7 @@ as.ab <- function(x) { # try by removing all spaces and numbers if (x[i] %like% " " | x[i] %like% "[0-9]") { found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i]))) - if (length(found) > 0) { + if (length(found) > 0 & !is.na(found)) { x_new[i] <- found[1L] next } @@ -222,6 +223,16 @@ as.ab <- function(x) { x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1]) } + # take failed ATC codes apart from rest + x_unknown_ATCs <- x_unknown[x_unknown %like% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]"] + x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs] + if (length(x_unknown_ATCs) > 0) { + warning("These ATC codes are not (yet) in the antibiotics data set: ", + paste('"', sort(unique(x_unknown_ATCs)), '"', sep = "", collapse = ', '), + ".", + call. = FALSE) + } + if (length(x_unknown) > 0) { warning("These values could not be coerced to a valid antibiotic ID: ", paste('"', sort(unique(x_unknown)), '"', sep = "", collapse = ', '), diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index b1b7a455..8b6719da 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9005 + 0.7.0.9006 diff --git a/docs/articles/index.html b/docs/articles/index.html index 79ce3e0e..47c4f781 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9005 + 0.7.0.9006 diff --git a/docs/authors.html b/docs/authors.html index 74efc566..2afaccf2 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9005 + 0.7.0.9006 diff --git a/docs/index.html b/docs/index.html index d2df906e..0229b58d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.0.9005 + 0.7.0.9006 diff --git a/docs/news/index.html b/docs/news/index.html index f11c079d..0a1aed95 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.0.9005 + 0.7.0.9006 @@ -232,9 +232,9 @@ -
+

-AMR 0.7.0.9005 Unreleased +AMR 0.7.0.9006 Unreleased

@@ -1106,7 +1106,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents

diff --git a/git_premaster.sh b/git_premaster.sh index d65c5491..9bd2496c 100755 --- a/git_premaster.sh +++ b/git_premaster.sh @@ -30,31 +30,25 @@ if [ -z "$new_version" ]; then new_version="$current_tag.9000" echo echo "** COULD NOT CREATE NEW VERSION NUMBER! **" - echo "Are there some unpushed changes in a new tag?? Then mind NEWS.md. Assuming sequence number 9000." + echo "Are there some unpushed changes in a new tag? Then mind NEWS.md. Assuming sequence number 9000." echo fi sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION # update 1st line of NEWS.md sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md -echo "First 3 lines of DESCRIPTION:" +echo "• First 3 lines of DESCRIPTION:" head -3 DESCRIPTION echo -echo "First line of NEWS.md:" +echo "• First line of NEWS.md:" head -1 NEWS.md echo -read -p "Continue (Y/n)? " choice -case "$choice" in - n|N ) exit 1;; - * ) ;; -esac -echo echo "•••••••••••••••••••••••••••••••••" echo "• Reloading/documenting package •" echo "•••••••••••••••••••••••••••••••••" Rscript -e "devtools::load_all(quiet = TRUE)" -echo "Documenting..." +echo "• Documenting..." Rscript -e "suppressMessages(devtools::document())" -echo "Installing..." +echo "• Installing..." Rscript -e "devtools::install(quiet = TRUE, dependencies = FALSE)" echo echo "••••••••••••••••••••••••••" @@ -73,7 +67,7 @@ echo "•••••••••••••••••••••••• git status --short echo -read -p "Continue (Y/n)? " choice +read -p "Pushing version ${new_version}. Continue (Y/n)? " choice case "$choice" in n|N ) exit 1;; * ) ;;