extractSpectraData: Extract data from MSnbase objects for use in Spectra

Description Usage Arguments Value Author(s) Examples

View source: R/functions-MSpectra.R

Description

extractSpectraData extracts the spectra data (m/z and intensity values including metadata) from MSnExp, OnDiskMSnExp, Spectrum1, Spectrum2 objects (or list of such objects) and returns these as a DataFrame that can be used to create a Spectra::Spectra object.This function enables thus to convert data from the old MSnbase package to the newer Spectra package.

Usage

1

Arguments

x

a list of Spectrum objects or an object extending MSnExp or a MSpectra object.

Value

DataFrame() with the full spectrum data that can be passed to the Spectra::Spectra() function to create a Spectra object.

Author(s)

Johannes Rainer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Read an mzML file with MSnbase
fl <- system.file("TripleTOF-SWATH", "PestMix1_SWATH.mzML",
    package = "msdata")
data <- filterRt(readMSData(fl, mode = "onDisk"), rt = c(1, 6))

## Extract the data as a DataFrame
res <- extractSpectraData(data)
res

## This can be used as an input for the Spectra constructor of the
## Spectra package:
## sps <- Spectra::Spectra(res)
## sps

MSnbase documentation built on Jan. 23, 2021, 2 a.m.