peakPantheR_ROIStatistics {peakPantheR} | R Documentation

## Save to disk each ROI EIC and mean IS RT

### Description

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

### Usage

    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)
    }

[Package peakPantheR version 1.4.0 Index]