align-Chromatogram: Aligning chromatographic data

Description Usage Arguments Value Author(s) Examples

Description

Align chromatogram x against chromatogram y. The resulting chromatogram has the same length (number of data points) than y and the same retention times thus allowing to perform any pair-wise comparisons between the chromatograms. If x is a MChromatograms() object, each Chromatogram in it is aligned against y.

Parameter method allows to specify which alignment method should be used. Currently there are the following options:

Usage

1
2
3
4
5
## S4 method for signature 'Chromatogram,Chromatogram'
align(x, y, method = c("matchRtime", "approx"), ...)

## S4 method for signature 'MChromatograms,Chromatogram'
align(x, y, method = c("matchRtime", "approx"), ...)

Arguments

x

Chromatogram() or MChromatograms() to be aligned against y.

y

Chromatogram() to which x should be aligned to.

method

character(1)

...

additional parameters to be passed along to the alignment functions.

Value

Chromatogram (or MChromatograms) representing x aligned against y.

Author(s)

Johannes Rainer, Michael Witting

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
chr1 <- Chromatogram(rtime = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
    intensity = c(3, 5, 14, 30, 24, 6, 2, 1, 1, 0))
chr2 <- Chromatogram(rtime = c(2.5, 3.42, 4.5, 5.43, 6.5),
    intensity = c(5, 12, 15, 11, 5))

plot(chr1, col = "black")
points(rtime(chr2), intensity(chr2), col = "blue", type = "l")

## Align chr2 to chr1 without interpolation
res <- align(chr2, chr1)
rtime(res)
intensity(res)
points(rtime(res), intensity(res), col = "#00ff0080", type = "l")

## Align chr2 to chr1 with interpolation
res <- align(chr2, chr1, method = "approx")
points(rtime(res), intensity(res), col = "#ff000080", type = "l")

legend("topright", col = c("black", "blue", "#00ff0080", "#ff000080"), lty = 1,
    legend = c("chr1", "chr2", "chr2 matchRtime", "chr2 approx"))

xcms documentation built on Nov. 8, 2020, 5:13 p.m.