1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 06:46:11 +01:00

(v2.1.1.9112) unit test

This commit is contained in:
dr. M.S. (Matthijs) Berends 2024-12-06 18:01:54 +01:00
parent 0488d00f20
commit 419cb5b9c4
12 changed files with 34 additions and 31 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 2.1.1.9111 Version: 2.1.1.9112
Date: 2024-12-06 Date: 2024-12-06
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)

View File

@ -1,4 +1,4 @@
# AMR 2.1.1.9111 # AMR 2.1.1.9112
*(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).)*

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: AMR Name: AMR
Version: 2.1.1.9111 Version: 2.1.1.9112
Summary: A Python wrapper for the AMR R package Summary: A Python wrapper for the AMR R package
Home-page: https://github.com/msberends/AMR Home-page: https://github.com/msberends/AMR
Author: Dr. Matthijs Berends Author: Dr. Matthijs Berends

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='AMR', name='AMR',
version='2.1.1.9111', version='2.1.1.9112',
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
'rpy2', 'rpy2',

View File

@ -71,7 +71,7 @@
#' #'
#' # you can combine selectors like you are used with tidyverse #' # you can combine selectors like you are used with tidyverse
#' # e.g., for betalactams, but not the ones with an enzyme inhibitor: #' # e.g., for betalactams, but not the ones with an enzyme inhibitor:
#' example_isolates |> select(betalactams(), -betalactams_with_inhibitor()) #' example_isolates %>% select(betalactams(), -betalactams_with_inhibitor())
#' #'
#' # select only antibiotic columns with DDDs for oral treatment #' # select only antibiotic columns with DDDs for oral treatment
#' example_isolates %>% select(administrable_per_os()) #' example_isolates %>% select(administrable_per_os())

49
R/sir.R
View File

@ -1658,15 +1658,16 @@ get_skimmers.sir <- function(column) {
print.sir <- function(x, ...) { print.sir <- function(x, ...) {
x_name <- deparse(substitute(x)) x_name <- deparse(substitute(x))
cat("Class 'sir'\n") cat("Class 'sir'\n")
if (!is.null(attributes(x)$guideline) && !all(is.na(attributes(x)$guideline))) { # TODO for #170
cat(font_blue(word_wrap("These values were interpreted using ", # if (!is.null(attributes(x)$guideline) && !all(is.na(attributes(x)$guideline))) {
font_bold(vector_and(attributes(x)$guideline, quotes = FALSE)), # cat(font_blue(word_wrap("These values were interpreted using ",
" based on ", # font_bold(vector_and(attributes(x)$guideline, quotes = FALSE)),
vector_and(attributes(x)$method, quotes = FALSE), # " based on ",
" values. ", # vector_and(attributes(x)$method, quotes = FALSE),
"Use `sir_interpretation_history(", x_name, ")` to return a full logbook."))) # " values. ",
cat("\n") # "Use `sir_interpretation_history(", x_name, ")` to return a full logbook.")))
} # cat("\n")
# }
print(as.character(x), quote = FALSE) print(as.character(x), quote = FALSE)
} }
@ -1749,23 +1750,25 @@ summary.sir <- function(object, ...) {
c.sir <- function(...) { c.sir <- function(...) {
lst <- list(...) lst <- list(...)
guideline <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$guideline %or% NA_character_) # TODO for #170
mo <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$mo %or% NA_character_) # guideline <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$guideline %or% NA_character_)
ab <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ab %or% NA_character_) # mo <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$mo %or% NA_character_)
method <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$method %or% NA_character_) # ab <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ab %or% NA_character_)
ref_tbl <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_tbl %or% NA_character_) # method <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$method %or% NA_character_)
ref_breakpoints <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_breakpoints %or% NA_character_) # ref_tbl <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_tbl %or% NA_character_)
# ref_breakpoints <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_breakpoints %or% NA_character_)
out <- as.sir(unlist(lapply(list(...), as.character))) out <- as.sir(unlist(lapply(list(...), as.character)))
if (!all(is.na(guideline))) { # TODO for #170
attributes(out)$guideline <- guideline # if (!all(is.na(guideline))) {
attributes(out)$mo <- mo # attributes(out)$guideline <- guideline
attributes(out)$ab <- ab # attributes(out)$mo <- mo
attributes(out)$method <- method # attributes(out)$ab <- ab
attributes(out)$ref_tbl <- ref_tbl # attributes(out)$method <- method
attributes(out)$ref_breakpoints <- ref_breakpoints # attributes(out)$ref_tbl <- ref_tbl
} # attributes(out)$ref_breakpoints <- ref_breakpoints
# }
out out
} }

BIN
data-raw/AMR intro.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

View File

@ -1,5 +1,5 @@
This files contains all context you must know about the AMR package for R. This files contains all context you must know about the AMR package for R.
First and foremost, you are trained on version 2.1.1.9111. Remember this whenever someone asks which AMR package version youre at. First and foremost, you are trained on version 2.1.1.9112. Remember this whenever someone asks which AMR package version youre at.
-------------------------------- --------------------------------
THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'NAMESPACE': THE PART HEREAFTER CONTAINS CONTENTS FROM FILE 'NAMESPACE':
@ -2130,7 +2130,7 @@ example_isolates \%>\% select(mo, aminoglycosides())
# you can combine selectors like you are used with tidyverse # you can combine selectors like you are used with tidyverse
# e.g., for betalactams, but not the ones with an enzyme inhibitor: # e.g., for betalactams, but not the ones with an enzyme inhibitor:
example_isolates |> select(betalactams(), -betalactams_with_inhibitor()) example_isolates \%>\% select(betalactams(), -betalactams_with_inhibitor())
# select only antibiotic columns with DDDs for oral treatment # select only antibiotic columns with DDDs for oral treatment
example_isolates \%>\% select(administrable_per_os()) example_isolates \%>\% select(administrable_per_os())

View File

@ -203,7 +203,7 @@ example_isolates \%>\% select(mo, aminoglycosides())
# you can combine selectors like you are used with tidyverse # you can combine selectors like you are used with tidyverse
# e.g., for betalactams, but not the ones with an enzyme inhibitor: # e.g., for betalactams, but not the ones with an enzyme inhibitor:
example_isolates |> select(betalactams(), -betalactams_with_inhibitor()) example_isolates \%>\% select(betalactams(), -betalactams_with_inhibitor())
# select only antibiotic columns with DDDs for oral treatment # select only antibiotic columns with DDDs for oral treatment
example_isolates \%>\% select(administrable_per_os()) example_isolates \%>\% select(administrable_per_os())