knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE,
  message = TRUE,
  out.width = "100%"
)

metflow2 also provide some useful tools for MS raw data processing.


Extract EICs from mzXML data

You can use metflow2 to extract peaks from the mzXML format data and then draw them.

Data preparation

Put you mzXML data and the feature_table (xlsx format) in a folder and then set this folder as the working directory.

![](../man/figures/Screen Shot 2020-04-01 at 1.38.19 PM.png)

The feature_table should be xlsx format and like the below figure shows:

![](../man/figures/Screen Shot 2020-04-01 at 1.41.04 PM.png)

Note: The rt must in seconds.

We use the demo data from demoData package.

Load demo data

First we load the demo data from demoData package and then place them in a example folder.

library(demoData)
library(metflow2)
library(tidyverse)
##create a folder named as example
path <- file.path(".", "example")
dir.create(path = path, showWarnings = FALSE)
##get demo data
mzxml_data <- system.file("mzxml/POS/QC", package = "demoData")

file.copy(from = file.path(mzxml_data, dir(mzxml_data)), 
          to = path, overwrite = TRUE, 
          recursive = TRUE)

is_table <- system.file("mzxml/POS/", package = "demoData")

file.copy(from = file.path(is_table, "is.xlsx"), 
          to = path, overwrite = TRUE, 
          recursive = TRUE)

Now the demo mzXML data and feature table (is.xlsx)is in the ./example/ folder.

Extract peaks

Next, we use the extractPeaks() function for peak detection and alignment.

peak_data <- 
extractPeaks(
  path = path,
  ppm = 15,
  threads = 4,
  is.table = "is.xlsx",
  mz = NULL,
  rt = NULL,
  rt.tolerance = 40
)

Some important arguments:

![](../man/figures/Screen Shot 2020-04-01 at 10.11.33 AM.png)

Other parameters you can find here: processData().

Draw plots

After get the peak_data using extractPeaks() function, we can use show_peak() function to draw plot.

show_peak(object = peak_data, peak.index = 1)

If you don't want to get the interactive plot, you can just set interactive as FALSE.

show_peak(object = peak_data, peak.index = 1, interactive = FALSE)

You can also set alpha as 0 to avoid the area color.

show_peak(object = peak_data, peak.index = 5, alpha = 0)


jaspershen/metflow2 documentation built on Aug. 15, 2021, 4:38 p.m.