(v0.7.0.9006) ab algorithm fix for ATC codes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-06-11 15:31:32 +02:00
parent 8f674e19bb
commit 44ab53128e
10 changed files with 30 additions and 25 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 0.7.0.9005
Version: 0.7.0.9006
Date: 2019-06-11
Title: Antimicrobial Resistance Analysis
Authors@R: c(

View File

@ -1,4 +1,4 @@
# AMR 0.7.0.9005
# AMR 0.7.0.9006
#### New
* Support for all scientifically published pathotypes of *E. coli* to date. Supported are: AIEC (Adherent-Invasive *E. coli*), ATEC (Atypical Entero-pathogenic *E. coli*), DAEC (Diffusely Adhering *E. coli*), EAEC (Entero-Aggresive *E. coli*), EHEC (Entero-Haemorrhagic *E. coli*), EIEC (Entero-Invasive *E. coli*), EPEC (Entero-Pathogenic *E. coli*), ETEC (Entero-Toxigenic *E. coli*), NMEC (Neonatal Meningitiscausing *E. coli*), STEC (Shiga-toxin producing *E. coli*) and UPEC (Uropathogenic *E. coli*). All these lead to the microbial ID of *E. coli*:

15
R/ab.R
View File

@ -203,7 +203,8 @@ as.ab <- function(x) {
# try by removing all spaces
if (x[i] %like% " ") {
found <- suppressWarnings(as.ab(gsub(" +", "", x[i])))
if (length(found) > 0) {
print(found)
if (length(found) > 0 & !is.na(found)) {
x_new[i] <- found[1L]
next
}
@ -212,7 +213,7 @@ as.ab <- function(x) {
# try by removing all spaces and numbers
if (x[i] %like% " " | x[i] %like% "[0-9]") {
found <- suppressWarnings(as.ab(gsub("[ 0-9]", "", x[i])))
if (length(found) > 0) {
if (length(found) > 0 & !is.na(found)) {
x_new[i] <- found[1L]
next
}
@ -222,6 +223,16 @@ as.ab <- function(x) {
x_unknown <- c(x_unknown, x_bak[x[i] == x_bak_clean][1])
}
# take failed ATC codes apart from rest
x_unknown_ATCs <- x_unknown[x_unknown %like% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]"]
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
if (length(x_unknown_ATCs) > 0) {
warning("These ATC codes are not (yet) in the antibiotics data set: ",
paste('"', sort(unique(x_unknown_ATCs)), '"', sep = "", collapse = ', '),
".",
call. = FALSE)
}
if (length(x_unknown) > 0) {
warning("These values could not be coerced to a valid antibiotic ID: ",
paste('"', sort(unique(x_unknown)), '"', sep = "", collapse = ', '),

View File

@ -78,7 +78,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>

View File

@ -78,7 +78,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>

View File

@ -78,7 +78,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>

View File

@ -42,7 +42,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>

View File

@ -78,7 +78,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>
@ -232,9 +232,9 @@
</div>
<div id="amr-0709005" class="section level1">
<div id="amr-0709006" class="section level1">
<h1 class="page-header">
<a href="#amr-0709005" class="anchor"></a>AMR 0.7.0.9005<small> Unreleased </small>
<a href="#amr-0709006" class="anchor"></a>AMR 0.7.0.9006<small> Unreleased </small>
</h1>
<div id="new" class="section level4">
<h4 class="hasAnchor">
@ -1106,7 +1106,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-0709005">0.7.0.9005</a></li>
<li><a href="#amr-0709006">0.7.0.9006</a></li>
<li><a href="#amr-070">0.7.0</a></li>
<li><a href="#amr-061">0.6.1</a></li>
<li><a href="#amr-060">0.6.0</a></li>

View File

@ -78,7 +78,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.7.0.9005</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.0.9006</span>
</span>
</div>

View File

@ -30,31 +30,25 @@ if [ -z "$new_version" ]; then
new_version="$current_tag.9000"
echo
echo "** COULD NOT CREATE NEW VERSION NUMBER! **"
echo "Are there some unpushed changes in a new tag?? Then mind NEWS.md. Assuming sequence number 9000."
echo "Are there some unpushed changes in a new tag? Then mind NEWS.md. Assuming sequence number 9000."
echo
fi
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
# update 1st line of NEWS.md
sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md
echo "First 3 lines of DESCRIPTION:"
echo "First 3 lines of DESCRIPTION:"
head -3 DESCRIPTION
echo
echo "First line of NEWS.md:"
echo "First line of NEWS.md:"
head -1 NEWS.md
echo
read -p "Continue (Y/n)? " choice
case "$choice" in
n|N ) exit 1;;
* ) ;;
esac
echo
echo "•••••••••••••••••••••••••••••••••"
echo "• Reloading/documenting package •"
echo "•••••••••••••••••••••••••••••••••"
Rscript -e "devtools::load_all(quiet = TRUE)"
echo "Documenting..."
echo "• Documenting..."
Rscript -e "suppressMessages(devtools::document())"
echo "Installing..."
echo "Installing..."
Rscript -e "devtools::install(quiet = TRUE, dependencies = FALSE)"
echo
echo "••••••••••••••••••••••••••"
@ -73,7 +67,7 @@ echo "••••••••••••••••••••••••
git status --short
echo
read -p "Continue (Y/n)? " choice
read -p "Pushing version ${new_version}. Continue (Y/n)? " choice
case "$choice" in
n|N ) exit 1;;
* ) ;;