knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(eisaCIM)
library(tidyverse)
library(sessioninfo)

Introduction

This vignette is still work in progress.

Import data

As an example a mzML file (mammalian_cell_ref_original_Hilic_pos_F2_eisa_sim.mzML) is attached to this package.

mzml_file <- system.file("extdata", "mammalian_cell_ref_original_Hilic_pos_F2_eisa_sim.mzML", 
                         package = "eisaCIM")

Load the file.

raw_data <- read_files(files = mzml_file)

Extract SIM's

We'll have a look at cystine. First we'll check which SIM traces are in the mzML file.

get_all_sim(data = raw_data)

For cystine we need the following traces:

Index|SIM trace |Comment | |:----|:-------:|--------| |14 |241 |Precursor | |12 |152 |Fragment 1 | |6 |120 |Fragment 2 | |25 |74 |Fragment 3 |

The indexes is what we need to extract the sim data. We define a character vector for the SIM names and a numerical vector with the indexes of the SIM traces.

# define the name of the SIM traces
sim_names <- c("241", "152", "120", "74")
# the index of the SIM traces
sim_ids <- c(14, 12, 6, 25)

sim_data <- extract_sim_data(data = raw_data,
                             sim_names = sim_names,
                             sim_ids = sim_ids)

Plot all the four SIM traces for cystine.

Show all four SIMs. Cystine elutes at 5.3 minutes.

plot_sims(sim_data,
          rt_line = 5.3,
          title = "SIM's of cystine")

Usin CentWave algorithm of xcms to find peaks. A noise level should be defined for each trace.

# define the noise level for each trace
noise <- c(1e6, 5e6, 5e6, 5e6)

# do the actual peak picking
my_peaks <- find_peaks(data = raw_data,
                       sim_ids = sim_ids,
                       sim_names = sim_names,
                       noise = noise)

Plot boxes around the peaks which are detected with peak picking.

plot_sims(sim_data = sim_data,
          rt_line = 5.3,
          peak_data = my_peaks)

Group the peaks over the four traces. Group the peaks of the different traces if they are elute with a difference of smaller then 5 seconds.

my_peaks <- group_peaks(peak_list = my_peaks,
                        rt_diff = 5)

Clean up the peak list, only keep a peak group if it has a peak in each trace.

my_peaks_clean <- my_peaks %>% 
  filter(num_peaks == 4)

Show the SIM's in combination with the cleaned peak list.

plot_sims(sim_data = sim_data,
          rt_line = 5.3,
          peak_data = my_peaks_clean)

CIM chromatogram

Next we create the CIM chromatogram.

plot_cim(sim_data = sim_data,
         peak_list = my_peaks_clean,
         select_sim = "241",
         rt_line = 5.3)

The peak information for SIM trace 241.

my_peaks_clean %>% 
  filter(sim == "241")

The meaning of the columns found in the XCMS package.

Reconstructed EISA fragmentation spectrum

Calculate relative intensity for each peak group. The sum of the 4 peaks in the traces is 100%.

my_peaks_clean <- reconstruct_spectrum(my_peaks_clean)

Reconstructed EISA fragmentation spectrum for cystine (retention time 5.3 minutes).

plot_reconstruct_spectrum(peak_list = my_peaks_clean,
                          peak_group = 19,
                          title = "Reconstructed EISA fragmentation spectrum",
                          subtitle = "Cystine")

Session info

session_info()


ricoderks/eisaCIM documentation built on Dec. 22, 2021, 4:09 p.m.