diff --git a/DESCRIPTION b/DESCRIPTION index 1af369ff..38f7b2ae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9023 -Date: 2019-08-04 +Version: 0.7.1.9024 +Date: 2019-08-06 Title: Antimicrobial Resistance Analysis Authors@R: c( person( @@ -67,7 +67,7 @@ Suggests: VignetteBuilder: knitr URL: https://msberends.gitlab.io/AMR, https://gitlab.com/msberends/AMR BugReports: https://gitlab.com/msberends/AMR/issues -License: GPL-2 | file LICENSE +License: GPL-2 Encoding: UTF-8 LazyData: true RoxygenNote: 6.1.1 diff --git a/LICENSE b/LICENSE deleted file mode 100755 index 23cb7903..00000000 --- a/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/NEWS.md b/NEWS.md index 4776489b..22dd0b6f 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9023 +# AMR 0.7.1.9024 ### Breaking * Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. @@ -35,13 +35,17 @@ Since this is a major change, usage of the old `also_single_tested` will throw an informative error that it has been replaced by `only_all_tested`. ### Changed +* Fixed a bug in `eucast_rules()` that caused an error when the input was a specific kind of `tibble` * Removed class `atc` - using `as.atc()` is now deprecated in favour of `ab_atc()` and this will return a character, not the `atc` class anymore * Removed deprecated functions `abname()`, `ab_official()`, `atc_name()`, `atc_official()`, `atc_property()`, `atc_tradenames()`, `atc_trivial_nl()` * Fix and speed improvement for `mo_shortname()` -* Fix for `as.mo()` where misspelled input would not be understood +* Algorithm improvements for `as.mo()`: + * Some misspelled input were not understood + * These new trivial names known to the field are now understood: meningococcus, gonococcus, pneumococcus + * Added support for unknown yeasts and fungi +* Added the newest taxonomic data from the IJSEM journal (now up to date until August 2019) * Fix for using `mo_*` functions where the coercion uncertainties and failures would not be available through `mo_uncertainties()` and `mo_failures()` anymore * Deprecated the `country` parameter of `mdro()` in favour of the already existing `guideline` parameter to support multiple guidelines within one country -* Fix for frequency tables when creating one directly on a group (using `group_by()`) * The `name` of `RIF` is now Rifampicin instead of Rifampin * The `antibiotics` data set is now sorted by name * Using verbose mode with `eucast_rules(..., verbose = TRUE)` returns more informative and readable output diff --git a/R/data.R b/R/data.R index adf3e19c..1974ab19 100755 --- a/R/data.R +++ b/R/data.R @@ -55,7 +55,7 @@ #' #' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}. #' @inheritSection catalogue_of_life Catalogue of Life -#' @format A \code{\link{data.frame}} with 67,906 observations and 16 variables: +#' @format A \code{\link{data.frame}} with 68,260 observations and 16 variables: #' \describe{ #' \item{\code{mo}}{ID of microorganism as used by this package} #' \item{\code{col_id}}{Catalogue of Life ID} @@ -72,8 +72,8 @@ #' \item{9 entries of \emph{Streptococcus} (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)} #' \item{2 entries of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])} #' \item{3 entries of Trichomonas (Trichomonas vaginalis, and its family and genus)} -#' \item{3 other 'undefined' entries (unknown, unknown Gram negatives and unknown Gram positives)} -#' \item{8,830 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life} +#' \item{5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)} +#' \item{8,970 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life} #' } #' @section About the records from DSMZ (see source): #' Names of prokaryotes are defined as being validly published by the International Code of Nomenclature of Bacteria. Validly published are all names which are included in the Approved Lists of Bacterial Names and the names subsequently published in the International Journal of Systematic Bacteriology (IJSB) and, from January 2000, in the International Journal of Systematic and Evolutionary Microbiology (IJSEM) as original articles or in the validation lists. @@ -91,14 +91,14 @@ catalogue_of_life <- list( version = "Catalogue of Life: {year} Annual Checklist", url_CoL = "http://www.catalogueoflife.org/annual-checklist/{year}/", url_DSMZ = "https://www.dsmz.de/microorganisms/pnu/bacterial_nomenclature_info_mm.php", - yearmonth_DSMZ = "February 2019" + yearmonth_DSMZ = "August 2019" ) #' Data set with previously accepted taxonomic names #' #' A data set containing old (previously valid or accepted) taxonomic names according to the Catalogue of Life. This data set is used internally by \code{\link{as.mo}}. #' @inheritSection catalogue_of_life Catalogue of Life -#' @format A \code{\link{data.frame}} with 21,342 observations and 4 variables: +#' @format A \code{\link{data.frame}} with 21,743 observations and 4 variables: #' \describe{ #' \item{\code{col_id}}{Catalogue of Life ID that was originally given} #' \item{\code{col_id_new}}{New Catalogue of Life ID that responds to an entry in the \code{\link{microorganisms}} data set} diff --git a/R/eucast_rules.R b/R/eucast_rules.R index c19be762..8478cf3a 100755 --- a/R/eucast_rules.R +++ b/R/eucast_rules.R @@ -183,7 +183,21 @@ eucast_rules <- function(x, rules = c("breakpoints", "expert", "other", "all"), verbose = FALSE, ...) { - + + if (verbose == TRUE & interactive()) { + txt <- paste0("WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form: with extensive info about which rows and columns would be effected and in which way.", + "\n\nThis may overwrite your existing data if you use e.g.:", + "\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?") + if ("rstudioapi" %in% rownames(installed.packages())) { + q_continue <- rstudioapi::showQuestion("Using verbose = TRUE with eucast_rules()", txt) + } else { + q_continue <- menu(choices = c("OK", "Cancel"), graphics = TRUE, title = txt) + } + if (q_continue %in% c(FALSE, 2)) { + return(invisible()) + } + } + if (!is.data.frame(x)) { stop("`x` must be a data frame.", call. = FALSE) } @@ -381,7 +395,6 @@ eucast_rules <- function(x, cols <- unique(cols[!is.na(cols) & !is.null(cols)]) if (length(rows) > 0 & length(cols) > 0) { before_df <- x_original - before <- as.character(unlist(as.list(x_original[rows, cols]))) tryCatch( # insert into original table @@ -402,9 +415,7 @@ eucast_rules <- function(x, x[rows, cols] <<- x_original[rows, cols] - after <- as.character(unlist(as.list(x_original[rows, cols]))) - - # before_df might not be a data.frame, but a tibble of data.table instead + # before_df might not be a data.frame, but a tibble or data.table instead old <- as.data.frame(before_df, stringsAsFactors = FALSE)[rows,] no_of_changes_this_run <- 0 for (i in 1:length(cols)) { @@ -419,13 +430,14 @@ eucast_rules <- function(x, stringsAsFactors = FALSE) colnames(verbose_new) <- c("row", "col", "mo_fullname", "old", "new", "rule", "rule_group", "rule_name") verbose_new <- verbose_new %>% filter(old != new | is.na(old)) + # save changes to data set 'verbose_info' verbose_info <<- rbind(verbose_info, verbose_new) no_of_changes_this_run <- no_of_changes_this_run + nrow(verbose_new) } - # return number of (new) changes + # after the applied changes: return number of (new) changes return(no_of_changes_this_run) } - # return number of (new) changes: none. + # no changes were applied: return number of (new) changes: none. return(0) } diff --git a/R/like.R b/R/like.R index 75619a4e..b7d6c158 100755 --- a/R/like.R +++ b/R/like.R @@ -76,7 +76,11 @@ like <- function(x, pattern) { if (is.factor(x)) { as.integer(x) %in% base::grep(pattern, levels(x), ignore.case = TRUE) } else { - base::grepl(pattern, x, ignore.case = TRUE) + tryCatch(base::grepl(pattern, x, ignore.case = TRUE), + error = function(e) ifelse(test = grepl("Invalid regexp", e$message), + # try with perl = TRUE: + yes = return(base::grepl(pattern, x, ignore.case = TRUE, perl = TRUE)), + no = stop(e$message))) } } diff --git a/R/mo.R b/R/mo.R index 47cd6664..a8587773 100755 --- a/R/mo.R +++ b/R/mo.R @@ -472,7 +472,9 @@ exec_as.mo <- function(x, x_backup_without_spp <- x x_species <- paste(x, "species") # translate to English for supported languages of mo_property - x <- gsub("(Gruppe|gruppe|groep|grupo|gruppo|groupe)", "group", x, ignore.case = TRUE) + x <- gsub("(gruppe|groep|grupo|gruppo|groupe)", "group", x, ignore.case = TRUE) + x <- gsub("(hefe|gist|gisten|levadura|lievito|fermento|levure)[a-z]*", "yeast", x, ignore.case = TRUE) + x <- gsub("(schimmels?|mofo|molde|stampo|moisissure)[a-z]*", "fungus", x, ignore.case = TRUE) # remove non-text in case of "E. coli" except dots and spaces x <- gsub("[^.a-zA-Z0-9/ \\-]+", "", x) # replace minus by a space @@ -483,7 +485,7 @@ exec_as.mo <- function(x, x <- gsub("(alpha|beta|gamma).?ha?emoly", "\\1-haemoly", x) # remove genus as first word x <- gsub("^Genus ", "", x) - # allow characters that resemble others, but not on first try + # allow characters that resemble others ---- if (initial_search == FALSE) { x <- tolower(x) x <- gsub("[iy]+", "[iy]+", x) @@ -493,15 +495,17 @@ exec_as.mo <- function(x, x <- gsub("a+", "a+", x) x <- gsub("u+", "u+", x) # allow any ending of -um, -us, -ium, -icum, -ius, -icus, -ica and -a (needs perl for the negative backward lookup): - x <- gsub("(u\\+\\(c\\|k\\|q\\|qu\\+\\|s\\|z\\|x\\|ks\\)\\+)(?![a-z[])", + x <- gsub("(u\\+\\(c\\|k\\|q\\|qu\\+\\|s\\|z\\|x\\|ks\\)\\+)(?![a-z])", "(u[s|m]|[iy][ck]?u[ms]|[iy]?[ck]?a)", x, ignore.case = TRUE, perl = TRUE) - x <- gsub("(\\[iy\\]\\+\\(c\\|k\\|q\\|qu\\+\\|s\\|z\\|x\\|ks\\)\\+a\\+)(?![a-z[])", + x <- gsub("(\\[iy\\]\\+\\(c\\|k\\|q\\|qu\\+\\|s\\|z\\|x\\|ks\\)\\+a\\+)(?![a-z])", "(u[s|m]|[iy][ck]?u[ms]|[iy]?[ck]?a)", x, ignore.case = TRUE, perl = TRUE) - x <- gsub("(\\[iy\\]\\+u\\+m)(?![a-z[])", + x <- gsub("(\\[iy\\]\\+u\\+m)(?![a-z])", "(u[s|m]|[iy][ck]?u[ms]|[iy]?[ck]?a)", x, ignore.case = TRUE, perl = TRUE) x <- gsub("e+", "e+", x, ignore.case = TRUE) x <- gsub("o+", "o+", x, ignore.case = TRUE) x <- gsub("(.)\\1+", "\\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, ignore.case = TRUE, perl = TRUE) } x <- strip_whitespace(x) @@ -519,7 +523,7 @@ exec_as.mo <- function(x, x_withspaces_end_only <- paste0(x_withspaces, '$') x_withspaces_start_end <- paste0('^', x_withspaces, '$') - if (debug == TRUE) { + 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')) @@ -725,6 +729,14 @@ exec_as.mo <- function(x, } next } + if (x_backup_without_spp[i] %like% 'haemoly.*strept') { + # Haemolytic streptococci in different languages + x[i] <- microorganismsDT[mo == 'B_STRPT_HAE', ..property][[1]][1L] + if (initial_search == TRUE) { + set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history) + } + next + } # CoNS/CoPS in different languages (support for German, Dutch, Spanish, Portuguese) ---- if (x_backup_without_spp[i] %like% '[ck]oagulas[ea] negatie?[vf]' | x_trimmed[i] %like% '[ck]oagulas[ea] negatie?[vf]' @@ -787,6 +799,32 @@ exec_as.mo <- function(x, } next } + + # trivial names known to the field: + if ("meningococcus" %like% x_trimmed[i]) { + # coerce S. coagulase positive + x[i] <- microorganismsDT[mo == 'B_NESSR_MEN', ..property][[1]][1L] + if (initial_search == TRUE) { + set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history) + } + next + } + if ("gonococcus" %like% x_trimmed[i]) { + # coerce S. coagulase positive + x[i] <- microorganismsDT[mo == 'B_NESSR_GON', ..property][[1]][1L] + if (initial_search == TRUE) { + set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history) + } + next + } + if ("pneumococcus" %like% x_trimmed[i]) { + # coerce S. coagulase positive + x[i] <- microorganismsDT[mo == 'B_STRPT_PNE', ..property][[1]][1L] + if (initial_search == TRUE) { + set_mo_history(x_backup[i], get_mo_code(x[i], property), 0, force = force_mo_history) + } + next + } } # FIRST TRY FULLNAMES AND CODES ---- @@ -1006,6 +1044,9 @@ exec_as.mo <- function(x, if (uncertainty_level >= 1) { # (1) look again for old taxonomic names, now for G. species ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 1] (1) look again for old taxonomic names, now for G. species\n") + } found <- microorganisms.oldDT[fullname %like% c.x_withspaces_start_end | fullname %like% d.x_withspaces_start_only] if (NROW(found) > 0 & nchar(g.x_backup_without_spp) >= 6) { @@ -1035,7 +1076,10 @@ exec_as.mo <- function(x, # (2) Try with misspelled input ---- # just rerun with initial_search = FALSE will used the extensive regex part above - found <- suppressMessages(suppressWarnings(exec_as.mo(a.x_backup, initial_search = FALSE, allow_uncertain = FALSE))) + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 1] (2) Try with misspelled input\n") + } + found <- suppressMessages(suppressWarnings(exec_as.mo(a.x_backup, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found, ..property][[1]] @@ -1054,6 +1098,9 @@ exec_as.mo <- function(x, if (uncertainty_level >= 2) { # (3) look for genus only, part of name ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (3) look for genus only, part of name\n") + } if (nchar(g.x_backup_without_spp) > 4 & !b.x_trimmed %like% " ") { if (!grepl("^[A-Z][a-z]+", b.x_trimmed, ignore.case = FALSE)) { # not when input is like Genustext, because then Neospora would lead to Actinokineospora @@ -1074,9 +1121,12 @@ exec_as.mo <- function(x, } # (4) strip values between brackets ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (4) strip values between brackets\n") + } a.x_backup_stripped <- gsub("( *[(].*[)] *)", " ", a.x_backup) a.x_backup_stripped <- trimws(gsub(" +", " ", a.x_backup_stripped)) - found <- suppressMessages(suppressWarnings(exec_as.mo(a.x_backup_stripped, initial_search = FALSE, allow_uncertain = FALSE))) + found <- suppressMessages(suppressWarnings(exec_as.mo(a.x_backup_stripped, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found) & nchar(g.x_backup_without_spp) >= 6) { found_result <- found found <- microorganismsDT[mo == found, ..property][[1]] @@ -1092,6 +1142,9 @@ exec_as.mo <- function(x, } # (5a) try to strip off half an element from end and check the remains ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (5a) try to strip off half an element from end and check the remains\n") + } x_strip <- a.x_backup %>% strsplit(" ") %>% unlist() if (length(x_strip) > 1) { for (i in 1:(length(x_strip) - 1)) { @@ -1100,7 +1153,7 @@ exec_as.mo <- function(x, # remove last half of the second term x_strip_collapsed <- paste(c(x_strip[1:(length(x_strip) - i)], lastword_half), collapse = " ") if (nchar(x_strip_collapsed) >= 4) { - found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE))) + found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found, ..property][[1]] @@ -1118,11 +1171,14 @@ exec_as.mo <- function(x, } } # (5b) try to strip off one element from end and check the remains ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (5b) try to strip off one element from end and check the remains\n") + } if (length(x_strip) > 1) { for (i in 1:(length(x_strip) - 1)) { x_strip_collapsed <- paste(x_strip[1:(length(x_strip) - i)], collapse = " ") if (nchar(x_strip_collapsed) >= 4) { - found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE))) + found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found, ..property][[1]] @@ -1139,12 +1195,47 @@ exec_as.mo <- function(x, } } } + # (5c) check for unknown yeasts/fungi ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (5b) check for unknown yeasts/fungi\n") + } + if (b.x_trimmed %like% "yeast") { + found <- "F_YEAST" + found_result <- found + found <- microorganismsDT[mo == found, ..property][[1]] + uncertainties <<- rbind(uncertainties, + data.frame(uncertainty = 2, + input = a.x_backup, + fullname = microorganismsDT[mo == found_result[1L], fullname][[1]], + mo = found_result[1L])) + if (initial_search == TRUE) { + set_mo_history(a.x_backup, get_mo_code(found[1L], property), 2, force = force_mo_history) + } + return(found[1L]) + } + if (b.x_trimmed %like% "fungus") { + found <- "F_FUNGUS" + found_result <- found + found <- microorganismsDT[mo == found, ..property][[1]] + uncertainties <<- rbind(uncertainties, + data.frame(uncertainty = 2, + input = a.x_backup, + fullname = microorganismsDT[mo == found_result[1L], fullname][[1]], + mo = found_result[1L])) + if (initial_search == TRUE) { + set_mo_history(a.x_backup, get_mo_code(found[1L], property), 2, force = force_mo_history) + } + return(found[1L]) + } # (6) try to strip off one element from start and check the remains (only allow >= 2-part name outcome) ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 2] (6) try to strip off one element from start and check the remains (only allow >= 2-part name outcome)\n") + } x_strip <- a.x_backup %>% strsplit(" ") %>% unlist() if (length(x_strip) > 1 & nchar(g.x_backup_without_spp) >= 6) { for (i in 2:(length(x_strip))) { x_strip_collapsed <- paste(x_strip[i:length(x_strip)], collapse = " ") - found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE))) + found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found_result[1L], ..property][[1]] @@ -1167,11 +1258,14 @@ exec_as.mo <- function(x, if (uncertainty_level >= 3) { # (7) try to strip off one element from start and check the remains ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 3] (7) try to strip off one element from start and check the remains\n") + } x_strip <- a.x_backup %>% strsplit(" ") %>% unlist() if (length(x_strip) > 1 & nchar(g.x_backup_without_spp) >= 6) { for (i in 2:(length(x_strip))) { x_strip_collapsed <- paste(x_strip[i:length(x_strip)], collapse = " ") - found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE))) + found <- suppressMessages(suppressWarnings(exec_as.mo(x_strip_collapsed, initial_search = FALSE, allow_uncertain = FALSE, debug = debug))) if (!empty_result(found)) { found_result <- found found <- microorganismsDT[mo == found, ..property][[1]] @@ -1189,6 +1283,9 @@ exec_as.mo <- function(x, } # (8) part of a name (very unlikely match) ---- + if (isTRUE(debug)) { + cat("\n[UNCERTAINLY LEVEL 3] (8) part of a name (very unlikely match)\n") + } found <- microorganismsDT[fullname %like% f.x_withspaces_end_only] if (nrow(found) > 0) { found_result <- found[["mo"]] @@ -1217,7 +1314,7 @@ exec_as.mo <- function(x, x_withspaces_end_only[i], x_backup_without_spp[i]) if (!empty_result(x[i])) { - # no set_mo_history: is already set in uncertain_fn() + # no set_mo_history here - it is already set in uncertain_fn() next } diff --git a/R/sysdata.rda b/R/sysdata.rda index 096a3d9b..c24a8039 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/eucast_rules.tsv b/data-raw/eucast_rules.tsv index 9c9ccae8..4b822a63 100644 --- a/data-raw/eucast_rules.tsv +++ b/data-raw/eucast_rules.tsv @@ -1,4 +1,14 @@ -if_mo_property like_is_one_of this_value and_these_antibiotics have_these_values then_change_these_antibiotics to_value reference.rule reference.rule_group +# --------------------------------------------------------------------------------------------------- +# For editing this EUCAST reference file, these values can all be used for target antibiotics: +# all_betalactams, aminoglycosides, carbapenems, cephalosporins, cephalosporins_without_CAZ, fluoroquinolones, +# glycopeptides, macrolides, minopenicillins, polymyxins, streptogramins, tetracyclines, ureidopenicillins +# and all separate EARS-Net letter codes like AMC. They can be separated by comma: 'AMC, fluoroquinolones'. +# The if_mo_property column can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain". +# The like.is.one_of column must contain one of: like, is, one_of ('like' will read the first column as regular expression) +# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. All species in this group can be found in: LiPuma J, Curr Opin Pulm Med. 2005 Nov;11(6):528-33. (PMID 16217180). +# >>>>> IF YOU WANT TO IMPORT THIS FILE INTO YOUR OWN SOFTWARE, HAVE THE FIRST 10 LINES SKIPPED <<<<< +# --------------------------------------------------------------------------------------------------- +if_mo_property like.is.one_of this_value and_these_antibiotics have_these_values then_change_these_antibiotics to_value reference.rule reference.rule_group order is Enterobacteriales AMP S AMX S Enterobacteriales (Order) Breakpoints order is Enterobacteriales AMP I AMX I Enterobacteriales (Order) Breakpoints order is Enterobacteriales AMP R AMX R Enterobacteriales (Order) Breakpoints diff --git a/data-raw/internals.R b/data-raw/internals.R index 596ba5f7..1be61db0 100644 --- a/data-raw/internals.R +++ b/data-raw/internals.R @@ -1,14 +1,16 @@ -# EUCAST rules ---- -# For editing the reference file, these values can all be used for target antibiotics: -# "aminoglycosides", "tetracyclines", "polymyxins", "macrolides", "glycopeptides", -# "streptogramins", "cephalosporins", "cephalosporins_without_CAZ", "carbapenems", -# "minopenicillins", "ureidopenicillins", "fluoroquinolones", "all_betalactams", -# and all separate EARS-Net letter codes like "AMC". They can be separated by comma: "AMC, fluoroquinolones". -# The mo_property can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain". -# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. The species in this group can be found in: -# LiPuma JJ, Curr Opin Pulm Med. 2005 Nov;11(6):528-33. (PMID 16217180). +# --------------------------------------------------------------------------------------------------- +# For editing this EUCAST reference file, these values can all be used for target antibiotics: +# all_betalactams, aminoglycosides, carbapenems, cephalosporins, cephalosporins_without_CAZ, fluoroquinolones, +# glycopeptides, macrolides, minopenicillins, polymyxins, streptogramins, tetracyclines, ureidopenicillins +# and all separate EARS-Net letter codes like AMC. They can be separated by comma: 'AMC, fluoroquinolones'. +# The if_mo_property column can be any column name from the AMR::microorganisms data set, or "genus_species" or "gramstain". +# The EUCAST guideline contains references to the 'Burkholderia cepacia complex'. All species in this group can be found in: +# LiPuma J, Curr Opin Pulm Med. 2005 Nov;11(6):528-33. (PMID 16217180). +# >>>>> IF YOU WANT TO IMPORT THIS FILE INTO YOUR OWN SOFTWARE, HAVE THE FIRST 10 LINES SKIPPED <<<<< +# --------------------------------------------------------------------------------------------------- eucast_rules_file <- dplyr::arrange( .data = utils::read.delim(file = "data-raw/eucast_rules.tsv", + skip = 10, sep = "\t", stringsAsFactors = FALSE, header = TRUE, diff --git a/data-raw/reproduction_of_microorganisms.R b/data-raw/reproduction_of_microorganisms.R index db8b7217..79b18291 100644 --- a/data-raw/reproduction_of_microorganisms.R +++ b/data-raw/reproduction_of_microorganisms.R @@ -99,7 +99,7 @@ MOs <- data_total %>% # and not all fungi: Aspergillus, Candida, Trichphyton and Pneumocystis are the most important, # so only keep these orders from the fungi: & !(kingdom == "Fungi" - & !order %in% c("Eurotiales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales")) + & !order %in% c("Eurotiales", "Mucorales", "Saccharomycetales", "Schizosaccharomycetales", "Tremellales", "Onygenales", "Pneumocystales")) ) # or the genus has to be one of the genera we found in our hospitals last decades (Northern Netherlands, 2002-2018) | genus %in% c("Absidia", "Acremonium", "Actinotignum", "Alternaria", "Anaerosalibacter", "Ancylostoma", "Anisakis", "Apophysomyces", @@ -123,7 +123,7 @@ MOs <- MOs %>% MOs <- MOs %>% # remove text if it contains 'Not assigned' like phylum in viruses - mutate_all(~gsub("Not assigned", "", .)) + mutate_all(~gsub("(Not assigned|\\[homonym\\]|\\[mistake\\])", "", ., ignore.case = TRUE)) MOs <- MOs %>% # Only keep first author, e.g. transform 'Smith, Jones, 2011' to 'Smith et al., 2011': @@ -166,8 +166,10 @@ MOs <- MOs %>% # Remove non-ASCII characters (these are not allowed by CRAN) MOs <- MOs %>% - lapply(iconv, from = "UTF-8", to = "ASCII//TRANSLIT") %>% - as_tibble(stringsAsFactors = FALSE) + lapply(iconv, from = "UTF-8", to = "ASCII//TRANSLIT") %>% + as_tibble(stringsAsFactors = FALSE) %>% + # remove invalid characters + mutate_all(~gsub("[\"'`]+", "", .)) # Split old taxonomic names - they refer in the original data to a new `taxonID` with `acceptedNameUsageID` MOs.old <- MOs %>% @@ -219,6 +221,9 @@ MOs <- MOs %>% !(source == "DSMZ" & fullname %in% (MOs %>% filter(source == "CoL") %>% pull(fullname)))) %>% distinct(fullname, .keep_all = TRUE) +# what characters are in the fullnames? +paste(unique(sort(unlist(strsplit(x = paste(MOs$fullname, collapse = ""), split = "")))), collapse = "") + # Add abbreviations so we can easily know which ones are which ones. # These will become valid and unique microbial IDs for the AMR package. MOs <- MOs %>% @@ -295,7 +300,6 @@ MOs <- MOs %>% # put `mo` in front, followed by the rest select(mo, everything(), -abbr_other, -abbr_genus, -abbr_species, -abbr_subspecies) - # add non-taxonomic entries MOs <- MOs %>% bind_rows( @@ -348,6 +352,38 @@ MOs <- MOs %>% species_id = "", source = "manually added", stringsAsFactors = FALSE), + data.frame(mo = "F_YEAST", + col_id = NA_integer_, + fullname = "(unknown yeast)", + kingdom = "Fungi", + phylum = "(unknown phylum)", + class = "(unknown class)", + order = "(unknown order)", + family = "(unknown family)", + genus = "(unknown genus)", + species = "(unknown species)", + subspecies = "(unknown subspecies)", + rank = "species", + ref = NA_character_, + species_id = "", + source = "manually added", + stringsAsFactors = FALSE), + data.frame(mo = "F_FUNGUS", + col_id = NA_integer_, + fullname = "(unknown fungus)", + kingdom = "Fungi", + phylum = "(unknown phylum)", + class = "(unknown class)", + order = "(unknown order)", + family = "(unknown family)", + genus = "(unknown genus)", + species = "(unknown species)", + subspecies = "(unknown subspecies)", + rank = "species", + ref = NA_character_, + species_id = "", + source = "manually added", + stringsAsFactors = FALSE), # CoNS MOs %>% filter(genus == "Staphylococcus", species == "epidermidis") %>% .[1,] %>% @@ -488,6 +524,11 @@ MOs <- MOs %>% sum(duplicated(MOs$mo)) colnames(MOs) +# here we welcome the new ones: +MOs %>% filter(!fullname %in% AMR::microorganisms$fullname) %>% View() +# and the ones we lost: +AMR::microorganisms %>% filter(!fullname %in% MOs$fullname) %>% View() + # set prevalence per species MOs <- MOs %>% mutate(prevalence = case_when( @@ -534,12 +575,16 @@ MOs.old$col_id <- as.integer(MOs.old$col_id) MOs.old$col_id_new <- as.integer(MOs.old$col_id_new) # save +### for other server saveRDS(MOs, "microorganisms.rds") saveRDS(MOs.old, "microorganisms.old.rds") +### for same server +microorganisms <- MOs +microorganisms.old <- MOs.old # on the server, do: usethis::use_data(microorganisms, overwrite = TRUE, version = 2) usethis::use_data(microorganisms.old, overwrite = TRUE, version = 2) rm(microorganisms) rm(microorganisms.old) -# and update the year in R/data.R +# and update the year and dimensions in R/data.R diff --git a/data/microorganisms.old.rda b/data/microorganisms.old.rda index 5d42f9d3..674279f6 100644 Binary files a/data/microorganisms.old.rda and b/data/microorganisms.old.rda differ diff --git a/data/microorganisms.rda b/data/microorganisms.rda index 830db938..b5a2d375 100755 Binary files a/data/microorganisms.rda and b/data/microorganisms.rda differ diff --git a/docs/articles/index.html b/docs/articles/index.html index c48fa4b1..716bf558 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9023 + 0.7.1.9024 diff --git a/docs/authors.html b/docs/authors.html index 5a4b4dc2..56ea8d31 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9023 + 0.7.1.9024 diff --git a/docs/index.html b/docs/index.html index 09fce559..2afce086 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9023 + 0.7.1.9024 @@ -377,9 +377,7 @@

License

diff --git a/docs/news/index.html b/docs/news/index.html index 1b85843d..c155f84f 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9023 + 0.7.1.9024
@@ -225,9 +225,9 @@ -
+

-AMR 0.7.1.9023 Unreleased +AMR 0.7.1.9024 Unreleased

@@ -273,15 +273,23 @@

Changed

    +
  • Fixed a bug in eucast_rules() that caused an error when the input was a specific kind of tibble +
  • Removed class atc - using as.atc() is now deprecated in favour of ab_atc() and this will return a character, not the atc class anymore
  • Removed deprecated functions abname(), ab_official(), atc_name(), atc_official(), atc_property(), atc_tradenames(), atc_trivial_nl()
  • Fix and speed improvement for mo_shortname()
  • -
  • Fix for as.mo() where misspelled input would not be understood
  • +
  • Algorithm improvements for as.mo(): +
      +
    • Some misspelled input were not understood
    • +
    • These new trivial names known to the field are now understood: meningococcus, gonococcus, pneumococcus
    • +
    • Added support for unknown yeasts and fungi
    • +
    +
  • +
  • Added the newest taxonomic data from the IJSEM journal (now up to date until August 2019)
  • Fix for using mo_* functions where the coercion uncertainties and failures would not be available through mo_uncertainties() and mo_failures() anymore
  • Deprecated the country parameter of mdro() in favour of the already existing guideline parameter to support multiple guidelines within one country
  • -
  • Fix for frequency tables when creating one directly on a group (using group_by())
  • The name of RIF is now Rifampicin instead of Rifampin
  • The antibiotics data set is now sorted by name
  • Using verbose mode with eucast_rules(..., verbose = TRUE) returns more informative and readable output
  • @@ -1198,7 +1206,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index 1f15e96c..445796d3 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.1.9015 + 0.7.1.9024
@@ -238,7 +238,7 @@

Format

-

A data.frame with 67,906 observations and 16 variables:

+

A data.frame with 68,260 observations and 16 variables:

mo

ID of microorganism as used by this package

col_id

Catalogue of Life ID

fullname

Full name, like "Escherichia coli"

@@ -261,8 +261,8 @@
  • 9 entries of Streptococcus (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)

  • 2 entries of Staphylococcus (coagulase-negative [CoNS] and coagulase-positive [CoPS])

  • 3 entries of Trichomonas (Trichomonas vaginalis, and its family and genus)

  • -
  • 3 other 'undefined' entries (unknown, unknown Gram negatives and unknown Gram positives)

  • -
  • 8,830 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life

  • +
  • 5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)

  • +
  • 8,970 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life

  • About the records from DSMZ (see source)

    diff --git a/docs/reference/microorganisms.old.html b/docs/reference/microorganisms.old.html index 6695e187..bdea301a 100644 --- a/docs/reference/microorganisms.old.html +++ b/docs/reference/microorganisms.old.html @@ -80,7 +80,7 @@ AMR (for R) - 0.7.1.9015 + 0.7.1.9024
    @@ -238,7 +238,7 @@

    Format

    -

    A data.frame with 21,342 observations and 4 variables:

    +

    A data.frame with 21,743 observations and 4 variables:

    col_id

    Catalogue of Life ID that was originally given

    col_id_new

    New Catalogue of Life ID that responds to an entry in the microorganisms data set

    fullname

    Old full taxonomic name of the microorganism

    diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd index 7df34f03..0e7ff53b 100755 --- a/man/microorganisms.Rd +++ b/man/microorganisms.Rd @@ -4,7 +4,7 @@ \name{microorganisms} \alias{microorganisms} \title{Data set with ~65,000 microorganisms} -\format{A \code{\link{data.frame}} with 67,906 observations and 16 variables: +\format{A \code{\link{data.frame}} with 68,260 observations and 16 variables: \describe{ \item{\code{mo}}{ID of microorganism as used by this package} \item{\code{col_id}}{Catalogue of Life ID} @@ -33,8 +33,8 @@ Manually added were: \item{9 entries of \emph{Streptococcus} (beta haemolytic groups A, B, C, D, F, G, H, K and unspecified)} \item{2 entries of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])} \item{3 entries of Trichomonas (Trichomonas vaginalis, and its family and genus)} - \item{3 other 'undefined' entries (unknown, unknown Gram negatives and unknown Gram positives)} - \item{8,830 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life} + \item{5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)} + \item{8,970 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) that are not in the Catalogue of Life} } } \section{About the records from DSMZ (see source)}{ diff --git a/man/microorganisms.old.Rd b/man/microorganisms.old.Rd index 11d67a48..c685c73a 100644 --- a/man/microorganisms.old.Rd +++ b/man/microorganisms.old.Rd @@ -4,7 +4,7 @@ \name{microorganisms.old} \alias{microorganisms.old} \title{Data set with previously accepted taxonomic names} -\format{A \code{\link{data.frame}} with 21,342 observations and 4 variables: +\format{A \code{\link{data.frame}} with 21,743 observations and 4 variables: \describe{ \item{\code{col_id}}{Catalogue of Life ID that was originally given} \item{\code{col_id_new}}{New Catalogue of Life ID that responds to an entry in the \code{\link{microorganisms}} data set} diff --git a/tests/testthat/test-eucast_rules.R b/tests/testthat/test-eucast_rules.R index 27029777..e471de06 100755 --- a/tests/testthat/test-eucast_rules.R +++ b/tests/testthat/test-eucast_rules.R @@ -25,7 +25,7 @@ test_that("EUCAST rules work", { # thoroughly check input table expect_equal(colnames(eucast_rules_file), - c("if_mo_property", "like_is_one_of", "this_value", + c("if_mo_property", "like.is.one_of", "this_value", "and_these_antibiotics", "have_these_values", "then_change_these_antibiotics", "to_value", "reference.rule", "reference.rule_group"))