diff --git a/DESCRIPTION b/DESCRIPTION index 14a7cf81..4a7f261c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9012 -Date: 2019-07-10 +Version: 0.7.1.9013 +Date: 2019-07-11 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NEWS.md b/NEWS.md index aa4d72d3..b9314012 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9012 +# AMR 0.7.1.9013 ### New * Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for `portion_*` functions or `count_*` functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter `only_all_tested` (**which defaults to `FALSE`**) replaces the old `also_single_tested` and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the `portion` and `count` help pages), where the %SI is being determined: @@ -39,9 +39,10 @@ * 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 `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 +* Speed improvement for `guess_ab_col()` which is now 30 times faster for antibiotic abbreviations # AMR 0.7.1 diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index 148bea8f..0fc662af 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -79,6 +79,13 @@ guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE) { search_string.ab <- suppressWarnings(as.ab(search_string)) if (search_string.ab %in% colnames(x)) { ab_result <- colnames(x)[colnames(x) == search_string.ab][1L] + + } else if (any(tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations"))))) { + ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(unlist(ab_property(search_string.ab, "abbreviations")))][1L] + + # } else if (any(tolower(colnames(x)) %in% tolower(ab_tradenames(search_string.ab)))) { + # ab_result <- colnames(x)[tolower(colnames(x)) %in% tolower(ab_tradenames(search_string.ab))][1L] + } else { # sort colnames on length - longest first cols <- colnames(x[, x %>% colnames() %>% nchar() %>% order() %>% rev()]) diff --git a/R/misc.R b/R/misc.R index babb054c..6ab8c09e 100755 --- a/R/misc.R +++ b/R/misc.R @@ -97,8 +97,10 @@ search_type_in_df <- function(x, type) { if (type == "mo") { if ("mo" %in% lapply(x, class)) { found <- colnames(x)[lapply(x, class) == "mo"][1] - } else if (any(colnames(x) %like% "^(mo|microorganism|organism|bacteria)s?$")) { - found <- colnames(x)[colnames(x) %like% "^(mo|microorganism|organism|bacteria)s?$"][1] + } else if (any(colnames(x) %like% "^(mo|microorganism|organism|bacteria|bacterie)s?$")) { + found <- colnames(x)[colnames(x) %like% "^(mo|microorganism|organism|bacteria|bacterie)s?$"][1] + } else if (any(colnames(x) %like% "^(microorganism|organism|bacteria|bacterie)")) { + found <- colnames(x)[colnames(x) %like% "^(microorganism|organism|bacteria|bacterie)"][1] } else if (any(colnames(x) %like% "species")) { found <- colnames(x)[colnames(x) %like% "species"][1] } diff --git a/R/sysdata.rda b/R/sysdata.rda index 096a3d9b..43047d60 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 415c8868..4ae125f0 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013 diff --git a/docs/articles/index.html b/docs/articles/index.html index 6b620390..edb8aba6 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013 diff --git a/docs/authors.html b/docs/authors.html index 25c4783b..a8501621 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013 diff --git a/docs/index.html b/docs/index.html index cce165d8..8f5e99f0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013 @@ -190,9 +190,9 @@
-
+

