diff --git a/DESCRIPTION b/DESCRIPTION index 9feab66c..5c93ec62 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 2.1.0.9003 +Version: 2.1.0.9004 Date: 2023-10-20 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 7e4bc348..a53efd17 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,10 @@ -# AMR 2.1.0.9003 +# AMR 2.1.0.9004 * Fix for selecting first isolates using the phenotype-based method * This included too many isolates when patients had altering antibiograms within the same bacterial species * See for more info [our issue #122](https://github.com/msberends/AMR/issues/122) * Added 1,366 LOINC codes to the `antibiotics` data set and updated to the latest version (LOINC v2.76) -* MICs can now be used in complex number calculations +* MICs can now be used in complex number calculations and allow scientific number format as input (e.g., `as.mic("1.28e-2")`) * Fix rounding MICs on latest R beta ('R-devel') * Removed unneeded note about the used language when option `AMR_locale` is set * Fixed non-ASCII characters in documentation, according to CRAN maintainers diff --git a/R/aa_globals.R b/R/aa_globals.R index 19a6e99d..3b519054 100755 --- a/R/aa_globals.R +++ b/R/aa_globals.R @@ -102,7 +102,7 @@ TAXONOMY_VERSION <- list( ), SNOMED = list( accessed_date = as.Date("2021-07-01"), - citation = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12).", + citation = "Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12).", url = "https://phinvads.cdc.gov" ), LOINC = list( @@ -113,6 +113,7 @@ TAXONOMY_VERSION <- list( ) globalVariables(c( + ".GenericCallEnv", ".mo", ".rowid", ".syndromic_group", diff --git a/R/mic.R b/R/mic.R index e24a123e..a5eef2dd 100644 --- a/R/mic.R +++ b/R/mic.R @@ -184,6 +184,8 @@ as.mic <- function(x, na.rm = FALSE) { # comma to period x <- gsub(",", ".", x, fixed = TRUE) + # transform scientific notation + x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"] <- as.double(x[x %like% "[-]?[0-9]+([.][0-9]+)?e[-]?[0-9]+"]) # transform Unicode for >= and <= x <- gsub("\u2264", "<=", x, fixed = TRUE) x <- gsub("\u2265", ">=", x, fixed = TRUE) diff --git a/inst/tinytest/test-first_isolate.R b/inst/tinytest/test-first_isolate.R index a1ef7307..c8b0fcb4 100755 --- a/inst/tinytest/test-first_isolate.R +++ b/inst/tinytest/test-first_isolate.R @@ -45,6 +45,19 @@ expect_equal( 1373 ) +# for phenotype determination +expect_equal(AMR:::duplicated_antibiogram("SSSS", points_threshold = 2, ignore_I = TRUE, type = "points"), + FALSE) +expect_equal(AMR:::duplicated_antibiogram(c("RRR", "SSS"), + points_threshold = 2, ignore_I = TRUE, type = "points"), + c(FALSE, FALSE)) +expect_equal(AMR:::duplicated_antibiogram(c("RRR", "RRR", "SSS"), + points_threshold = 2, ignore_I = TRUE, type = "points"), + c(FALSE, TRUE, FALSE)) +expect_equal(AMR:::duplicated_antibiogram(c("RRR", "RSS", "SSS", "RSS", "RRR", "RRR", "SSS", "RSS", "RSR", "RRR"), + points_threshold = 2, ignore_I = TRUE, type = "points"), + c(FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE)) + # Phenotype-based, using key antimicrobials expect_equal( sum(first_isolate( diff --git a/man/as.mo.Rd b/man/as.mo.Rd index eb476085..101b2f96 100644 --- a/man/as.mo.Rd +++ b/man/as.mo.Rd @@ -127,7 +127,7 @@ The coercion rules consider the prevalence of microorganisms in humans, which is \item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on December 11th, 2022. \item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on December 11th, 2022. \item Reimer, LC \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} Nucleic Acids Res., 50(D1):D741-D74; \doi{10.1093/nar/gkab961}. Accessed from \url{https://bacdive.dsmz.de} on May 12th, 2023. -\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} +\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} \item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269} } } diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd index 140ff536..09106678 100644 --- a/man/microorganisms.Rd +++ b/man/microorganisms.Rd @@ -30,7 +30,7 @@ A \link[tibble:tibble]{tibble} with 52 171 observations and 23 variables: \item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on December 11th, 2022. \item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on December 11th, 2022. \item Reimer, LC \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} Nucleic Acids Res., 50(D1):D741-D74; \doi{10.1093/nar/gkab961}. Accessed from \url{https://bacdive.dsmz.de} on May 12th, 2023. -\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} +\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} \item Grimont \emph{et al.} (2007). Antigenic Formulae of the Salmonella Serovars, 9th Edition. WHO Collaborating Centre for Reference and Research on \emph{Salmonella} (WHOCC-SALM). \item Bartlett \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269} } diff --git a/man/mo_property.Rd b/man/mo_property.Rd index cdd69c5d..af8085de 100644 --- a/man/mo_property.Rd +++ b/man/mo_property.Rd @@ -356,7 +356,7 @@ This function uses \code{\link[=as.mo]{as.mo()}} internally, which uses an advan \item Parte, AC \emph{et al.} (2020). \strong{List of Prokaryotic names with Standing in Nomenclature (LPSN) moves to the DSMZ.} International Journal of Systematic and Evolutionary Microbiology, 70, 5607-5612; \doi{10.1099/ijsem.0.004332}. Accessed from \url{https://lpsn.dsmz.de} on December 11th, 2022. \item GBIF Secretariat (2022). GBIF Backbone Taxonomy. Checklist dataset \doi{10.15468/39omei}. Accessed from \url{https://www.gbif.org} on December 11th, 2022. \item Reimer, LC \emph{et al.} (2022). \strong{\emph{BacDive} in 2022: the knowledge base for standardized bacterial and archaeal data.} Nucleic Acids Res., 50(D1):D741-D74; \doi{10.1093/nar/gkab961}. Accessed from \url{https://bacdive.dsmz.de} on May 12th, 2023. -\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microoganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} +\item Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS). US Edition of SNOMED CT from 1 September 2020. Value Set Name 'Microorganism', OID 2.16.840.1.114222.4.11.1009 (v12). URL: \url{https://phinvads.cdc.gov} \item Bartlett A \emph{et al.} (2022). \strong{A comprehensive list of bacterial pathogens infecting humans} \emph{Microbiology} 168:001269; \doi{10.1099/mic.0.001269} } }