GithubHelp home page GithubHelp logo

msberends / amr Goto Github PK

View Code? Open in Web Editor NEW
79.0 6.0 11.0 1.17 GB

Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by using evidence-based methods, as described in https://doi.org/10.18637/jss.v104.i03.

Home Page: https://msberends.github.io/AMR/

License: Other

R 49.67% CSS 0.21% JavaScript 0.18% HTML 49.94%
r microbiology epidemiology antimicrobial-data amr software

amr's People

Contributors

ceefluz avatar gxpcluster avatar msberends avatar r0ssing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

amr's Issues

antibiotics dataset (ceftazidime/avibactam)

Hello

I suspect you will already have this on your radar somehow, but just in case I want to mention:

CZA ceftazidime/avibactam now has a WHO ATC code and a DDD under

J01DD52 (ceftazidime and beta-lactamase inhibitor)

Thanks!

ab_info("Ceftazidime avibactam")
$ab
[1] "CZA"

$atc
[1] NA

$cid
[1] NA

$name
[1] "Ceftazidime/avibactam"

$group
[1] "Cephalosporins (3rd gen.)"

$atc_group1
[1] NA

$atc_group2
[1] NA

$tradenames
[1] ""

$ddd
$ddd$oral
$ddd$oral$amount
[1] NA

$ddd$oral$units
[1] NA


$ddd$iv
$ddd$iv$amount
[1] NA

$ddd$iv$units
[1] NA

eucast_rules() throws an error

The following code throws an error message:
library(AMR)
library(tidyverse)
oops <- data.frame(mo = c("Klebsiella",
"Escherichia"), ampicillin = "S")
oops

eucast_rules(oops, info = FALSE)

The message (in german) is:

Fehler in value[3L] :
ungültiger regulärer Ausdruck '^(abbotic|abboticin|abdizide|abelcet|abelecet|abomacetin|acetohmt|acetylspiramycin|acideclavulanique|acidefusidique|acidoclavulanico|acidofusidico|acidomandelico|acidumclavulanicum|acidumfusidicum|acillin|acneryne|acnesol|acromona|acronize|actilin|actiline|actimoxi|aczone|adesulfonesodium|adobacillin|advocin|aeroquin|aethambutolum|aethionamidum|aetina|aetiva|aizumycin|aknecordeslosung|aknedermerygel|aknemycin|alcephin|alcobon|alconcilox|aldapsone|aldesulfonasodica|aldesulfone|aldesulfonesodique|aldesulfonesodium|alenfral|alexin|alfacet|alficetyn|alflucoz|alfumet|aliporina|almitil|almondacid|alsporin|altacef|ambisome|amblosin|ambofen|ambrocef|ambylan|amcill|amdinocillin|amfipen|amfipenv|amfotericinab|amicacin|amidazin|amidazine|amikacillin|amikacin|amikacinbase|amikacindihydrate|amikacinsulfate|amikacina|amikacine|amikacinum|amikavet|amikin|amiklin|amikozit|aminodeoxykanamycin|aminoform|aminoformaldehyde|aminopar|aminosalicylic|aminosalicylicaci

It seems to be an unvalid regular expression.

Is this error reproducible?

mo_fullname("P. aeroginosa") does not return mo with highest matching score

Hi,

I have just discovered this package and started to play with it; looks very promising and would like to thank you for this contribution.

I have a dataset with bacteria coded as strings, and one string is obviously misspelled: "P. aeroginosa" instead of "P. aeruginosa". The spelling misstake is made in 2/7 (~20%) of cases.

When I use as.mo(), "P. aeroginosa" assumes Pasteurella aerogenes, but also a helpful message on uncertainty. For "P. aeruginosa", as.mo() correctly assumes Pseudomonas aeruginosa:

> as.mo("P. aeroginosa")
ℹ Function `as.mo()` is uncertain about "P. aeroginosa" (assuming Pasteurella
  aerogenes). Run `mo_uncertainties()` to review this.
Class <mo>
[1] B_PSTRL_AERG
> as.mo("P. aeruginosa")
Class <mo>
[1] B_PSDMN_AERG

However, it is my understanding that the organism with the highest matching score that should be returned. When I check, both the misspelled and correctly spelled string returns Pseudomonas aeruginosa as highest matching score:

