Skip to content

amr_upset() - MIC distribution panel - box plot middle line is not plotting the median? #93

Description

@karatsang

amr_upset() function

In regards to the MIC distribution panel that is generated by the amr_upset() function - the middle line within the box plot is not plotting the median MIC value?

Referring to the attached plot below. The code to reproduce panel a):

kp_mero <- download_ebi(
  antibiotic = "meropenem",
  species = "Klebsiella pneumoniae",
  reformat = TRUE,
  interpret_eucast = TRUE,
  interpret_ecoff = TRUE
)
kp_mero_euscape <- kp_mero %>% filter(grepl("31358985", source))

contaminated_assemblies <- c("SAMEA3729690", "SAMEA3721062", "SAMEA3721052", "SAMEA3720966", "SAMEA3673128", "SAMEA3538742", "SAMEA3721188", "SAMEA3649589", "SAMEA3538652", "SAMEA3649503", "SAMEA3538911", "SAMEA3727711", "SAMEA3649452", "SAMEA3649453", "SAMEA3649454", "SAMEA3649467", "SAMEA3721063", "SAMEA3538862", "SAMEA3538667", "SAMEA3673004", "SAMEA3729818", "SAMEA3729660", "SAMEA3673078", "SAMEA3673097")

kp_mero_euscape <- kp_mero_euscape %>%
  filter(!id %in% contaminated_assemblies)

kleborate_dev <- import_kleborate(kleborate_raw)


kp_mero_kleborate_binary_matrix <- get_binary_matrix(
  geno_table = kleborate_dev,
  pheno_table = kp_mero_euscape,
  antibiotic = "Meropenem",
  drug_class_list = c("Carbapenems"),
  sir_col = "pheno_eucast",
  keep_assay_values = TRUE,
  keep_assay_values_from = "mic",
  marker_col = "marker.label"
)

kp_mic_upset_kleborate <- amr_upset(kp_mero_kleborate_binary_matrix, assay = "mic", bp_R="8", bp_S="2", ecoff_bp="0.125", min_set_size = 1)

kp_mic_upset_kleborate$plot
kp_mic_upset_kleborate$summary

Reviewing kp_mic_upset_kleborate$summary, I am not sure if the box plot middle line is plotting median_excludeRangeValues or median_ignoreRanges? For example, in panel a) in the no markers (first column) of the UpSet plot, the median looks to be 1.5mg/L, but the median_excludeRangeValues= 0.25 and median_ignoreRanges = 0.06 from kp_mic_upset_kleborate$summary.

As a "sanity check", in panel b) - in the no carbapenem, wt porin (first) column, it's plotting the same data using geom_boxplot(width = 0.7, outlier.shape = NA) and the median is <0.25mg/L

I haven't looked too deeply into this, but will investigate tomorrow

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions