getTargetFeatureStatistic: Calculate chromatographic peak properties

Description Usage Arguments Value Examples

View source: R/getTargetFeatureStatistic.R

Description

Calculate the ppm error, retention time deviation, tailing factor and asymmetry factor for each measured feature.

Usage

1
2
getTargetFeatureStatistic(fittedCurves, targetFeatTable, foundPeakTable,
  verbose = FALSE)

Arguments

fittedCurves

(list) A list (one entry per ROI window) of peakPantheR_curveFit or NA

targetFeatTable

a data.frame of compounds to target as rows. Columns: cpdID (str), cpdName (str), rtMin (float in seconds), rt (float in seconds, or NA), rtMax (float in seconds), mzMin (float), mz (float or NA), mzMax (float).

foundPeakTable

a data.frame as generated by findTargetFeatures, with features as rows and peak properties as columns. The following columns are mandatory: mzMin, mz, mzMax, rtMin, rt, rtMax

verbose

(bool) if TRUE message when NA scans are removed

Value

A data.frame with measured compounds as rows and measurements and properties as columns (see Details).

Details:

The returned data.frame is structured as follow:

found was the peak found
rt retention time of peak apex (sec)
rtMin leading edge of peak retention time (sec) determined at 0.5% of apex intensity
rtMax trailing edge of peak retention time (sec) determined at 0.5% of apex intensity
mz weighted (by intensity) mean of peak m/z across scans
mzMin m/z peak minimum (between rtMin, rtMax)
mzMax m/z peak maximum (between rtMin, rtMax)
peakArea integrated peak area
maxIntMeasured maximum peak intensity in raw data
maxIntPredicted maximum peak intensity based on curve fit
ppm_error difference in ppm between the expected and measured m/z
rt_dev_sec difference in seconds between the expected and measured rt
tailingFactor the tailing factor is a measure of peak tailing. It is defined as the distance from the front slope of the peak to the back slope divided by twice the distance from the center line of the peak to the front slope, with all measurements made at 5% of the maximum peak height. The tailing factor of a peak will typically be similar to the asymmetry factor for the same peak, but the two values cannot be directly converted
asymmetryFactor the asymmetry factor is a measure of peak tailing. It is defined as the distance from the center line of the peak to the back slope divided by the distance from the center line of the peak to the front slope, with all measurements made at 10% of the maximum peak height. The asymmetry factor of a peak will typically be similar to the tailing factor for the same peak, but the two values cannot be directly converted

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
37
38
39
40
41
## Not run: 
# fittedCurve
cFit1           <- list(amplitude=162404.8057918259, center=3341.888,
                        sigma=0.078786133031045896, gamma=0.0018336101984172684,
                        fitStatus=2, curveModel="skewedGaussian")
class(cFit1)    <- 'peakPantheR_curveFit'
cFit2           <- list(amplitude=199249.10572753669, center=3382.577,
                        sigma=0.074904415304607966, gamma=0.0011471899372353885,
                        fitStatus=2, curveModel="skewedGaussian")
class(cFit2)    <- 'peakPantheR_curveFit'
input_fitCurves <- list(cFit1, cFit2)

input_ROI       <- data.frame(matrix(vector(), 2, 8, dimnames=list(c(), c("cpdID", 
                     "cpdName", "rtMin", "rt", "rtMax", "mzMin", "mz", "mzMax"))),
                     stringsAsFactors=F)
input_ROI[1,] 	<- c("ID-1", "testCpd 1", 3310., 3344.88, 3390., 522.19, 522.2, 522.21)
input_ROI[2,] 	<- c("ID-2", "testCpd 2", 3280., 3385.58, 3440., 496.19, 496.2, 496.21)
input_ROI[,3:8] <- sapply(input_ROI[,3:8], as.numeric)

# foundPeakTable
input_foundPeakTable      <- data.frame(matrix(vector(), 2, 10, dimnames=list(c(), 
                               c("found", "rtMin", "rt", "rtMax", "mzMin", "mz", "mzMax",
                               "peakArea", "maxIntMeasured", "maxIntPredicted"))),
                               stringsAsFactors=F)
input_foundPeakTable[1,]  <- c(TRUE, 3309.758, 3346.827, 3385.410, 522.19, 522.2, 522.21, 
                               26133726, 889280, 901015)
input_foundPeakTable[2,]  <- c(TRUE, 3345.376, 3386.529, 3428.279, 496.19, 496.2, 496.21,
                               35472141, 1128960, 1113576)
input_foundPeakTable[,1]  <- sapply(input_foundPeakTable[,c(1)], as.logical)

# Run peak statistics
peakStatistics <- getTargetFeatureStatistic(input_fitCurves, input_ROI, input_foundPeakTable)
peakStatistics   
#   found    rtMin       rt    rtMax  mzMin    mz  mzMax peakArea maxIntMeasured maxIntPredicted
# 1  TRUE 3309.758 3346.827 3385.410 522.19 522.2 522.21 26133726         889280          901015 
# 2  TRUE 3345.376 3386.529 3428.279 496.19 496.2 496.21 35472141        1128960         1113576
#   ppm_error rt_dev_sec tailingFactor asymmetryFactor
# 1        0      1.947      1.015385        1.026886
# 2        0      0.949      1.005372        1.009304

## End(Not run)

peakPantheR documentation built on May 1, 2019, 10:53 p.m.