> tibble::tibble(
...     p = AMR::mo_matching_score("P. aeroginosa", microorganisms$fullname),
...     name = microorganisms$fullname
... ) |>
...     dplyr::arrange(desc(p))
# A tibble: 70,760 × 2
       p name                    
   <dbl> <chr>                   
 1 0.75  Pseudomonas aeruginosa  
 2 0.719 Vibrio aerogenes        
 3 0.714 Paraferrimonas          
 4 0.714 Pseudaeromonas          
 5 0.690 Pasteurella aerogenes   
 6 0.688 Alteromonas alba        
 7 0.688 Psychrobacter glacincola
 8 0.682 Alteromonas             
 9 0.682 Lysobacter spongiicola  
10 0.679 Panacagrimonas          
# … with 70,750 more rows
> tibble::tibble(
...     p = AMR::mo_matching_score("P. aeruginosa", microorganisms$fullname),
...     name = microorganisms$fullname
... ) |>
...     dplyr::arrange(desc(p))
# A tibble: 70,760 × 2
       p name                     
   <dbl> <chr>                    
 1 0.773 Pseudomonas aeruginosa   
 2 0.714 Paraferrimonas           
 3 0.714 Salsuginimonas           
 4 0.706 Paraperlucidibaca        
 5 0.688 Psychrobacter glacincola 
 6 0.688 Vibrio aerogenes         
 7 0.68  Pseudomonas pertucinogena
 8 0.679 Panacagrimonas           
 9 0.679 Paraglaciecola           
10 0.679 Pseudaeromonas           
# … with 70,750 more rows
> 

This means that I would expect as.mo() (and mo_fullname()) to return Pseudomonas aeruginosa in both cases. However, they do not – how come?

Thanks.

New MICs to support

Check if these are valid MICs too, and add them if that's the case:

0.0003
0.0004
0.0006
0.0008
0.0012
0.0016
0.002
0.003
0.0032
0.0035
0.004
0.0042
0.0047
0.005
0.006
0.0063
0.0064
0.0065
0.0094
0.0156
0.0165
0.125

`custom_eucast_rules()` does not allow printing `NA` after tilde

