R/peakPantheR_parallelAnnotation.R
peakPantheR_parallelAnnotation.Rd
Integrate all target features in all files defined in the
initialised input object and store results. The use of updated ROI and the
integration of FIR are controled by the input object slots useUROI
and
useFIR
. Files are processed in parallel using
peakPantheR_singleFileSearch; ncores
controls the number of
cores used for parallelisation, with ncores=0
corresponding to serial
processing. If the processing of a file fails (file does not exist or error
during execution) the sample is removed from the outputed object.
peakPantheR_parallelAnnotation(
object,
ncores = 0,
getAcquTime = TRUE,
resetWorkers = 1,
centroided = TRUE,
curveModel = "skewedGaussian",
verbose = TRUE,
...
)
(peakPantheRAnnotation) Initialised peakPantheRAnnotation
object defining the samples to process and compounds to target. The slots
useUROI
and useFIR
controls if uROI must be used and FIR
integrated if a feature is not found
(int) Number of cores to use for parallelisation. Default 0 for no parallelisation.
(bool) If TRUE will extract sample acquisition date-time from the mzML metadata (the additional file access will impact run time)
(int) If 0, the parallel cluster is only initiated once.
If >0 the cluster will be reset (and the memory of each worker freed) once
ncores * resetWorkers
files have been processed. Default value is 1,
the cluster is reset once ncores
files have been processed. While
potentially impacting performance (need to wait until all ncores *
resetWorkers
files are processed before restarting the cluster), shutting
down the workers processes regularly will ensure the OS can reallocate memory
more efficiently. For values >1, ensure sufficient system memory is available
(bool) use TRUE if the data is centroided, used by
readMSData
when reading the raw data files
(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, number of features found (total and matched to targets) and failures
Passes arguments to findTargetFeatures
to alter
peak-picking parameters
a list: list()$result
(peakPantheRAnnotation) fully
annotated object, list()$failures
(list) list of failed samples and error message
Other peakPantheR:
peakPantheRAnnotation
,
peakPantheR_singleFileSearch()
Other parallelAnnotation:
peakPantheRAnnotation
,
peakPantheR_singleFileSearch()
if(requireNamespace('faahKO')){
## Load data
library(faahKO)
# 3 files
input_spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
system.file('cdf/KO/ko16.CDF', package = 'faahKO'),
system.file('cdf/KO/ko18.CDF', package = 'faahKO'))
# 4 features
input_ROI <- data.frame(matrix(vector(), 4, 8,
dimnames=list(c(), c('cpdID', 'cpdName', 'rtMin', 'rt',
'rtMax', 'mzMin', 'mz', 'mzMax'))),
stringsAsFactors=FALSE)
input_ROI[1,] <- c('ID-1', 'Cpd 1', 3310., 3344.888, 3390., 522.194778,
522.2, 522.205222)
input_ROI[2,] <- c('ID-2', 'Cpd 2', 3280., 3385.577, 3440., 496.195038,
496.2, 496.204962)
input_ROI[3,] <- c('ID-3', 'Cpd 3', 3420., 3454.435, 3495., 464.195358,
464.2, 464.204642)
input_ROI[4,] <- c('ID-4', 'Cpd 4', 3670., 3701.697, 3745., 536.194638,
536.2, 536.205362)
input_ROI[,c(3:8)] <- vapply(input_ROI[,c(3:8)], as.numeric,
FUN.VALUE=numeric(4))
# Initialise object
initAnnotation <- peakPantheRAnnotation(spectraPaths=input_spectraPaths,
targetFeatTable=input_ROI)
# to use updated ROI:
# uROIExist=TRUE, useUROI=TRUE, uROI=input_uROI
# to use FallBack Integration Regions:
# useFIR=TRUE, FIR=input_FIR
# Run serially
result_parallelAnnotation <- peakPantheR_parallelAnnotation(initAnnotation,
ncores=0,
getAcquTime=FALSE,
verbose=TRUE)
# Processing 4 compounds in 3 samples:
# uROI:\tFALSE
# FIR:\tFALSE
# ----- ko15 -----
# Polarity can not be extracted from netCDF files, please set manually the
# polarity with the 'polarity' method.
# Reading data from 4 windows
# Data read in: 0.24 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
# 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 #3
# Found 4/4 features in 0.06 secs
# Peak statistics done in: 0.02 secs
# Feature search done in: 0.76 secs
# ----- ko16 -----
# Polarity can not be extracted from netCDF files, please set manually the
# polarity with the 'polarity' method.
# Reading data from 4 windows
# Data read in: 0.24 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
# 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 #2
# 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 #3
# 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 #4
# Found 4/4 features in 0.08 secs
# Peak statistics done in: 0 secs
# Feature search done in: 0.71 secs
# ----- ko18 -----
# Polarity can not be extracted from netCDF files, please set manually the
# polarity with the 'polarity' method.
# Reading data from 4 windows
# Data read in: 0.25 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
# 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 #2
# 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 #4
# Found 4/4 features in 0.06 secs
# Peak statistics done in: 0 secs
# Feature search done in: 0.71 secs
# ----------------
# Parallel annotation done in: 2.18 secs
# No failures
result_parallelAnnotation$failures
result_parallelAnnotation$annotation
# An object of class peakPantheRAnnotation
# 4 compounds in 3 samples.
# updated ROI do not exist (uROI)
# does not use updated ROI (uROI)
# does not use fallback integration regions (FIR)
# is annotated
}
#> Processing 4 compounds in 3 samples:
#> uROI: FALSE
#> FIR: FALSE
#> ----- ko15 -----
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 4 windows
#> Data read in: 1.53 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
#> 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 #3
#> Found 4/4 features in 0.02 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 2.18 secs
#> ----- ko16 -----
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 4 windows
#> Data read in: 1.45 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
#> 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 #2
#> 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 #3
#> 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 #4
#> Found 4/4 features in 0.03 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 2 secs
#> ----- ko18 -----
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 4 windows
#> Data read in: 1.42 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
#> 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 #2
#> Fit of ROI #3 is unsuccessful (apex residuals is 0.45 of max fit intensity, max intensity residuals is 0.46 of max fit intensity)
#> 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 #4
#> Found 3/4 features in 0.02 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 1.93 secs
#> Annotation object cannot be reordered by sample acquisition date
#> ----------------
#> Parallel annotation done in: 7.45 secs
#> 0 failure(s)
#> An object of class peakPantheRAnnotation
#> 4 compounds in 3 samples.
#> updated ROI do not exist (uROI)
#> does not use updated ROI (uROI)
#> does not use fallback integration regions (FIR)
#> is annotated