ImportRawMSData: Import raw MS data

View source: R/Spectra_import.R

ImportRawMSDataR Documentation

Import raw MS data

Description

This function handles the reading in of raw MS data (.mzML, .CDF and .mzXML). Users must set their working directory to the folder containing their raw data, divided into two subfolders named their desired group labels. The function will output two chromatograms into the user's working directory, a base peak intensity chromatogram (BPIC) and a total ion chromatogram (TIC). Further, this function sets the number of cores to be used for parallel processing. It first determines the number of cores within a user's computer and then sets it that number/2.

Usage

ImportRawMSData(
  mSet = NULL,
  path = getwd(),
  metadata = NULL,
  mode = "onDisk",
  plotSettings = SetPlotParam(),
  running.controller = NULL
)

Arguments

mSet

mSet Object, can be optional. Usually generated by InitDataObjects("spec", "raw", FALSE) before the data import.

path

Character, input the path to the folder containing the raw MS spectra to be processed. Or a character vector containing all raw files absolute paths.

metadata

Data.frame or character. A phenotype data frame or a absolute path of the metadata file (.txt) for all samples, optional. In the option, first column should be the sample name, while second column is the corresponding group name. If ommited, all samples in the same sub-folder will be considered as one group.

mode

Character, the data input mode. Default is "onDisk" to avoid memory crash. "inMemory" will read data into memory.

plotSettings

List, plotting parameters produced by SetPlotParam Function. "plot.opts" can be added through this function for samples numbers for plotting. Defalut is "default", "all" will apply all samples for plotting and may cause memory crash, especially for large sample dataset.

running.controller

The resuming pipeline running controller. Optional. Don't need to define by hand.

Value

will return a mSet object will raw data read inside.

Author(s)

Zhiqiang Pang zhiqiang.pang@mail.mcgill.ca, Jasmine Chong jasmine.chong@mail.mcgill.ca, Mai Yamamoto yamamoto.mai@mail.mcgill.ca, and Jeff Xia jeff.xia@mcgill.ca McGill University, Canada License: GNU GPL (>= 2)

Examples

##' Get raw spectra files
DataFiles <- dir(system.file("mzData", package = "mtbls2"), full.names = TRUE,
                 recursive = TRUE)[c(10:12, 14:16)]
##' Create a phenodata data.frame
pd <- data.frame(sample_name = sub(basename(DataFiles), pattern = ".mzData",
                                   replacement = "", fixed = TRUE),
                 sample_group = c(rep("col0", 3), rep("cyp79", 3)),
                 stringsAsFactors = FALSE)
##' Import raw spectra
mSet <- ImportRawMSData(path = DataFiles, metadata = pd);

xia-lab/OptiLCMS documentation built on Nov. 6, 2024, 11:01 a.m.