Hi Matthijs S. Berends!
Your work here is a pure gold mine, thank you so much for your effort!
I want to overwrite some of the rules with the custom_eucast_rules function, let's use this as an example:
"x <- custom_eucast_rules(AMC == NA & genus == "Klebsiella" ~ AMC == NA)
x"
console returns:
"A set of custom EUCAST rules:
Error in if (rule$result_value == "R") { :
missing value where TRUE/FALSE is necessary"
AMC == NA before the tilde is not a problem, it only returns an error if NA is after the tilde. I have never submitted an issue on github before, so this is probably not the most elegant way to do it. I hope I don't waste your time.
Kind regards
Marc Westerholt

Drug mapping for co-fluampicil

Hello
Have you considered mapping co-fluampicil (flucloxacillin + ampicillin) J01CR50?
Apologies in advance if this has already been considered.
Best wishes
Peter

AMR fails on drug names ending with "-p"

Opened on 26 May 2020 by Asoke Talukder on GitLab:

When a drug name ends with "-P" or "-p", AMR fails. Following are some reproduction sequences:

ab_name("x-p")
[1] "(x-p)"
Warning message:
These values could not be coerced to a valid antimicrobial ID: "x-p".
ab_name("xy-p")
Error in ifelse(grepl("Invalid regexp", e$message), return(base::grepl(pattern = pattern, :
invalid regular expression '^/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ab_name("xyx-p")
Error in ifelse(grepl("Invalid regexp", e$message), return(base::grepl(pattern = pattern, :
invalid regular expression '^/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ab_name("xyxa-p")
Error: C stack usage 7969188 is too close to the limit

ampc cefalosporin resistance

hai matthijs

previously you added the (convenient) function to automatically change the cephalosporins resistance for chrom-ampc organisms to R. We forgot however, that the first and second generations and the penicillins w/o inhibitor also should be made R in these instances.....

gr

Rogier

Adding option to ggplot_pca for angle of vector labels

Hello:
I was happy to see that you have updated the ggbiplot function. I had parameterized some of the colors as well for personal use, but I am new to github and coding.

One thing I had added that you might want to consider is the option to angle or not angle the vector labels. I prefer the text to be parallel for figures, personally.

Let me know if you need help!

Support for CLSI 2020 and 2021

From an email:

Dear Dr. Berends,

I would like to know if is possible to get a new version of AMR package for R with CLSI 2020 or 2021. In the current version of AMR package, CLSI it is given only until 2019, and EUCAST until 2021. It is a great package, congratulations!!

So, I hope you can help me with the question, or if you could provide a suggestion/hint to use CLSI 2021 would be really nice.

Thank you very much for your time and understanding.

This is indeed a good idea, we’ll start working on it!

MIC value without leading zero

As discussed in #5

It turns out that exports from Vitek have values such as <=.25 (i.e with no leading 0). as.mic can't interpret this and converts the value to NA

Error in seq_len

Hi,

I'm trying to run ab_from_text on a list of drugs and am getting the following error:

> ab_from_text(drugs_wo_empty$CRF_concomitant_medication_which, type = "drug",
+              thorough_search = TRUE, info = TRUE)
[======>--------------------------------------------------------------------------------------------------------------------------]   6% (17/20)Error in seq_len(length(v) - 1) : 
  argument must be coercible to non-negative integer

The list of drugs looks like this

> drugs_wo_empty$CRF_concomitant_medication_which
  [1] "L-Thyroxin 175µg [175µg Levothyroxin natrium, (170,2µg Levothyroxin)] 1x1 => Hyperthyreose seit 1999"                                                                                                                                                                                                                                                                                                                                                                                                      
  [2] "Mirtazapin 15mg 1x0,25 => Hypoxie/Schlafstörung seit 03.2012"                                                                                                                                                                                                                                                                                                                                                                                                                                              
  [3] "Magnesium Dragees [(keine Wirkstoff-Angaben)] 1x1 => Obstipation seit 01.2014"                                                                                                                                                                                                                                                                                                                                                                                                                             
  [4] "Marcumar 3mg [3mg Phenprocoumon] nach INR 1x0,25 => Vorhoffflimmern seit 30.11.2010"                                                                                                                                                                                                                                                                                                                                                                                                                       
  [5] "MetoHEXAL 50mg [50mg Metoprololtartrat (Ph.Eur.) (39mg Metoprolol)]  im Wechsel 1er Tag: 1x1 + 2ter Tag: 1x0,5 => Hypertonie seit 03.2013"                                                                                                                                                                                                                                                                                                                                                                 
  [6] "Propafenon 300 [300mg Propafenon-HCl (271mg Propafenon)] im Wechsel 1er Tag: 1x1,5 + 2ter Tag: 1x2 => Vorhoffflimmern seit 03.2013"                                                                                                                                                                                                                                                                                                                                                                        
  [7] "Bedarfsmedikation: MOVICOL Pulv. [13,13g Macrogol 3350, 0,35g Natriumchlorid, (0,138g Natrium), 0,18g Natriumhydrogencarbonat, 0,05g Kaliumchlorid] 1 Btl. => bei Obstipation seit 03.2013"                                                                                                                                                                                                                                                                                                                
  [8] "Dominal forte 40mg [40mg Prothipendyl hydrochlorid-1-Wasser, (33,6mg Prothipendyl)] 1x bei Hypoxie/Schlafstörung seit 07.2012"                                                                                                                                                                                                                                                                                                                                                                             
  [9] "Twynsta 40mg/10mg [40mg Telmisartan, 13,9mg Amlodipinbesilat (10mg Amlodipin)] 1x  => bei Bedarf - Hypertonie seit 04.2012"                                                                                                                                                                                                                                                                                                                                                                                
 [10] "dispatim 0,5%Augentropfen [6,83mg/1ml Timolol hydrogenmaleat, (5mg/1ml Timolol)] 1x in jedes Auge 1 Tr. => Glaukom seit 1992"                                                                                                                                                                                                                                                                                                                                                                              
 [11] "Bedarfsmedikation: Ibuprofen 600mg 1x1 bei Rückenschmerzen seit 08.2012"                                                                                                                                                                                                                                                                                                                                                                                                                                   
 [12] "Bisoprolol 2,5mg [2,5 mg Bisoprololfumarat (2:1) (2,12 mg Bisoprolol)] 1x1 => Hypertonie seit 12.2013"                                                                                                                                                                                                                                                                                                                                                                                                     
 [13] "Ramipril 5mg 1x1 => Hypertonie seit 12.2013"                                                                                                                                                                                                                                                                                                                                                                                                                                                               
 [14] "Fungazol 200mg 1xWoche => Nagelpilz seit 06.2013"                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 [15] "Allopurinol 300mg 1x1 => Hyperurikämie seit 1980"                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 [16] "Aprovel 300mg [300mg Irbesartan] 1x0,5 => Hypertonie seit 08.2012"                                                                                                                                                                                                                                                                                                                                                                                                                                         
 [17] "Euthyrox 150µg [150µg Levothyroxin natrium, (145,88µg Levothyroxin)] 1x1 => Hypothyreose seit 1980"                                                                                                                                                                                                                                                                                                                                                                                                        
 [18] "LisiHEXAL 10mg [10,89mg Lisinopril 2H2O, (10mg Lisinopril)] 1x1 => Hypertonie seit 15.08.2014"                                                                                                                                                                                                                                                                                                                                                                                                             
 [19] "Kalinor 1,56g Kalium/2,5g Citrat Brausetabl. [2,17g Kaliumcitrat 1H2O, (0,78g Kalium), 2g Kaliumhydrogencarbonat]  alle 2Tage => Wadenkrämpfe seit 15.08.2014"                                                                                                                                                                                                                                                                                                                                             
 [20] "Hyaluronsäure 1x2 => LWS-Bandscheibenschäden seit 05.2014"

Could you please help with this?

Thank you,
Susheel

Using at.rsi with dplyr's mutate and across

I have a line to calculate RSI values in a df as follows

rsi_data <- mic_amr_data %>% dplyr::mutate_at(vars(-c(id,Species,mo)), as.rsi, mo = .$mo, guideline = 'EUCAST')

If I try with the new across() function from dplyr 1.0

rsi_data <- mic_amr_data %>% dplyr::mutate(across(-c(id,Species,mo), as.rsi, mo = .$mo, guideline = 'EUCAST'))

every column is interpreted as col which the package thinks is COLISTIN

issue with as.ab (amr 1.5)

hai

this code works under AMR 1.4, but not with AMR 1.5:

df <- df %>% rename_with(df, .fn = as.ab, .cols = amikacine:voriconazol)

now with AMR 1.5 I get this error:

Error: in .fn(): argument flag_multiple_results must be of class "logical", not "tbl_df/tbl/data.frame"

(greetings,
Rogier)

refinement of eucast-ampc rules

hai
a refinement that should be made:
the new rule to make the ampc organisms R (or make NA), is based on isolates that show S based on in vitro results. But raw results with 'I' should also be included. Because of the resistance mechanism, these are essentially the same situations.

eucast text that you quote:

'a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to NA. Currently only works when version_expertrules is 3.2; 'EUCAST Expert Rules v3.2 on Enterobacterales' states that susceptible (S) results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of NA for this argument will remove results for these agents, while e.g. a value of "R" will make the results for these agents resistant.'

does not explicitly state this, but it is ofcourse implied.

Source for SNOMED is not universal/international

We received an email containing:

I have a question in respect to the the microorganism table in the AMR package. The source of the organism taxonomic classification is clearly references. What is unclear is the source of the SNOMED codes in the table.
This is relevant to interoperability and linking to other health data sets.

Would you mind explaining which SNOMED version is used in the package and how often the SNOMED codes in the AMR table are updated.

The current SNOMED implementation relies on this page of Nictiz, the Dutch independent national competence centre for electronic exchange of health and care information.

We should be looking for (1) an internationally adopted (and more direct) source. Furthermore, we should (2) keep track of implemented version numbers.

Wrong MIC interpretation of carbapenems in *Morganella morganii*

During an ECCMID 2021 talk, it was discovered by someone that the MIC of at least imipenem is wrongly interpreted for M. morganii.

Test using:

as.rsi(x = as.mic(c(0.0125, 0.5, 1, 2, 4, 8)),
       mo = "Morganella morganii", 
       ab = "Imipenem",
       guideline = "EUCAST") 

# or coloured plotting
plot(as.mic(c(0.0125, 0.5, 1, 2, 4, 8)),
     mo = "Morganella morganii", 
     ab = "Imipenem",
     guideline = "EUCAST") 

strange results for P. aer when using BRMO-guideline within MDRO()

Hai

When i use the mdro() function with the dutch wip-brmo guidelines (or when using the equivalent brmo() function), I get strange results for my Pseudomonas aeruginosa isolates:
A portion (~8%, n=1080 isolates) are labeled MDRO/BRMO positive, the rest is negative.
However the positive isolates have reason ‘not covered by BRMO guideline ", and in results for non-susceptible it says “” (aka the string is empy). I am not entirely sure if these are labeled correctly, so I want to be able to see which antibiotics are labeled by the algoritm as non-susceptible. These isolates are covered by the guideline, so I think there is a mistake in there somewhere.
Thanks!

Cannot specify column for species designation in mdro()

Hi,

Thanks for a great package! I had a small issue with the mdro() function that I managed to fix, details below.

When I ran the mdro() function on my table of SIR phenotypes, I kept getting the following error:

> mdro(vitek_spp)
NOTE: Using column 'species' as input for `col_mo`.
Auto-guessing columns suitable for analysis... OK.
Error: Can't convert `species` <character> to match type of `species` <mo>.

Running
mdro(vitek_spp, col_mo = "species")
threw the same error as above, even though I was specifying which column had the species information.

I also tried converting my species column into the mo type:
vitek_spp <- vitek_spp %>% mutate(species = as.mo(species)) and confirmed that this column was an S3:mo variable type, but still got the same error as above.

Eventually I worked out that if I named my species column, mo instead (the same column name as the example_isolates data included with the package), the function would run.

Is this the expected behaviour?

ab_ddd() returns NA for several ATCs

Thank you for this great package! I use it quite heavily in my antimicrobial stewardship projects.

Issue details

ab_ddd() & atc_online_property() both return NA for:

  • ATC J01EE01 (SULFAMETHOXAZOLUM + TRIMETHOPRIMUM).
    This happens for combination products where the DDDs deviate from the main principles.
    These DDDs are included in a separate list: https://www.whocc.no/ddd/list_of_ddds_combined_products/.
  • ATC P01AB01 (metronidazole oral) - not yet in the database (?)
  • ATC J01DI54 (CEFTOLOZANUM+TAZOBACTAM):
    • ab_ddd() returns the DDD, but not the unit
    • atc_online_property() works fine

Session info

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] AMR_1.7.1        lubridate_1.7.10 ggplot2_3.3.3    readr_1.4.0
[5] dplyr_1.0.6

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6       rstudioapi_0.13  magrittr_2.0.1   hms_1.1.0       
 [5] tidyselect_1.1.1 munsell_0.5.0    colorspace_2.0-1 R6_2.5.0
 [9] rlang_0.4.11     fansi_0.5.0      tools_4.1.0      grid_4.1.0
[13] gtable_0.3.0     utf8_1.2.1       cli_3.0.1        DBI_1.1.1
[17] withr_2.4.2      ellipsis_0.3.2   assertthat_0.2.1 tibble_3.1.2    
[21] lifecycle_1.0.0  crayon_1.4.1     purrr_0.3.4      ps_1.6.0
[25] vctrs_0.3.8      glue_1.4.2       compiler_4.1.0   pillar_1.6.1
[29] generics_0.1.0   scales_1.1.1     jsonlite_1.7.2   pkgconfig_2.0.3

Package removed from CRAN?

I've just tried to reinstall "AMR" into R (4.0.5, 64bit, Win10 1909) and got the following error:

Warning in install.packages :
package ‘AMR’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Heading over to https://cran.r-project.org/web/packages/AMR/index.html, I see this:

Package ‘AMR’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2021-05-22 as check problems were not corrected in time.
A summary of the most recent check results can be obtained from the check results archive.
Please use the canonical form https://CRAN.R-project.org/package=AMR to link to this page.

Is a fix coming? It would be such a shame for this incredibly useful package to disappear.

Attributes lost after exporting/importing data sets?

I have a question regarding the use of AMR and the special classes that can be made with AMR.

Often I export datafiles, and save them. After I import them back into r studio, I lose the attributes that were obtained using the scripts in AMR. For instance the special classes like mo, rsi, mic. Of course I can restore them by using the original as.mo and as.rsi functions. However, these are the ones that take up the most time to run. Especially as.mo and as.disk take >10 minutes to run on my data set.
This is very inconvenient, so i'm looking for a solution.
I've tried a number of options like, readr, feather, rds. But none of these provide a solution. How do you go about this problem?

thanks!

Re: AMR library problem.

Hello, I have been using your AMR library for a while. In one of the latest versions, I began to receive the error "Error in value [[3L]] (cond): incorrect regular expression '^ (abbotic | abboticin | abdizid ...." when using the eucast_rules () function. How can I fix this? grateful for any answer.

Regard `""` as `NA` in `as.disk()`

This is inconsistent:

# first MIC and RSI
AMR::as.mic("")
#> Class <mic>
#> [1] <NA>
AMR::as.rsi("")
#> Class <rsi>
#> [1] <NA>

# now disk
AMR::as.disk("")
#> Warning: in `as.disk()`: 1 results truncated (100%) that were invalid disk
#> zones: ""
#> Class <disk>
#> [1] NA

Interpreting CLSI values (blood)

I noticed a peculiarity with interpretation of some CLSI antibiotics

> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'CLSI 2019')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline CLSI 2019 ... OK.
       mo AMC
1 E. coli   R
> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'CLSI 2018')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline CLSI 2018 ... OK.
       mo AMC
1 E. coli   S
> data.frame(mo = "E. coli",
+            AMC = 4) %>%
+   as.rsi(guideline = 'EUCAST')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `AMC` (amoxicillin/clavulanic acid) contains MIC values.
=> Interpreting MIC values of `AMC` (amoxicillin/clavulanic acid) using guideline EUCAST 2020 ... OK.
       mo AMC
1 E. coli   S

An MIC value of 4 for AMC which I think should be interpreted as sensitive is being interpreted as R for CLSI 2019

I think this is because of row 6 in the table below

> rsi_translation %>% filter(guideline == 'CLSI 2019' & method == 'MIC' & ab == 'AMC')
   guideline method                   site           mo  ab            ref_tbl disk_dose breakpoint_S breakpoint_R   uti
1  CLSI 2019    MIC                   <NA>      B_AGGRG AMC        M45 Table 9      <NA>         4.00            8 FALSE
2  CLSI 2019    MIC                   <NA>      B_ANRSL AMC           Table 2J      <NA>         4.00           16 FALSE
3  CLSI 2019    MIC                   <NA> B_BRKHL_PSDM AMC       M45 Table 21      <NA>         8.00           32 FALSE
4  CLSI 2019    MIC                   <NA>      B_CRDBC AMC        M45 Table 9      <NA>         4.00            8 FALSE
5  CLSI 2019    MIC                   <NA> B_EKNLL_CRRD AMC        M45 Table 9      <NA>         4.00            8 FALSE
6  CLSI 2019    MIC      Skin, soft tissue B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         0.25            1 FALSE
7  CLSI 2019    MIC                    UTI B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         8.00           NA  TRUE
8  CLSI 2019    MIC Skin, soft tissue, UTI B_ESCHR_COLI AMC     VET08 Table 2A      <NA>         0.25            1  TRUE
9  CLSI 2019    MIC                   <NA>      B_HMPHL AMC           Table 2E      <NA>         4.00            8 FALSE
10 CLSI 2019    MIC                   <NA>      B_KGLLA AMC        M45 Table 9      <NA>         4.00            8 FALSE
11 CLSI 2019    MIC                   <NA> B_MRXLL_CTRR AMC       M45 Table 16      <NA>         4.00            8 FALSE
12 CLSI 2019    MIC                   <NA>      B_PSTRL AMC       M45 Table 17      <NA>         0.50           NA FALSE
13 CLSI 2019    MIC Skin, soft tissue, UTI B_PSTRL_MLTC AMC     VET08 Table 2H      <NA>         0.25            1  TRUE
14 CLSI 2019    MIC                   <NA>      B_STPHY AMC           Table 2C      <NA>         4.00            8 FALSE
15 CLSI 2019    MIC      Skin, soft tissue      B_STPHY AMC     VET08 Table 2C      <NA>         0.25            1 FALSE
16 CLSI 2019    MIC                    UTI      B_STPHY AMC     VET08 Table 2C      <NA>         8.00           NA  TRUE
17 CLSI 2019    MIC Skin, soft tissue, UTI      B_STPHY AMC     VET08 Table 2C      <NA>         0.25            1  TRUE
18 CLSI 2019    MIC                   <NA>      B_STRPT AMC         Table 2H-1      <NA>           NA           NA FALSE
19 CLSI 2019    MIC Skin, soft tissue, UTI      B_STRPT AMC     VET08 Table 2D      <NA>         0.25            1  TRUE
20 CLSI 2019    MIC         Non-meningitis B_STRPT_PNMN AMC           Table 2G      <NA>         2.00            8 FALSE
21 CLSI 2019    MIC                   <NA>      B_VIBRI AMC       M45 Table 20      <NA>         8.00           32 FALSE
22 CLSI 2019    MIC                   <NA>      UNKNOWN AMC Generic CLSI rules   20-10ug         8.00           32 FALSE

This should not be used for bacteraemia, only skin and soft tissue. Is there any way to exclude these and only include interpretations for blood?

brmo() fills every row

hai

i have a question regarding the BRMO() function:

it seems to ‘fill in’ every row with an answer (positive/negative). Even if all the antibiotic (rsi-class) columns are empty (NA). Is that the correct behavior?

my code:

df <- df %>% mutate(BRMO_wip = brmo(., col_mo = "microbe_ID", only_rsi_columns = TRUE))

Even with the last argument, every row (meaning every isolate) gets a value.

It would make more sense if the rows that contain empty antibiotic results get a NA while using the BRMO() function.
Now i get problems downstream when using the firstisolates() function. These empty rows are included because of this one column.

Detection of ampC in eucast_rules()

eucast_rules() does apply the EUCAST tables and also makes cefoxitine R for chromosomal ampC producers. However, reported values for 3rd generation cephalosporins are left intact. According to EUCAST, those values should be blinded or should at least have a comment.

Possible new implementations:

  • Alter value of those bug/drug combinations (to "R" or NA)
  • Make new argument to set this option

Incorrect reporting of R e.g CIP and Enterobacterales?

The EUCAST breakpoint table for CIP and Enterobacterales shows
image
This is replicated in you rsi_translation data
image
However this code yields R

> as.rsi(x = as.mic(0.5),
        mo = as.mo("E. coli"),
        ab = "CIP",
        guideline = "EUCAST")
=> Interpreting MIC values of `CIP` (ciprofloxacin) using guideline EUCAST 2020 ... OK.
Class <rsi>
[1] R

I would have expected this to be I

WHONET interpretations when MIC is >

I have noticed some differences in interpretation between WHO net and your package
Organism: ABA
Drug: CIP
MIC: >2

WHONET => R
AMR (R Package) => I

> data.frame(mo = "A.baumanii",
+             CIP = ">2") %>%
+    as.rsi(guideline = 'CLSI 2019')
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Assuming column `CIP` (ciprofloxacin) contains MIC values.
=> Interpreting MIC values of `CIP` (ciprofloxacin) using guideline CLSI 2019 ... OK.
          mo CIP
1 A.baumanii   I

I think this comes from the breakpoints where <1 is S and > 4 is R
WHONET interprets cautiously by saying >2 could be > 4. I have checked with colleagues who have been doing AMR surveillance for 30 years in the Philippines. They would also interpret this as R

rsi_translation %>% filter(guideline == 'CLSI 2019' & method == 'MIC' & ab == 'CIP' & (str_starts(mo, 'B_ACNTB') | mo == 'UNKNOWN'))
  guideline method site      mo  ab            ref_tbl disk_dose breakpoint_S breakpoint_R   uti
1 CLSI 2019    MIC <NA> B_ACNTB CIP         Table 2B-2      <NA>         1.00            4 FALSE
2 CLSI 2019    MIC <NA> UNKNOWN CIP Generic CLSI rules       5ug         0.25            1 FALSE

small error in ab_property docs

Line 47 in ab_property.Rd:

\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.ab]{as.ab()}}}

Should be antibiotic instead of microorgansim

Veillonella

hai

I've noticed a small error: veillonella is a gram-negative coccoid bacterium.
AMR mo_gramstain() classifies it as a gram-positive coccus.
greetings!

Error in getting mo properties from old MO codes

Previous package versions used some MO codes that are replaced with new codes.

Getting properties from old codes does not work:

library(AMR)

# recreate old code structure, could be from e.g. AMR 1.0.0
old_mo <- structure(c("B_ENTRB_CLOC", "B_PRPNB_ACNS"),
                    class = c("mo", "character"))

mo_genus(old_mo)
#> Error in data.frame(uncertainty = uncertainty_level, input = input, fullname = fullname,  : 
#>   arguments imply differing number of rows: 1, 0, 2 

# using as.mo() to transform first, works
mo_genus(as.mo(old_mo))
#> NOTE: 2 old microbial codes (from previous package versions) were updated to current used MO codes.
#> [1] "Enterobacter"  "Cutibacterium"

Strange thing is though, objects don't work, but values do:

old_mo[1]
#> Class <mo>
#> [1] B_ENTRB_CLOC

mo_genus("B_ENTRB_CLOC") # typed in as value
#> [1] "Enterobacter"

mo_genus(old_mo[1]) # exact same value, now as object
#> Error in data.frame(uncertainty = uncertainty_level, input = input, fullname = fullname,  : 
#>   arguments imply differing number of rows: 1, 0 

Custom guideline for as.rsi()

Hello! Thank you for this useful tool!
I was wondering if there is a way to have a customary guildeline in as.rsi(). It may be because my data is from veterinary field, but I get too many NAs and even different breakpoints applied with the current 'EUCAST' or 'CLSI' guildeline implemented in the package. So it'll be really great if I can have "my breakpoints" in the rsi_translation file and call it when using as.rsi().
Thank you! :D

Prevent unknown ATC codes from getting coerced

ATC codes that are not in the antibiotics data set, should not be coerced, but should return this:

AMR/R/ab.R

Lines 454 to 460 in 70a07ba

# take failed ATC codes apart from rest
x_unknown_ATCs <- x_unknown[x_unknown %like% "[A-Z][0-9][0-9][A-Z][A-Z][0-9][0-9]"]
x_unknown <- x_unknown[!x_unknown %in% x_unknown_ATCs]
if (length(x_unknown_ATCs) > 0 & fast_mode == FALSE) {
warning_("in `as.ab()`: these ATC codes are not (yet) in the antibiotics data set: ",
vector_and(x_unknown_ATCs), ".")
}

For example, this should be not happening (since J01CR50 is not piptazo, see #55):

ab_info("J01CR50")
#> $ab
#> [1] "TZP"
#> 
#> $cid
#> [1] 461573
#> 
#> $name
#> [1] "Piperacilline/tazobactam"
#> 
#> $group
#> [1] "Beta-lactams/penicillines"
#> 
#> $atc
#> [1] "J01CR05"
#> 
#> $atc_group1
#> [1] "Beta-lactam antibacterials, penicillins"
#> 
#> $atc_group2
#> [1] "Combinations of penicillins, incl. beta-lactamase inhibitors"
#> 
#> $tradenames
#> [1] ""           "tazocel"    "tazocillin" "tazocin"    "zosyn"     
#> 
#> $loinc
#> character(0)
#> 
#> $ddd
#> $ddd$oral
#> $ddd$oral$amount
#> [1] NA
#> 
#> $ddd$oral$units
#> [1] NA
#> 
#> 
#> $ddd$iv
#> $ddd$iv$amount
#> [1] 14
#> 
#> $ddd$iv$units
#> [1] "g"
#> 
#> 
#> 
#> Warning messages:
#> 1: in `ab_ddd()`: DDDs of some combined products are available for different dose combinations and not (yet) part of the AMR package.Please
#> refer to the WHOCC website:
#> www.whocc.no/ddd/list_of_ddds_combined_products/ 
#> 2: in `ab_ddd_units()`: DDDs of combined products are available for different dose combinations and not (yet) part of the AMR
#> package.Please refer to the WHOCC website:
#> www.whocc.no/ddd/list_of_ddds_combined_products/ 
#> 3: in `ab_ddd_units()`: DDDs of combined products are available for different dose combinations and not (yet) part of the AMR
#> package.Please refer to the WHOCC website:
#> www.whocc.no/ddd/list_of_ddds_combined_products/ 

Custom AMR rules to expand EUCAST rules

Work on a new function custom_eucast_rules(), which output can be used in eucast_rules() to expand its capabilities with organisation- or analysis-specific rules.

This would also be a more durable solution to cases like #28, #19 and #25

Custom_eucast_rules() and the use of antibiotic==NA before the tilde

Hi again Matthijs

I hope everything is well.
After I had rewritten the eucast rules in the custom_eucast_rules(), I discovered that some of the rules were not applied. More specifically the expert rules were a problem. First i tried this syntax(just an example), which I think would be most logical since the custom_eucast_rules() works with just an antibiotic before and after the tilde:
genus == "Enterococcus faecium" ~ FUS=="R"
But it did not work. Then I tried:
genus == "Enterococcus faecium" & FUS==NA ~ FUS=="R"
which did not work either.
Do you have any workarounds or ideas on how to solve this one?

Kind regards
Marc Westerholt

Issue with Eucast Expert Rules (Stenotrophomonas maltophilia and CAZ)

Using the function eucast_rules(), Stenotrophomonas maltophilia isolates should not be interpreted "R" to ceftazidime.

Indeed, it was updated in v3.1 of EUCAST Expert Rules ( http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf ) :
"Table 2: Ceftazidime R deleted for Stenotrophomonas maltophilia"

Anyways, thank you a lot for your work. This package is very useful to analyze antimicrobial resistance data.

first isolates function does not take untested isolates into account

hai mattthijs

i have a question or suggestion with regard to the use of the 'first isolates' function

i have recently used the function on a dataframe, and noted that the result included isolates of which no susceptibility testing was performed.

so i ended up with a dataframe of first isolates from blood, of which a significant amount was not tested at all.

the setup of the function does currently not provide for a solution, is that correct?

ofcourse i could first filter the dataframe before i call the function on it, but it would make much more sense if the function contained an argument that could be used to check for missing results in certain columns. eg: include the isolate in the analysis if certain columns are !NA.

Or am i missing something?

RSI values by lab system MIPS

Support these values for as.rsi():

U susceptible urine
D susceptible dose-dependent
V variable MIC limits
E insufficient evidence
- not tested

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.