# NOT RUN {
## Load data
library(faahKO)
library(MSnbase)
netcdfFilePath <- system.file('cdf/KO/ko15.CDF', package = "faahKO")
raw_data <- MSnbase::readMSData(netcdfFilePath, centroided=TRUE, mode='onDisk')
## targetFeatTable
targetFeatTable <- data.frame(matrix(vector(), 2, 8, dimnames=list(c(), c("cpdID",
"cpdName", "rtMin", "rt", "rtMax", "mzMin", "mz", "mzMax"))),
stringsAsFactors=F)
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[,3:8] <- sapply(targetFeatTable[,3:8], as.numeric)
ROIsPt <- extractSignalRawData(raw_data, rt=targetFeatTable[,c('rtMin','rtMax')],
mz=targetFeatTable[,c('mzMin','mzMax')], verbose=TRUE)
# Reading data from 2 windows
foundPeaks <- findTargetFeatures(ROIsPt, targetFeatTable, verbose=T)
# 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.07 secs
foundPeaks
# $peakTable
# found rtMin rt rtMax mzMin mz mzMax peakArea maxIntMeasured maxIntPredicted
# 1 TRUE 3309.759 3346.828 3385.410 522.1948 522.2 522.2052 26133727 889280 901015.8
# 2 TRUE 3345.377 3386.529 3428.279 496.2000 496.2 496.2000 35472141 1128960 1113576.7
#
# $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"
# }
Run the code above in your browser using DataLab