mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 18:06:11 +01:00
fix unit test
This commit is contained in:
parent
7c1b564648
commit
c5981cdeb3
13
.github/prehooks/pre-commit
vendored
13
.github/prehooks/pre-commit
vendored
@ -39,7 +39,7 @@ if [ -f "$COMMIT_MSG_PATH" ]; then
|
|||||||
COMMIT_MSG=$(cat "$COMMIT_MSG_PATH")
|
COMMIT_MSG=$(cat "$COMMIT_MSG_PATH")
|
||||||
else
|
else
|
||||||
echo "Commit message file not found."
|
echo "Commit message file not found."
|
||||||
echo 1
|
COMMIT_MSG=""
|
||||||
fi
|
fi
|
||||||
# check the commit message, cancel commit if needed
|
# check the commit message, cancel commit if needed
|
||||||
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then
|
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then
|
||||||
@ -118,4 +118,15 @@ if [ -e "NEWS.md" ]; then
|
|||||||
else
|
else
|
||||||
echo "- no NEWS.md found!"
|
echo "- no NEWS.md found!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Prepend the version number to the commit message
|
||||||
|
if [ -f "$COMMIT_MSG_PATH" ]; then
|
||||||
|
# Prepend the version number
|
||||||
|
echo "(v${currentversion}) ${COMMIT_MSG}" > "$COMMIT_MSG_PATH"
|
||||||
|
echo "- prepended version number to commit message"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Commit message file not found. Unable to prepend version number."
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 2.1.1.9037
|
Version: 2.1.1.9038
|
||||||
Date: 2024-05-31
|
Date: 2024-06-04
|
||||||
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)
|
||||||
data analysis and to work with microbial and antimicrobial properties by
|
data analysis and to work with microbial and antimicrobial properties by
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 2.1.1.9037
|
# AMR 2.1.1.9038
|
||||||
|
|
||||||
*(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!)*
|
*(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!)*
|
||||||
|
|
||||||
|
57
R/export_biosample.R
Executable file
57
R/export_biosample.R
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
# ==================================================================== #
|
||||||
|
# TITLE: #
|
||||||
|
# AMR: An R Package for Working with Antimicrobial Resistance Data #
|
||||||
|
# #
|
||||||
|
# SOURCE CODE: #
|
||||||
|
# https://github.com/msberends/AMR #
|
||||||
|
# #
|
||||||
|
# PLEASE CITE THIS SOFTWARE AS: #
|
||||||
|
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
|
||||||
|
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
|
||||||
|
# Data. Journal of Statistical Software, 104(3), 1-31. #
|
||||||
|
# https://doi.org/10.18637/jss.v104.i03 #
|
||||||
|
# #
|
||||||
|
# Developed at the University of Groningen and the University Medical #
|
||||||
|
# Center Groningen in The Netherlands, in collaboration with many #
|
||||||
|
# colleagues from around the world, see our website. #
|
||||||
|
# #
|
||||||
|
# This R package is free software; you can freely use and distribute #
|
||||||
|
# it for both personal and commercial purposes under the terms of the #
|
||||||
|
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||||
|
# the Free Software Foundation. #
|
||||||
|
# We created this package for both routine data analysis and academic #
|
||||||
|
# research and it was publicly released in the hope that it will be #
|
||||||
|
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||||
|
# #
|
||||||
|
# Visit our website for the full manual and a complete tutorial about #
|
||||||
|
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||||
|
# ==================================================================== #
|
||||||
|
|
||||||
|
#' Export Data Set as NCBI BioSample Antibiogram
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' @param x a data set
|
||||||
|
#' @param filename a character string specifying the file name
|
||||||
|
#' @param type a character string specifying the type of data set, either "pathogen MIC" or "beta-lactamase MIC", see <https://www.ncbi.nlm.nih.gov/biosample/docs/>
|
||||||
|
#' @param save_as_xlsx
|
||||||
|
export_biosample <- function(x,
|
||||||
|
filename = paste0("biosample_", format(Sys.time(), "%Y-%m-%d-%H%M%S"), ".xlsx"),
|
||||||
|
type = "pathogen MIC",
|
||||||
|
columns = where(is.mic),
|
||||||
|
save_as_xlsx = TRUE) {
|
||||||
|
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
|
||||||
|
meet_criteria(filename, allow_class = "character", has_length = 1)
|
||||||
|
meet_criteria(type, allow_class = "character", has_length = 1, is_in = c("pathogen MIC", "beta-lactamase MIC"))
|
||||||
|
meet_criteria(save_as_xlsx, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
|
out <- x %pm>%
|
||||||
|
pm_select(columns)
|
||||||
|
stop_if(NROW(out) == 0, "No columns found.")
|
||||||
|
|
||||||
|
if (isTRUE(save_as_xlsx)) {
|
||||||
|
export <- import_fn("write.xlsx", pkg = "openxlsx", error_on_fail = TRUE)
|
||||||
|
export(out, file = filename, overwrite = TRUE, asTable = FALSE)
|
||||||
|
} else {
|
||||||
|
out
|
||||||
|
}
|
||||||
|
}
|
2
R/sir.R
2
R/sir.R
@ -858,6 +858,8 @@ as_sir_method <- function(method_short,
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mo_var_found <- ""
|
||||||
}
|
}
|
||||||
if (is.null(mo)) {
|
if (is.null(mo)) {
|
||||||
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class 'mo' found). See ?as.sir.\n\n",
|
stop_("No information was supplied about the microorganisms (missing argument `mo` and no column of class 'mo' found). See ?as.sir.\n\n",
|
||||||
|
10
index.md
10
index.md
@ -1,16 +1,18 @@
|
|||||||
# The `AMR` Package for R <a href="https://msberends.github.io/AMR/"><img src="./logo.svg" align="right" height="139" /></a>
|
# The `AMR` Package for R <a href="https://msberends.github.io/AMR/"><img src="./logo.svg" align="right" height="139" /></a>
|
||||||
|
|
||||||
|
<img src="./endorsement_clsi_eucast.jpg" align="right" height="120" />
|
||||||
|
|
||||||
* Provides an **all-in-one solution** for AMR data analysis in a One Health approach
|
* Provides an **all-in-one solution** for AMR data analysis in a One Health approach
|
||||||
* Generates **antibiograms** - traditional, combined, syndromic, and even WISCA
|
* Generates **antibiograms** - traditional, combined, syndromic, and even WISCA
|
||||||
* Provides the **full microbiological taxonomy** and data on **all antimicrobial drugs**
|
* Provides the **full microbiological taxonomy** and extensive info on **all antimicrobial drugs**
|
||||||
* Applies all recent **CLSI and EUCAST clinical and veterinary breakpoints** for MICs and disk zones
|
* Applies all recent **CLSI and EUCAST clinical and veterinary breakpoints** for MICs and disk zones
|
||||||
* Corrects for duplicate isolates, **calculates and predicts AMR** per antibiotic class
|
* Corrects for duplicate isolates, **calculates and predicts AMR** per antibiotic class
|
||||||
* Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**, and **SNOMED CT**
|
* Integrates with **WHONET**, ATC, **EARS-Net**, PubChem, **LOINC**, **SNOMED CT**, and **NCBI**
|
||||||
* Works on Windows, macOS and Linux with **all versions of R** since R-3.0 and is completely **dependency-free**, highly suitable for places with **limited resources**
|
* Works on Windows, macOS and Linux with **all versions of R** since R-3.0 and is completely **dependency-free**, highly suitable for places with **limited resources**
|
||||||
|
|
||||||
<div style="display: flex; font-size: 0.8em;">
|
<div style="display: flex; font-size: 0.8em;">
|
||||||
<p style="text-align:left; width: 50%;"><small><a href="https://msberends.github.io/AMR/">https://msberends.github.io/AMR</a></small></p>
|
<p style="text-align:left; width: 50%;"><small><a href="https://msberends.github.io/AMR/">https://msberends.github.io/AMR</a></small></p>
|
||||||
<p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03">https://doi.org/10.18637/jss.v104.i03</a></small></p>
|
<p style="text-align:right; width: 50%;"><small><a href="https://doi.org/10.18637/jss.v104.i03" target="_blank">https://doi.org/10.18637/jss.v104.i03</a></small></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -25,7 +27,7 @@ After installing this package, R knows [**~52,000 distinct microbial species**](
|
|||||||
|
|
||||||
##### Used in over 175 countries, translated into 20 languages
|
##### Used in over 175 countries, translated into 20 languages
|
||||||
|
|
||||||
<a href="./countries_large.png"><img src="./countries.png" target="_blank" align="right" style="max-width: 300px;" /></a>
|
<a href="./countries_large.png" target="_blank"><img src="./countries.png" align="right" style="max-width: 300px;" /></a>
|
||||||
|
|
||||||
Since its first public release in early 2018, this R package has been used in almost all countries in the world. Click the map to enlarge and to see the country names.
|
Since its first public release in early 2018, this R package has been used in almost all countries in the world. Click the map to enlarge and to see the country names.
|
||||||
|
|
||||||
|
24
man/export_biosample.Rd
Normal file
24
man/export_biosample.Rd
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/export_biosample.R
|
||||||
|
\name{export_biosample}
|
||||||
|
\alias{export_biosample}
|
||||||
|
\title{Export Data Set as NCBI BioSample Antibiogram}
|
||||||
|
\usage{
|
||||||
|
export_biosample(
|
||||||
|
x,
|
||||||
|
filename = paste0("biosample_", format(Sys.time(), "\%Y-\%m-\%d-\%H\%M\%S"), ".xlsx"),
|
||||||
|
type = "pathogen MIC",
|
||||||
|
columns = where(is.mic),
|
||||||
|
save_as_xlsx = TRUE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{a data set}
|
||||||
|
|
||||||
|
\item{filename}{a character string specifying the file name}
|
||||||
|
|
||||||
|
\item{type}{a character string specifying the type of data set, either "pathogen MIC" or "beta-lactamase MIC", see \url{https://www.ncbi.nlm.nih.gov/biosample/docs/}}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Export Data Set as NCBI BioSample Antibiogram
|
||||||
|
}
|
BIN
pkgdown/logos/endorsement_clsi_eucast.jpg
Normal file
BIN
pkgdown/logos/endorsement_clsi_eucast.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
Loading…
Reference in New Issue
Block a user