(TLDR - to find out how to conduct AMR analysis, please continue reading here to get started.


@@ -248,7 +248,7 @@

Latest released version

This package is available on the official R network (CRAN), which has a peer-reviewed submission process. Install this package in R with:

- +

It will be downloaded and installed automatically. For RStudio, click on the menu Tools > Install Packages… and then type in “AMR” and press Install.

Note: Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.

@@ -256,8 +256,8 @@

Latest development version

The latest and unpublished development version can be installed with (precaution: may be unstable):

-
install.packages("devtools")
-devtools::install_gitlab("msberends/AMR")
+
install.packages("devtools")
+devtools::install_gitlab("msberends/AMR")
@@ -299,9 +299,9 @@

NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{https://www.whocc.no/copyright_disclaimer/}.

Read more about the data from WHOCC in our manual.

-
+

-WHONET / EARS-Net

+WHONET / EARS-Net

We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an example data set WHONET with the exact same structure as a WHONET export file. Furthermore, this package also contains a data set antibiotics with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.

Read our tutorial about how to work with WHONET data here.

diff --git a/docs/news/index.html b/docs/news/index.html index 2d75fc22..4b67cc1c 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013
@@ -232,9 +232,9 @@
-
+

-AMR 0.7.1.9012 Unreleased +AMR 0.7.1.9013 Unreleased

@@ -242,29 +242,29 @@ @@ -282,15 +282,16 @@
  • 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 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
  • +
  • Speed improvement for guess_ab_col() which is now 30 times faster for antibiotic abbreviations
  • -
    +

    -AMR 0.7.1 2019-06-23 +AMR 0.7.1 2019-06-23

    @@ -298,14 +299,14 @@

    All these lead to the microbial ID of E. coli:

    - +
  • Function mo_info() as an analogy to ab_info(). The mo_info() prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism
  • Function mo_synonyms() to get all previously accepted taxonomic names of a microorganism

  • @@ -369,9 +370,9 @@

    -
    +

    -AMR 0.7.0 2019-06-03 +AMR 0.7.0 2019-06-03

    + @@ -466,9 +467,9 @@ Please +

    -AMR 0.6.1 2019-03-29 +AMR 0.6.1 2019-03-29

    @@ -480,9 +481,9 @@ Please +

    -AMR 0.6.0 2019-03-27 +AMR 0.6.0 2019-03-27

    New website!

    We’ve got a new website: https://msberends.gitlab.io/AMR (built with the great pkgdown)

    @@ -505,7 +506,7 @@ Please catalogue_of_life_version(). -
  • Due to this change, some mo codes changed (e.g. Streptococcus changed from B_STRPTC to B_STRPT). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
  • +
  • Due to this change, some mo codes changed (e.g. Streptococcus changed from B_STRPTC to B_STRPT). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
  • New function mo_rank() for the taxonomic rank (genus, species, infraspecies, etc.)
  • New function mo_url() to get the direct URL of a species from the Catalogue of Life
  • @@ -519,33 +520,33 @@ This data is updated annually - check the included version with the new function
  • New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:

    - +

    The antibiotics data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the antibiotics data set. For example:

    - +
  • All ab_* functions are deprecated and replaced by atc_* functions:

    - -These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
  • + +These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
  • 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
  • @@ -556,20 +557,20 @@ These functions use as.atc()New function age_groups() to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
  • New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

    -
    x <- resistance_predict(septic_patients, col_ab = "amox")
    -plot(x)
    -ggplot_rsi_predict(x)
    +
    x <- resistance_predict(septic_patients, col_ab = "amox")
    +plot(x)
    +ggplot_rsi_predict(x)
  • Functions filter_first_isolate() and filter_first_weighted_isolate() to shorten and fasten filtering on data sets with antimicrobial results, e.g.:

    - +

    is equal to:

    -
    septic_patients %>%
    -  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
    -  filter(only_firsts == TRUE) %>%
    -  select(-only_firsts)
    +
    septic_patients %>%
    +  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
    +  filter(only_firsts == TRUE) %>%
    +  select(-only_firsts)
  • New function availability() to check the number of available (non-empty) results in a data.frame
  • @@ -598,33 +599,33 @@ These functions use as.atc()
  • Now handles incorrect spelling, like i instead of y and f instead of ph:

    - +
  • Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default allow_uncertain = TRUE is equal to uncertainty level 2. Run ?as.mo for more info about these levels.

    -
    # equal:
    -as.mo(..., allow_uncertain = TRUE)
    -as.mo(..., allow_uncertain = 2)
    -
    -# also equal:
    -as.mo(..., allow_uncertain = FALSE)
    -as.mo(..., allow_uncertain = 0)
    +
    # equal:
    +as.mo(..., allow_uncertain = TRUE)
    +as.mo(..., allow_uncertain = 2)
    +
    +# also equal:
    +as.mo(..., allow_uncertain = FALSE)
    +as.mo(..., allow_uncertain = 0)
    Using as.mo(..., allow_uncertain = 3) could lead to very unreliable results.
  • Implemented the latest publication of Becker et al. (2019), for categorising coagulase-negative Staphylococci
  • All microbial IDs that found are now saved to a local file ~/.Rhistory_mo. Use the new function clean_mo_history() to delete this file, which resets the algorithms.
  • Incoercible results will now be considered ‘unknown’, MO code UNKNOWN. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:

    - +
  • Fix for vector containing only empty values
  • Finds better results when input is in other languages
  • @@ -670,19 +671,19 @@ Using as.mo(..., allow_uncertain = 3)
  • Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:

    - +
  • Header info is now available as a list, with the header function
  • The parameter header is now set to TRUE at default, even for markdown
  • @@ -713,9 +714,9 @@ Using as.mo(..., allow_uncertain = 3)

    -
    +

    -AMR 0.5.0 2018-11-30 +AMR 0.5.0 2018-11-30

    @@ -757,10 +758,10 @@ Using as.mo(..., allow_uncertain = 3)Fewer than 3 characters as input for as.mo will return NA
  • Function as.mo (and all mo_* wrappers) now supports genus abbreviations with “species” attached

    -
    as.mo("E. species")        # B_ESCHR
    -mo_fullname("E. spp.")     # "Escherichia species"
    -as.mo("S. spp")            # B_STPHY
    -mo_fullname("S. species")  # "Staphylococcus species"
    +
    as.mo("E. species")        # B_ESCHR
    +mo_fullname("E. spp.")     # "Escherichia species"
    +as.mo("S. spp")            # B_STPHY
    +mo_fullname("S. species")  # "Staphylococcus species"
  • Added parameter combine_IR (TRUE/FALSE) to functions portion_df and count_df, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)
  • Fix for portion_*(..., as_percent = TRUE) when minimal number of isolates would not be met
  • @@ -773,17 +774,17 @@ Using as.mo(..., allow_uncertain = 3)
  • Support for grouping variables, test with:

    - +
  • Support for (un)selecting columns:

    - +
  • -
  • Check for hms::is.hms +
  • Check for hms::is.hms
  • Now prints in markdown at default in non-interactive sessions
  • No longer adds the factor level column and sorts factors on count again
  • @@ -840,9 +841,9 @@ Using as.mo(..., allow_uncertain = 3)

    -
    +

    -AMR 0.4.0 2018-10-01 +AMR 0.4.0 2018-10-01

    @@ -861,18 +862,18 @@ Using as.mo(..., allow_uncertain = 3)

    They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:

    -
    mo_gramstain("E. coli")
    -# [1] "Gram negative"
    -mo_gramstain("E. coli", language = "de") # German
    -# [1] "Gramnegativ"
    -mo_gramstain("E. coli", language = "es") # Spanish
    -# [1] "Gram negativo"
    -mo_fullname("S. group A", language = "pt") # Portuguese
    -# [1] "Streptococcus grupo A"
    +
    mo_gramstain("E. coli")
    +# [1] "Gram negative"
    +mo_gramstain("E. coli", language = "de") # German
    +# [1] "Gramnegativ"
    +mo_gramstain("E. coli", language = "es") # Spanish
    +# [1] "Gram negativo"
    +mo_fullname("S. group A", language = "pt") # Portuguese
    +# [1] "Streptococcus grupo A"

    Furthermore, former taxonomic names will give a note about the current taxonomic name:

    - +
  • Functions count_R, count_IR, count_I, count_SI and count_S to selectively count resistant or susceptible isolates
  • @@ -975,9 +976,9 @@ Using as.mo(..., allow_uncertain = 3)
    -
    +

    -AMR 0.3.0 2018-08-14 +AMR 0.3.0 2018-08-14

    @@ -1082,7 +1083,7 @@ Using as.mo(..., allow_uncertain = 3) -
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • +
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • Classes rsi and mic do not add the attribute package.version anymore
  • Added "groups" option for atc_property(..., property). It will return a vector of the ATC hierarchy as defined by the WHO. The new function atc_groups is a convenient wrapper around this.
  • Build-in host check for atc_property as it requires the host set by url to be responsive
  • @@ -1112,9 +1113,9 @@ Using as.mo(..., allow_uncertain = 3)

    -
    +

    -AMR 0.2.0 2018-05-03 +AMR 0.2.0 2018-05-03

    @@ -1170,9 +1171,9 @@ Using as.mo(..., allow_uncertain = 3)

    -
    +

    -AMR 0.1.1 2018-03-14 +AMR 0.1.1 2018-03-14

    -
    +

    -AMR 0.1.0 2018-02-22 +AMR 0.1.0 2018-02-22

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 1c0ed4af..9f781c72c 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 2.3.1 +pandoc: '2.6' pkgdown: 1.3.0 pkgdown_sha: ~ articles: diff --git a/docs/reference/index.html b/docs/reference/index.html index 9a6a54c8..ba022acb 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9012 + 0.7.1.9013