Using reference samples (referenceSpectraFiles), save (to saveFolder) each ROI EIC (ROI) and reports the mean apex RT for all IS (IS_ROI) across samples

peakPantheR_ROIStatistics(
    referenceSpectraFiles,
    saveFolder,
    ROI = NULL,
    IS_ROI = NULL,
    sampleColour = NULL,
    ncores = 0,
    saveISPlots = TRUE,
    verbose = TRUE
)

Arguments

referenceSpectraFiles

(str) A character vector of paths to the reference spectra files

saveFolder

(str) Path to the folder where EICs and IS mean RT (IS_mean_RT.csv) will be saved

ROI

(data.frame) NULL or a data.frame of Regions Of Interest (ROI) with compounds as row and ROI parameters as columns: rtMin (float in seconds), rt (float in seconds, or NA), rtMax (float in seconds), mzMin (float), mz (float or NA), mzMax (float) (if NULL, ROI EICs are not saved)

IS_ROI

(data.frame) NULL or a data.frame of IS ROI with IS as row and ROI parameters as columns: rtMin (float in seconds), rt (float in seconds, or NA), rtMax (float in seconds), mzMin (float), mz (float or NA), mzMax (float) (if NULL IS mean RT is not calculated and saved in IS_mean_RT.csv)

sampleColour

(str) NULL or vector colour for each sample

ncores

(int) Number of cores to use to integrate IS in parallel

saveISPlots

(bool) If TRUE save a diagnostic plot for each IS to saveFolder/IS_search compound

verbose

(bool) If TRUE message progress

Value

None

Examples

if(requireNamespace('faahKO')){
## Initialise a peakPantheRAnnotation object with 2 samples and 1 targeted
## compound

# Paths to spectra files
library(faahKO)
spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
                    system.file('cdf/KO/ko16.CDF', package = 'faahKO'))

# targetFeatTable
targetFeatTable <- data.frame(matrix(vector(), 1, 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[,c(3:8)] <- vapply(targetFeatTable[,c(3:8)], as.numeric,
                                    FUN.VALUE=numeric(1))

# input
refSpecFiles  <- spectraPaths
input_ROI     <- targetFeatTable
input_IS_ROI  <- targetFeatTable
sampleColour  <- c('blue', 'red')

# temporary saveFolder
saveFolder1   <- tempdir()

# Calculate ROI statiscs
peakPantheR_ROIStatistics(refSpecFiles, saveFolder1, ROI=input_ROI,
                            IS_ROI=input_IS_ROI, sampleColour=sampleColour,
                            ncores=0, saveISPlots=TRUE, verbose=TRUE)
}
#> - EICs for each ROI windows will be saved to: C:\Temp\RtmpOQUVbX
#>     1 ROI in 2 reference samples
#> - Mean RT of IS across reference samples will be saved to: C:\Temp\RtmpOQUVbX
#>     1 IS in 2 reference samples
#> 
#> -- Saving EICs for each ROI --
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 1 windows
#> Data read in: 1.39 secs
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Reading data from 1 windows
#> Data read in: 1.38 secs
#> 1 ROIs saved to C:\Temp\RtmpOQUVbX
#> 
#> -- Calculating mean RT for each IS --
#> Processing 1 compounds in 2 samples:
#>   uROI:	FALSE
#>   FIR:	FALSE
#> ----- ko15 -----
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Check input, mzMLPath must be a .mzML
#> Reading data from 1 windows
#> Data read in: 1.29 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 1/1 features in 0.01 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 1.78 secs
#> ----- ko16 -----
#> Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
#> Check input, mzMLPath must be a .mzML
#> Reading data from 1 windows
#> Data read in: 1.23 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 1/1 features in 0 secs
#> Peak statistics done in: 0 secs
#> Feature search done in: 1.69 secs
#> Annotation object cannot be reordered by sample acquisition date
#> ----------------
#> Parallel annotation done in: 4.24 secs
#>   0 failure(s)
#> Annotation parameters saved at C:\Temp\RtmpOQUVbX/IS_search/annotationParameters_summary.csv
#> Saving diagnostic plots:
#>   Compound 1/1 diagnostic plot saved at C:\Temp\RtmpOQUVbX/IS_search/cpd_1.png
#> IS mean RT saved at C:\Temp\RtmpOQUVbX/IS_mean_RT.csv