diff --git a/DESCRIPTION b/DESCRIPTION index 29b9f39c..5bea109a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.1.9010 -Date: 2022-05-16 +Version: 1.8.1.9011 +Date: 2022-06-03 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by @@ -90,5 +90,5 @@ BugReports: https://github.com/msberends/AMR/issues License: GPL-2 | file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.0 Roxygen: list(markdown = TRUE) diff --git a/NEWS.md b/NEWS.md index d75c7fc2..de19e5f0 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# `AMR` 1.8.1.9010 -## Last updated: 16 May 2022 +# `AMR` 1.8.1.9011 +## Last updated: 3 June 2022 ### New * EUCAST 2022 and CLSI 2022 guidelines have been added for `as.rsi()`. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations. @@ -11,7 +11,7 @@ * Small fix for using `ab_from_text()` * Fixes for reading in text files using `set_mo_source()`, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package * Using any `random_*()` function (such as `random_mic()`) is now possible by directly calling the package without loading it first: `AMR::random_mic(10)` - +* Changed value in column `prevalence` of the `microorganisms` data set from 3 to 2 for these genera: *Acholeplasma*, *Alistipes*, *Alloprevotella*, *Bergeyella*, *Borrelia*, *Brachyspira*, *Butyricimonas*, *Cetobacterium*, *Chlamydia*, *Chlamydophila*, *Deinococcus*, *Dysgonomonas*, *Elizabethkingia*, *Empedobacter*, *Haloarcula*, *Halobacterium*, *Halococcus*, *Myroides*, *Odoribacter*, *Ornithobacterium*, *Parabacteroides*, *Pedobacter*, *Phocaeicola*, *Porphyromonas*, *Riemerella*, *Sphingobacterium*, *Streptobacillus*, *Tenacibaculum*, *Terrimonas*, *Victivallis*, *Wautersiella*, *Weeksella* # `AMR` 1.8.1 diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz index a8b51104..a85387c6 100644 Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ diff --git a/data-raw/reproduction_of_microorganisms.R b/data-raw/reproduction_of_microorganisms.R index bc571fad..f4b92ac2 100644 --- a/data-raw/reproduction_of_microorganisms.R +++ b/data-raw/reproduction_of_microorganisms.R @@ -168,31 +168,40 @@ rm(ref_taxonomy) rm(data_col.bak) rm(data_dsmz.bak) -mo_found_in_NL <- c("Absidia", "Acremonium", "Actinotignum", "Aedes", "Alternaria", "Anaerosalibacter", "Ancylostoma", - "Angiostrongylus", "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus", - "Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", "Beauveria", - "Bilophilia", "Blastocystis", "Branhamella", "Brochontrix", "Brugia", "Calymmatobacterium", "Candida", "Capillaria", - "Capnocytophaga", "Catabacter", "Cdc", "Chaetomium", "Chilomastix", "Chryseobacterium", - "Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", "Conidiobolus", - "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Demodex", "Dermatobia", "Dicrocoelium", - "Dioctophyma", "Diphyllobothrium", "Dipylidium", "Dirofilaria", "Dracunculus", "Echinococcus", - "Echinostoma", "Elisabethkingia", "Enterobius", "Enteromonas", "Euascomycetes", "Exophiala", - "Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", "Fonsecaea", "Fusarium", "Fusobacterium", - "Giardia", "Gnathostoma", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces", - "Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", "Lelliottia", - "Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", "Malassezia", - "Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", "Molonomonas", - "Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", "Nanophetus", "Nattrassia", - "Necator", "Nectria", "Novospingobium", "Ochroconis", "Oesophagostomum", "Oidiodendron", "Onchocerca", - "Opisthorchis", "Opistorchis", "Paragonimus", "Paramyxovirus", "Pediculus", "Phlebotomus", - "Phocanema", "Phoma", "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Prevotella", +mo_found_in_NL <- c("Absidia", "Acholeplasma", "Acremonium", "Actinotignum", "Aedes", "Alistipes", + "Alloprevotella", "Alternaria", "Anaerosalibacter", "Ancylostoma", "Angiostrongylus", + "Anisakis", "Anopheles", "Apophysomyces", "Arachnia", "Ascaris", "Aspergillus", + "Aureobacterium", "Aureobasidium", "Bacteroides", "Balantidum", "Basidiobolus", + "Beauveria", "Bergeyella", "Bilophilia", "Blastocystis", "Borrelia", "Brachyspira", + "Branhamella", "Brochontrix", "Brugia", "Butyricimonas", "Calymmatobacterium", + "Candida", "Capillaria", "Capnocytophaga", "Catabacter", "Cdc", "Cetobacterium", + "Chaetomium", "Chilomastix", "Chlamydia", "Chlamydophila", "Chryseobacterium", + "Chryseomonas", "Chrysonilia", "Cladophialophora", "Cladosporium", "Clonorchis", + "Conidiobolus", "Contracaecum", "Cordylobia", "Cryptococcus", "Curvularia", "Deinococcus", + "Demodex", "Dermatobia", "Dicrocoelium", "Dioctophyma", "Diphyllobothrium", "Dipylidium", + "Dirofilaria", "Dracunculus", "Dysgonomonas", "Echinococcus", "Echinostoma", + "Elisabethkingia", "Elizabethkingia", "Empedobacter", "Enterobius", "Enteromonas", + "Euascomycetes", "Exophiala", "Exserohilum", "Fasciola", "Fasciolopsis", "Flavobacterium", + "Fonsecaea", "Fusarium", "Fusobacterium", "Giardia", "Gnathostoma", "Haloarcula", + "Halobacterium", "Halococcus", "Hendersonula", "Heterophyes", "Hymenolepis", "Hypomyces", + "Hysterothylacium", "Kloeckera", "Koserella", "Larva", "Lecythophora", "Leishmania", + "Lelliottia", "Leptomyxida", "Leptosphaeria", "Leptotrichia", "Loa", "Lucilia", "Lumbricus", + "Malassezia", "Malbranchea", "Mansonella", "Mesocestoides", "Metagonimus", "Metarrhizium", + "Molonomonas", "Mortierella", "Mucor", "Multiceps", "Mycocentrospora", "Mycoplasma", + "Myroides", "Nanophetus", "Nattrassia", "Necator", "Nectria", "Novospingobium", "Ochroconis", + "Odoribacter", "Oesophagostomum", "Oidiodendron", "Onchocerca", "Opisthorchis", + "Opistorchis", "Ornithobacterium", "Parabacteroides", "Paragonimus", "Paramyxovirus", + "Pediculus", "Pedobacter", "Phlebotomus", "Phocaeicola", "Phocanema", "Phoma", + "Phthirus", "Piedraia", "Pithomyces", "Pityrosporum", "Porphyromonas", "Prevotella", "Pseudallescheria", "Pseudoterranova", "Pulex", "Retortamonas", "Rhizomucor", "Rhizopus", - "Rhodotorula", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", "Schistosoma", - "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Spirometra", "Sporobolomyces", "Stachybotrys", - "Stenotrophomononas", "Stomatococcus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia", - "Ternidens", "Torulopsis", "Toxocara", "Toxoplasma", "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma", - "Trichomonas", "Trichophyton", "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium", - "Trombicula", "Trypanosoma", "Tunga", "Ureaplasma", "Wuchereria") + "Rhodotorula", "Riemerella", "Salinococcus", "Sanguibacteroides", "Sarcophagidae", "Sarcoptes", + "Schistosoma", "Scolecobasidium", "Scopulariopsis", "Scytalidium", "Sphingobacterium", + "Spirometra", "Sporobolomyces", "Stachybotrys", "Stenotrophomononas", "Stomatococcus", + "Streptobacillus", "Strongyloides", "Syncephalastraceae", "Syngamus", "Taenia", + "Tenacibaculum", "Ternidens", "Terrimonas", "Torulopsis", "Toxocara", "Toxoplasma", + "Treponema", "Trichinella", "Trichobilharzia", "Trichoderma", "Trichomonas", "Trichophyton", + "Trichosporon", "Trichostrongylus", "Trichuris", "Tritirachium", "Trombicula", "Trypanosoma", + "Tunga", "Ureaplasma", "Victivallis", "Wautersiella", "Weeksella", "Wuchereria") MOs <- data_total %>% filter( diff --git a/docs/404.html b/docs/404.html index f77db2be..9d39967a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -43,7 +43,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index ea004b66..109a6e41 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ diff --git a/docs/articles/datasets.html b/docs/articles/datasets.html index c9b84f76..fe8236ad 100644 --- a/docs/articles/datasets.html +++ b/docs/articles/datasets.html @@ -44,7 +44,7 @@ @@ -190,7 +190,7 @@vignettes/datasets.Rmd
datasets.Rmd
A data set with 20,318 rows and 11 columns, containing the following +
A data set with 20,369 rows and 11 columns, containing the following
column names:
guideline, method, site, mo,
rank_index, ab, ref_tbl, disk_dose,
breakpoint_S, breakpoint_R and uti.
This data set contains interpretation rules for MIC values and disk -diffusion diameters. Included guidelines are CLSI (2010-2021) and EUCAST -(2011-2021).
+diffusion diameters. Included guidelines are CLSI (2011-2022) and EUCAST +(2011-2022).AMR
1.8.1.9010AMR
1.8.1.9011as.rsi()
. EUCAST 2022 is now the new default guideline for all MIC and disks diffusion interpretations.as.rsi()
on certain EUCAST breakpoints for MIC valuesas.integer()
for MIC values, since MIC are not integer values and running table()
on MIC values consequently failed for not being able to retrieve the level position (as that’s how normally as.integer()
on factor
s work)set_mo_source()
, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this packagerandom_*()
function (such as random_mic()
) is now possible by directly calling the package without loading it first: AMR::random_mic(10)
prevalence
of the microorganisms
data set from 3 to 2 for these genera: Acholeplasma, Alistipes, Alloprevotella, Bergeyella, Borrelia, Brachyspira, Butyricimonas, Cetobacterium, Chlamydia, Chlamydophila, Deinococcus, Dysgonomonas, Elizabethkingia, Empedobacter, Haloarcula, Halobacterium, Halococcus, Myroides, Odoribacter, Ornithobacterium, Parabacteroides, Pedobacter, Phocaeicola, Porphyromonas, Riemerella, Sphingobacterium, Streptobacillus, Tenacibaculum, Terrimonas, Victivallis, Wautersiella, Weeksella
+To interpret MIC values as RSI values, use as.rsi()
on MIC values. It supports guidelines from EUCAST (2011-2022) and CLSI (2011-2022).
This class for MIC values is a quite a special data type: formally it is an ordered factor with valid MIC values as factor levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
x <- random_mic(10)
-x
-#> Class <mic>
-#> [1] 16 1 8 8 64 >=128 0.0625 32 32 16
-
-is.factor(x)
-#> [1] TRUE
-
-x[1] * 2
-#> [1] 32
-
-median(x)
-#> [1] 26
This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using numeric values in data analysis, e.g.:
x[x > 4]
-#> Class <mic>
-#> [1] 16 8 8 64 >=128 32 32 16
-
-df <- data.frame(x, hospital = "A")
-subset(df, x > 4) # or with dplyr: df %>% filter(x > 4)
-#> x hospital
-#> 1 16 A
-#> 5 64 A
-#> 6 >=128 A
-#> 8 32 A
-#> 9 32 A
-#> 10 16 A
This class for MIC values is a quite a special data type: formally it is an ordered factor with valid MIC values as factor levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
+
This makes it possible to maintain operators that often come with MIC values, such ">=" and "<=", even when filtering using numeric values in data analysis, e.g.:
+
The following generic functions are implemented for the MIC class: !
, !=
, %%
, %/%
, &
, *
, +
, -
, /
, <
, <=
, ==
, >
, >=
, ^
, |
, abs()
, acos()
, acosh()
, all()
, any()
, asin()
, asinh()
, atan()
, atanh()
, ceiling()
, cos()
, cosh()
, cospi()
, cummax()
, cummin()
, cumprod()
, cumsum()
, digamma()
, exp()
, expm1()
, floor()
, gamma()
, lgamma()
, log()
, log1p()
, log2()
, log10()
, max()
, mean()
, min()
, prod()
, range()
, round()
, sign()
, signif()
, sin()
, sinh()
, sinpi()
, sqrt()
, sum()
, tan()
, tanh()
, tanpi()
, trigamma()
and trunc()
. Some functions of the stats
package are also implemented: median()
, quantile()
, mad()
, IQR()
, fivenum()
. Also, boxplot.stats()
is supported. Since sd()
and var()
are non-generic functions, these could not be extended. Use mad()
as an alternative, or use e.g. sd(as.numeric(x))
where x
is your vector of MIC values.
Using as.double()
or as.numeric()
on MIC values will remove the operators and return a numeric vector. Do not use as.integer()
on MIC values as by the R convention on factors, it will return the index of the factor levels (which is often useless for regular users).
Use droplevels()
to drop unused levels. At default, it will return a plain factor. Use droplevels(..., as.mic = TRUE)
to maintain the <mic>
class.
A microorganism (MO) code from this package (class: mo
) is human readable and typically looks like these examples:
Code Full name
- --------------- --------------------------------------
- B_KLBSL Klebsiella
- B_KLBSL_PNMN Klebsiella pneumoniae
- B_KLBSL_PNMN_RHNS Klebsiella pneumoniae rhinoscleromatis
- | | | |
- | | | |
- | | | \---> subspecies, a 4-5 letter acronym
- | | \----> species, a 4-5 letter acronym
- | \----> genus, a 5-7 letter acronym
- \----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria),
- C (Chromista), F (Fungi), P (Protozoa)
-
A microorganism (MO) code from this package (class: mo
) is human readable and typically looks like these examples:
Values that cannot be coerced will be considered 'unknown' and will get the MO code UNKNOWN
.
Use the mo_*
functions to get properties based on the returned code, see Examples.
The algorithm uses data from the Catalogue of Life (see below) and from one other source (see microorganisms).
@@ -269,12 +257,12 @@Becker K et al. Coagulase-Negative Staphylococci. 2014. Clin Microbiol Rev. 27(4): 870-926; doi: 10.1128/CMR.00109-13
Becker K et al. Implications of identifying the recently defined members of the S. aureus complex, S. argenteus and S. schweitzeri: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS). 2019. Clin Microbiol Infect; doi: 10.1016/j.cmi.2019.02.028
Becker K et al. Emergence of coagulase-negative staphylococci 2020. Expert Rev Anti Infect Ther. 18(4):349-366; doi: 10.1080/14787210.2020.1730813
Lancefield RC A serological differentiation of human and other groups of hemolytic streptococci. 1933. J Exp Med. 57(4): 571-95; doi: 10.1084/jem.57.4.571
Becker K et al. Coagulase-Negative Staphylococci. 2014. Clin Microbiol Rev. 27(4): 870-926; doi:10.1128/CMR.00109-13
Becker K et al. Implications of identifying the recently defined members of the S. aureus complex, S. argenteus and S. schweitzeri: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS). 2019. Clin Microbiol Infect; doi:10.1016/j.cmi.2019.02.028
Becker K et al. Emergence of coagulase-negative staphylococci 2020. Expert Rev Anti Infect Ther. 18(4):349-366; doi:10.1080/14787210.2020.1730813
Lancefield RC A serological differentiation of human and other groups of hemolytic streptococci. 1933. J Exp Med. 57(4): 571-95; doi:10.1084/jem.57.4.571
Catalogue of Life: 2019 Annual Checklist, http://www.catalogueoflife.org
List of Prokaryotic names with Standing in Nomenclature (5 October 2021), doi: 10.1099/ijsem.0.004332
List of Prokaryotic names with Standing in Nomenclature (5 October 2021), doi:10.1099/ijsem.0.004332
US Edition of SNOMED CT from 1 September 2020, retrieved from the Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS), OID 2.16.840.1.114222.4.11.1009, version 12; url: https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009
The as.rsi()
function works in four ways:
For cleaning raw / untransformed data. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as "<0.25; S"
will be coerced to "S"
. Combined interpretations for multiple test methods (as seen in laboratory records) such as "S; S"
will be coerced to "S"
, but a value like "S; I"
will return NA
with a warning that the input is unclear.
For interpreting minimum inhibitory concentration (MIC) values according to EUCAST or CLSI. You must clean your MIC values first using as.mic()
, that also gives your columns the new data class mic
. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo
argument.
Using dplyr
, R/SI interpretation can be done very easily with either:
For interpreting minimum inhibitory concentration (MIC) values according to EUCAST or CLSI. You must clean your MIC values first using as.mic()
, that also gives your columns the new data class mic
. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo
argument.
Using dplyr
, R/SI interpretation can be done very easily with either:
Operators like "<=" will be stripped before interpretation. When using conserve_capped_values = TRUE
, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (conserve_capped_values = FALSE
) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
For interpreting disk diffusion diameters according to EUCAST or CLSI. You must clean your disk zones first using as.disk()
, that also gives your columns the new data class disk
. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo
argument.
Using dplyr
, R/SI interpretation can be done very easily with either:
For interpreting disk diffusion diameters according to EUCAST or CLSI. You must clean your disk zones first using as.disk()
, that also gives your columns the new data class disk
. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the mo
argument.
Using dplyr
, R/SI interpretation can be done very easily with either:
For interpreting a complete data set, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running as.rsi(your_data)
.
When using more than one variable for ...
(= combination therapy), use only_all_tested
to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility()
works to calculate the %SI:
--------------------------------------------------------------------
- only_all_tested = FALSE only_all_tested = TRUE
- ----------------------- -----------------------
- Drug A Drug B include as include as include as include as
- numerator denominator numerator denominator
--------- -------- ---------- ----------- ---------- -----------
- S or I S or I X X X X
- R S or I X X X X
- <NA> S or I X X - -
- S or I R X X X X
- R R - X - X
- <NA> R - - - -
- S or I <NA> X X - -
- R <NA> - - - -
- <NA> <NA> - - - -
---------------------------------------------------------------------
-
Please note that, in combination therapies, for only_all_tested = TRUE
applies that:
count_S() + count_I() + count_R() = count_all()
- proportion_S() + proportion_I() + proportion_R() = 1
and that, in combination therapies, for only_all_tested = FALSE
applies that:
count_S() + count_I() + count_R() >= count_all()
- proportion_S() + proportion_I() + proportion_R() >= 1
When using more than one variable for ...
(= combination therapy), use only_all_tested
to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility()
works to calculate the %SI:
Please note that, in combination therapies, for only_all_tested = TRUE
applies that:
and that, in combination therapies, for only_all_tested = FALSE
applies that:
Using only_all_tested
has no impact when only using one antibiotic as input.
If you are familiar with the case_when()
function of the dplyr
package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule itself is written before the tilde (~
) and the consequence of the rule is written after the tilde:
x <- custom_eucast_rules(TZP == "S" ~ aminopenicillins == "S",
- TZP == "R" ~ aminopenicillins == "R")
These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:
x
-#> A set of custom EUCAST rules:
-#>
-#> 1. If TZP is S then set to S:
-#> amoxicillin (AMX), ampicillin (AMP)
-#>
-#> 2. If TZP is R then set to R:
-#> amoxicillin (AMX), ampicillin (AMP)
The rules (the part before the tilde, in above example TZP == "S"
and TZP == "R"
) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column TZP
must exist. We will create a sample data set and test the rules set:
df <- data.frame(mo = c("E. coli", "K. pneumoniae"),
- TZP = "R",
- amox = "",
- AMP = "")
-df
-#> mo TZP amox AMP
-#> 1 E. coli R
-#> 2 K. pneumoniae R
-
-eucast_rules(df, rules = "custom", custom_rules = x)
-#> mo TZP amox AMP
-#> 1 E. coli R R R
-#> 2 K. pneumoniae R R R
If you are familiar with the case_when()
function of the dplyr
package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule itself is written before the tilde (~
) and the consequence of the rule is written after the tilde:
These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all aminopenicillins (ampicillin and amoxicillin) must be made "S", and if TZP is "R", aminopenicillins must be made "R". These rules can also be printed to the console, so it is immediately clear how they work:
+
The rules (the part before the tilde, in above example TZP == "S"
and TZP == "R"
) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column TZP
must exist. We will create a sample data set and test the rules set:
There is one exception in variables used for the rules: all column names of the microorganisms data set can also be used, but do not have to exist in the data set. These column names are: mo
, fullname
, kingdom
, phylum
, class
, order
, family
, genus
, species
, subspecies
, rank
, ref
, species_id
, source
, prevalence
and snomed
. Thus, this next example will work as well, despite the fact that the df
data set does not contain a column genus
:
y <- custom_eucast_rules(TZP == "S" & genus == "Klebsiella" ~ aminopenicillins == "S",
- TZP == "R" & genus == "Klebsiella" ~ aminopenicillins == "R")
-
-eucast_rules(df, rules = "custom", custom_rules = y)
-#> mo TZP amox AMP
-#> 1 E. coli R
-#> 2 K. pneumoniae R R R
There is one exception in variables used for the rules: all column names of the microorganisms data set can also be used, but do not have to exist in the data set. These column names are: r vector_and(colnames(microorganisms), quote = "``", sort = FALSE)
. Thus, this next example will work as well, despite the fact that the df
data set does not contain a column genus
:
It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part after the tilde. In above examples, the antibiotic group aminopenicillins
is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule.
aminoglycosides
(amikacin, amikacin/fosfomycin, amphotericin B-high, apramycin, arbekacin, astromicin, bekanamycin, dibekacin, framycetin, gentamicin, gentamicin-high, habekacin, hygromycin, isepamicin, kanamycin, kanamycin-high, kanamycin/cephalexin, micronomicin, neomycin, netilmicin, pentisomicin, plazomicin, propikacin, ribostamycin, sisomicin, streptoduocin, streptomycin, streptomycin-high, tobramycin and tobramycin-high)
aminopenicillins
(amoxicillin and ampicillin)
antifungals
(5-fluorocytosine, amphotericin B, anidulafungin, butoconazole, caspofungin, ciclopirox, clotrimazole, econazole, fluconazole, fosfluconazole, griseofulvin, hachimycin, ibrexafungerp, isavuconazole, isoconazole, itraconazole, ketoconazole, manogepix, micafungin, miconazole, nystatin, pimaricin, posaconazole, rezafungin, ribociclib, sulconazole, terbinafine, terconazole and voriconazole)
antimycobacterials
(4-aminosalicylic acid, calcium aminosalicylate, capreomycin, clofazimine, delamanid, enviomycin, ethambutol, ethambutol/isoniazid, ethionamide, isoniazid, morinamide, p-aminosalicylic acid, pretomanid, prothionamide, pyrazinamide, rifabutin, rifampicin, rifampicin/isoniazid, rifampicin/pyrazinamide/ethambutol/isoniazid, rifampicin/pyrazinamide/isoniazid, rifamycin, rifapentine, simvastatin/fenofibrate, sodium aminosalicylate, streptomycin/isoniazid, terizidone, thioacetazone/isoniazid, tiocarlide and viomycin)
betalactams
(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, biapenem, carbenicillin, carindacillin, cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/nacubactam, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, ciclacillin, clometocillin, cloxacillin, dicloxacillin, doripenem, epicillin, ertapenem, flucloxacillin, hetacillin, imipenem, imipenem/EDTA, imipenem/relebactam, latamoxef, lenampicillin, loracarbef, mecillinam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, panipenem, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, razupenem, ritipenem, ritipenem acoxil, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, tebipenem, temocillin, ticarcillin and ticarcillin/clavulanic acid)
carbapenems
(biapenem, doripenem, ertapenem, imipenem, imipenem/EDTA, imipenem/relebactam, meropenem, meropenem/nacubactam, meropenem/vaborbactam, panipenem, razupenem, ritipenem, ritipenem acoxil and tebipenem)
cephalosporins
(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef and loracarbef)
cephalosporins_1st
(cefacetrile, cefadroxil, cefaloridine, cefatrizine, cefazedone, cefazolin, cefroxadine, ceftezole, cephalexin, cephalothin, cephapirin and cephradine)
cephalosporins_2nd
(cefaclor, cefamandole, cefmetazole, cefonicid, ceforanide, cefotetan, cefotiam, cefoxitin, cefoxitin screening, cefprozil, cefuroxime, cefuroxime axetil and loracarbef)
cephalosporins_3rd
(cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefetamet, cefetamet pivoxil, cefixime, cefmenoxime, cefodizime, cefoperazone, cefoperazone/sulbactam, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotiam hexetil, cefovecin, cefpimizole, cefpiramide, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefsulodin, ceftazidime, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftriaxone and latamoxef)
cephalosporins_4th
(cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetecol, cefoselis, cefozopran, cefpirome and cefquinome)
cephalosporins_5th
(ceftaroline, ceftaroline/avibactam, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor and ceftolozane/tazobactam)
cephalosporins_except_caz
(cefacetrile, cefaclor, cefadroxil, cefaloridine, cefamandole, cefatrizine, cefazedone, cefazolin, cefcapene, cefcapene pivoxil, cefdinir, cefditoren, cefditoren pivoxil, cefepime, cefepime/clavulanic acid, cefepime/tazobactam, cefetamet, cefetamet pivoxil, cefetecol, cefetrizole, cefixime, cefmenoxime, cefmetazole, cefodizime, cefonicid, cefoperazone, cefoperazone/sulbactam, ceforanide, cefoselis, cefotaxime, cefotaxime/clavulanic acid, cefotaxime/sulbactam, cefotetan, cefotiam, cefotiam hexetil, cefovecin, cefoxitin, cefoxitin screening, cefozopran, cefpimizole, cefpiramide, cefpirome, cefpodoxime, cefpodoxime proxetil, cefpodoxime/clavulanic acid, cefprozil, cefquinome, cefroxadine, cefsulodin, cefsumide, ceftaroline, ceftaroline/avibactam, ceftazidime/avibactam, ceftazidime/clavulanic acid, cefteram, cefteram pivoxil, ceftezole, ceftibuten, ceftiofur, ceftizoxime, ceftizoxime alapivoxil, ceftobiprole, ceftobiprole medocaril, ceftolozane/enzyme inhibitor, ceftolozane/tazobactam, ceftriaxone, cefuroxime, cefuroxime axetil, cephalexin, cephalothin, cephapirin, cephradine, latamoxef and loracarbef)
fluoroquinolones
(besifloxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nifuroquine, norfloxacin, ofloxacin, orbifloxacin, pazufloxacin, pefloxacin, pradofloxacin, premafloxacin, prulifloxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin and trovafloxacin)
glycopeptides
(avoparcin, dalbavancin, norvancomycin, oritavancin, ramoplanin, teicoplanin, teicoplanin-macromethod, telavancin, vancomycin and vancomycin-macromethod)
glycopeptides_except_lipo
(avoparcin, norvancomycin, ramoplanin, teicoplanin, teicoplanin-macromethod, vancomycin and vancomycin-macromethod)
lincosamides
(acetylmidecamycin, acetylspiramycin, clindamycin, gamithromycin, kitasamycin, lincomycin, meleumycin, nafithromycin, pirlimycin, primycin, solithromycin, tildipirosin, tilmicosin, tulathromycin, tylosin and tylvalosin)
lipoglycopeptides
(dalbavancin, oritavancin and telavancin)
macrolides
(acetylmidecamycin, acetylspiramycin, azithromycin, clarithromycin, dirithromycin, erythromycin, flurithromycin, gamithromycin, josamycin, kitasamycin, meleumycin, midecamycin, miocamycin, nafithromycin, oleandomycin, pirlimycin, primycin, rokitamycin, roxithromycin, solithromycin, spiramycin, telithromycin, tildipirosin, tilmicosin, troleandomycin, tulathromycin, tylosin and tylvalosin)
oxazolidinones
(cadazolid, cycloserine, linezolid, tedizolid and thiacetazone)
penicillins
(amoxicillin, amoxicillin/clavulanic acid, amoxicillin/sulbactam, ampicillin, ampicillin/sulbactam, apalcillin, aspoxicillin, avibactam, azidocillin, azlocillin, aztreonam, aztreonam/avibactam, aztreonam/nacubactam, bacampicillin, benzathine benzylpenicillin, benzathine phenoxymethylpenicillin, benzylpenicillin, carbenicillin, carindacillin, cefepime/nacubactam, ciclacillin, clometocillin, cloxacillin, dicloxacillin, epicillin, flucloxacillin, hetacillin, lenampicillin, mecillinam, metampicillin, methicillin, mezlocillin, mezlocillin/sulbactam, nacubactam, nafcillin, oxacillin, penamecillin, penicillin/novobiocin, penicillin/sulbactam, phenethicillin, phenoxymethylpenicillin, piperacillin, piperacillin/sulbactam, piperacillin/tazobactam, piridicillin, pivampicillin, pivmecillinam, procaine benzylpenicillin, propicillin, sarmoxicillin, sulbactam, sulbenicillin, sultamicillin, talampicillin, tazobactam, temocillin, ticarcillin and ticarcillin/clavulanic acid)
polymyxins
(colistin, polymyxin B and polymyxin B/polysorbate 80)
quinolones
(besifloxacin, cinoxacin, ciprofloxacin, clinafloxacin, danofloxacin, delafloxacin, difloxacin, enoxacin, enrofloxacin, finafloxacin, fleroxacin, flumequine, garenoxacin, gatifloxacin, gemifloxacin, grepafloxacin, levofloxacin, levonadifloxacin, lomefloxacin, marbofloxacin, metioxate, miloxacin, moxifloxacin, nadifloxacin, nalidixic acid, nifuroquine, nitroxoline, norfloxacin, ofloxacin, orbifloxacin, oxolinic acid, pazufloxacin, pefloxacin, pipemidic acid, piromidic acid, pradofloxacin, premafloxacin, prulifloxacin, rosoxacin, rufloxacin, sarafloxacin, sitafloxacin, sparfloxacin, temafloxacin, tilbroquinol, tioxacin, tosufloxacin and trovafloxacin)
streptogramins
(pristinamycin and quinupristin/dalfopristin)
tetracyclines
(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline, tetracycline and tigecycline)
tetracyclines_except_tgc
(cetocycline, chlortetracycline, clomocycline, demeclocycline, doxycycline, eravacycline, lymecycline, metacycline, minocycline, omadacycline, oxytetracycline, penimepicycline, rolitetracycline and tetracycline)
trimethoprims
(brodimoprim, sulfadiazine, sulfadiazine/tetroxoprim, sulfadiazine/trimethoprim, sulfadimethoxine, sulfadimidine, sulfadimidine/trimethoprim, sulfafurazole, sulfaisodimidine, sulfalene, sulfamazone, sulfamerazine, sulfamerazine/trimethoprim, sulfamethizole, sulfamethoxazole, sulfamethoxypyridazine, sulfametomidine, sulfametoxydiazine, sulfametrole/trimethoprim, sulfamoxole, sulfamoxole/trimethoprim, sulfanilamide, sulfaperin, sulfaphenazole, sulfapyridine, sulfathiazole, sulfathiourea, trimethoprim and trimethoprim/sulfamethoxazole)
ureidopenicillins
(azlocillin, mezlocillin, piperacillin and piperacillin/tazobactam)
It is possible to define antibiotic groups instead of single antibiotics for the rule consequence, the part after the tilde. In above examples, the antibiotic group aminopenicillins
is used to include ampicillin and amoxicillin. The following groups are allowed (case-insensitive). Within parentheses are the agents that will be matched when running the rule.
r paste0(" * ", sapply(DEFINED_AB_GROUPS, function(x) paste0("``", tolower(gsub("^AB_", "", x)), "``\\cr(", vector_and(ab_name(eval(parse(text = x), envir = asNamespace("AMR")), language = NULL, tolower = TRUE), quotes = FALSE), ")"), USE.NAMES = FALSE), "\n", collapse = "")
EUCAST Expert Rules. Version 2.0, 2012.
-Leclercq et al. EUCAST expert rules in antimicrobial susceptibility testing. Clin Microbiol Infect. 2013;19(2):141-60; doi: 10.1111/j.1469-0691.2011.03703.x
EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes Tables. Version 3.1, 2016. (link)
EUCAST Intrinsic Resistance and Unusual Phenotypes. Version 3.2, 2020. (link)
EUCAST Intrinsic Resistance and Unusual Phenotypes. Version 3.3, 2021. (link)
Custom rules can be created using custom_eucast_rules()
, e.g.:
x <- custom_eucast_rules(AMC == "R" & genus == "Klebsiella" ~ aminopenicillins == "R",
- AMC == "I" & genus == "Klebsiella" ~ aminopenicillins == "I")
-
-eucast_rules(example_isolates, rules = "custom", custom_rules = x)
Custom rules can be created using custom_eucast_rules()
, e.g.:
Unlike the exact test of goodness-of-fit (fisher.test()
), the G-test does not directly calculate the probability of obtaining the observed results or something more extreme. Instead, like almost all statistical tests, the G-test has an intermediate step; it uses the data to calculate a test statistic that measures how far the observed data are from the null expectation. You then use a mathematical relationship, in this case the chi-square distribution, to estimate the probability of obtaining that value of the test statistic.
The G-test uses the log of the ratio of two likelihoods as the test statistic, which is why it is also called a likelihood ratio test or log-likelihood ratio test. The formula to calculate a G-statistic is:
\(G = 2 * sum(x * log(x / E))\)
-where E
are the expected values. Since this is chi-square distributed, the p value can be calculated in R with:
p <- stats::pchisq(G, df, lower.tail = FALSE)
where E
are the expected values. Since this is chi-square distributed, the p value can be calculated in R with:
where df
are the degrees of freedom.
If there are more than two categories and you want to find out which ones are significantly different from their null expectation, you can use the same method of testing each category vs. the sum of all categories, with the Bonferroni correction. You use G-tests for each category, of course.
diff --git a/docs/reference/index.html b/docs/reference/index.html index 9fab2958..faadabda 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index a0388fdc..f1ae782b 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -17,7 +17,7 @@ @@ -258,31 +258,15 @@ Ordered factoCustom guidelines can be set with the custom_mdro_guideline()
function. This is of great importance if you have custom rules to determine MDROs in your hospital, e.g., rules that are dependent on ward, state of contact isolation or other variables in your data.
If you are familiar with the case_when()
function of the dplyr
package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule is written before the tilde (~
) and the consequence of the rule is written after the tilde:
custom <- custom_mdro_guideline(CIP == "R" & age > 60 ~ "Elderly Type A",
- ERY == "R" & age > 60 ~ "Elderly Type B")
If you are familiar with the case_when()
function of the dplyr
package, you will recognise the input method to set your own rules. Rules must be set using what R considers to be the 'formula notation'. The rule is written before the tilde (~
) and the consequence of the rule is written after the tilde:
If a row/an isolate matches the first rule, the value after the first ~
(in this case 'Elderly Type A') will be set as MDRO value. Otherwise, the second rule will be tried and so on. The number of rules is unlimited.
You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.
custom
-#> A set of custom MDRO rules:
-#> 1. CIP is "R" and age is higher than 60 -> Elderly Type A
-#> 2. ERY is "R" and age is higher than 60 -> Elderly Type B
-#> 3. Otherwise -> Negative
-#>
-#> Unmatched rows will return NA.
The outcome of the function can be used for the guideline
argument in the mdro()
function:
x <- mdro(example_isolates,
- guideline = custom)
-table(x)
-#> Negative Elderly Type A Elderly Type B
-#> 1070 198 732
Rules can also be combined with other custom rules by using c()
:
x <- mdro(example_isolates,
- guideline = c(custom,
- custom_mdro_guideline(ERY == "R" & age > 50 ~ "Elderly Type C")))
-table(x)
-#> Negative Elderly Type A Elderly Type B Elderly Type C
-#> 961 198 732 109
You can print the rules set in the console for an overview. Colours will help reading it if your console supports colours.
+
The outcome of the function can be used for the guideline
argument in the mdro()
function:
Rules can also be combined with other custom rules by using c()
:
The rules set (the custom
object in this case) could be exported to a shared file location using saveRDS()
if you collaborate with multiple users. The custom rules set could then be imported using readRDS()
.
Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:
| A | B |
---|--------------------|-----------------------|
-1 | Organisation XYZ | mo |
-2 | lab_mo_ecoli | Escherichia coli |
-3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
-4 | | |
-
We save it as "home/me/ourcodes.xlsx"
. Now we have to set it as a source:
set_mo_source("home/me/ourcodes.xlsx")
-#> NOTE: Created mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
-#> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
-#> "Organisation XYZ" and "mo"
Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:
+
We save it as "home/me/ourcodes.xlsx"
. Now we have to set it as a source:
It has now created a file "~/mo_source.rds"
with the contents of our Excel file. Only the first column with foreign values and the 'mo' column will be kept when creating the RDS file.
And now we can use it in our functions:
as.mo("lab_mo_ecoli")
-#> Class <mo>
-#> [1] B_ESCHR_COLI
-
-mo_genus("lab_mo_kpneumoniae")
-#> [1] "Klebsiella"
-
-# other input values still work too
-as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
-#> NOTE: Translation to one microorganism was guessed with uncertainty.
-#> Use mo_uncertainties() to review it.
-#> Class <mo>
-#> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
If we edit the Excel file by, let's say, adding row 4 like this:
| A | B |
---|--------------------|-----------------------|
-1 | Organisation XYZ | mo |
-2 | lab_mo_ecoli | Escherichia coli |
-3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
-4 | lab_Staph_aureus | Staphylococcus aureus |
-5 | | |
-
...any new usage of an MO function in this package will update your data file:
as.mo("lab_mo_ecoli")
-#> NOTE: Updated mo_source file '/Users/me/mo_source.rds' (0.3 kB) from
-#> '/Users/me/Documents/ourcodes.xlsx' (9 kB), columns
-#> "Organisation XYZ" and "mo"
-#> Class <mo>
-#> [1] B_ESCHR_COLI
-
-mo_genus("lab_Staph_aureus")
-#> [1] "Staphylococcus"
To delete the reference data file, just use ""
, NULL
or FALSE
as input for set_mo_source()
:
set_mo_source(NULL)
-#> Removed mo_source file '/Users/me/mo_source.rds'
And now we can use it in our functions:
+
If we edit the Excel file by, let's say, adding row 4 like this:
+
...any new usage of an MO function in this package will update your data file:
+
To delete the reference data file, just use ""
, NULL
or FALSE
as input for set_mo_source()
:
If the original file (in the previous case an Excel file) is moved or deleted, the mo_source.rds
file will be removed upon the next use of as.mo()
or any mo_*
function.
When using more than one variable for ...
(= combination therapy), use only_all_tested
to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility()
works to calculate the %SI:
--------------------------------------------------------------------
- only_all_tested = FALSE only_all_tested = TRUE
- ----------------------- -----------------------
- Drug A Drug B include as include as include as include as
- numerator denominator numerator denominator
--------- -------- ---------- ----------- ---------- -----------
- S or I S or I X X X X
- R S or I X X X X
- <NA> S or I X X - -
- S or I R X X X X
- R R - X - X
- <NA> R - - - -
- S or I <NA> X X - -
- R <NA> - - - -
- <NA> <NA> - - - -
---------------------------------------------------------------------
-
Please note that, in combination therapies, for only_all_tested = TRUE
applies that:
count_S() + count_I() + count_R() = count_all()
- proportion_S() + proportion_I() + proportion_R() = 1
and that, in combination therapies, for only_all_tested = FALSE
applies that:
count_S() + count_I() + count_R() >= count_all()
- proportion_S() + proportion_I() + proportion_R() >= 1
When using more than one variable for ...
(= combination therapy), use only_all_tested
to only count isolates that are tested for all antibiotics/variables that you test them for. See this example for two antibiotics, Drug A and Drug B, about how susceptibility()
works to calculate the %SI:
Please note that, in combination therapies, for only_all_tested = TRUE
applies that:
and that, in combination therapies, for only_all_tested = FALSE
applies that:
Using only_all_tested
has no impact when only using one antibiotic as input.
Overview of the data set:
head(rsi_translation)
## guideline method site mo rank_index ab ref_tbl disk_dose
-## 1 EUCAST 2022 MIC <NA> F_ASPRG_MGTS 2 AMB Aspergillus <NA>
-## 2 EUCAST 2022 MIC <NA> F_ASPRG_NIGR 2 AMB Aspergillus <NA>
-## 3 EUCAST 2022 MIC <NA> F_CANDD 3 AMB Candida <NA>
-## 4 EUCAST 2022 MIC <NA> F_CANDD_ALBC 2 AMB Candida <NA>
-## 5 EUCAST 2022 MIC <NA> F_CANDD_DBLN 2 AMB Candida <NA>
-## 6 EUCAST 2022 MIC <NA> F_CANDD_KRUS 2 AMB Candida <NA>
-## breakpoint_S breakpoint_R uti
-## 1 1 1 FALSE
-## 2 1 1 FALSE
-## 3 1 1 FALSE
-## 4 1 1 FALSE
-## 5 1 1 FALSE
-## 6 1 1 FALSE
Overview of the data set:
+head(rsi_translation)
The repository of this AMR
package contains a file comprising this exact data set: https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt. This file allows for machine reading EUCAST and CLSI guidelines, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. The file is updated automatically and the mo
and ab
columns have been transformed to contain the full official names instead of codes.