getTargetFeatureStatistic: Calculate chromatographic peak properties

View source: R/getTargetFeatureStatistic.R

getTargetFeatureStatisticR Documentation

Calculate chromatographic peak properties

Description

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

Usage

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

Details

## Examples cannot be computed as the function is not exported: # 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)

# ROI input_ROI <- data.frame(matrix(vector(), 2, 8, dimnames=list(c(), c('cpdID', 'cpdName', 'rtMin', 'rt', 'rtMax', 'mzMin', 'mz', 'mzMax'))), stringsAsFactors=FALSE) 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] <- vapply(input_ROI[,3:8], as.numeric, FUN.VALUE=numeric(2))

# foundPeakTable input_foundPeakTable <- data.frame(matrix(vector(), 2, 10, dimnames=list(c(), c('found', 'rtMin', 'rt', 'rtMax', 'mzMin', 'mz', 'mzMax','peakArea','maxIntMeasured','maxIntPredicted'))), stringsAsFactors=FALSE) 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] <- vapply(input_foundPeakTable[,c(1)], as.logical, FUN.VALUE=logical(1))

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

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
peakAreaRaw integrated peak area from raw data points
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

phenomecentre/peakPantheR documentation built on Feb. 29, 2024, 9:07 p.m.