Last data update: 2014.03.03

R: Correct peak positions according to a ptw warping model
correctPeaksR Documentation

Correct peak positions according to a ptw warping model

Description

Once an appropriate warping model has been established, corrected retention times can be predicted for each peak. These are stored in a separate column in the list of peak tables.

Usage

correctPeaks(peakList, modList)

Arguments

peakList

A nested list of peak tables: the first level is the sample, and the second level is the component. Every component is described by a matrix where every row is one peak, and the columns contain information on retention time, full width at half maximum (FWHM), peak width, height, and area.

modList

A list of ptw models.

Value

The input list of peak tables is returned with extra columns containing the corrected retention time.

Author(s)

Ron Wehrens

See Also

correctRT

Examples

data(teaMerged)
pks <- getAllPeaks(teaMerged$CList, span = 11)
warping.models <- correctRT(teaMerged$CList, reference = 2,
                            what = "models")
pks.corrected <- correctPeaks(pks, warping.models)

## original profiles and peaks, in black and gray
plot(teaMerged, mat.idx = 3, what = "profiles", comp.idx = 2,
     showWindows = FALSE, col = "gray")
abline(v = pks[[3]][[2]][,"rt"])
## shifted profiles and peaks, in red and pink
CList.corrected <- correctRT(teaMerged$CList, reference = 2)
lines(as.numeric(rownames(CList.corrected[[3]])),
      CList.corrected[[3]][,2], col = "pink")
abline(v = pks.corrected[[3]][[2]][,"rt.cor"], col = "red")
## note that the rightmost peak in the uncorrected data is no longer
## within the range of the data

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(alsace)
Loading required package: ALS
Loading required package: nnls
Loading required package: Iso
Iso 0.0-17
Loading required package: ptw
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/alsace/correctPeaks.Rd_%03d_medium.png", width=480, height=480)
> ### Name: correctPeaks
> ### Title: Correct peak positions according to a ptw warping model
> ### Aliases: correctPeaks
> ### Keywords: manip
> 
> ### ** Examples
> 
> data(teaMerged)
> pks <- getAllPeaks(teaMerged$CList, span = 11)
> warping.models <- correctRT(teaMerged$CList, reference = 2,
+                             what = "models")
> pks.corrected <- correctPeaks(pks, warping.models)
> 
> ## original profiles and peaks, in black and gray
> plot(teaMerged, mat.idx = 3, what = "profiles", comp.idx = 2,
+      showWindows = FALSE, col = "gray")
> abline(v = pks[[3]][[2]][,"rt"])
> ## shifted profiles and peaks, in red and pink
> CList.corrected <- correctRT(teaMerged$CList, reference = 2)
> lines(as.numeric(rownames(CList.corrected[[3]])),
+       CList.corrected[[3]][,2], col = "pink")
> abline(v = pks.corrected[[3]][[2]][,"rt.cor"], col = "red")
> ## note that the rightmost peak in the uncorrected data is no longer
> ## within the range of the data
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>