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

(v0.8.0.9005) fix unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-10-26 22:21:26 +02:00
parent d2e8249edd
commit 412077a6f2
15 changed files with 20 additions and 22 deletions

View File

@ -117,7 +117,7 @@ coverage:
script: script:
- apt-get install --yes git - apt-get install --yes git
# codecov token is set in https://gitlab.com/msberends/AMR/settings/ci_cd # codecov token is set in https://gitlab.com/msberends/AMR/settings/ci_cd
- Rscript -e "cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = '$codecov'); cat('Code coverage:', covr::percent_coverage(cc))" - Rscript -e "Sys.setenv(NOT_CRAN = 'true'); cc <- covr::package_coverage(); covr::codecov(coverage = cc, token = '$codecov'); cat('Code coverage:', covr::percent_coverage(cc))"
coverage: '/Code coverage: \d+\.\d+/' coverage: '/Code coverage: \d+\.\d+/'
pages: pages:

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 0.8.0.9004 Version: 0.8.0.9005
Date: 2019-10-26 Date: 2019-10-26
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(

View File

@ -1,4 +1,4 @@
# AMR 0.8.0.9004 # AMR 0.8.0.9005
<small>Last updated: 26-Oct-2019</small> <small>Last updated: 26-Oct-2019</small>
### New ### New

View File

@ -52,6 +52,7 @@ globalVariables(c(".",
"Last name", "Last name",
"lookup", "lookup",
"mdr", "mdr",
"MDRO",
"median", "median",
"microorganisms", "microorganisms",
"microorganisms.codes", "microorganisms.codes",

View File

@ -461,7 +461,7 @@ mdro <- function(x,
left_join_microorganisms(by = col_mo) %>% left_join_microorganisms(by = col_mo) %>%
# add unconfirmed to where genus is available # add unconfirmed to where genus is available
mutate(MDRO = ifelse(!is.na(genus), 1, NA_integer_), mutate(MDRO = ifelse(!is.na(genus), 1, NA_integer_),
row_number = 1:nrow(x)) %>% row_number = seq_len(nrow(x))) %>%
# transform to data.frame so subsetting is possible with x[y, z] (might not be the case with tibble/data.table/...) # transform to data.frame so subsetting is possible with x[y, z] (might not be the case with tibble/data.table/...)
as.data.frame(stringsAsFactors = FALSE) as.data.frame(stringsAsFactors = FALSE)

2
R/mo.R
View File

@ -241,7 +241,6 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
pull(mo) pull(mo)
# don't save valid fullnames to history (i.e. values that are in microorganisms$fullname) # don't save valid fullnames to history (i.e. values that are in microorganisms$fullname)
# set_mo_history(x, y, 0, force = isTRUE(list(...)$force_mo_history), disable = isTRUE(list(...)$disable_mo_history))
} else { } else {
# will be checked for mo class in validation and uses exec_as.mo internally if necessary # will be checked for mo class in validation and uses exec_as.mo internally if necessary
@ -636,7 +635,6 @@ exec_as.mo <- function(x,
x[i] <- found[1L] x[i] <- found[1L]
if (initial_search == TRUE) { if (initial_search == TRUE) {
# don't save valid fullnames to history (i.e. values that are in microorganisms$fullname) # don't save valid fullnames to history (i.e. values that are in microorganisms$fullname)
# set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history, disable = disable_mo_history)
} }
next next
} }

View File

@ -19,4 +19,3 @@ ignore:
- "R/atc_online.R" - "R/atc_online.R"
- "R/mo_source.R" - "R/mo_source.R"
- "R/resistance_predict.R" - "R/resistance_predict.R"
- "R/aa_test.R"

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -45,7 +45,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>
@ -231,9 +231,9 @@
</div> </div>
<div id="amr-0-8-0-9004" class="section level1"> <div id="amr-0-8-0-9005" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-8-0-9004" class="anchor"></a>AMR 0.8.0.9004<small> Unreleased </small> <a href="#amr-0-8-0-9005" class="anchor"></a>AMR 0.8.0.9005<small> Unreleased </small>
</h1> </h1>
<p><small>Last updated: 26-Oct-2019</small></p> <p><small>Last updated: 26-Oct-2019</small></p>
<div id="new" class="section level3"> <div id="new" class="section level3">
@ -1321,7 +1321,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-8-0-9004">0.8.0.9004</a></li> <li><a href="#amr-0-8-0-9005">0.8.0.9005</a></li>
<li><a href="#amr-0-8-0">0.8.0</a></li> <li><a href="#amr-0-8-0">0.8.0</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9004</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9005</span>
</span> </span>
</div> </div>

View File

@ -125,7 +125,7 @@ test_that("mdro works", {
2) 2)
# check the guideline by Magiorakos et al. (2012), the default guideline # check the guideline by Magiorakos et al. (2012), the default guideline
stau <- tibble::tribble( stau <- tribble(
~mo, ~GEN, ~RIF, ~CPT, ~OXA, ~CIP, ~MFX, ~SXT, ~FUS, ~VAN, ~TEC, ~TLV, ~TGC, ~CLI, ~DAP, ~ERY, ~LNZ, ~CHL, ~FOS, ~QDA, ~TCY, ~DOX, ~MNO, ~mo, ~GEN, ~RIF, ~CPT, ~OXA, ~CIP, ~MFX, ~SXT, ~FUS, ~VAN, ~TEC, ~TLV, ~TGC, ~CLI, ~DAP, ~ERY, ~LNZ, ~CHL, ~FOS, ~QDA, ~TCY, ~DOX, ~MNO,
"S. aureus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S. aureus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"S. aureus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S. aureus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
@ -134,7 +134,7 @@ test_that("mdro works", {
) )
expect_equal(as.integer(mdro(stau)), c(1:4)) expect_equal(as.integer(mdro(stau)), c(1:4))
ente <- tibble::tribble( ente <- tribble(
~mo, ~GEH, ~STH, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~MFX, ~VAN, ~TEC, ~TGC, ~DAP, ~LNZ, ~AMP, ~QDA, ~DOX, ~MNO, ~mo, ~GEH, ~STH, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~MFX, ~VAN, ~TEC, ~TGC, ~DAP, ~LNZ, ~AMP, ~QDA, ~DOX, ~MNO,
"Enterococcus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "Enterococcus", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"Enterococcus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "Enterococcus", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
@ -143,7 +143,7 @@ test_that("mdro works", {
) )
expect_equal(as.integer(mdro(ente)), c(1:4)) expect_equal(as.integer(mdro(ente)), c(1:4))
entero <- tibble::tribble( entero <- tribble(
~mo, ~GEN, ~TOB, ~AMK, ~NET, ~CPT, ~TCC, ~TZP, ~ETP, ~IPM, ~MEM, ~DOR, ~CZO, ~CXM, ~CTX, ~CAZ, ~FEP, ~FOX, ~CTT, ~CIP, ~SXT, ~TGC, ~ATM, ~AMP, ~AMC, ~SAM, ~CHL, ~FOS, ~COL, ~TCY, ~DOX, ~MNO, ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~CPT, ~TCC, ~TZP, ~ETP, ~IPM, ~MEM, ~DOR, ~CZO, ~CXM, ~CTX, ~CAZ, ~FEP, ~FOX, ~CTT, ~CIP, ~SXT, ~TGC, ~ATM, ~AMP, ~AMC, ~SAM, ~CHL, ~FOS, ~COL, ~TCY, ~DOX, ~MNO,
"E. coli", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "E. coli", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"E. coli", "R", "R", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "E. coli", "R", "R", "R", "R", "R", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
@ -152,7 +152,7 @@ test_that("mdro works", {
) )
expect_equal(as.integer(mdro(entero)), c(1:4)) expect_equal(as.integer(mdro(entero)), c(1:4))
pseud <- tibble::tribble( pseud <- tribble(
~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CAZ, ~FEP, ~CIP, ~LVX, ~TCC, ~TZP, ~ATM, ~FOS, ~COL, ~PLB, ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CAZ, ~FEP, ~CIP, ~LVX, ~TCC, ~TZP, ~ATM, ~FOS, ~COL, ~PLB,
"P. aeruginosa", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "P. aeruginosa", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"P. aeruginosa", "R", "S", "S", "S", "R", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S", "P. aeruginosa", "R", "S", "S", "S", "R", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S",
@ -161,7 +161,7 @@ test_that("mdro works", {
) )
expect_equal(as.integer(mdro(pseud)), c(1:4)) expect_equal(as.integer(mdro(pseud)), c(1:4))
acin <- tibble::tribble( acin <- tribble(
~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~TZP, ~TCC, ~CTX, ~CRO, ~CAZ, ~FEP, ~SXT, ~SAM, ~COL, ~PLB, ~TCY, ~DOX, ~MNO, ~mo, ~GEN, ~TOB, ~AMK, ~NET, ~IPM, ~MEM, ~DOR, ~CIP, ~LVX, ~TZP, ~TCC, ~CTX, ~CRO, ~CAZ, ~FEP, ~SXT, ~SAM, ~COL, ~PLB, ~TCY, ~DOX, ~MNO,
"A. baumannii", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A. baumannii", "R", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"A. baumannii", "R", "R", "R", "R", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S", "A. baumannii", "R", "R", "R", "R", "S", "R", "S", "S", "S", "S", "S", "S", "S", "S", "R", "S", "S", "S", "S", "S", "S", "S",