Chromatogram-class: Representation of chromatographic MS data

Description Usage Arguments Details Slots Author(s) See Also Examples

Description

The Chromatogram class is designed to store chromatographic MS data, i.e. pairs of retention time and intensity values. Instances of the class can be created with the Chromatogram constructor function but in most cases the dedicated methods for OnDiskMSnExp and MSnExp objects extracting chromatograms should be used instead (i.e. the chromatogram method).

Chromatogram: create an instance of the Chromatogram class.

aggregationFun,aggregationFun<- get or set the aggregation function.

rtime returns the retention times for the rentention time - intensity pairs stored in the chromatogram.

intensity returns the intensity for the rentention time - intensity pairs stored in the chromatogram.

mz get the mz (range) of the chromatogram. The function returns a numeric(2) with the lower and upper mz value.

precursorMz get the mz of the precursor ion. The function returns a numeric(2) with the lower and upper mz value.

fromFile returns the value from the fromFile slot.

length returns the length (number of retention time - intensity pairs) of the chromatogram.

as.data.frame returns the rtime and intensity values from the object as data.frame.

filterRt: filters the chromatogram based on the provided retention time range.

clean: Removes unused 0-intensity data points. See clean documentation for more details and examples.

plot: plots a Chromatogram object.

msLevel returns the MS level of the chromatogram.

isEmpty returns TRUE for empty chromatogram or chromatograms with all intensities being NA.

productMz get the mz of the product chromatogram/ion. The function returns a numeric(2) with the lower and upper mz value.

bin aggregates intensity values from a chromatogram in discrete bins along the retention time axis and returns a Chromatogram object with the retention time representing the mid-point of the bins and the intensity the binned signal.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Chromatogram(
  rtime = numeric(),
  intensity = numeric(),
  mz = c(NA_real_, NA_real_),
  filterMz = c(NA_real_, NA_real_),
  precursorMz = c(NA_real_, NA_real_),
  productMz = c(NA_real_, NA_real_),
  fromFile = integer(),
  aggregationFun = character(),
  msLevel = 1L
)

aggregationFun(object)

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

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

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

## S4 method for signature 'Chromatogram'
mz(object, filter = FALSE)

## S4 method for signature 'Chromatogram'
precursorMz(object)

## S4 method for signature 'Chromatogram'
fromFile(object)

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

## S4 method for signature 'Chromatogram'
as.data.frame(x)

## S4 method for signature 'Chromatogram'
filterRt(object, rt)

## S4 method for signature 'Chromatogram'
clean(object, all = FALSE, na.rm = FALSE)

## S4 method for signature 'Chromatogram,ANY'
plot(
  x,
  col = "#00000060",
  lty = 1,
  type = "l",
  xlab = "retention time",
  ylab = "intensity",
  main = NULL,
  ...
)

## S4 method for signature 'Chromatogram'
msLevel(object)

## S4 method for signature 'Chromatogram'
isEmpty(x)

## S4 method for signature 'Chromatogram'
productMz(object)

## S4 method for signature 'Chromatogram'
bin(
  object,
  binSize = 0.5,
  breaks = seq(floor(min(rtime(object))), ceiling(max(rtime(object))), by = binSize),
  fun = max
)

Arguments

rtime

numeric with the retention times (length has to be equal to the length of intensity).

intensity

numeric with the intensity values (length has to be equal to the length of rtime).

mz

numeric(2) representing the mz value range (min, max) on which the chromatogram was created. This is supposed to contain the real range of mz values in contrast to the filterMz below. If not applicable use mzrange = c(0, 0).

filterMz

numeric(2) representing the mz value range (min, max) that was used to filter the original object on mz dimension. If not applicable use filterMz = c(0, 0).

precursorMz

numeric(2) for SRM/MRM transitions. Represents the mz of the precursor ion. See details for more information.

productMz

numeric(2) for SRM/MRM transitions. Represents the mz of the product. See details for more information.

fromFile

integer(1) the index of the file within the OnDiskMSnExp or MSnExp from which the chromatogram was extracted.

aggregationFun

character string specifying the function that was used to aggregate intensity values for the same retention time across the mz range. Supported are "sum" (total ion chromatogram), "max" (base peak chromatogram), "min" and "mean".

msLevel

integer with the MS level from which the chromatogram was extracted.

object

A Chromatogram object.

filter

For mz: whether the mz range used to filter the original object should be returned (filter = TRUE), or the mz range calculated on the real data (filter = FALSE).

x

For as.data.frame and length: a Chromatogram object.

rt

For filterRt: numeric(2) defining the lower and upper retention time for the filtering.

all

For clean: logical(1) whether all 0 intensities should be removed (default is FALSE). See clean for more details and examples.

na.rm

For clean: logical(1) whether all NA intensities should be removed before cleaning the Chromatogram. Defaults to FALSE. See clean for more details and examples.

col

For plot: the color to be used for plotting.

lty

For plot: the line type. See help page of plot in the graphics package for details.

type

For plot: the type of plot. See help page of plot in the graphics package for details.

xlab

For plot: the x-axis label.

ylab

For plot: the y-axis label.

main

For plot: the plot title. If not provided the mz range will be used as plot title.

...

For plot: additional arguments to be passed to the base 'plot' function.

binSize

for bin: numeric(1) with the size of the bins (in seconds).

breaks

for bin: numeric defining the bins. Usually not required as the function calculates the bins automatically based on binSize.

fun

for bin: function to be used to aggregate the intensity values falling within each bin.

Details

The mz, filterMz, precursorMz and productMz are stored as a numeric(2) representing a range even if the chromatogram was generated for only a single ion (i.e. a single mz value). Using ranges for mz values allow this class to be used also for e.g. total ion chromatograms or base peak chromatograms.

The slots precursorMz and productMz allow to represent SRM (single reaction monitoring) and MRM (multiple SRM) chromatograms. As example, a Chromatogram for a SRM transition 273 -> 153 will have a @precursorMz = c(273, 273) and a @productMz = c(153, 153).

Slots

.__classVersion__,rtime,intensity,mz,filterMz,precursorMz,productMz,fromFile,aggregationFun,msLevel

See corresponding parameter above.

Author(s)

Johannes Rainer

See Also

MChromatograms for combining Chromatogram in a two-dimensional matrix (rows being mz-rt ranges, columns samples). chromatogram for the method to extract chromatogram data from a MSnExp or OnDiskMSnExp object. clean for the method to clean a Chromatogram object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Create a simple Chromatogram object.
ints <- abs(rnorm(100, sd = 100))
rts <- seq_len(length(ints))
chr <- Chromatogram(rtime = rts, intensity = ints)
chr

## Extract intensities
intensity(chr)

## Extract retention times
rtime(chr)

## Extract the mz range - is NA for the present example
mz(chr)

## plot the Chromatogram
plot(chr)

## Create a simple Chromatogram object based on random values.
chr <- Chromatogram(intensity = abs(rnorm(1000, mean = 2000, sd = 200)),
        rtime = sort(abs(rnorm(1000, mean = 10, sd = 5))))
chr

## Get the intensities
head(intensity(chr))

## Get the retention time
head(rtime(chr))

## What is the retention time range of the object?
range(rtime(chr))

## Filter the chromatogram to keep only values between 4 and 10 seconds
chr2 <- filterRt(chr, rt = c(4, 10))

range(rtime(chr2))

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