diff --git a/.Rbuildignore b/.Rbuildignore index 98066496..23bb08a6 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -15,6 +15,7 @@ ^docs$ ^git_merge\.sh$ ^git_premaster\.sh$ +^git_siteonly\.sh$ ^index\.md$ ^installed_deps$ ^Meta$ diff --git a/.gitignore b/.gitignore index 778fdaa4..df3420ec 100755 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,6 @@ vignettes/*.R ^CRAN-RELEASE$ git_premaster.sh git_merge.sh +git_siteonly.sh packrat/lib*/ packrat/src/ diff --git a/DESCRIPTION b/DESCRIPTION index 0f63d641..4784b50f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.5.0.9010 -Date: 2019-01-17 +Version: 0.5.0.9011 +Date: 2019-01-21 Title: Antimicrobial Resistance Analysis Authors@R: c( person( @@ -58,6 +58,7 @@ Imports: Suggests: covr (>= 3.0.1), ggplot2, + readxl, rmarkdown, rstudioapi, testthat (>= 1.0.2) diff --git a/NAMESPACE b/NAMESPACE index 70daebb9..4ef60676 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -77,6 +77,7 @@ export(full_join_microorganisms) export(g.test) export(geom_rsi) export(get_locale) +export(get_mo_source) export(ggplot_rsi) export(ggplot_rsi_predict) export(guess_ab_col) @@ -136,6 +137,7 @@ export(rsi_predict) export(scale_rsi_colours) export(scale_y_percent) export(semi_join_microorganisms) +export(set_mo_source) export(skewness) export(theme_rsi) export(top_freq) diff --git a/NEWS.md b/NEWS.md index 480f68b9..b3bd83b1 100755 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,7 @@ * New website: https://msberends.gitlab.io/AMR (built with the great [`pkgdown`](https://pkgdown.r-lib.org/)) * Contains the complete manual of this package and all of its functions with an explanation of their parameters * Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis +* New functions `set_mo_source()` and `get_mo_source()` to use your own predefined MO codes as input for `as.mo()` and consequently all `mo_*` functions * Support for the upcoming [`dplyr`](https://dplyr.tidyverse.org) version 0.8.0 * New function `guess_ab_col()` to find an antibiotic column in a table * New function `mo_failures()` to review values that could not be coerced to a valid MO code, using `as.mo()`. This latter function will now only show a maximum of 25 uncoerced values. @@ -55,6 +56,7 @@ * Removed parameter `output_logical`, the function will now always return a logical value * Renamed parameter `filter_specimen` to `specimen_group`, although using `filter_specimen` will still work * A note to the manual pages of the `portion` functions, that low counts can influence the outcome and that the `portion` functions may camouflage this, since they only return the portion (albeit being dependent on the `minimum` parameter) +* Merged data sets `microorganisms.certe` and `microorganisms.umcg` into `microorganisms.codes` * Function `mo_taxonomy()` now contains the kingdom too * Reduce false positives for `is.rsi.eligible()` * Summaries of class `mo` will now return the top 3 and the unique count, e.g. using `summary(mo)` diff --git a/R/data.R b/R/data.R index b1ad6748..2b2838f6 100755 --- a/R/data.R +++ b/R/data.R @@ -148,7 +148,7 @@ #' } #' @source [3] Integrated Taxonomic Information System (ITIS) on-line database, \url{https://www.itis.gov}. #' @inheritSection AMR Read more on our website! -#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.umcg}} +#' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.codes}} "microorganisms" #' Data set with old taxonomic data from ITIS @@ -167,29 +167,17 @@ #' @seealso \code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms}} "microorganisms.old" -#' Translation table for UMCG +#' Translation table for microorganism codes #' -#' A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}. -#' @format A \code{\link{data.frame}} with 1,095 observations and 2 variables: +#' A data set containing commonly used codes for microorganisms. Define your own with \code{\link{set_mo_source}}. +#' @format A \code{\link{data.frame}} with 3,303 observations and 2 variables: #' \describe{ -#' \item{\code{umcg}}{Code of microorganism according to UMCG MMB} -#' \item{\code{certe}}{Code of microorganism according to Certe MMB} -#' } -#' @inheritSection AMR Read more on our website! -#' @seealso \code{\link{as.mo}} \code{\link{microorganisms.certe}} \code{\link{microorganisms}} -"microorganisms.umcg" - -#' Translation table for Certe -#' -#' A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}. -#' @format A \code{\link{data.frame}} with 2,665 observations and 2 variables: -#' \describe{ -#' \item{\code{certe}}{Code of microorganism according to Certe MMB} +#' \item{\code{certe}}{Commonly used code of a microorganism} #' \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}} #' } #' @inheritSection AMR Read more on our website! #' @seealso \code{\link{as.mo}} \code{\link{microorganisms}} -"microorganisms.certe" +"microorganisms.codes" #' Data set with 2000 blood culture isolates of septic patients #' diff --git a/R/globals.R b/R/globals.R index 7c4d538b..f48f3a20 100755 --- a/R/globals.R +++ b/R/globals.R @@ -54,11 +54,10 @@ globalVariables(c(".", "median", "mic", "microorganisms", - "microorganisms.certe", + "microorganisms.codes", "microorganisms.old", "microorganisms.oldDT", "microorganisms.prevDT", - "microorganisms.umcg", "microorganisms.unprevDT", "microorganismsDT", "mo", diff --git a/R/mo.R b/R/mo.R index 54012ed1..9e780163 100755 --- a/R/mo.R +++ b/R/mo.R @@ -30,7 +30,7 @@ #' #' This excludes \emph{Enterococci} at default (who are in group D), use \code{Lancefield = "all"} to also categorise all \emph{Enterococci} as group D. #' @param allow_uncertain a logical to indicate whether the input should be checked for less possible results, see Details -#' @param reference_df a \code{data.frame} to use for extra reference when translating \code{x} to a valid \code{mo}. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid \code{mo} as found in the \code{\link{microorganisms}} data set. +#' @param reference_df a \code{data.frame} to use for extra reference when translating \code{x} to a valid \code{mo}. See \code{\link{set_mo_source}} and \code{\link{get_mo_source}} to automate the usage of your own codes (e.g. used in your analysis or organisation). #' @rdname as.mo #' @aliases mo #' @keywords mo Becker becker Lancefield lancefield guess @@ -139,7 +139,7 @@ #' df <- df %>% #' mutate(mo = as.mo(paste(genus, species))) #' } -as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, reference_df = NULL) { +as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, reference_df = get_mo_source()) { mo <- mo_validate(x = x, property = "mo", Becker = Becker, Lancefield = Lancefield, allow_uncertain = allow_uncertain, reference_df = reference_df) @@ -152,11 +152,11 @@ is.mo <- function(x) { identical(class(x), "mo") } -#' @importFrom dplyr %>% pull left_join n_distinct progress_estimated +#' @importFrom dplyr %>% pull left_join n_distinct progress_estimated filter #' @importFrom data.table data.table as.data.table setkey #' @importFrom crayon magenta red italic exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, - allow_uncertain = TRUE, reference_df = NULL, + allow_uncertain = TRUE, reference_df = get_mo_source(), property = "mo", clear_options = TRUE) { if (!"AMR" %in% base::.packages()) { @@ -206,11 +206,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, if (!is.data.frame(reference_df) | NCOL(reference_df) < 2) { stop('`reference_df` must be a data.frame with at least two columns.', call. = FALSE) } - # remove factors, just keep characters + if (!"mo" %in% colnames(reference_df)) { + stop("`reference_df` must contain a column `mo` with values from the 'microorganisms' data set.", call. = FALSE) + } + reference_df <- reference_df %>% filter(!is.na(mo)) + # # remove factors, just keep characters suppressWarnings( reference_df[] <- lapply(reference_df, as.character) ) } + if (all(identical(trimws(x_input), "") | is.na(x_input))) { # all empty if (property == "mo") { @@ -220,24 +225,25 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, } else { return(rep(NA_character_, length(x_input))) } - } else if (all(x %in% microorganismsDT[["mo"]])) { - # existing mo codes when not looking for property "mo", like mo_genus("B_ESCHR_COL") - x <- microorganismsDT[data.table(mo = x), on = "mo", ..property][[1]] - } else if (!is.null(reference_df) - & all(x %in% reference_df[, 1]) - & all(reference_df[, 2] %in% microorganismsDT[["mo"]])) { - # manually defined reference + + } else if (all(x %in% reference_df[, 1]) + & all(reference_df[, "mo"] %in% microorganismsDT[["mo"]])) { + # all in reference df colnames(reference_df)[1] <- "x" - colnames(reference_df)[2] <- "mo" suppressWarnings( x <- data.frame(x = x, stringsAsFactors = FALSE) %>% left_join(reference_df, by = "x") %>% left_join(microorganisms, by = "mo") %>% pull(property) ) - } else if (all(toupper(x) %in% microorganisms.certe[, "certe"])) { - # old Certe codes - y <- as.data.table(microorganisms.certe)[data.table(certe = toupper(x)), on = "certe", ] + + } else if (all(x %in% microorganismsDT[["mo"]])) { + # existing mo codes when not looking for property "mo", like mo_genus("B_ESCHR_COL") + x <- microorganismsDT[data.table(mo = x), on = "mo", ..property][[1]] + + } else if (all(toupper(x) %in% microorganisms.codes[, "code"])) { + # commonly used MO codes + y <- as.data.table(microorganisms.codes)[data.table(code = toupper(x)), on = "code", ] x <- microorganismsDT[data.table(mo = y[["mo"]]), on = "mo", ..property][[1]] } else if (!all(x %in% microorganismsDT[[property]])) { @@ -419,28 +425,16 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, } # TRY OTHER SOURCES ---- - if (toupper(x_backup[i]) %in% microorganisms.certe[, 1]) { - mo_found <- microorganisms.certe[toupper(x_backup[i]) == microorganisms.certe[, 1], 2][1L] + if (toupper(x_backup[i]) %in% microorganisms.codes[, 1]) { + mo_found <- microorganisms.codes[toupper(x_backup[i]) == microorganisms.codes[, 1], "mo"][1L] if (length(mo_found) > 0) { x[i] <- microorganismsDT[mo == mo_found, ..property][[1]][1L] next } } - if (x_backup[i] %in% microorganisms.umcg[, 1]) { - mo_umcg <- microorganisms.umcg[microorganisms.umcg[, 1] == x_backup[i], 2] - mo_found <- microorganisms.certe[microorganisms.certe[, 1] == mo_umcg, 2][1L] - if (length(mo_found) == 0) { - # not found - x[i] <- NA_character_ - failures <- c(failures, x_backup[i]) - } else { - x[i] <- microorganismsDT[mo == mo_found, ..property][[1]][1L] - } - next - } if (!is.null(reference_df)) { if (x_backup[i] %in% reference_df[, 1]) { - ref_mo <- reference_df[reference_df[, 1] == x_backup[i], 2] + ref_mo <- reference_df[reference_df[, 1] == x_backup[i], "mo"] if (ref_mo %in% microorganismsDT[, mo]) { x[i] <- microorganismsDT[mo == ref_mo, ..property][[1]][1L] next diff --git a/R/mo_source.R b/R/mo_source.R new file mode 100644 index 00000000..60128ced --- /dev/null +++ b/R/mo_source.R @@ -0,0 +1,174 @@ +# ==================================================================== # +# TITLE # +# Antimicrobial Resistance (AMR) Analysis # +# # +# SOURCE # +# https://gitlab.com/msberends/AMR # +# # +# LICENCE # +# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) # +# # +# This R package is free software; you can freely use and distribute # +# it for both personal and commercial purposes under the terms of the # +# GNU General Public License version 2.0 (GNU GPL-2), as published by # +# the Free Software Foundation. # +# # +# This R package was created for academic research and was publicly # +# released in the hope that it will be useful, but it comes WITHOUT # +# ANY WARRANTY OR LIABILITY. # +# Visit our website for more info: https://msberends.gitab.io/AMR. # +# ==================================================================== # + +#' Use predefined reference data set +#' +#' These functions can be used to predefine your own reference to be used in \code{\link{as.mo}} and consequently all \code{mo_*} functions like \code{\link{mo_genus}} and \code{\link{mo_gramstain}}. +#' @param path location of your reference file, see Details +#' @rdname mo_source +#' @name mo_source +#' @aliases set_mo_source get_mo_source +#' @details The reference file can be a text file seperated with commas (CSV) or pipes, an Excel file (old 'xls' format or new 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you need to have the \code{readxl} package installed. +#' +#' \code{set_mo_source} will check the file for validity: it must be a \code{data.frame}, must have a column named \code{"mo"} which contains values from \code{microorganisms$mo} and must have a reference column with your own defined values. If all tests pass, \code{set_mo_source} will read the file into R and export it to \code{"~/.mo_source.rds"}. This compressed data file will then be used at default for MO determination (function \code{\link{as.mo}} and consequently all \code{mo_*} functions like \code{\link{mo_genus}} and \code{\link{mo_gramstain}}). The location of the original file will be saved as option with \code{\link{options}(mo_source = path)}. Its timestamp will be saved with \code{\link{options}(mo_source_datetime = ...)}. +#' +#' \code{get_mo_source} will return the data set by reading \code{"~/.mo_source.rds"} with \code{\link{readRDS}}. If the original file has changed (the file defined with \code{path}), it will call \code{set_mo_source} to update the data file automatically. +#' +#' Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The compressed file will have a size of 0.1 kB and can be read by \code{get_mo_source} in only a couple of microseconds (a millionth of a second). +#' @importFrom dplyr select everything +#' @export +#' @inheritSection AMR Read more on our website! +#' @examples +#' \dontrun{ +#' +#' # imagine this Excel file (mo codes looked up in `microorganisms` data set): +#' # A B +#' # 1 our code mo +#' # 2 lab_mo_ecoli B_ESCHR_COL +#' # 3 lab_mo_kpneumoniae B_KLBSL_PNE +#' +#' # 1. We save it as 'home/me/ourcodes.xlsx' +#' +#' # 2. We use it for input: +#' set_mo_source("C:\path\ourcodes.xlsx") +#' #> Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'. +#' +#' # 3. And use it in our functions: +#' as.mo("lab_mo_ecoli") +#' #> B_ESCHR_COL +#' +#' mo_genus("lab_mo_kpneumoniae") +#' #> "Klebsiella" +#' +#' # 4. It will look for changes itself: +#' # (add new row to the Excel file and save it) +#' +#' mo_genus("lab_mo_kpneumoniae") +#' #> Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'. +#' #> "Klebsiella" +#' } +set_mo_source <- function(path) { + + if (!is.character(path) | length(path) > 1) { + stop("`path` must be a character of length 1.") + } + + if (path == "") { + options(mo_source = NULL) + options(mo_source_timestamp = NULL) + if (file.exists("~/.mo_source.rds")) { + unlink("~/.mo_source.rds") + message("Removed mo_source file '~/.mo_source.rds'.") + } + return(invisible()) + } + + if (!file.exists(path)) { + stop("File not found: ", path) + } + + is_valid <- function(df) { + valid <- TRUE + if (!is.data.frame(df)) { + valid <- FALSE + } else if (!"mo" %in% colnames(df)) { + valid <- FALSE + } else if (!all(df$mo %in% AMR::microorganisms$mo)) { + valid <- FALSE + } else if (NCOL(df) < 2) { + valid <- FALSE + } + valid + } + + if (path %like% '[.]rds$') { + df <- readRDS(path) + + } else if (path %like% '[.]xlsx?$') { + # is Excel file (old or new) + if (!"readxl" %in% utils::installed.packages()) { + stop("Install the 'readxl' package first.") + } + if (path %like% '[.]xlsx$') { + df <- readxl::read_xlsx(path) + } else { + df <- readxl::read_xls(path) + } + + } else { + # try comma first + try( + df <- utils::read.table(header = TRUE, sep = ",", stringsAsFactors = FALSE), + silent = TRUE) + if (!is_valid(df)) { + # try pipe + try( + df <- utils::read.table(header = TRUE, sep = "|", stringsAsFactors = FALSE), + silent = TRUE) + } + } + + if (!is_valid(df)) { + stop("File must contain a column with self-defined values and a reference column `mo` with valid values from the `microorganisms` data set.") + } + + if (colnames(df)[1] == "mo") { + # put mo to the end + df <- df %>% select(-"mo", everything(), "mo") + } + + df <- as.data.frame(df, stringAsFactors = FALSE) + + # success + if (file.exists("~/.mo_source.rds")) { + action <- "Updated" + } else { + action <- "Created" + } + saveRDS(df, "~/.mo_source.rds") + options(mo_source = path) + options(mo_source_timestamp = as.character(file.info(path)$mtime)) + message(action, " mo_source file '~/.mo_source.rds' from '", path, "'.") +} + +#' @rdname mo_source +#' @export +get_mo_source <- function() { + + if (is.null(getOption("mo_source", NULL))) { + return(NULL) + } else { + old_time <- as.POSIXct(getOption("mo_source_timestamp")) + new_time <- as.POSIXct(as.character(file.info(getOption("mo_source", ""))$mtime)) + + if (is.na(new_time)) { + # source file was deleted, remove reference too + set_mo_source("") + return(NULL) + } + if (new_time != old_time) { + # set updated source + set_mo_source(getOption("mo_source")) + } + } + + readRDS("~/.mo_source.rds") +} diff --git a/_pkgdown.yml b/_pkgdown.yml index f44270cf..db7d835f 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -19,7 +19,7 @@ # Visit our website for more info: https://msberends.gitab.io/AMR. # # ==================================================================== # -url: https://msberends.gitlab.io/AMR +url: 'https://msberends.gitlab.io/AMR' title: 'AMR (for R)' @@ -74,74 +74,77 @@ navbar: href: 'LICENSE-text.html' reference: -- title: 'Background information' - desc: > - Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html) - for more information about how to work with functions in this package. - contents: - - '`AMR`' - - '`ITIS`' -- title: 'Cleaning your data' - desc: > - Functions for cleaning and optimising your data, to be able - to add variables later on (like taxonomic properties) or to - fix and extend antibiotic interpretations by applying [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/). - contents: - - starts_with("as.") - - '`eucast_rules`' - - '`guess_ab_col`' - - '`read.4D`' -- title: 'Adding variables to your data' - desc: > - Functions to add new data to existing data, like the determination - of first isolates, - contents: - - '`first_isolate`' - - '`mdro`' - - '`key_antibiotics`' - - '`mo_property`' - - '`ab_property`' - - '`atc_property`' - - '`abname`' - - '`age`' - - '`age_groups`' - - '`p.symbol`' - - '`join`' -- title: 'Analysing your data' - desc: > - Functions for conducting AMR analysis - contents: - - '`count`' - - '`portion`' - - '`freq`' - - '`g.test`' - - '`ggplot_rsi`' - - '`kurtosis`' - - '`resistance_predict`' - - '`rsi`' - - '`skewness`' -- title: 'Included data sets' - desc: > - References for microorganisms and antibiotics, and even a - genuine data set with isolates from septic patients. - contents: - - '`antibiotics`' - - '`microorganisms`' - - '`septic_patients`' - - '`microorganisms.certe`' - - '`microorganisms.old`' - - '`microorganisms.umcg`' - - '`supplementary_data`' -- title: Other - desc: > - These functions are mostly for internal use, but some of - them may also be suitable for your analysis. Especially the - 'like' function can be useful: `if (x %like% y) {...}`. - contents: - - '`get_locale`' - - '`like`' - - '`mo_failures`' - - '`mo_renamed`' + - title: 'Background information' + desc: > + Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html) + for more information about how to work with functions in this package. + contents: + - '`AMR`' + - '`ITIS`' + - title: 'Cleaning your data' + desc: > + Functions for cleaning and optimising your data, to be able to add + variables later on (like taxonomic properties) or to fix and extend + antibiotic interpretations by applying [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/). + contents: + - starts_with("as.") + - '`mo_source`' + - '`eucast_rules`' + - '`guess_ab_col`' + - '`read.4D`' + - title: 'Adding variables to your data' + desc: > + Functions to add new data to existing data, like the determination + of first isolates, multi-drug resistant microorganisms (MDRO), getting + properties of microorganisms or antibiotics and determining the age of + patients or divide ages into age groups. + contents: + - '`first_isolate`' + - '`mdro`' + - '`key_antibiotics`' + - '`mo_property`' + - '`ab_property`' + - '`atc_property`' + - '`abname`' + - '`age`' + - '`age_groups`' + - '`p.symbol`' + - '`join`' + - title: 'Analysing your data' + desc: > + Functions for conducting AMR analysis, like counting isolates, calculating + resistance or susceptibility, creating frequency tables or make plots. + contents: + - '`count`' + - '`portion`' + - '`freq`' + - '`g.test`' + - '`ggplot_rsi`' + - '`kurtosis`' + - '`resistance_predict`' + - '`rsi`' + - '`skewness`' + - title: 'Included data sets' + desc: > + References for microorganisms and antibiotics, and even a + genuine data set with isolates from septic patients. + contents: + - '`antibiotics`' + - '`microorganisms`' + - '`septic_patients`' + - '`microorganisms.codes`' + - '`microorganisms.old`' + - '`supplementary_data`' + - title: Other + desc: > + These functions are mostly for internal use, but some of + them may also be suitable for your analysis. Especially the + 'like' function can be useful: `if (x %like% y) {...}`. + contents: + - '`get_locale`' + - '`like`' + - '`mo_failures`' + - '`mo_renamed`' authors: Matthijs S. Berends: diff --git a/data/microorganisms.certe.rda b/data/microorganisms.certe.rda deleted file mode 100644 index 5791cc07..00000000 Binary files a/data/microorganisms.certe.rda and /dev/null differ diff --git a/data/microorganisms.codes.rda b/data/microorganisms.codes.rda new file mode 100644 index 00000000..c18dc4c7 Binary files /dev/null and b/data/microorganisms.codes.rda differ diff --git a/data/microorganisms.umcg.rda b/data/microorganisms.umcg.rda deleted file mode 100755 index a46e345b..00000000 Binary files a/data/microorganisms.umcg.rda and /dev/null differ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index dd71ced5..a2bbd152 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 diff --git a/docs/articles/benchmarks.html b/docs/articles/benchmarks.html index 25383803..b6d617e2 100644 --- a/docs/articles/benchmarks.html +++ b/docs/articles/benchmarks.html @@ -40,7 +40,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 @@ -178,7 +178,7 @@

Benchmarks

Matthijs S. Berends

-

17 January 2019

+

21 January 2019

diff --git a/docs/articles/index.html b/docs/articles/index.html index 2babab18..2120c8c3 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 diff --git a/docs/authors.html b/docs/authors.html index e76cedf6..ebc84305 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 diff --git a/docs/extra.css b/docs/extra.css index 2c0d74ab..532993ba 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -23,22 +23,22 @@ /* class for footer */ .university { - background-image: url(logo_rug.png); - height: 40px; - background-size: 160px; - background-repeat: no-repeat; + background-image: url(logo_rug.png); + background-size: 200px; + background-repeat: no-repeat; + background-position: center right; } /* Supports icons for brand using font-awesome */ .fab { - font-family: "Font Awesome 5 Brands" !important; + font-family: "Font Awesome 5 Brands" !important; } /* Remove the 'Read more on our website!' part from the manual pages */ #read-more-on-our-website-, #read-more-on-our-website- + p, li a[href="#read-more-on-our-website-"] { - display: none; + display: none; } /* make colour darker and better readable for links */ @@ -60,21 +60,33 @@ a pre[href], a pre[href]:hover, a pre[href]:focus { /* syntax font */ pre, code { - font-family: 'Courier New', monospace; - font-size: 100% !important; - font-weight: bold; - background-color: transparent; + font-family: 'Courier New', monospace; + font-size: 100% !important; + font-weight: bold; + background-color: transparent; } pre { font-size: 90% !important; } +kbd { + display: inline-block; + padding: 0 4px; + box-shadow: 1px 1px 1px #2c3e50; + margin: 2px; + font-size: small; + vertical-align: text-bottom; + color: #2c3e50; + background: #eee; + font-weight: bold; +} + li, p { - line-height: 1.5; + line-height: 1.5; } /* slightly smaller blockquote */ blockquote { - font-size: 98%; + font-size: 98%; } /* 2nd list in navigation should be smaller */ @@ -91,11 +103,11 @@ help { /* replace 'Developers' with 'Authors' */ .developers h2 { - display: none; + display: none; } .developers:before { - content: 'Authors'; - font-size: 1.5em; + content: 'Authors'; + font-size: 1.5em; } /* hide version label */ @@ -105,11 +117,11 @@ help { /* Date of vignettes */ .template-article .date:before { - content: 'Last updated: '; + content: 'Last updated: '; } .template-article .date { - font-size: 14px; - padding-top: 40px; + font-size: 14px; + padding-top: 40px; } /* more space between icon and text in top menu */ @@ -134,15 +146,21 @@ help { padding: 4px !important; } thead { - border-top: 2px solid black; - border-bottom: 2px solid black; + border-top: 2px solid black; + border-bottom: 2px solid black; } -tbody { - border-bottom: 2px solid black; +thead ~ tbody { + /* only when it has a header */ + border-bottom: 2px solid black; } table a:not(.btn), .table a:not(.btn) { - text-decoration: inherit; + text-decoration: inherit; } table a:not(.btn):hover, .table a:not(.btn):hover { - text-decoration: underline; + text-decoration: underline; +} + +.template-reference-index h2 ~ p { + font-size: 110%; + /* font-weight: bold; */ } diff --git a/docs/extra.js b/docs/extra.js index ca621c42..c26f219e 100644 --- a/docs/extra.js +++ b/docs/extra.js @@ -29,11 +29,19 @@ $('head').append('' + $('footer .copyright p').html().replace("Developed by", - "AMR (for R). Developed at the University of Groningen.
Authors:") + + 'AMR (for R). Developed at the University of Groningen.
Authors:') + '

'); - //$('footer').prepend("
"); + $('footer').addClass("university"); // Edit title of manual $('.template-reference-index h1').text('Manual'); diff --git a/docs/index.html b/docs/index.html index 652d96ac..40885317 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011
@@ -191,6 +191,7 @@
  • Research Microbiologists
  • Biomedical Researchers
  • Research Pharmacologists
  • +
  • Data Scientists / Data Analysts
  • Veterinary Microbiology:

    -

    Other specialists in any of the above fields:

    -

    Developers:

    +
  • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions
  • Support for the upcoming dplyr version 0.8.0
  • New function guess_ab_col() to find an antibiotic column in a table
  • New function mo_failures() to review values that could not be coerced to a valid MO code, using as.mo(). This latter function will now only show a maximum of 25 uncoerced values.
  • @@ -297,6 +298,8 @@
  • A note to the manual pages of the portion functions, that low counts can influence the outcome and that the portion functions may camouflage this, since they only return the portion (albeit being dependent on the minimum parameter)
  • +
  • Merged data sets microorganisms.certe and microorganisms.umcg into microorganisms.codes +
  • Function mo_taxonomy() now contains the kingdom too
  • Reduce false positives for is.rsi.eligible()
  • diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 15529a4f..078b4bc2 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -80,7 +80,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 @@ -228,7 +228,7 @@
    as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE,
    -  reference_df = NULL)
    +  reference_df = get_mo_source())
     
     is.mo(x)
    @@ -255,7 +255,7 @@ reference_df -

    a data.frame to use for extra reference when translating x to a valid mo. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid mo as found in the microorganisms data set.

    +

    a data.frame to use for extra reference when translating x to a valid mo. See set_mo_source and get_mo_source to automate the usage of your own codes (e.g. used in your analysis or organisation).

    diff --git a/docs/reference/index.html b/docs/reference/index.html index 3b6ae348..7d3685a6 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 @@ -278,6 +278,12 @@

    Class 'rsi'

    + +

    set_mo_source() get_mo_source()

    + +

    Use predefined reference data set

    + +

    eucast_rules() EUCAST_rules() interpretive_reading()

    @@ -299,7 +305,7 @@

    Adding variables to your data

    -

    Functions to add new data to existing data, like the determination of first isolates,

    +

    Functions to add new data to existing data, like the determination of first isolates, multi-drug resistant microorganisms (MDRO), getting properties of microorganisms or antibiotics and determining the age of patients or divide ages into age groups.

    @@ -373,7 +379,7 @@

    Analysing your data

    -

    Functions for conducting AMR analysis

    +

    Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, creating frequency tables or make plots.

    @@ -459,9 +465,9 @@ -

    microorganisms.certe

    +

    microorganisms.codes

    -

    Translation table for Certe

    +

    Translation table for microorganism codes

    @@ -470,12 +476,6 @@

    Data set with old taxonomic data from ITIS

    - -

    microorganisms.umcg

    - -

    Translation table for UMCG

    - -

    microorganismsDT microorganisms.prevDT microorganisms.unprevDT microorganisms.oldDT

    diff --git a/docs/reference/microorganisms.codes.html b/docs/reference/microorganisms.codes.html new file mode 100644 index 00000000..0cc3f176 --- /dev/null +++ b/docs/reference/microorganisms.codes.html @@ -0,0 +1,297 @@ + + + + + + + + +Translation table for microorganism codes — microorganisms.codes • AMR (for R) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    A data set containing commonly used codes for microorganisms. Define your own with set_mo_source.

    + +
    + +
    microorganisms.codes
    + +

    Format

    + +

    A data.frame with 3,303 observations and 2 variables:

    +
    certe

    Commonly used code of a microorganism

    +
    mo

    Code of microorganism in microorganisms

    +
    + +

    Read more on our website!

    + + +


    +On our website https://msberends.gitlab.io/AMR you can find a omprehensive tutorial about how to conduct AMR analysis and find the complete documentation of all functions, which reads a lot easier than in R.

    + +

    See also

    + + + + +
    + +
    + + +
    + + + + + + + + + diff --git a/docs/reference/microorganisms.html b/docs/reference/microorganisms.html index 141ff016..b8d69189 100644 --- a/docs/reference/microorganisms.html +++ b/docs/reference/microorganisms.html @@ -80,7 +80,7 @@ AMR (for R) - 0.5.0.9010 + 0.5.0.9011 @@ -269,7 +269,7 @@ On our website https://msberends.gitla

    See also

    -

    as.mo mo_property microorganisms.umcg

    +

    as.mo mo_property microorganisms.codes

    diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html new file mode 100644 index 00000000..2a624675 --- /dev/null +++ b/docs/reference/mo_source.html @@ -0,0 +1,334 @@ + + + + + + + + +Use predefined reference data set — mo_source • AMR (for R) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    These functions can be used to predefine your own reference to be used in as.mo and consequently all mo_* functions like mo_genus and mo_gramstain.

    + +
    + +
    set_mo_source(path)
    +
    +get_mo_source()
    + +

    Arguments

    + + + + + + +
    path

    location of your reference file, see Details

    + +

    Details

    + +

    The reference file can be a text file seperated with commas (CSV) or pipes, an Excel file (old 'xls' format or new 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you need to have the readxl package installed.

    +

    set_mo_source will check the file for validity: it must be a data.frame, must have a column named "mo" which contains values from microorganisms$mo and must have a reference column with your own defined values. If all tests pass, set_mo_source will read the file into R and export it to "~/.mo_source.rds". This compressed data file will then be used at default for MO determination (function as.mo and consequently all mo_* functions like mo_genus and mo_gramstain). The location of the original file will be saved as option with options(mo_source = path). Its timestamp will be saved with options(mo_source_datetime = ...).

    +

    get_mo_source will return the data set by reading "~/.mo_source.rds" with readRDS. If the original file has changed (the file defined with path), it will call set_mo_source to update the data file automatically.

    +

    Reading an Excel file (.xlsx) with only one row has a size of 8-9 kB. The compressed file will have a size of 0.1 kB and can be read by get_mo_source in only a couple of microseconds (a millionth of a second).

    + +

    Read more on our website!

    + + +


    +On our website https://msberends.gitlab.io/AMR you can find a omprehensive tutorial about how to conduct AMR analysis and find the complete documentation of all functions, which reads a lot easier than in R.

    + + +

    Examples

    +
    # NOT RUN {
    +# imagine this Excel file (mo codes looked up in `microorganisms` data set):
    +#            A                B
    +# 1  our code            mo
    +# 2  lab_mo_ecoli        B_ESCHR_COL
    +# 3  lab_mo_kpneumoniae  B_KLBSL_PNE
    +
    +# 1. We save it as 'home/me/ourcodes.xlsx'
    +
    +# 2. We use it for input:
    +set_mo_source("C:\path\ourcodes.xlsx")
    +#> Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'.
    +
    +# 3. And use it in our functions:
    +as.mo("lab_mo_ecoli")
    +#> B_ESCHR_COL
    +
    +mo_genus("lab_mo_kpneumoniae")
    +#> "Klebsiella"
    +
    +# 4. It will look for changes itself:
    +# (add new row to the Excel file and save it)
    +
    +mo_genus("lab_mo_kpneumoniae")
    +#> Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'.
    +#> "Klebsiella"
    +# }
    +
    +
    + +
    + + +
    + + + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index c91fb660..5fde7870 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -85,14 +85,11 @@ https://msberends.gitlab.io/AMR/reference/microorganisms.html - https://msberends.gitlab.io/AMR/reference/microorganisms.certe.html + https://msberends.gitlab.io/AMR/reference/microorganisms.codes.html https://msberends.gitlab.io/AMR/reference/microorganisms.old.html - - https://msberends.gitlab.io/AMR/reference/microorganisms.umcg.html - https://msberends.gitlab.io/AMR/reference/mo_failures.html @@ -102,6 +99,9 @@ https://msberends.gitlab.io/AMR/reference/mo_renamed.html + + https://msberends.gitlab.io/AMR/reference/mo_source.html + https://msberends.gitlab.io/AMR/reference/p.symbol.html diff --git a/index.md b/index.md index 0f4a2496..abadefa7 100644 --- a/index.md +++ b/index.md @@ -17,6 +17,7 @@ Medical Microbiology: * Research Microbiologists * Biomedical Researchers * Research Pharmacologists + * Data Scientists / Data Analysts Veterinary Microbiology: @@ -29,14 +30,6 @@ Microbial Ecology: * Extremophile Researchers * Astrobiologists -Other specialists in any of the above fields: - - * Data Scientists/Data Analysts - * Biotechnologists - * Biochemists - * Geneticists - * Molecular Biologists/Microbiologists - Developers: * Package developers for R @@ -51,7 +44,7 @@ This package is available on the official R network (CRAN), which has a peer-rev install.packages("AMR") ``` -It will be downloaded and installed automatically. For RStudio, click on menu *Tools* > *Install Packages...*, then type in "AMR" and press Install. +It will be downloaded and installed automatically. For RStudio, click on the menu *Tools* > *Install Packages...* and then type in "AMR" and press Install. ### Get started diff --git a/man/as.mo.Rd b/man/as.mo.Rd index a8bcc27e..5502655b 100644 --- a/man/as.mo.Rd +++ b/man/as.mo.Rd @@ -7,7 +7,7 @@ \title{Transform to microorganism ID} \usage{ as.mo(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain = TRUE, - reference_df = NULL) + reference_df = get_mo_source()) is.mo(x) } @@ -24,7 +24,7 @@ is.mo(x) \item{allow_uncertain}{a logical to indicate whether the input should be checked for less possible results, see Details} -\item{reference_df}{a \code{data.frame} to use for extra reference when translating \code{x} to a valid \code{mo}. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid \code{mo} as found in the \code{\link{microorganisms}} data set.} +\item{reference_df}{a \code{data.frame} to use for extra reference when translating \code{x} to a valid \code{mo}. See \code{\link{set_mo_source}} and \code{\link{get_mo_source}} to automate the usage of your own codes (e.g. used in your analysis or organisation).} } \value{ Character (vector) with class \code{"mo"}. Unknown values will return \code{NA}. diff --git a/man/microorganisms.Rd b/man/microorganisms.Rd index dd54e519..75b63fee 100755 --- a/man/microorganisms.Rd +++ b/man/microorganisms.Rd @@ -48,6 +48,6 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https:// } \seealso{ -\code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.umcg}} +\code{\link{as.mo}} \code{\link{mo_property}} \code{\link{microorganisms.codes}} } \keyword{datasets} diff --git a/man/microorganisms.certe.Rd b/man/microorganisms.codes.Rd similarity index 59% rename from man/microorganisms.certe.Rd rename to man/microorganisms.codes.Rd index 9c49fb5e..ce516570 100644 --- a/man/microorganisms.certe.Rd +++ b/man/microorganisms.codes.Rd @@ -1,19 +1,19 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} -\name{microorganisms.certe} -\alias{microorganisms.certe} -\title{Translation table for Certe} -\format{A \code{\link{data.frame}} with 2,665 observations and 2 variables: +\name{microorganisms.codes} +\alias{microorganisms.codes} +\title{Translation table for microorganism codes} +\format{A \code{\link{data.frame}} with 3,303 observations and 2 variables: \describe{ - \item{\code{certe}}{Code of microorganism according to Certe MMB} + \item{\code{certe}}{Commonly used code of a microorganism} \item{\code{mo}}{Code of microorganism in \code{\link{microorganisms}}} }} \usage{ -microorganisms.certe +microorganisms.codes } \description{ -A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}. +A data set containing commonly used codes for microorganisms. Define your own with \code{\link{set_mo_source}}. } \section{Read more on our website!}{ diff --git a/man/microorganisms.umcg.Rd b/man/microorganisms.umcg.Rd deleted file mode 100755 index 5027162d..00000000 --- a/man/microorganisms.umcg.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{microorganisms.umcg} -\alias{microorganisms.umcg} -\title{Translation table for UMCG} -\format{A \code{\link{data.frame}} with 1,095 observations and 2 variables: -\describe{ - \item{\code{umcg}}{Code of microorganism according to UMCG MMB} - \item{\code{certe}}{Code of microorganism according to Certe MMB} -}} -\usage{ -microorganisms.umcg -} -\description{ -A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{microorganisms}$mo} (using \code{\link{left_join_microorganisms}}). GLIMS codes can also be translated to valid \code{MO}s with \code{\link{guess_mo}}. -} -\section{Read more on our website!}{ - -\if{html}{\figure{logo.png}{options: height=40px style=margin-bottom:5px} \cr} -On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a omprehensive tutorial} about how to conduct AMR analysis and find \href{https://msberends.gitlab.io/AMR/reference}{the complete documentation of all functions}, which reads a lot easier than in R. -} - -\seealso{ -\code{\link{as.mo}} \code{\link{microorganisms.certe}} \code{\link{microorganisms}} -} -\keyword{datasets} diff --git a/man/mo_source.Rd b/man/mo_source.Rd new file mode 100644 index 00000000..a0a20dea --- /dev/null +++ b/man/mo_source.Rd @@ -0,0 +1,63 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/mo_source.R +\name{mo_source} +\alias{mo_source} +\alias{set_mo_source} +\alias{get_mo_source} +\title{Use predefined reference data set} +\usage{ +set_mo_source(path) + +get_mo_source() +} +\arguments{ +\item{path}{location of your reference file, see Details} +} +\description{ +These functions can be used to predefine your own reference to be used in \code{\link{as.mo}} and consequently all \code{mo_*} functions like \code{\link{mo_genus}} and \code{\link{mo_gramstain}}. +} +\details{ +The reference file can be a text file seperated with commas (CSV) or pipes, an Excel file (old 'xls' format or new 'xlsx' format) or an R object file (extension '.rds'). To use an Excel file, you need to have the \code{readxl} package installed. + +\code{set_mo_source} will check the file for validity: it must be a \code{data.frame}, must have a column named \code{"mo"} which contains values from \code{microorganisms$mo} and must have a reference column with your own defined values. If all tests pass, \code{set_mo_source} will read the file into R and export it to \code{"~/.mo_source.rds"}. This compressed data file will then be used at default for MO determination (function \code{\link{as.mo}} and consequently all \code{mo_*} functions like \code{\link{mo_genus}} and \code{\link{mo_gramstain}}). The location of the original file will be saved as option with \code{\link{options}(mo_source = path)}. Its timestamp will be saved with \code{\link{options}(mo_source_datetime = ...)}. + +\code{get_mo_source} will return the data set by reading \code{"~/.mo_source.rds"} with \code{\link{readRDS}}. If the original file has changed (the file defined with \code{path}), it will call \code{set_mo_source} to update the data file automatically. + +Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The compressed file will have a size of 0.1 kB and can be read by \code{get_mo_source} in only a couple of microseconds (a millionth of a second). +} +\section{Read more on our website!}{ + +\if{html}{\figure{logo.png}{options: height=40px style=margin-bottom:5px} \cr} +On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a omprehensive tutorial} about how to conduct AMR analysis and find \href{https://msberends.gitlab.io/AMR/reference}{the complete documentation of all functions}, which reads a lot easier than in R. +} + +\examples{ +\dontrun{ + +# imagine this Excel file (mo codes looked up in `microorganisms` data set): +# A B +# 1 our code mo +# 2 lab_mo_ecoli B_ESCHR_COL +# 3 lab_mo_kpneumoniae B_KLBSL_PNE + +# 1. We save it as 'home/me/ourcodes.xlsx' + +# 2. We use it for input: +set_mo_source("C:\\path\\ourcodes.xlsx") +#> Created mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'. + +# 3. And use it in our functions: +as.mo("lab_mo_ecoli") +#> B_ESCHR_COL + +mo_genus("lab_mo_kpneumoniae") +#> "Klebsiella" + +# 4. It will look for changes itself: +# (add new row to the Excel file and save it) + +mo_genus("lab_mo_kpneumoniae") +#> Updated mo_source file '~/.mo_source.rds' from 'home/me/ourcodes.xlsx'. +#> "Klebsiella" +} +} diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 2c0d74ab..532993ba 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -23,22 +23,22 @@ /* class for footer */ .university { - background-image: url(logo_rug.png); - height: 40px; - background-size: 160px; - background-repeat: no-repeat; + background-image: url(logo_rug.png); + background-size: 200px; + background-repeat: no-repeat; + background-position: center right; } /* Supports icons for brand using font-awesome */ .fab { - font-family: "Font Awesome 5 Brands" !important; + font-family: "Font Awesome 5 Brands" !important; } /* Remove the 'Read more on our website!' part from the manual pages */ #read-more-on-our-website-, #read-more-on-our-website- + p, li a[href="#read-more-on-our-website-"] { - display: none; + display: none; } /* make colour darker and better readable for links */ @@ -60,21 +60,33 @@ a pre[href], a pre[href]:hover, a pre[href]:focus { /* syntax font */ pre, code { - font-family: 'Courier New', monospace; - font-size: 100% !important; - font-weight: bold; - background-color: transparent; + font-family: 'Courier New', monospace; + font-size: 100% !important; + font-weight: bold; + background-color: transparent; } pre { font-size: 90% !important; } +kbd { + display: inline-block; + padding: 0 4px; + box-shadow: 1px 1px 1px #2c3e50; + margin: 2px; + font-size: small; + vertical-align: text-bottom; + color: #2c3e50; + background: #eee; + font-weight: bold; +} + li, p { - line-height: 1.5; + line-height: 1.5; } /* slightly smaller blockquote */ blockquote { - font-size: 98%; + font-size: 98%; } /* 2nd list in navigation should be smaller */ @@ -91,11 +103,11 @@ help { /* replace 'Developers' with 'Authors' */ .developers h2 { - display: none; + display: none; } .developers:before { - content: 'Authors'; - font-size: 1.5em; + content: 'Authors'; + font-size: 1.5em; } /* hide version label */ @@ -105,11 +117,11 @@ help { /* Date of vignettes */ .template-article .date:before { - content: 'Last updated: '; + content: 'Last updated: '; } .template-article .date { - font-size: 14px; - padding-top: 40px; + font-size: 14px; + padding-top: 40px; } /* more space between icon and text in top menu */ @@ -134,15 +146,21 @@ help { padding: 4px !important; } thead { - border-top: 2px solid black; - border-bottom: 2px solid black; + border-top: 2px solid black; + border-bottom: 2px solid black; } -tbody { - border-bottom: 2px solid black; +thead ~ tbody { + /* only when it has a header */ + border-bottom: 2px solid black; } table a:not(.btn), .table a:not(.btn) { - text-decoration: inherit; + text-decoration: inherit; } table a:not(.btn):hover, .table a:not(.btn):hover { - text-decoration: underline; + text-decoration: underline; +} + +.template-reference-index h2 ~ p { + font-size: 110%; + /* font-weight: bold; */ } diff --git a/pkgdown/extra.js b/pkgdown/extra.js index ca621c42..c26f219e 100644 --- a/pkgdown/extra.js +++ b/pkgdown/extra.js @@ -29,11 +29,19 @@ $('head').append('' + $('footer .copyright p').html().replace("Developed by", - "AMR (for R). Developed at the University of Groningen.
    Authors:") + + 'AMR (for R). Developed at the University of Groningen.
    Authors:') + '

    '); - //$('footer').prepend("
    "); + $('footer').addClass("university"); // Edit title of manual $('.template-reference-index h1').text('Manual'); diff --git a/tests/testthat/test-mo.R b/tests/testthat/test-mo.R index 86e76c19..f02f8af8 100644 --- a/tests/testthat/test-mo.R +++ b/tests/testthat/test-mo.R @@ -194,7 +194,7 @@ test_that("as.mo works", { expect_equal(suppressMessages(as.character(as.mo("Escherichia blattae"))), "B_SHMWL_BLA") # - Didymosphaeria spartinae (unprevalent) expect_warning(suppressMessages(as.mo("D spartin", allow_uncertain = TRUE))) - # - was renames to Leptosphaeria obiones + # - was renamed to Leptosphaeria obiones expect_equal(suppressWarnings(suppressMessages(as.character(as.mo("D spartin", allow_uncertain = TRUE)))), "F_LPTSP_OBI") @@ -205,15 +205,15 @@ test_that("as.mo works", { # predefined reference_df expect_equal(as.character(as.mo("TestingOwnID", - reference_df = data.frame(a = "TestingOwnID", b = "B_ESCHR_COL"))), + reference_df = data.frame(mycol = "TestingOwnID", mo = "B_ESCHR_COL"))), "B_ESCHR_COL") expect_equal(as.character(as.mo(c("TestingOwnID", "E. coli"), - reference_df = data.frame(a = "TestingOwnID", b = "B_ESCHR_COL"))), + reference_df = data.frame(mycol = "TestingOwnID", mo = "B_ESCHR_COL"))), c("B_ESCHR_COL", "B_ESCHR_COL")) expect_warning(as.mo("TestingOwnID", reference_df = NULL)) - expect_error(as.mo("E. coli", reference_df = data.frame(a = "TestingOwnID"))) + expect_error(as.mo("E. coli", reference_df = data.frame(mycol = "TestingOwnID"))) - # combination of existing mo and certe + # combination of existing mo and other code expect_identical(as.character(as.mo(c("B_ESCHR_COL", "ESCCOL"))), c("B_ESCHR_COL", "B_ESCHR_COL"))