mirror of https://github.com/msberends/AMR.git
(v0.8.0.9032) fix regex error
This commit is contained in:
parent
09e2730b53
commit
67f3f4387b
|
@ -1,5 +1,5 @@
|
|||
Package: AMR
|
||||
Version: 0.8.0.9031
|
||||
Version: 0.8.0.9032
|
||||
Date: 2019-11-15
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
|
|
4
NEWS.md
4
NEWS.md
|
@ -1,4 +1,4 @@
|
|||
# AMR 0.8.0.9031
|
||||
# AMR 0.8.0.9032
|
||||
<small>Last updated: 15-Nov-2019</small>
|
||||
|
||||
### Breaking
|
||||
|
@ -35,7 +35,7 @@
|
|||
as.mo(c("Stafylococcus aureus",
|
||||
"staphylokok aureuz"))
|
||||
#> Warning:
|
||||
#> Results of two values was guessed with uncertainty. Use mo_uncertainties() to review them.
|
||||
#> Results of two values were guessed with uncertainty. Use mo_uncertainties() to review them.
|
||||
#> Class 'mo'
|
||||
#> [1] B_STPHY_AURS B_STPHY_AURS
|
||||
|
||||
|
|
34
R/mo.R
34
R/mo.R
|
@ -545,7 +545,7 @@ exec_as.mo <- function(x,
|
|||
x <- gsub("o+", "o+", x)
|
||||
x <- gsub("(.)\\1+", "\\1+", x)
|
||||
# allow multiplication of all other consonants
|
||||
x <- gsub("([bdghjlnrw]+)", "\\1+", x)
|
||||
x <- gsub("([bdgjlnrw]+)", "\\1+", x)
|
||||
# allow ending in -en or -us
|
||||
x <- gsub("e\\+n(?![a-z[])", "(e+n|u+(c|k|q|qu|s|z|x|ks)+)", x, perl = TRUE)
|
||||
# if the input is longer than 10 characters, allow any forgotten consonant between all characters, as some might just have forgotten one...
|
||||
|
@ -555,10 +555,11 @@ exec_as.mo <- function(x,
|
|||
# allow au and ou after all these regex implementations
|
||||
x <- gsub("a+[bcdfghjklmnpqrstvwxyz]?u+[bcdfghjklmnpqrstvwxyz]?", "(a+u+|o+u+)[bcdfghjklmnpqrstvwxyz]?", x, fixed = TRUE)
|
||||
x <- gsub("o+[bcdfghjklmnpqrstvwxyz]?u+[bcdfghjklmnpqrstvwxyz]?", "(a+u+|o+u+)[bcdfghjklmnpqrstvwxyz]?", x, fixed = TRUE)
|
||||
# make sure to remove regex overkill (will lead to errors)
|
||||
x <- gsub("++", "+", x, fixed = TRUE)
|
||||
}
|
||||
x <- strip_whitespace(x, dyslexia_mode)
|
||||
# make sure to remove regex overkill (will lead to errors)
|
||||
x <- gsub("++", "+", x, fixed = TRUE)
|
||||
x <- gsub("?+", "?", x, fixed = TRUE)
|
||||
|
||||
x_trimmed <- x
|
||||
x_trimmed_species <- paste(x_trimmed, "species")
|
||||
|
@ -571,21 +572,22 @@ exec_as.mo <- function(x,
|
|||
# add start en stop regex
|
||||
x <- paste0("^", x, "$")
|
||||
|
||||
|
||||
x_withspaces_start_only <- paste0("^", x_withspaces)
|
||||
x_withspaces_end_only <- paste0(x_withspaces, "$")
|
||||
x_withspaces_start_end <- paste0("^", x_withspaces, "$")
|
||||
|
||||
if (isTRUE(debug)) {
|
||||
cat(paste0('x "', x, '"\n'))
|
||||
cat(paste0('x_species "', x_species, '"\n'))
|
||||
cat(paste0('x_withspaces_start_only "', x_withspaces_start_only, '"\n'))
|
||||
cat(paste0('x_withspaces_end_only "', x_withspaces_end_only, '"\n'))
|
||||
cat(paste0('x_withspaces_start_end "', x_withspaces_start_end, '"\n'))
|
||||
cat(paste0('x_backup "', x_backup, '"\n'))
|
||||
cat(paste0('x_backup_without_spp "', x_backup_without_spp, '"\n'))
|
||||
cat(paste0('x_trimmed "', x_trimmed, '"\n'))
|
||||
cat(paste0('x_trimmed_species "', x_trimmed_species, '"\n'))
|
||||
cat(paste0('x_trimmed_without_group "', x_trimmed_without_group, '"\n'))
|
||||
cat(paste0(blue('x'), ' "', x, '"\n'))
|
||||
cat(paste0(blue('x_species'), ' "', x_species, '"\n'))
|
||||
cat(paste0(blue('x_withspaces_start_only'), ' "', x_withspaces_start_only, '"\n'))
|
||||
cat(paste0(blue('x_withspaces_end_only'), ' "', x_withspaces_end_only, '"\n'))
|
||||
cat(paste0(blue('x_withspaces_start_end'), ' "', x_withspaces_start_end, '"\n'))
|
||||
cat(paste0(blue('x_backup'), ' "', x_backup, '"\n'))
|
||||
cat(paste0(blue('x_backup_without_spp'), ' "', x_backup_without_spp, '"\n'))
|
||||
cat(paste0(blue('x_trimmed'), ' "', x_trimmed, '"\n'))
|
||||
cat(paste0(blue('x_trimmed_species'), ' "', x_trimmed_species, '"\n'))
|
||||
cat(paste0(blue('x_trimmed_without_group'), ' "', x_trimmed_without_group, '"\n'))
|
||||
}
|
||||
|
||||
progress <- progress_estimated(n = length(x), min_time = 3)
|
||||
|
@ -1590,12 +1592,12 @@ exec_as.mo <- function(x,
|
|||
if (NROW(uncertainties) > 0 & initial_search == TRUE) {
|
||||
options(mo_uncertainties = as.list(distinct(uncertainties, input, .keep_all = TRUE)))
|
||||
|
||||
plural <- c("", "it")
|
||||
plural <- c("", "it", "was")
|
||||
if (NROW(uncertainties) > 1) {
|
||||
plural <- c("s", "them")
|
||||
plural <- c("s", "them", "were")
|
||||
}
|
||||
msg <- paste0("\nResult", plural[1], " of ", nr2char(NROW(uncertainties)), " value", plural[1],
|
||||
" was guessed with uncertainty. Use mo_uncertainties() to review ", plural[2], ".")
|
||||
" ", plural[3], " guessed with uncertainty. Use mo_uncertainties() to review ", plural[2], ".")
|
||||
warning(red(msg),
|
||||
call. = FALSE,
|
||||
immediate. = TRUE) # thus will always be shown, even if >= warnings
|
||||
|
|
10
R/zzz.R
10
R/zzz.R
|
@ -49,7 +49,7 @@
|
|||
#' @importFrom data.table as.data.table setkey
|
||||
#' @importFrom dplyr %>% mutate case_when
|
||||
make_DT <- function() {
|
||||
microorganismsDT <- as.data.table(AMR::microorganisms %>%
|
||||
microorganismsDT <- AMR::microorganisms %>%
|
||||
mutate(kingdom_index = case_when(kingdom == "Bacteria" ~ 1,
|
||||
kingdom == "Fungi" ~ 2,
|
||||
kingdom == "Protozoa" ~ 3,
|
||||
|
@ -60,12 +60,16 @@ make_DT <- function() {
|
|||
fullname_lower = gsub("[^.a-z0-9/ \\-]+", "",
|
||||
# use this paste instead of `fullname` to
|
||||
# work with Viridans Group Streptococci, etc.
|
||||
tolower(trimws(paste(genus, species, subspecies))))))
|
||||
tolower(trimws(ifelse(genus == "",
|
||||
fullname,
|
||||
paste(genus, species, subspecies)))))) %>%
|
||||
as.data.table()
|
||||
|
||||
# so arrange data on prevalence first, then kingdom, then full name
|
||||
setkey(microorganismsDT,
|
||||
prevalence,
|
||||
kingdom_index,
|
||||
fullname)
|
||||
fullname_lower)
|
||||
microorganismsDT
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -231,9 +231,9 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div id="amr-0-8-0-9031" class="section level1">
|
||||
<div id="amr-0-8-0-9032" class="section level1">
|
||||
<h1 class="page-header">
|
||||
<a href="#amr-0-8-0-9031" class="anchor"></a>AMR 0.8.0.9031<small> Unreleased </small>
|
||||
<a href="#amr-0-8-0-9032" class="anchor"></a>AMR 0.8.0.9032<small> Unreleased </small>
|
||||
</h1>
|
||||
<p><small>Last updated: 15-Nov-2019</small></p>
|
||||
<div id="breaking" class="section level3">
|
||||
|
@ -286,7 +286,7 @@
|
|||
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Stafylococcus aureus"</span>,</a>
|
||||
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="st">"staphylokok aureuz"</span>))</a>
|
||||
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="co">#> Warning: </span></a>
|
||||
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co">#> Results of two values was guessed with uncertainty. Use mo_uncertainties() to review them.</span></a>
|
||||
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co">#> Results of two values were guessed with uncertainty. Use mo_uncertainties() to review them.</span></a>
|
||||
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="co">#> Class 'mo'</span></a>
|
||||
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="co">#> [1] B_STPHY_AURS B_STPHY_AURS</span></a>
|
||||
<a class="sourceLine" id="cb4-7" data-line-number="7"></a>
|
||||
|
@ -1385,7 +1385,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
|
|||
<div id="tocnav">
|
||||
<h2>Contents</h2>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#amr-0-8-0-9031">0.8.0.9031</a></li>
|
||||
<li><a href="#amr-0-8-0-9032">0.8.0.9032</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-0">0.7.0</a></li>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.9031</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue