diff --git a/DESCRIPTION b/DESCRIPTION index e2187ea8f..878ccadb5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 2.1.1.9220 -Date: 2025-03-19 +Version: 2.1.1.9221 +Date: 2025-03-20 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 87baa98df..0ce266ae9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 2.1.1.9220 +# AMR 2.1.1.9221 *(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://msberends.github.io/AMR/#latest-development-version).)* @@ -46,6 +46,7 @@ This package now supports not only tools for AMR data analysis in clinical setti * It is now possible to use column names for argument `ab`, `mo`, and `uti`: `as.sir(..., ab = "column1", mo = "column2", uti = "column3")`. This greatly improves the flexibility for users. * Users can now set their own criteria (using regular expressions) as to what should be considered S, I, R, SDD, and NI. * To get quantitative values, `as.double()` on a `sir` object will return 1 for S, 2 for SDD/I, and 3 for R (NI will become `NA`). Other functions using `sir` classes (e.g., `summary()`) are updated to reflect the change to contain NI and SDD. + * Combined MIC values (e.g., from CLSI) are now supported * The argument `conserve_capped_values` in `as.sir()` has been replaced with `capped_mic_handling`, which allows greater flexibility in handling capped MIC values (`<`, `<=`, `>`, `>=`). The four available options (`"standard"`, `"strict"`, `"relaxed"`, `"inverse"`) provide full control over whether these values should be interpreted conservatively or ignored. Using `conserve_capped_values` is now deprecated and returns a warning. * `antibiogram()` function * Argument `antibiotics` has been renamed to `antimicrobials`. Using `antibiotics` will still work, but now returns a warning. diff --git a/R/mic.R b/R/mic.R index f1233f553..841bc1801 100644 --- a/R/mic.R +++ b/R/mic.R @@ -201,6 +201,10 @@ as.mic <- function(x, na.rm = FALSE, keep_operators = "all") { # transform Unicode for >= and <= x <- gsub("\u2264", "<=", x, fixed = TRUE) x <- gsub("\u2265", ">=", x, fixed = TRUE) + if (any(x %like% "[0-9]/.*[0-9]", na.rm = TRUE)) { + warning_("Some MICs were combined values, only the first values are kept") + x[x %like% "[0-9]/.*[0-9]"] <- gsub("/.*", "", x[x %like% "[0-9]/.*[0-9]"]) + } # remove other invalid characters x <- gsub("[^a-zA-Z0-9.><= -]+", "", x, perl = TRUE) # transform => to >= and =< to <= diff --git a/data-raw/_generate_python_wrapper.sh b/data-raw/_generate_python_wrapper.sh index ed3963e1f..71b3ce764 100644 --- a/data-raw/_generate_python_wrapper.sh +++ b/data-raw/_generate_python_wrapper.sh @@ -84,9 +84,7 @@ except metadata.PackageNotFoundError: # R package version of AMR r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_amr_lib_path}"))') - -print(python_amr_version) -print(r_amr_version) +r_amr_version = str(r_amr_version[0]) # Compare R and Python package versions if r_amr_version != python_amr_version: diff --git a/data-raw/gpt_training_text_v2.1.1.9220.txt b/data-raw/gpt_training_text_v2.1.1.9221.txt similarity index 99% rename from data-raw/gpt_training_text_v2.1.1.9220.txt rename to data-raw/gpt_training_text_v2.1.1.9221.txt index 40d5ae7a6..0412d31cc 100644 --- a/data-raw/gpt_training_text_v2.1.1.9220.txt +++ b/data-raw/gpt_training_text_v2.1.1.9221.txt @@ -1,6 +1,6 @@ This knowledge base contains all context you must know about the AMR package for R. You are a GPT trained to be an assistant for the AMR package in R. You are an incredible R specialist, especially trained in this package and in the tidyverse. -First and foremost, you are trained on version 2.1.1.9220. Remember this whenever someone asks which AMR package version you’re at. +First and foremost, you are trained on version 2.1.1.9221. Remember this whenever someone asks which AMR package version you’re at. Below are the contents of the NAMESPACE file, the index.md file, and all the man/*.Rd files (documentation) in the package. Every file content is split using 100 hypens. ----------------------------------------------------------------------------------------------------