mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:46:11 +01:00
small fix for microorganisms data set
This commit is contained in:
parent
de36b0be23
commit
c5073f2fd1
13
R/mo.R
13
R/mo.R
@ -37,7 +37,6 @@
|
|||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item{\code{"E. coli"} will return the ID of \emph{Escherichia coli} and not \emph{Entamoeba coli}, although the latter would alphabetically come first}
|
#' \item{\code{"E. coli"} will return the ID of \emph{Escherichia coli} and not \emph{Entamoeba coli}, although the latter would alphabetically come first}
|
||||||
#' \item{\code{"H. influenzae"} will return the ID of \emph{Haemophilus influenzae} and not \emph{Haematobacter influenzae}}
|
#' \item{\code{"H. influenzae"} will return the ID of \emph{Haemophilus influenzae} and not \emph{Haematobacter influenzae}}
|
||||||
#' \item{Something like \code{"s pyo"} will return the ID of \emph{Streptococcus pyogenes} and not \emph{Actinomyes pyogenes}}
|
|
||||||
#' \item{Something like \code{"p aer"} will return the ID of \emph{Pseudomonas aeruginosa} and not \emph{Pasteurella aerogenes}}
|
#' \item{Something like \code{"p aer"} will return the ID of \emph{Pseudomonas aeruginosa} and not \emph{Pasteurella aerogenes}}
|
||||||
#' \item{Something like \code{"stau"} or \code{"staaur"} will return the ID of \emph{Staphylococcus aureus} and not \emph{Staphylococcus auricularis}}
|
#' \item{Something like \code{"stau"} or \code{"staaur"} will return the ID of \emph{Staphylococcus aureus} and not \emph{Staphylococcus auricularis}}
|
||||||
#' }
|
#' }
|
||||||
@ -139,6 +138,7 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
# add start en stop regex
|
# add start en stop regex
|
||||||
x <- paste0('^', x, '$')
|
x <- paste0('^', x, '$')
|
||||||
x_withspaces_all <- x_withspaces
|
x_withspaces_all <- x_withspaces
|
||||||
|
x_withspaces_start <- paste0('^', x_withspaces)
|
||||||
x_withspaces <- paste0('^', x_withspaces, '$')
|
x_withspaces <- paste0('^', x_withspaces, '$')
|
||||||
|
|
||||||
for (i in 1:length(x)) {
|
for (i in 1:length(x)) {
|
||||||
@ -177,11 +177,6 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
x[i] <- 'STAAUR'
|
x[i] <- 'STAAUR'
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
if (tolower(x[i]) == '^s.*pyo$') {
|
|
||||||
# avoid detection of Actinomyces pyogenes in case of Streptococcus pyogenes
|
|
||||||
x[i] <- 'STCPYO'
|
|
||||||
next
|
|
||||||
}
|
|
||||||
if (tolower(x[i]) == '^p.*aer$') {
|
if (tolower(x[i]) == '^p.*aer$') {
|
||||||
# avoid detection of Pasteurella aerogenes in case of Pseudomonas aeruginosa
|
# avoid detection of Pasteurella aerogenes in case of Pseudomonas aeruginosa
|
||||||
x[i] <- 'PSEAER'
|
x[i] <- 'PSEAER'
|
||||||
@ -240,6 +235,12 @@ as.mo <- function(x, Becker = FALSE, Lancefield = FALSE) {
|
|||||||
x[i] <- found[1L]
|
x[i] <- found[1L]
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
# try any match keeping spaces, not ending with $
|
||||||
|
found <- MOs[which(MOs$fullname %like% x_withspaces_start[i]),]$mo
|
||||||
|
if (length(found) > 0) {
|
||||||
|
x[i] <- found[1L]
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
# try any match diregarding spaces
|
# try any match diregarding spaces
|
||||||
found <- MOs[which(MOs$fullname %like% x[i]),]$mo
|
found <- MOs[which(MOs$fullname %like% x[i]),]$mo
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user