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,
plot_type,
x_variable,
y_variable,
qc_types = NA,
facet_by_class = FALSE,
y_shared = FALSE,
filter_data = FALSE,
include_qualifier = FALSE,
equality_line = FALSE,
threshold_values = NA_real_,
log_scale = FALSE,
x_lim = c(NA_real_, NA_real_),
y_lim = c(NA_real_, NA_real_),
cols_page = 5,
point_size = 1.5,
point_color = "#0460acff",
point_fill = "#4da2e7ff",
point_shape = 21,
point_alpha = 0.5,
point_stroke = 0.5,
font_base_size = 8
)Arguments
- data
A
MRMhubExperimentobject containing pre-calculated QC metrics.- plot_type
A character string specifying the type of plot to generate. Must be one of "scatter", "diff", or "ratio". Selecting "scatter" plots the "y_variable" against the "y_variable" values as a scatter plot, "diff" plots the difference between the two values against the average value, and "ratio" plots the log2 ratio of the two values against the average value.c
- 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.
- qc_types
A character vector specifying the QC types to plot.
- facet_by_class
Logical; if
TRUE, facets the plot byfeature_class, as definedLogical; if
TRUE, all facets share the same y-axis scale. IfFALSE(default), each facet has its own y-axis scale.- 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_values
Numeric single value or vector with 2 elements; threshold valus to be shown as dashed lines from both axes on the plot (default is
NA).- log_scale
Logical, whether to use a log10 scale the axes.
- x_lim
Numeric vector of length 2 for x-axis limits. Use
NAfor auto-scaling (default isc(0, NA)).- y_lim
Numeric vector of length 2 for y-axis limits. Use
NAfor auto-scaling (default isc(0, NA)).- cols_page
Integer; number of facet columns per page (default is
5).- point_size
Numeric; size of points in millimeters (default is
1).- point_color
A vector specifying the colors for points corresponding to different QC types. This can be either an unnamed vector or a named vector, with names corresponding to QC types. Unused colors will be ignored. Default is
NAwhich corresponds to the default colors for QC types defined in the package.- point_fill
A vector specifying the fill colors for points corresponding to different QC types. This can be either an unnamed vector or a named vector, with names corresponding to QC types. Unused fill colors will be ignored. Default is
NAwhich corresponds to the default fill colors for QC types defined in the package.- point_shape
A vector specifying the shapes for points corresponding to different QC types. This can be either an unnamed vector or a named vector, with names corresponding to QC types. Unused shapes will be ignored. Default is
NAwhich corresponds to the default shapes for QC types defined in the package.- point_alpha
Numeric; transparency of points (default is
0.5).- point_stroke
Numeric; thickness of point borders (default is
0.5).- font_base_size
Numeric; base font size in points (default is
8).
Details
The comparison is visualized through one of three plot types:
Scatter plot: Values of
y_variablevsx_variableDifference plot: (
y_variable- `x_variable“) vs mean of both valuesRatio plot: log2(
y_variable/x_variable) vs mean of both values
x_variableandy_variablemust be available in the QC metrics table. Please refer to the help page ofcalc_qc_metrics()for more information on the available QC metric variables.When
facet_by_class = TRUE, then thefeature_classmust be defined in the metadata or retrieved via specific functions, e.g.,parse_lipid_feature_names().