Study Variables Profile

if (length(PROFILING_VARIABLES) > 0) {
  cat(paste0(
    "This study variables profile visualizes group sizes within study variables as well as
    intersected with other study variables, if more than one is indicated. Set Size =
    Number of samples per group in variable (color-coded). Intersection Size = Number of
    samples with same combination of groups.The following variable(s) are used:",
    "\n**", paste(PROFILING_VARIABLES, collapse = "**, **"), "**."))

  plot_study_variables_profile(biocrates, PROFILING_VARIABLES)
} else {
  cat("No variables have been selected for profiling.")
}

Status Profiles {.tabset}

Status profiles visualize the occurrence of the different possible measurement statuses. Profiles are generated over all measurements, for different sample types (in percentages, since the number of samples vary per type), for different samples, for different compound classes (in percentages, since the number of compounds vary per class), as well as for different compounds.

message("**Note**: Many LC compounds in the Biocrates MxP Quant 500 Kit are 1-point calibrated and
don't feature an external standard. Thus, a high number of \"< LOD\" is to be expected within 
standard calibration samples.")

Overall

easy_datatable(count_status(data = biocrates), round_colums = "Percentage",
               caption = "Number of statuses in all measurements.", show_type = "statistics")
plot_status_profile(data = biocrates)

# General figure params
num_columns <- 4
fig_height_heatmap <- 4

Per sample type {.tabset}

# Profile figure size
num_types <- biocrates %>% pull(Sample.Type) %>% unique() %>% length()
fig_height_status_types <- ceiling(num_types/num_columns) * 1.2 + 1
# Heatmap figure sizes
fig_width_heatmap_types <- 0.15 * num_types + 1.5

easy_datatable(count_status(data = biocrates, grouping = "Sample.Type"), round_colums = "Percentage",
               caption = "Number of statuses per sample type.", show_type = "statistics")

Heatmap

plot_status_heatmap(data = biocrates, grouping = "Sample.Type", percentage = TRUE)

Single

plot_status_profile(data = biocrates, grouping = "Sample.Type", percentage = TRUE)

Per sample {.tabset}

# Profile figure size
num_samples <- biocrates %>% pull(Sample.Name) %>% unique() %>% length()
fig_height_status_samples <- min(50, ceiling(num_samples/num_columns) * 1.2 + 1)
# Heatmap figure sizes
fig_width_heatmap_samples <- 0.15 * num_samples + 1.5

easy_datatable(count_status(data = biocrates, grouping = "Sample.Name"), round_colums = "Percentage",
               caption = "Number of statuses per sample.", show_type = "statistics")

Heatmap

plot_status_heatmap(data = biocrates, grouping = "Sample.Name")

Single

plot_status_profile(data = biocrates, grouping = "Sample.Name")

Per compound class {.tabset}

# Profile figure size
num_class <- biocrates %>% pull(Class) %>% unique() %>% length()
fig_height_status_compounds <- ceiling(num_class/num_columns) * 1.2 + 1
# Heatmap figure sizes
fig_width_heatmap_class <- 0.15 * num_class + 1.5

easy_datatable(count_status(data = biocrates, grouping = "Class"), round_colums = "Percentage",
               caption = "Number of statuses per compound class.", show_type = "statistics")

Heatmap

plot_status_heatmap(data = biocrates, grouping = "Class", percentage = TRUE)

Single

plot_status_profile(data = biocrates, grouping = "Class", percentage = TRUE)

Per compound {.tabset}

# Profile figure size
num_compounds <- biocrates %>% pull(Compound) %>% unique() %>% length()
fig_height_status_compounds <- ceiling(num_compounds/num_columns) * 1.2 + 1
# Heatmap figure sizes
fig_width_heatmap_compounds <- 0.15 * num_compounds + 1.5

easy_datatable(count_status(data = biocrates, grouping = "Compound"), round_colums = "Percentage",
               caption = "Number of statuses per compound.", show_type = "statistics")

Heatmap

plot_status_heatmap(data = biocrates, grouping = "Compound")

Single

plot_status_profile(data = biocrates, grouping = "Compound")


bihealth/metaquac documentation built on Aug. 7, 2021, 8:40 a.m.