MsBackendTimsTof: TimsTOF data backend

View source: R/MsBackendTimsTof-functions.R

MsBackendTimsTofR Documentation

TimsTOF data backend

Description

The MsBackendTimsTof class supports Bruker TimsTOF data files. New objects are created with the MsBackendTimsTof function. To ensure a small memory footprint, only general information is kept in memory (such as number of frames and scans) and all data (specifically the peaks data) is retrieved from the original file on-the-fly.

Usage

MsBackendTimsTof()

## S4 method for signature 'MsBackendTimsTof'
backendInitialize(object, files, ..., BPPARAM = bpparam())

## S4 method for signature 'MsBackendTimsTof'
length(x)

## S4 method for signature 'MsBackendTimsTof'
peaksData(object, columns = c("mz", "intensity"))

## S4 method for signature 'MsBackendTimsTof'
peaksVariables(object)

## S4 method for signature 'MsBackendTimsTof'
mz(object)

## S4 method for signature 'MsBackendTimsTof'
intensity(object)

## S4 method for signature 'MsBackendTimsTof'
rtime(object)

## S4 method for signature 'MsBackendTimsTof'
x[i, j, ..., drop = FALSE]

## S4 method for signature 'MsBackendTimsTof'
dataStorage(object)

## S4 method for signature 'MsBackendTimsTof'
dataOrigin(object)

## S4 method for signature 'MsBackendTimsTof'
spectraVariables(object)

## S4 method for signature 'MsBackendTimsTof'
spectraData(object, columns = spectraVariables(object))

## S4 method for signature 'MsBackendTimsTof'
show(object)

## S4 method for signature 'MsBackendTimsTof'
msLevel(object, ...)

## S4 method for signature 'MsBackendTimsTof'
x$name

Arguments

object

MsBackendTimsTof object.

files

character specifying TimsTOF ’*.d’ folders names.

...

Additional arguments.

BPPARAM

Parameter object defining the parallel processing setup to import data in parallel. Defaults to BPPARAM = bpparam(). See bpparam() for more information.

x

MsBackendTimsTof object.

columns

For spectraData: names of the spectra variables to extract from object. For peaksData: names of the peak variables to extract. Defaults to columns = c("mz", "intensity").

i

For [: integer, logical to subset the object.

j

For [: not supported.

drop

For [: not considered.

name

For $: the name of the variable to access.

Available methods

The following methods are implemented:

  • $: access any of the spectraVariables of the backend.

  • [: subset the backend. Only subsetting by element (row/i) is allowed. First the ⁠@indices⁠ slot of object is subsetted and then the frames and fileNames slots are subsetted accordingly. Note that [ does not update the values of frames variables (such as "MaxIntensity", "SummedIntensities", "NumScans" and "NumPeaks").

  • backendInitialize: initializes object (the MsBackendTimsTof object) using TimsTOF data files whose path is specified by files. This method is supposed to be called right after creating a MsBackendTimsTof object with MsBackendTimsTof function.

  • dataOrigin: gets a character of length equal to the number of spectra in object with the names of the '*.d' folders where each spectrum is stored.

  • dataStorage: same as dataOrigin.

  • intensity: gets the intensity values from the spectra in the backend. Returns a NumericList() of numeric vectors (intensity values for each spectrum). The length of the list is equal to the number of spectra in object.

  • msLevel: gets the spectra MS level. Returns an integer vector (of length equal to the number of spectra) with the MS level for each spectrum.

  • mz: gets the mass-to-charge ratios (m/z) from the spectra in the backend. Returns a NumericList() of numeric vectors (m/z values for each spectrum). The length of the list is equal to the number of spectra in object.

  • peaksData: gets the peak matrices of the spectra in the backend. Returns a list of matrix with columns defined by parameter columns (which defaults to columns = c("mz", "intensity"). Use peaksVariables to list all supported and available columns for a backend. The length of the list is equal to the number of spectra in object.

  • peaksVariables: gets the supported peak variables (columns) for the backend.

  • rtime: gets the retention times for each spectrum. Returns a numeric vector (length equal to the number of spectra) with the retention time for each spectrum.

  • spectraData: gets spectra variables (specified by columns) from object.

  • spectraVariables: returns a character vector with the spectra variables names of core spectra variables defined in the Spectra package and other additional variables contained in object. Note that also "mz" and "intensity" (which are by default not returned by the ⁠spectraVariables,Spectra⁠ method) are returned.

Author(s)

Andrea Vicini, Johannes Rainer

Examples


## Load the opentimsr package to retrieve the required shared library
## from Bruker.
so_folder <- tempdir()
library(opentimsr)
so_file <- download_bruker_proprietary_code(so_folder, method = "wget")
setup_bruker_so(so_file)
path_d_folder <- system.file("ddaPASEF.d",
                             package = "MsBackendTimsTof")

## Define the test file
fl <- system.file("ddaPASEF.d", package = "MsBackendTimsTof")

## Create a MsBackend instance for that file
be <- backendInitialize(MsBackendTimsTof(), fl)
be

## Available spectra variables
spectraVariables(be)

## Subset to 10 randomly selected spectra.
be_sub <- be[sort(sample(seq_along(be), 10))]
rtime(be_sub)

pd <- peaksData(be_sub, columns = c("mz", "intensity", "tof", "inv_ion_mobility"))

rformassspectrometry/MsBackendTimsTof documentation built on March 21, 2023, 4:30 a.m.