Skip to contents

This function takes a data frame with the minimum and maximum retention time (in seconds), and keeps the scans inside the provided boundaries. This filter function aims to keep the scans between the provided ROI and remove the scans outside the ROI.

Usage

roi_filter(spec, roi_table)

Arguments

spec

a data frame containing the MS/MS data.

roi_table

a data frame with two columns min_rt and max_rt specifying the minimum and maximum retention time for a specific metabolite.

Examples

# \donttest{
# Importing the Spectrum of Procyanidin A2 in negative ionization mode
# and 20 eV as the collision energy
ProcA2_file <- system.file("extdata",
  "ProcyanidinA2_neg_20eV.mzXML",
  package = "MS2extract"
)

# Region of interest table (rt ins seconds)
ProcA2_data <- data.frame(
  Formula = "C30H24O12", Ionization_mode = "Negative",
  min_rt = 163, max_rt = 180
)

ProcA2_raw <- import_mzxml(ProcA2_file, ProcA2_data)
#> • Processing: ProcyanidinA2_neg_20eV.mzXML
#> • Found 1 CE value: 20
#> • Remember to match CE velues in spec_metadata when exporting your library
#> • m/z range given 10 ppm: 575.11376 and 575.12526

# 26731 ions detected in total
dim(ProcA2_raw)
#> [1] 17829     6
# }