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

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

Closed mvrcwest closed 3 years ago

mvrcwest commented 3 years ago

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

msberends commented 3 years ago

Hi!

I think I understand why the rule is not working: you are testing for the genus "Enterococcus faecium", but that's not a genus, that's a full name. So it can probably solved with either:

custom_eucast_rules(genus == "Enterococcus" & species == "faecium" ~ FUS == "R")
custom_eucast_rules(fullname == "Enterococcus faecium" ~ FUS == "R")

The first one is more robust, as it would also include subspecies (irrelevant for E. faecalis, but might be relevant for e.g., Klebsiella)

msberends commented 3 years ago

But it might be a good idea to build in a check, so the function would complain that in this case "Enterococcus faecium" is not a valid genus.

mvrcwest commented 3 years ago

How silly of me, but yes that would be a nice feature! Thank you for the help!