ExecutePlan: ExecutePlan

View source: R/Resume_functions.R

ExecutePlanR Documentation

ExecutePlan

Description

ExecutePlan

Usage

ExecutePlan(plan = NULL)

Arguments

plan

ResummingPlan object. The object is generated by running.plan() function.

Value

will return a result based on the plan input

Author(s)

Zhiqiang Pang zhiqiang.pang@mail.mcgill.ca Jeff Xia jeff.xia@mcgill.ca Mcgill University License: GNU GPL (>= 2)

Examples

##' Download the raw spectra data
DataFiles <- dir(system.file("mzData", package = "mtbls2"), full.names = TRUE,
            recursive = TRUE)[c(10:12, 14:16)]
##' Create a phenodata data.frame
pd <- data.frame(sample_name = sub(basename(DataFiles), pattern = ".mzData", 
                                   replacement = "", fixed = TRUE),
                 sample_group = c(rep("col0", 3), rep("cyp79", 3)),
                 stringsAsFactors = FALSE)
                 
##' Initialize your plan
plan <- InitializaPlan("raw_opt")

##' Define your plan
plan <- running.plan(plan,
                     mSet <- PerformROIExtraction(datapath = DataFiles[c(1:2)], rt.idx = 0.025,
                                                  plot = FALSE, rmConts = FALSE,
                                                  running.controller = rc),
                     param_initial <- SetPeakParam(),
                     best_parameters <- PerformParamsOptimization(mSet = mSet, param_initial,
                                                                  ncore = 1,
                                                                  running.controller = rc),
                     param <- best_parameters,
                     plotSettings1 <- SetPlotParam(Plot=TRUE),
                     plotSettings2 <- SetPlotParam(Plot=TRUE),
                     mSet <- ImportRawMSData(mSet = mSet, path = DataFiles, 
                                             metadata = pd,
                                             plotSettings = plotSettings1,
                                             running.controller = rc),
                     mSet <- PerformPeakProfiling(mSet = mSet, Params = param,
                                                  plotSettings = plotSettings2, ncore = 1,
                                                  running.controller = rc),
                     annParams <- SetAnnotationParam(polarity = 'negative',
                                                     mz_abs_add = 0.025),
                     mSet <- PerformPeakAnnotation(mSet = mSet,
                                                   annotaParam = annParams, ncore =1,
                                                   running.controller = rc),
                     mSet <- FormatPeakList(mSet = mSet, annParams,
                                            filtIso =FALSE, filtAdducts = FALSE,
                                            missPercent = 1));
##' Run it!
# result <- ExecutePlan(plan);

##' Re-define your plan with a change on mz_abs_add from 0.025 to 0.035
plan <- running.plan(plan,
                     mSet <- PerformROIExtraction(datapath = DataFiles[c(1:2)], rt.idx = 0.025,
                                                  plot = FALSE, rmConts = FALSE,
                                                  running.controller = rc),
                     param_initial <- SetPeakParam(),
                     best_parameters <- PerformParamsOptimization(mSet = mSet, param_initial,
                                                                  ncore = 1,
                                                                  running.controller = rc),
                     param <- best_parameters,
                     plotSettings1 <- SetPlotParam(Plot=TRUE),
                     plotSettings2 <- SetPlotParam(Plot=TRUE),
                     mSet <- ImportRawMSData(mSet = mSet, 
                                             path = DataFiles, 
                                             metadata = pd,
                                             plotSettings = plotSettings1,
                                             running.controller = rc),
                     mSet <- PerformPeakProfiling(mSet = mSet, Params = param,
                                                  plotSettings = plotSettings2, ncore = 1,
                                                  running.controller = rc),
                     annParams <- SetAnnotationParam(polarity = 'negative',
                                                     mz_abs_add = 0.035),
                     mSet <- PerformPeakAnnotation(mSet = mSet,
                                                   annotaParam = annParams, ncore =1,
                                                   running.controller = rc),
                     mSet <- FormatPeakList(mSet = mSet, annParams,
                                            filtIso =FALSE, filtAdducts = FALSE,
                                            missPercent = 1));

##' Re-run it! Most steps will be resumed from cache and save your time!
# result <- ExecutePlan(plan);

xia-lab/OptiLCMS documentation built on March 27, 2024, 11:11 a.m.