R/peakPantheR_singleFileSearch.R
peakPantheR_singleFileSearch.Rd
Report for a raw spectra the TIC, acquisition time, integrated targeted features, fitted curves and datapoints for each region of interest. Optimised to reduce the number of file access. Features not detected can be integrated using fallback integration regions (FIR).
peakPantheR_singleFileSearch(
singleSpectraDataPath,
targetFeatTable,
peakStatistic = FALSE,
plotEICsPath = NA,
getAcquTime = FALSE,
FIR = NULL,
centroided = TRUE,
curveModel = "skewedGaussian",
verbose = TRUE,
...
)
(str) path to netCDF or mzML raw data file (centroided, only with the channel of interest).
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).
(bool) If TRUE calculates additional peak statistics: 'ppm_error', 'rt_dev_sec', 'tailing factor' and 'asymmetry factor'
(str or NA) If not NA, will save a .png of all ROI
EICs at the path provided ('filepath/filename.png'
expected). If NA no
plot saved
(bool) If TRUE will extract sample acquisition date-time from the mzML metadata (the additional file access will impact run time)
(data.frame or NULL) If not NULL, integrate Fallback Integration
Regions (FIR) when a feature is not found. Compounds as row are identical to
targetFeatTable
, columns are rtMin
(float in seconds),
rtMax
(float in seconds), mzMin
(float), mzMax
(float).
(bool) use TRUE if the data is centroided, used by
readMSData
when reading the raw data file
(str) specify the peak-shape model to fit,
by default skewedGaussian
.
Accepted values are skewedGaussian
and emgGaussian
(bool) If TRUE message calculation progress, time taken and number of features found
Passes arguments to findTargetFeatures
to alter
peak-picking parameters (e.g. curveModel
, sampling
,
params
as a list of parameters for each ROI or 'guess',...)
a list: list()$TIC
(int) TIC value,
list()$peakTable
(data.frame) targeted features results
(see Details), list()$curveFit
(list) list of
peakPantheR_curveFit
or NA for each ROI, list()$acquTime
(POSIXct or NA) date-time of sample acquisition from mzML metadata,
list()$ROIsDataPoint
(list) a list of data.frame
of raw
data points for each ROI (retention time 'rt', mass 'mz' and intensity 'int'
(as column) of each raw data points (as row)).
The returned peakTable data.frame
is structured as follow:
cpdID | database compound ID |
cpdName | compound name |
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 |
is_filled | Logical indicate if the feature was integrated using FIR (Fallback Integration Region) |
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 |
Other peakPantheR:
peakPantheRAnnotation
,
peakPantheR_parallelAnnotation()
Other parallelAnnotation:
peakPantheRAnnotation
,
peakPantheR_parallelAnnotation()
if(requireNamespace('faahKO')){
## Load data
library(faahKO)
netcdfFilePath <- system.file('cdf/KO/ko15.CDF', package = 'faahKO')
## targetFeatTable
targetFeatTable <- data.frame(matrix(vector(), 2, 8, dimnames=list(c(),
c('cpdID','cpdName','rtMin','rt','rtMax','mzMin','mz',
'mzMax'))), stringsAsFactors=FALSE)
targetFeatTable[1,] <- c('ID-1', 'Cpd 1', 3310., 3344.888, 3390., 522.194778,
522.2, 522.205222)
targetFeatTable[2,] <- c('ID-2', 'Cpd 2', 3280., 3385.577, 3440., 496.195038,
496.2, 496.204962)
targetFeatTable[,c(3:8)] <- vapply(targetFeatTable[,c(3:8)], as.numeric,
FUN.VALUE=numeric(2))
res <- peakPantheR_singleFileSearch(netcdfFilePath,targetFeatTable,
peakStatistic=TRUE)
# Polarity can not be extracted from netCDF files, please set manually the
# polarity with the 'polarity' method.
# Reading data from 2 windows
# Data read in: 0.16 secs
# Warning: rtMin/rtMax outside of ROI; datapoints cannot be used for
# mzMin/mzMax calculation, approximate mz and returning ROI$mzMin and
# ROI$mzMax for ROI #1
# Found 2/2 features in 0.05 secs
# Peak statistics done in: 0 secs
# Feature search done in: 0.75 secs
res
# $TIC
# [1] 2410533091
#
# $peakTable
# found rtMin rt rtMax mzMin mz mzMax peakArea
# 1 TRUE 3309.759 3346.828 3385.410 522.1948 522.2 522.2052 26133727
# 2 TRUE 3345.377 3386.529 3428.279 496.2000 496.2 496.2000 35472141
# peakAreaRaw maxIntMeasured maxIntPredicted cpdID cpdName is_filled
# 1 26071378 889280 901015.8 ID-1 Cpd 1 FALSE
# 2 36498367 1128960 1113576.7 ID-2 Cpd 2 FALSE
# ppm_error rt_dev_sec tailingFactor asymmetryFactor
# 1 0.02337616 1.9397590 1.015357 1.026824
# 2 0.02460103 0.9518072 1.005378 1.009318
#
# $acquTime
# [1] NA
#
#
# $curveFit
# $curveFit[[1]]
# $amplitude
# [1] 162404.8
#
# $center
# [1] 3341.888
#
# $sigma
# [1] 0.07878613
#
# $gamma
# [1] 0.00183361
#
# $fitStatus
# [1] 2
#
# $curveModel
# [1] 'skewedGaussian'
#
# attr(,'class')
# [1] 'peakPantheR_curveFit'
#
# $curveFit[[2]]
# $amplitude
# [1] 199249.1
#
# $center
# [1] 3382.577
#
# $sigma
# [1] 0.07490442
#
# $gamma
# [1] 0.00114719
#
# $fitStatus
# [1] 2
#
# $curveModel
# [1] 'skewedGaussian'
#
# attr(,'class')
# [1] 'peakPantheR_curveFit'
#
#
# $ROIsDataPoint
# $ROIsDataPoint[[1]]
# rt mz int
# 1 3315.154 522.2 2187
# 2 3316.719 522.2 3534
# 3 3318.284 522.2 6338
# 4 3319.849 522.2 11718
# 5 3321.414 522.2 21744
# 6 3322.979 522.2 37872
# 7 3324.544 522.2 62424
# 8 3326.109 522.2 98408
# 9 3327.673 522.2 152896
# 10 3329.238 522.2 225984
# ...
#
# $ROIsDataPoint[[2]]
# rt mz int
# 1 3280.725 496.2 1349
# 2 3290.115 496.2 2069
# 3 3291.680 496.2 3103
# 4 3293.245 496.2 5570
# 5 3294.809 496.2 10730
# 6 3296.374 496.2 20904
# 7 3297.939 496.2 38712
# 8 3299.504 496.2 64368
# 9 3301.069 496.2 97096
# 10 3302.634 496.2 136320
# ...
}
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 2 windows
#> Data read in: 1.28 secs
#> Warning: rtMin/rtMax outside of ROI; datapoints cannot be used for mzMin/mzMax calculation, approximate mz and returning ROI$mzMin and ROI$mzMax for ROI #1
#> Found 2/2 features in 0.01 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 1.76 secs
#> $TIC
#> [1] 2410533091
#>
#> $peakTable
#> found rtMin rt rtMax mzMin mz mzMax peakArea peakAreaRaw
#> 1 TRUE 3309.759 3346.828 3385.410 522.1948 522.2 522.2052 26133727 26071378
#> 2 TRUE 3345.377 3386.529 3428.279 496.2000 496.2 496.2000 35472141 36498367
#> maxIntMeasured maxIntPredicted cpdID cpdName is_filled ppm_error rt_dev_sec
#> 1 889280 901015.8 ID-1 Cpd 1 FALSE 0.02337616 1.9397590
#> 2 1128960 1113576.7 ID-2 Cpd 2 FALSE 0.02460103 0.9518072
#> tailingFactor asymmetryFactor
#> 1 1.015357 1.026824
#> 2 1.005378 1.009318
#>
#> $acquTime
#> [1] NA
#>
#> $curveFit
#> $curveFit[[1]]
#> $amplitude
#> [1] 162404.8
#>
#> $center
#> [1] 3341.888
#>
#> $sigma
#> [1] 0.07878613
#>
#> $gamma
#> [1] 0.00183361
#>
#> $fitStatus
#> [1] 2
#>
#> $curveModel
#> [1] "skewedGaussian"
#>
#> attr(,"class")
#> [1] "peakPantheR_curveFit"
#>
#> $curveFit[[2]]
#> $amplitude
#> [1] 199249.1
#>
#> $center
#> [1] 3382.577
#>
#> $sigma
#> [1] 0.07490442
#>
#> $gamma
#> [1] 0.00114719
#>
#> $fitStatus
#> [1] 2
#>
#> $curveModel
#> [1] "skewedGaussian"
#>
#> attr(,"class")
#> [1] "peakPantheR_curveFit"
#>
#>
#> $ROIsDataPoint
#> $ROIsDataPoint[[1]]
#> rt mz int
#> 1 3315.154 522.2 2187
#> 2 3316.719 522.2 3534
#> 3 3318.284 522.2 6338
#> 4 3319.849 522.2 11718
#> 5 3321.414 522.2 21744
#> 6 3322.979 522.2 37872
#> 7 3324.544 522.2 62424
#> 8 3326.109 522.2 98408
#> 9 3327.673 522.2 152896
#> 10 3329.238 522.2 225984
#> 11 3330.803 522.2 308672
#> 12 3332.368 522.2 399360
#> 13 3333.933 522.2 504000
#> 14 3335.498 522.2 614656
#> 15 3337.063 522.2 711872
#> 16 3338.628 522.2 784704
#> 17 3340.193 522.2 836608
#> 18 3341.758 522.2 866304
#> 19 3343.323 522.2 882304
#> 20 3344.888 522.2 889280
#> 21 3346.453 522.2 888256
#> 22 3348.018 522.2 866816
#> 23 3349.583 522.2 827392
#> 24 3351.148 522.2 777728
#> 25 3352.713 522.2 727040
#> 26 3354.278 522.2 678464
#> 27 3355.843 522.2 629120
#> 28 3357.408 522.2 578048
#> 29 3358.973 522.2 524288
#> 30 3360.538 522.2 471040
#> 31 3362.102 522.2 416320
#> 32 3363.667 522.2 360064
#> 33 3365.232 522.2 302400
#> 34 3366.797 522.2 249152
#> 35 3368.362 522.2 202560
#> 36 3369.927 522.2 161024
#> 37 3371.492 522.2 123520
#> 38 3373.057 522.2 93160
#> 39 3374.622 522.2 71856
#> 40 3376.187 522.2 58392
#> 41 3377.752 522.2 51072
#> 42 3379.317 522.2 48376
#> 43 3380.882 522.2 49168
#> 44 3382.447 522.2 53120
#> 45 3384.012 522.2 62488
#> 46 3385.577 522.2 78680
#> 47 3387.142 522.2 102840
#> 48 3388.707 522.2 134656
#>
#> $ROIsDataPoint[[2]]
#> rt mz int
#> 1 3280.725 496.2 1349
#> 2 3290.115 496.2 2069
#> 3 3291.680 496.2 3103
#> 4 3293.245 496.2 5570
#> 5 3294.809 496.2 10730
#> 6 3296.374 496.2 20904
#> 7 3297.939 496.2 38712
#> 8 3299.504 496.2 64368
#> 9 3301.069 496.2 97096
#> 10 3302.634 496.2 136320
#> 11 3304.199 496.2 182080
#> 12 3305.764 496.2 233472
#> 13 3307.329 496.2 288064
#> 14 3308.894 496.2 341248
#> 15 3310.459 496.2 386560
#> 16 3312.024 496.2 419648
#> 17 3313.589 496.2 441344
#> 18 3315.154 496.2 454592
#> 19 3316.719 496.2 459776
#> 20 3318.284 496.2 456320
#> 21 3319.849 496.2 444736
#> 22 3321.414 496.2 425408
#> 23 3322.979 496.2 397888
#> 24 3324.544 496.2 365952
#> 25 3326.109 496.2 329856
#> 26 3327.673 496.2 288832
#> 27 3329.238 496.2 244864
#> 28 3330.803 496.2 207616
#> 29 3332.368 496.2 177216
#> 30 3333.933 496.2 148544
#> 31 3335.498 496.2 119240
#> 32 3337.063 496.2 94736
#> 33 3338.628 496.2 76832
#> 34 3340.193 496.2 64048
#> 35 3341.758 496.2 53744
#> 36 3343.323 496.2 45704
#> 37 3344.888 496.2 39576
#> 38 3346.453 496.2 35080
#> 39 3348.018 496.2 31432
#> 40 3349.583 496.2 28904
#> 41 3351.148 496.2 27064
#> 42 3352.713 496.2 25632
#> 43 3354.278 496.2 24480
#> 44 3355.843 496.2 23840
#> 45 3357.408 496.2 23688
#> 46 3358.973 496.2 24680
#> 47 3360.538 496.2 28608
#> 48 3362.102 496.2 39616
#> 49 3363.667 496.2 63344
#> 50 3365.232 496.2 107352
#> 51 3366.797 496.2 182144
#> 52 3368.362 496.2 295232
#> 53 3369.927 496.2 438016
#> 54 3371.492 496.2 592256
#> 55 3373.057 496.2 737408
#> 56 3374.622 496.2 858624
#> 57 3376.187 496.2 938368
#> 58 3377.752 496.2 982976
#> 59 3379.317 496.2 1015232
#> 60 3380.882 496.2 1057280
#> 61 3382.447 496.2 1095680
#> 62 3384.012 496.2 1122304
#> 63 3385.577 496.2 1128960
#> 64 3387.142 496.2 1111040
#> 65 3388.707 496.2 1058816
#> 66 3390.272 496.2 996608
#> 67 3391.837 496.2 942272
#> 68 3393.402 496.2 888640
#> 69 3394.966 496.2 820160
#> 70 3396.531 496.2 744448
#> 71 3398.096 496.2 674688
#> 72 3399.661 496.2 609600
#> 73 3401.226 496.2 543552
#> 74 3402.791 496.2 480896
#> 75 3404.356 496.2 428032
#> 76 3405.921 496.2 387520
#> 77 3407.486 496.2 350976
#> 78 3409.051 496.2 313984
#> 79 3410.616 496.2 276224
#> 80 3412.181 496.2 243776
#> 81 3413.746 496.2 219264
#> 82 3415.311 496.2 202368
#> 83 3416.876 496.2 189184
#> 84 3418.441 496.2 174272
#> 85 3420.006 496.2 158080
#> 86 3421.571 496.2 143744
#> 87 3423.136 496.2 135808
#> 88 3424.701 496.2 131648
#> 89 3426.266 496.2 126784
#> 90 3427.831 496.2 118328
#> 91 3429.395 496.2 109144
#> 92 3430.960 496.2 101944
#> 93 3432.525 496.2 96896
#> 94 3434.090 496.2 92048
#> 95 3435.655 496.2 86408
#> 96 3437.220 496.2 81288
#> 97 3438.785 496.2 78144
#>
#>