R/17_ms2_plot4mass_dataset.R
plot_ms2_matching.Rd
This function generates plots comparing MS2 spectra from experimental data with spectra from a reference database. It matches based on a set of user-specified parameters and provides visualizations with either static or interactive plots.
plot_ms2_matching(
object,
variable_id,
variable_index,
database,
polarity = c("positive", "negative"),
ms1.match.ppm = 25,
ms2.match.ppm = 30,
mz.ppm.thr = 400,
remove_fragment_intensity_cutoff = 0,
interactive_plot = FALSE
)
A `mass_dataset` object that contains MS2 data and annotations.
Optional. A vector of variable IDs to be plotted.
Optional. A vector of variable indices to be plotted. Either `variable_id` or `variable_index` must be provided.
A `databaseClass` object containing reference MS2 spectra for matching.
Character. The ionization mode, either "positive"
or "negative"
. Default is "positive"
.
Numeric. The mass-to-charge (m/z) tolerance in parts per million (ppm) for MS1 matching. Default is 25.
Numeric. The mass-to-charge (m/z) tolerance in parts per million (ppm) for MS2 matching. Default is 30.
Numeric. The m/z threshold for fragment matching. Default is 400.
Numeric. The intensity cutoff for removing low-intensity fragments. Default is 0.
Logical. If TRUE
, an interactive plot using plotly is returned. Default is FALSE
.
A list of plots (either static or interactive) comparing experimental and reference MS2 spectra.
The function compares MS2 spectra from the experimental data (provided by the `mass_dataset` object) to those in the reference `database`. It generates matching plots for each of the specified variables and annotations. Users can specify either the `variable_id` or `variable_index` for plotting. The function supports both static and interactive visualizations.
if (FALSE) { # \dontrun{
# Example usage:
all_plots <- plot_ms2_matching(
object = my_mass_dataset,
variable_id = c("pRPLC_1112", "pRPLC_1860"),
database = my_database
)
} # }