Skip to contents

This function generates scatter plots comparing two QC metrics variables across feature classes. A list of available QC metrics is available from the calc_qc_metrics() documentation.

Usage

plot_qcmetrics_comparison(
  data = NULL,
  x_variable,
  y_variable,
  facet_by_class = FALSE,
  filter_data = FALSE,
  include_qualifier = TRUE,
  equality_line = FALSE,
  threshold_value = NA,
  xlim = c(0, NA),
  ylim = c(0, NA),
  ncol = 5,
  point_size = 1,
  point_alpha = 0.5,
  font_base_size = 8
)

Arguments

data

A MidarExperiment object containing pre-calculated QC metrics.

x_variable

The name of the QC metric variable to be plotted on the x-axis.

y_variable

The name of the QC metric variable to be plotted on the y-axis.

facet_by_class

If TRUE, facets the plot by feature_class, as defined in the feature metadata.

filter_data

Logical; whether to use all data (default) or only QC-filtered data (filtered via filter_features_qc()).

include_qualifier

Logical; whether to include qualifier features (default is TRUE).

equality_line

Logical; whether to show a line indicating identical values in both compared variables (default is FALSE).

threshold_value

Numeric; threshold value to be shown as dashed lines from both axes on the plot (default is NA).

xlim

Numeric vector of length 2 for x-axis limits. Use NA for auto-scaling (default is c(0, NA)).

ylim

Numeric vector of length 2 for y-axis limits. Use NA for auto-scaling (default is c(0, NA)).

ncol

Integer; number of facet columns per page (default is 5).

point_size

Numeric; size of points in millimeters (default is 1).

point_alpha

Numeric; transparency of points (default is 0.5).

font_base_size

Numeric; base font size in points (default is 8).

Value

A ggplot2 object representing the scatter plot.

Details

  • x_variable and y_variable must be available in the QC metrics table. Please refer to the help page of calc_qc_metrics() for more information on the available QC metric variables.

  • When facet_by_class = TRUE, then the feature_class must be defined in the metadata or retrieved via specific functions, e.g., get_lipid_class_names().

Examples

# Example usage
mexp <- lipidomics_dataset
mexp <- calc_qc_metrics(mexp)
plot_qcmetrics_comparison(data = mexp,
            filter_data = FALSE,
            x_variable = "precursor_mz",
            y_variable = "rt_median_SPL",
            include_qualifier = TRUE)