# #——包括= FALSE ----------------------------------------------------------- 库(BiocStyle ) ## ---- eval = FALSE -------------------------------------------------------------- # BiocManager::安装(“身为/ pipeComp ") ## ---- 回声= FALSE, fig.cap = "概述PipeComp PipelineDefinition”——knitr:: include_graphics(系统。文件(“文档”,“pipeComp_scheme.png”,包= ' pipeComp '),) ## ----------------------------------------------------------------------------- 库(pipeComp)替代< -列表(par1 = c(“function_A”、“function_B”),par2 = 1:3, par3 = TRUE, #……parN = c(10、25、50 ) ) ## ---- eval = FALSE -------------------------------------------------------------- # res < - runPipeline(数据集,选择,pipelineDef = PipelineDefinition ) ## ----------------------------------------------------------------------------- 梳子< - buildCombMatrix(替代品)头(梳子 ) ## ---- eval = FALSE -------------------------------------------------------------- # 梳子< -梳子[(梳$ par1 ! =“function_A”|梳子par2美元= = 2),]# res < - runPipeline(数据集,选择,pipelineDef = PipelineDefinition # nthreads = 3 =梳子梳理 ) ## ----------------------------------------------------------------------------- my_pip < - PipelineDefinition(列表(step1 = function (x, param1){#做x和param1 x},步骤2 = function (x, method1 param2){得到(method1) (x, param2) # method1适用于x,与param2},将发髻= function (x, param3) {x <——some_fancy_function (x, param3) #函数也可以输出评估通过“intermediate_return”槽:< - my_evaluation_function e (x)列表(x = x, intermediate_return = e)})) my_pip ## ----------------------------------------------------------------------------- my_pip < PipelineDefinition(列表(step1 = function (x, meth1) {(meth1) (x)},步骤2 = function (x, meth2){得到(meth2) (x)}),评价=列表(步骤2 =函数c (x)(平均=平均(x) max = max (x))),描述=列表(step1 =“这个步骤meth1适用于x。”步骤2 =“这个步骤meth2适用于x。”))my_pip ## ----------------------------------------------------------------------------- 数据集< -列表(ds1 = 1:3, ds2 = c(5、10、15))替代< -列表(meth1 = c(“日志”、“√”),meth2 =“cumsum”)tmpdir1 < - paste0 (tempdir(),“/”)res < runPipeline (my_pip数据集,选择,output.prefix = tmpdir1) res评价步骤2美元 ## ----------------------------------------------------------------------------- my_pip [1 ] ## ----------------------------------------------------------------------------- pip2 < - addPipelineStep (my_pip, name =“newstep”=“步骤1”)pip2 ## ----------------------------------------------------------------------------- stepFn (pip2、“newstep”、类型=“函数”)< -函数(x, newparam) {do_something (x,newparam)} pip2 ## ----------------------------------------------------------------------------- 列表。文件(tmpdir1模式= \ \”评价。rds") ## ----------------------------------------------------------------------------- ds <- list.files(tmpdir1, pattern="evaluation\\.rds", full.names = TRUE) names(ds) <- basename(ds) res1 <- readPipelineResults(resfiles=ds) res <- aggregatePipelineResults(res1) ## ----------------------------------------------------------------------------- alternatives <- list(meth1=c("log2","sqrt"), meth2="cumsum") tmpdir2 <- paste0(tempdir(),"/") res <- runPipeline(datasets, alternatives, my_pip, output.prefix=tmpdir2) ## ----------------------------------------------------------------------------- res1 <- readPipelineResults(tmpdir1) res2 <- readPipelineResults(tmpdir2) res <- mergePipelineResults(res1,res2) ## ----------------------------------------------------------------------------- res <- aggregatePipelineResults(res) res$evaluation$step2 ## ----------------------------------------------------------------------------- fragile.fun <- function(x){ if(any(x>10)) stop("Too big!") 2^x } alternatives$meth1 <- c(alternatives$meth1, "fragile.fun") res <- runPipeline(datasets, alternatives, my_pip, output.prefix=tmpdir1, skipErrors=TRUE) ## ----------------------------------------------------------------------------- res$evaluation$step2 ## ---- fig.width=5, fig.height=2----------------------------------------------- plotElapsed(res, agg.by=FALSE) ## ---- fig.width=3.5, fig.height=2.5------------------------------------------- evalHeatmap(res, what=c("mean", "max"))