diff --git a/DESCRIPTION b/DESCRIPTION index 1f9186c53..263800627 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 2.1.1.9272 -Date: 2025-05-04 +Version: 2.1.1.9273 +Date: 2025-05-05 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index 1e5790f98..853d56fb6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9272 +# AMR 2.1.1.9273 *(this beta version will eventually become v3.0. We're happy to reach a new major milestone soon, which will be all about the new One Health support! Install this beta using [the instructions here](https://amr-for-r.org/#get-this-package).)* diff --git a/R/ab.R b/R/ab.R index 0031f7c24..3eff91bd6 100755 --- a/R/ab.R +++ b/R/ab.R @@ -282,7 +282,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(), levenshtein <- as.double(utils::adist(x[i], AMR_env$AB_lookup$generalised_name, ignore.case = FALSE, fixed = TRUE, - costs = c(insertions = 1, deletions = 1, substitutions = 3), + costs = c(insertions = 1, deletions = 1, substitutions = 2), counts = FALSE )) if (any(levenshtein <= 2)) { @@ -355,7 +355,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(), ab_df$lev_name <- as.double(utils::adist(x[i], ab_df$generalised_name, ignore.case = FALSE, fixed = TRUE, - costs = c(insertions = 1, deletions = 1, substitutions = 3), + costs = c(insertions = 1, deletions = 1, substitutions = 2), counts = FALSE )) ab_df$lev_syn <- vapply( @@ -367,7 +367,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(), min(as.double(utils::adist(x[i], y[nchar(y) >= 5], ignore.case = FALSE, fixed = TRUE, - costs = c(insertions = 1, deletions = 1, substitutions = 3), + costs = c(insertions = 1, deletions = 1, substitutions = 2), counts = FALSE )), na.rm = TRUE) ) @@ -379,7 +379,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(), ab_df$lev_trans <- as.double(utils::adist(x[i], ab_df$trans, ignore.case = FALSE, fixed = TRUE, - costs = c(insertions = 1, deletions = 1, substitutions = 3), + costs = c(insertions = 1, deletions = 1, substitutions = 2), counts = FALSE )) } else { @@ -651,8 +651,8 @@ generalise_antibiotic_name <- function(x) { x <- gsub("(/| AND | WITH | W/|[+]|[-])+", " ", x, perl = TRUE) # replace more than 1 space x <- trimws(gsub(" +", " ", x, perl = TRUE)) - # remove last couple of words if they are 1-3 characters - x <- gsub("( .{1,3})+$", "", x) + # remove last couple of words if they numbers or units + x <- gsub(" ([0-9]{3,99}|U?M?C?G)+$", "", x) # move HIGH to end x <- trimws(gsub("(.*) HIGH(.*)", "\\1\\2 HIGH", x, perl = TRUE)) x diff --git a/R/sysdata.rda b/R/sysdata.rda index d2e47a1ae..df3af75dd 100755 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