1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00

(v2.1.1.9083) update for first_isolate()

This commit is contained in:
dr. M.S. (Matthijs) Berends 2024-09-30 19:13:53 +02:00
parent 681fe011fe
commit 8907e8e4af
4 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 2.1.1.9082 Version: 2.1.1.9083
Date: 2024-09-30 Date: 2024-09-30
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)

11
NEWS.md
View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9082 # AMR 2.1.1.9083
*(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).)* *(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).)*
@ -51,19 +51,22 @@ This package now supports not only tools for AMR data analysis in clinical setti
* Added new argument `keep_operators` to `as.mic()`. This can be `"all"` (default), `"none"`, or `"edges"`. This argument is also available in the new `rescale_mic()` and `scale_*_mic()` functions. * Added new argument `keep_operators` to `as.mic()`. This can be `"all"` (default), `"none"`, or `"edges"`. This argument is also available in the new `rescale_mic()` and `scale_*_mic()` functions.
* Comparisons of MIC values are now more strict. For example, `>32` is higher than (and never equal to) `32`. Thus, `as.mic(">32") == as.mic(32)` now returns `FALSE`, and `as.mic(">32") > as.mic(32)` now returns `TRUE`. * Comparisons of MIC values are now more strict. For example, `>32` is higher than (and never equal to) `32`. Thus, `as.mic(">32") == as.mic(32)` now returns `FALSE`, and `as.mic(">32") > as.mic(32)` now returns `TRUE`.
* Sorting of MIC values (using `sort()`) was fixed in the same manner; `<0.001` now gets sorted before `0.001`, and `>0.001` gets sorted after `0.001`. * Sorting of MIC values (using `sort()`) was fixed in the same manner; `<0.001` now gets sorted before `0.001`, and `>0.001` gets sorted after `0.001`.
* Intermediate log2 levels used for MIC plotting are now more common values instead of following a strict dilution range
* Updated `italicise_taxonomy()` to support HTML output * Updated `italicise_taxonomy()` to support HTML output
* `custom_eucast_rules()` now supports multiple antibiotics and antibiotic groups to be affected by a single rule * `custom_eucast_rules()` now supports multiple antibiotics and antibiotic groups to be affected by a single rule
* `mo_info()` now contains an extra element `group_members`, with the contents of the new `mo_group_members()` function * `mo_info()` now contains an extra element `rank` and `group_members` (with the contents of the new `mo_group_members()` function)
* Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`. * Greatly improved `vctrs` integration, a Tidyverse package working in the background for many Tidyverse functions. For users, this means that functions such as `dplyr`'s `bind_rows()`, `rowwise()` and `c_across()` are now supported for e.g. columns of class `mic`. Despite this, this `AMR` package is still zero-dependent on any other package, including `dplyr` and `vctrs`.
* Updated all ATC codes from WHOCC * Updated all ATC codes from WHOCC
* Updated all antibiotic DDDs from WHOCC * Updated all antibiotic DDDs from WHOCC
* Fix for using a manual value for `mo_transform` in `antibiogram()` * Fix for using a manual value for `mo_transform` in `antibiogram()`
* Fix for mapping 'high level' antibiotics in `as.ab()` (amphotericin B-high, gentamicin-high, kanamycin-high, streptomycin-high, tobramycin-high) * Fix for mapping 'high level' antibiotics in `as.ab()` (amphotericin B-high, gentamicin-high, kanamycin-high, streptomycin-high, tobramycin-high)
* Improved overall algorithm of `as.ab()` for better performance and accuracy * Improved overall algorithm of `as.ab()` for better performance and accuracy
* Improved overall algorithm of `as.mo()` for better performance and accuracy. Specifically, more weight is given to genus and species combinations in cases where the subspecies is miswritten, so that the result will be the correct genus and species. * Improved overall algorithm of `as.mo()` for better performance and accuracy. Specifically:
* Intermediate log2 levels used for MIC plotting are now more common values instead of following a strict dilution range * More weight is given to genus and species combinations in cases where the subspecies is miswritten, so that the result will be the correct genus and species
* Genera from the World Health Organization's (WHO) Priority Pathogen List now have the highest prevalence
* Fixed a bug for when `antibiogram()` returns an empty data set * Fixed a bug for when `antibiogram()` returns an empty data set
* Updated the prevalence calculation to include genera from the World Health Organization's (WHO) Priority Pathogen List * Updated the prevalence calculation to include genera from the World Health Organization's (WHO) Priority Pathogen List
* Improved algorithm of `first_isolate()` when using the phenotype-based method, to prioritise records with the highest availability of SIR values
## Other ## Other
* Greatly updated and expanded documentation * Greatly updated and expanded documentation

View File

@ -670,8 +670,7 @@ duplicated_antibiogram <- function(antibiogram, points_threshold, ignore_I, type
# fast return, only 1 isolate # fast return, only 1 isolate
return(FALSE) return(FALSE)
} }
stop("Check R/first_isolate.R -> duplicated_antibiogram()") # first sort on data availability - count the dots and order that ascending so that highest availability of SIR is on top
# first sort on data availability - count the dots and order that ascending
number_dots <- vapply(FUN.VALUE = integer(1), number_dots <- vapply(FUN.VALUE = integer(1),
antibiogram, antibiogram,
function(x) sum(strsplit(x, "", fixed = TRUE)[[1]] == "."), function(x) sum(strsplit(x, "", fixed = TRUE)[[1]] == "."),

View File

@ -42,7 +42,7 @@ expect_equal(
) )
expect_equal( expect_equal(
sum(first_isolate(x = example_isolates, method = "phenotype-based", info = TRUE), na.rm = TRUE), sum(first_isolate(x = example_isolates, method = "phenotype-based", info = TRUE), na.rm = TRUE),
1373 1387
) )
# for phenotype determination # for phenotype determination
@ -66,7 +66,7 @@ expect_equal(
type = "keyantimicrobials", type = "keyantimicrobials",
antifungal = NULL, info = TRUE antifungal = NULL, info = TRUE
), na.rm = TRUE), ), na.rm = TRUE),
1376 1383
) )
expect_equal( expect_equal(
sum(first_isolate( sum(first_isolate(
@ -75,7 +75,7 @@ expect_equal(
type = "keyantimicrobials", type = "keyantimicrobials",
antifungal = NULL, info = TRUE, ignore_I = FALSE antifungal = NULL, info = TRUE, ignore_I = FALSE
), na.rm = TRUE), ), na.rm = TRUE),
1396 1397
) )