msberends / AMR

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.
https://msberends.github.io/AMR/
Other
83 stars 12 forks source link

UTI coding not being recognised in SIR interpretation #108

Closed theanita1 closed 1 year ago

theanita1 commented 1 year ago

Hi Matthijs

Since the update the program is assuming TRUE for uti, despite having both specific code to the contrary and I created a column titled "uti" with all fields saying "FALSE"

here is my current conversion code: agar<- agar %>% mutate_if(is.mic, as.sir, add_intrinsic_resistance = F, include_PKPD = F, uti = F)

And here is a screenshot with the error: image

Any suggestions?

here is a subset of my data (in MICs) so you could try and see agar_MIC_2.csv

msberends commented 1 year ago

Hi Anita,

Oops, that’s indeed unintended! I’ll look into it. Thanks for sharing!

theanita1 commented 1 year ago

Hi Matthijs

Update, was having a play around with the code and tried out "uti = NULL" in my above as.sir transformation code, and for some antibiotics it gives the warning "Breakpoints for UTI and non-UTI available for tobramycin (TOB) in Serratia ureilytica - assuming non-UTI. Use argument uti to set which isolates are from urine. See ?as.sir" These abx are: CRO, CXM, FOS, GEN, and TOB

Where as others continue to give the same warning as mentioned above. Those abx are: CIP, CZO, LVX, LEX, MEC, NIT, NOR, and TMP

Thought I'd mention this as maybe there's a difference in the coding for these abx

msberends commented 1 year ago

UTI were not considered well, I also fixed this. Will be on GitHub today somewhere!

msberends commented 1 year ago

Thanks for all the info, greatly helps!!

msberends commented 1 year ago

The development version nows contains the fix to this issue. You can try the latest version using:

install.packages("remotes") # if you haven't already
remotes::install_github("msberends/AMR")
theanita1 commented 1 year ago

Hi Matthijs

Wow, so much faster!

Slightly major problem - none of my Enterobacterales are converting to SIRs but instead just throwing NAs. And this isn't just those that have UTI site descriptions, I mean all of them. Everything is now NA.

Also some of the Staphs are broken -the only ones that worked are clindamycin, gentamicin, penicillin and teicoplanin

Sorry to be the bearer of bad news

msberends commented 1 year ago

Oh no! I’ll try to fix this today, so you can make your annual report in time :)

It’s 6:52 AM in the Netherlands now, so I’m hopping on the train in a moment and will check this morning.

msberends commented 1 year ago

I could reproduce the problem:

as.sir(random_mic(10), ab = "gent", mo = "E. coli", guideline = "EUCAST 2022", include_PKPD = FALSE)
#> Interpreting MIC values: 'gent' (GEN, gentamicin), EUCAST 2022... OK 
#> Class 'sir'
#>  [1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>

as.sir(random_mic(10), ab = "gent", mo = "Enterobacterales", guideline = "EUCAST 2022", include_PKPD = FALSE)
#> Interpreting MIC values: 'gent' (GEN, gentamicin), EUCAST 2022... NOTE 
#>   • Breakpoints for UTI and non-UTI available for gentamicin
#>      (GEN) in Enterobacterales - assuming an unspecified body
#>      site. Use argument uti to set which isolates are from
#>      urine. See ?as.sir.
#> Class 'sir'
#>  [1] R R R R S R S S S S

So the breakpoints work, but E. coli is not understood as a species within the order of Enterobacterales. I think this is a small error, I’m working on it today.

theanita1 commented 1 year ago

I've also got uti = F in my codes

I'm not using "Enterobacterales" as the organism, I'm using the 'mo' chr codes

msberends commented 1 year ago

Yes, I would expect that, and it should work. I just proved to myself that the clinical breakpoint itself (which is for all Enterobacterales) is working, but not for its lower taxonomy, such as E. coli. Normally, all lower species must take this breakpoint, but that last part is broken.

Sorry for the inconvenience!

msberends commented 1 year ago

I found and fixed the error, it was a silly mistake. It checked the microorganisms data set for the wrong column to look up taxonomic properties. Should be fixed now!

Please check it again with your data, also the plot in #119 (which was caused by the same silliness).

theanita1 commented 1 year ago

The interpretation was much slower this time but no errors and only notes for the specific meningitis sites (which doesn't effect my data set) And for the MIC plots (#119) it looks great - the gentamicin is grey and the tobramycin has interpreted according to "pseudo" Thanks heaps for the quick replies and fixes!