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 @@
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 @@ 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 @@ 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 @@ 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 @@ @@ -232,9 +232,9 @@ -as.mo(..., allow_uncertain = 3)
Contents