mirror of
https://github.com/msberends/AMR.git
synced 2024-12-27 14:06:12 +01:00
Compare commits
2 Commits
cfd31f0f0c
...
11b1dc2b02
Author | SHA1 | Date | |
---|---|---|---|
11b1dc2b02 | |||
b1399259e7 |
6
.github/workflows/publish-to-pypi.yml
vendored
6
.github/workflows/publish-to-pypi.yml
vendored
@ -59,9 +59,9 @@ jobs:
|
|||||||
bash _generate_python_wrapper.sh
|
bash _generate_python_wrapper.sh
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
env:
|
# env:
|
||||||
TWINE_USERNAME: "__token__"
|
# TWINE_USERNAME: "__token__"
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd data-raw/python_wrapper/AMR
|
cd data-raw/python_wrapper/AMR
|
||||||
python -m twine upload dist/*
|
python -m twine upload dist/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9099
|
Version: 2.1.1.9100
|
||||||
Date: 2024-10-17
|
Date: 2024-10-17
|
||||||
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)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9099
|
# AMR 2.1.1.9100
|
||||||
|
|
||||||
*(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).)*
|
||||||
|
|
||||||
|
48
R/sir.R
48
R/sir.R
@ -319,10 +319,22 @@ as.sir <- function(x, ...) {
|
|||||||
UseMethod("as.sir")
|
UseMethod("as.sir")
|
||||||
}
|
}
|
||||||
|
|
||||||
as_sir_structure <- function(x) {
|
as_sir_structure <- function(x,
|
||||||
structure(factor(as.character(unlist(unname(x))),
|
guideline = NULL,
|
||||||
|
mo = NULL,
|
||||||
|
ab = NULL,
|
||||||
|
method = NULL,
|
||||||
|
ref_tbl = NULL,
|
||||||
|
ref_breakpoints = NULL) {
|
||||||
|
out <- structure(factor(as.character(unlist(unname(x))),
|
||||||
levels = c("S", "SDD", "I", "R", "NI"),
|
levels = c("S", "SDD", "I", "R", "NI"),
|
||||||
ordered = TRUE),
|
ordered = TRUE),
|
||||||
|
guideline = guideline,
|
||||||
|
mo = mo,
|
||||||
|
ab = ab,
|
||||||
|
method = method,
|
||||||
|
ref_tbl = ref_tbl,
|
||||||
|
ref_breakpoints = ref_breakpoints,
|
||||||
class = c("sir", "ordered", "factor"))
|
class = c("sir", "ordered", "factor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1634,7 +1646,17 @@ get_skimmers.sir <- function(column) {
|
|||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
print.sir <- function(x, ...) {
|
print.sir <- function(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))) {
|
||||||
|
cat(font_blue(word_wrap("These values were interpreted using ",
|
||||||
|
font_bold(vector_and(attributes(x)$guideline, quotes = FALSE)),
|
||||||
|
" based on ",
|
||||||
|
vector_and(attributes(x)$method, quotes = FALSE),
|
||||||
|
" values. ",
|
||||||
|
"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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1715,7 +1737,27 @@ summary.sir <- function(object, ...) {
|
|||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
c.sir <- function(...) {
|
c.sir <- function(...) {
|
||||||
as.sir(unlist(lapply(list(...), as.character)))
|
lst <- list(...)
|
||||||
|
|
||||||
|
guideline <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$guideline %||% NA_character_)
|
||||||
|
mo <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$mo %||% NA_character_)
|
||||||
|
ab <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ab %||% NA_character_)
|
||||||
|
method <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$method %||% NA_character_)
|
||||||
|
ref_tbl <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_tbl %||% NA_character_)
|
||||||
|
ref_breakpoints <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_breakpoints %||% NA_character_)
|
||||||
|
|
||||||
|
out <- as.sir(unlist(lapply(list(...), as.character)))
|
||||||
|
|
||||||
|
if (!all(is.na(guideline))) {
|
||||||
|
attributes(out)$guideline <- guideline
|
||||||
|
attributes(out)$mo <- mo
|
||||||
|
attributes(out)$ab <- ab
|
||||||
|
attributes(out)$method <- method
|
||||||
|
attributes(out)$ref_tbl <- ref_tbl
|
||||||
|
attributes(out)$ref_breakpoints <- ref_breakpoints
|
||||||
|
}
|
||||||
|
|
||||||
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @method unique sir
|
#' @method unique sir
|
||||||
|
@ -21728,10 +21728,22 @@ as.sir <- function(x, ...) {
|
|||||||
UseMethod("as.sir")
|
UseMethod("as.sir")
|
||||||
}
|
}
|
||||||
|
|
||||||
as_sir_structure <- function(x) {
|
as_sir_structure <- function(x,
|
||||||
structure(factor(as.character(unlist(unname(x))),
|
guideline = NULL,
|
||||||
|
mo = NULL,
|
||||||
|
ab = NULL,
|
||||||
|
method = NULL,
|
||||||
|
ref_tbl = NULL,
|
||||||
|
ref_breakpoints = NULL) {
|
||||||
|
out <- structure(factor(as.character(unlist(unname(x))),
|
||||||
levels = c("S", "SDD", "I", "R", "NI"),
|
levels = c("S", "SDD", "I", "R", "NI"),
|
||||||
ordered = TRUE),
|
ordered = TRUE),
|
||||||
|
guideline = guideline,
|
||||||
|
mo = mo,
|
||||||
|
ab = ab,
|
||||||
|
method = method,
|
||||||
|
ref_tbl = ref_tbl,
|
||||||
|
ref_breakpoints = ref_breakpoints,
|
||||||
class = c("sir", "ordered", "factor"))
|
class = c("sir", "ordered", "factor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23043,7 +23055,17 @@ get_skimmers.sir <- function(column) {
|
|||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
print.sir <- function(x, ...) {
|
print.sir <- function(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))) {
|
||||||
|
cat(font_blue(word_wrap("These values were interpreted using ",
|
||||||
|
font_bold(vector_and(attributes(x)$guideline, quotes = FALSE)),
|
||||||
|
" based on ",
|
||||||
|
vector_and(attributes(x)$method, quotes = FALSE),
|
||||||
|
" values. ",
|
||||||
|
"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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23124,7 +23146,27 @@ summary.sir <- function(object, ...) {
|
|||||||
#' @export
|
#' @export
|
||||||
#' @noRd
|
#' @noRd
|
||||||
c.sir <- function(...) {
|
c.sir <- function(...) {
|
||||||
as.sir(unlist(lapply(list(...), as.character)))
|
lst <- list(...)
|
||||||
|
|
||||||
|
guideline <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$guideline %||% NA_character_)
|
||||||
|
mo <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$mo %||% NA_character_)
|
||||||
|
ab <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ab %||% NA_character_)
|
||||||
|
method <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$method %||% NA_character_)
|
||||||
|
ref_tbl <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_tbl %||% NA_character_)
|
||||||
|
ref_breakpoints <- vapply(FUN.VALUE = character(1), lst, function(x) attributes(x)$ref_breakpoints %||% NA_character_)
|
||||||
|
|
||||||
|
out <- as.sir(unlist(lapply(list(...), as.character)))
|
||||||
|
|
||||||
|
if (!all(is.na(guideline))) {
|
||||||
|
attributes(out)$guideline <- guideline
|
||||||
|
attributes(out)$mo <- mo
|
||||||
|
attributes(out)$ab <- ab
|
||||||
|
attributes(out)$method <- method
|
||||||
|
attributes(out)$ref_tbl <- ref_tbl
|
||||||
|
attributes(out)$ref_breakpoints <- ref_breakpoints
|
||||||
|
}
|
||||||
|
|
||||||
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @method unique sir
|
#' @method unique sir
|
||||||
@ -24740,7 +24782,13 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
|
|||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
1. First make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
|
1. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install AMR
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
|
||||||
|
|
||||||
For Linux:
|
For Linux:
|
||||||
|
|
||||||
@ -24761,12 +24809,6 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
|
|||||||
|
|
||||||
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
||||||
|
|
||||||
2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install AMR
|
|
||||||
```
|
|
||||||
|
|
||||||
# Examples of Usage
|
# Examples of Usage
|
||||||
|
|
||||||
## Cleaning Taxonomy
|
## Cleaning Taxonomy
|
||||||
@ -25982,7 +26024,7 @@ THE NEXT PART CONTAINS CONTENTS FROM FILE DESCRIPTION
|
|||||||
|
|
||||||
|
|
||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9098
|
Version: 2.1.1.9099
|
||||||
Date: 2024-10-17
|
Date: 2024-10-17
|
||||||
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)
|
||||||
|
@ -30,7 +30,13 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
|
|||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
1. First make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
|
1. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install AMR
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Make sure you have R installed. There is **no need to install the `AMR` R package**, as it will be installed automatically.
|
||||||
|
|
||||||
For Linux:
|
For Linux:
|
||||||
|
|
||||||
@ -51,12 +57,6 @@ This Python package is a wrapper round the `AMR` R package. It uses the `rpy2` p
|
|||||||
|
|
||||||
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
For Windows, visit the [CRAN download page](https://cran.r-project.org) to download and install R.
|
||||||
|
|
||||||
2. Since the Python package is available on the official [Python Package Index](https://pypi.org/project/AMR/), you can just run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install AMR
|
|
||||||
```
|
|
||||||
|
|
||||||
# Examples of Usage
|
# Examples of Usage
|
||||||
|
|
||||||
## Cleaning Taxonomy
|
## Cleaning Taxonomy
|
||||||
|
Loading…
Reference in New Issue
Block a user