readMsExperiment: Import MS spectra data of an experiment

View source: R/MsExperiment-functions.R

readMsExperimentR Documentation

Import MS spectra data of an experiment

Description

Read/import MS spectra data of an experiment from the respective (raw) data files into an MsExperiment() object. Files provided with the spectraFiles parameter are imported as a Spectra object and each file is automatically linked to rows (samples) of a sampleData data frame (if provided).

Usage

readMsExperiment(spectraFiles = character(), sampleData = data.frame(), ...)

Arguments

spectraFiles

character with the (absolute) file names of the MS data files that should be imported as a Spectra() object.

sampleData

data.frame or DataFrame with the sample annotations. Each row is expected to contain annotations for one file (sample). The order of the data frame's rows is expected to match the order of the provided files (with parameter spectraFiles).

...

additional parameters for the Spectra() call to import the data.

Value

MsExperiment.

Author(s)

Johannes Rainer

Examples


## Define the files of the experiment to import
fls <- c(system.file("microtofq/MM14.mzML", package = "msdata"),
         system.file("microtofq/MM8.mzML", package = "msdata"))

## Define a data frame with some sample annotations
ann <- data.frame(
    injection_index = 1:2,
    sample_id = c("MM14", "MM8"))

## Import the data
library(MsExperiment)
mse <- readMsExperiment(spectraFiles = fls, ann)
mse

## Access the spectra data
spectra(mse)

## Access the sample annotations
sampleData(mse)

## Import the data reading all MS spectra directly into memory
mse <- readMsExperiment(spectraFiles = fls, ann,
    backend = Spectra::MsBackendMemory())
mse

rformassspectrometry/MsExperiment documentation built on April 18, 2024, 11:43 a.m.