There doesn't seem to be a way to define a group of organisms that plays well with AMR::mo_group_members(), even after manually interacting with the database objects in R.
Here's my code snippet from a session to show what I'm talking about...
library(dplyr)
library(AMR) # Using remotes::install_git("https://github.com/msberends/AMR"), for most up to date version
#################################################################
# After running `add_custom_microorganisms()` for "Klebsiella oxytoca complex"
> AMR::as.mo('Klebsiella oxytoca complex')
Class 'mo'
[1] CUSTOM1_KLBSL_OXYC
#################################################################
# Not in actual table objects - AMR::as.mo() must be relying on some other instance (?)
> dplyr::filter(microorganisms, mo == 'CUSTOM1_KLBSL_OXYC')
# A tibble: 0 x 26
# i 26 variables: mo <mo>, fullname <chr>, status <chr>, kingdom <chr>, phylum <chr>, class <chr>, order <chr>, family <chr>, genus <chr>, species <chr>, subspecies <chr>, rank <chr>, ref <chr>, oxygen_tolerance <chr>,
# source <chr>, lpsn <chr>, lpsn_parent <chr>, lpsn_renamed_to <chr>, mycobank <chr>, mycobank_parent <chr>, mycobank_renamed_to <chr>, gbif <chr>, gbif_parent <chr>, gbif_renamed_to <chr>, prevalence <dbl>,
# snomed <list>
> dplyr::filter(microorganisms.groups, mo_group == 'CUSTOM1_KLBSL_OXYC')
# A tibble: 0 x 4
# i 4 variables: mo_group <mo>, mo <mo>, mo_group_name <chr>, mo_name <chr>
#################################################################
# After adding "Klebsiella oxytoca complex" rows to both tables manually
> dplyr::filter(microorganisms, mo == 'CUSTOM1_KLBSL_OXYC')
# A tibble: 1 x 26
mo fullname status kingdom phylum class order family genus species subspecies rank ref oxygen_tolerance source lpsn lpsn_parent lpsn_renamed_to mycobank mycobank_parent mycobank_renamed_to gbif
<mo> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 CUSTOM1_KLBSL_OXYC Klebsiella o~ accep~ Bacter~ Pseud~ Gamm~ Ente~ Enter~ Kleb~ oxytoc~ "" genus Ma e~ facultative ana~ LPSN 5158~ 482 NA NA NA NA 3221~
# i 4 more variables: gbif_parent <chr>, gbif_renamed_to <chr>, prevalence <dbl>, snomed <list>
> dplyr::filter(microorganisms.groups, mo_group == 'CUSTOM1_KLBSL_OXYC')
# A tibble: 6 x 4
mo_group mo mo_group_name mo_name
<mo> <mo> <chr> <chr>
1 CUSTOM1_KLBSL_OXYC B_KLBSL_MCHG Klebsiella oxytoca complex Klebsiella michiganensis
2 CUSTOM1_KLBSL_OXYC B_KLBSL_OXYT Klebsiella oxytoca complex Klebsiella oxytoca
3 CUSTOM1_KLBSL_OXYC B_KLBSL_SPLL Klebsiella oxytoca complex Klebsiella spallanzanii
4 CUSTOM1_KLBSL_OXYC B_KLBSL_PSTR Klebsiella oxytoca complex Klebsiella pasteurii
5 CUSTOM1_KLBSL_OXYC B_KLBSL_GRMN Klebsiella oxytoca complex Klebsiella grimontii
6 CUSTOM1_KLBSL_OXYC B_KLBSL_HXNS Klebsiella oxytoca complex Klebsiella huaxiensis
#################################################################
# Does not work as expected with `AMR::mo_group_members()`
> AMR::mo_group_members('B_ACNTB_BMNN-C')
[1] "Acinetobacter baumannii" "Acinetobacter calcoaceticus" "Acinetobacter dijkshoorniae" "Acinetobacter nosocomialis" "Acinetobacter pittii" "Acinetobacter seifertii"
> AMR::mo_group_members('CUSTOM1_KLBSL_OXYC')
character(0)
It's not a huge deal to just whip up a custom mo_group_members_direct() function that pulls right from those objects, but that feels like it could get messy and I think it would feel better to have this functionality integrated into the package. I know the best practices involve using the AMR_custom_mo to point to a custom .RDS instead of saving this stuff each session, but that doesn't currently help with custom groups.
Do you have any advice for the best way to add custom groups? If this feature is a WIP (or future want), I'm happy to assist in testing / dev as a regular user of this package.
Cheers,
Connor
There doesn't seem to be a way to define a group of organisms that plays well with
AMR::mo_group_members(), even after manually interacting with the database objects in R.Here's my code snippet from a session to show what I'm talking about...
It's not a huge deal to just whip up a custom
mo_group_members_direct()function that pulls right from those objects, but that feels like it could get messy and I think it would feel better to have this functionality integrated into the package. I know the best practices involve using theAMR_custom_moto point to a custom .RDS instead of saving this stuff each session, but that doesn't currently help with custom groups.Do you have any advice for the best way to add custom groups? If this feature is a WIP (or future want), I'm happy to assist in testing / dev as a regular user of this package.
Cheers,
Connor