knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

sRm is package which contains a selection of functions and methods for handling, processing and visualising Selective Reaction Monitoring (SRM) or Multiple Reaction Monitoring (MRM) Liquid Chromatography Mass Spectrometry Data (LC-MS). The key distinction between SRM/MRM data and other LC-MS data is that the data is acquired as a time-series in the form of chromatograms; whereas other LC-MS (ie DIA, DDA, PRM) acquire data as a series of mass spectrums which can then be used to create chromatograms.

sRm is designed to make use of existing packages (ie, much of the heavy lifting is done by mzR and xcms) and create a simple S4 interface to the user for processing, visualisation and reporting.

sRm can be easily installed directly from GitHub using the remotes package.

remotes::install_github('wilsontom/sRm')

Loading Data

Open and parse a series of .mzML files using the openSRM function.

library(sRm)

chrom_files <- list.files(system.file('extdata/Shimadzu_LCD', package = 'sRm'), full.names = TRUE)

srmExp <- openSRM(chrom_files, backend = 'mzR')

srmExp

The backend argument has to either be set as mzR or q3ML. In (hopefully) most instances mzR should be used as the backend, however due to a recent issue with backward compatability between pwiz and mzR (see here and here for more details) then the package q3ML is a pwiz independent parser for SRM-MS .mzML files.

Object Structure

The SRM object contains the following data;

Plotting Data

plotSRM

The main feature of sRm is a series of plotting methods which are useful for visualising the raw data. The plotSRM method uses the numeric index of the transition. These can be found in the transitions slot. The plotSRM method has two type options; overlay and facet.

plotSRM(srmExp, index = 11, type = 'overlay')
plotSRM(srmExp, index = 11, type = 'facet')

plotParent

plotParent use a numeric value of parent mass as an input, and plots all SRM transitions which feature the selected parent mass.

plotParent(srmExp, 303)

Peak Detection

sRm utilises the xcms::peaksWithCentWave() function to detection chromatogram features.

srmExpPeaks <-
  detectPeaks(srmExp,
              snthresh = 5,
              peakwidth = c(5,80), 
              parallel = FALSE)

The plotPeakArea can then be used to determine the quality of the peak integration.

plotPeakArea(srmExpPeaks, index = 1, sampleName = 'QC02')

Peak Grouping

Once peak detection has been performed, the groupPeaks method can be used to assign features to corresponding peak groups. The only parameter that needs to be set is rt_tolerance which is the retention time width which will be used to group similar peaks together.

srmExpGroups <- groupPeaks(srmExpPeaks, rt_tolerance = 0.5)

A summary of the peak groups can created using the groupSummary method.

group_table <- groupSummary(srmExpGroups)

head(group_table)

The output of the groupSummary method is a tibble so it can be easily processed further using dplyr to produce a list of the main GroupIDs which need exporting for further analysis.

For example, we can filter out any group which have low occupancy (and suspiciously high occupancy), have retention times in the wash phase of the chromatogram gradient or the peak width is too large.

number_of_samples <- nrow(srmExp@meta)

# Only keep groups with have Rt width of 3.0 minutes or less and total group occupancy is less than or equal to the total number of samples. 

group_table_filtered <-
  group_table %>% dplyr::filter(Rt >= 1.0 & Rt <= 16.0) %>%
  dplyr::filter(Rtwidth <= 3) %>% dplyr::filter(count <= number_of_samples)

The plotGroup method can also be used for a visual inspection of the group.

plotGroup(srmExpGroups, group = 'G001')

Create Group

There will occasions (ie, during standard optimisation) where using a data-driven approach to peak grouping (detailed above) is appropriate, but for targeted assays, the target retention time (Rt) is usually already known. Using the createGroup method, peak groups are created around the specified Rt at a given tolerance.

srmExpGroupTarg <- createGroup(srmExpPeaks, index = 1, rt = 3.2,  width = 30, id = 'Group01')

srmExpGroupTarg@groups
patchwork::wrap_plots(
  plotSRM(srmExpGroupTarg, index = 1),
  plotGroup(srmExpGroupTarg, group = 'Group01'),
  ncol = 1
)

Accessor Methods

All the available slots in the SRM object have a corresponding accessor method which can be used to retrieve the slot contents, instead of having to use; object@<slot_name>.

meta(srmExpGroups)

transitions(srmExpGroups)

peaks(srmExpGroups)

header(srmExpGroups)


wilsontom/sRm documentation built on Sept. 20, 2023, 7:19 a.m.