我正在研究这样定义的 Drake 工作流程:
projectName <- c("lake_2018_CER_lib_norm_log2", "lake_2018_CER_lib_norm", "lake_2018_CER_raw_counts")
normalize <- c(TRUE, TRUE, FALSE)
logTransform <- c(TRUE, FALSE, FALSE)
normalize_fxn <- function(datExpr) {
datExpr <- sweep(datExpr, 2, colSums(datExpr), FUN = "/")
return(datExpr)
}
plan <- drake_plan(
datExpr = target(fread(file_in(filePath), sep = "\t") %>% select(-1), transform = map(filePath = !!filePath, .id = FALSE)),
datExprNorm = target(if(normalize == TRUE) {normalize_fxn(datExpr)*1e6 + 1} else {datExpr}, transform = map(datExpr, normalize = !!normalize)),
datExprLog = target(if(logTransform == TRUE) {log2(datExprNorm*1e6 + 1)} else {datExprNorm}, transform = map(datExprNorm, logTransform = !!logTransform)),
filterGenesMinCells = target(if(is.numeric(percentCells)) {round(ncol(datExprLog)*percentCells)} else {NULL}, transform = cross(datExprLog, percentCells = !!percentCells)),
makePlots = target(realVsPermCor(datExpr = datExprLog,
projectName = projectName,
featureType = featureType,
nPerms = 100,
subsampleReal = NULL,
resampleReal = NULL,
subsamplePerm,
filterGenesMinCells = filterGenesMinCells,
filterCellsMinGenes = NULL,
fdrSubsample,
futureThreads = NULL,
openBlasThreads = 10,
outDir),
transform = cross(filterGenesMinCells, featureType = !!featureType, .id = c(featureType, percentCells)))
)
目标输出如下所示:
> plan$target
[1] "datExpr" "datExprLog_TRUE_datExprNorm_TRUE_datExpr"
[3] "datExprLog_FALSE_datExprNorm_TRUE_datExpr_2" "datExprLog_FALSE_datExprNorm_FALSE_datExpr"
[5] "datExprNorm_TRUE_datExpr" "datExprNorm_TRUE_datExpr_2"
[7] "datExprNorm_FALSE_datExpr" "filterGenesMinCells_NULL_datExprLog_TRUE_datExprNorm_TRUE_datExpr"
[9] "filterGenesMinCells_0.01_datExprLog_TRUE_datExprNorm_TRUE_datExpr" "filterGenesMinCells_0.02_datExprLog_TRUE_datExprNorm_TRUE_datExpr"
[11] "filterGenesMinCells_NULL_datExprLog_FALSE_datExprNorm_TRUE_datExpr_2" "filterGenesMinCells_0.01_datExprLog_FALSE_datExprNorm_TRUE_datExpr_2"
[13] "filterGenesMinCells_0.02_datExprLog_FALSE_datExprNorm_TRUE_datExpr_2" "filterGenesMinCells_NULL_datExprLog_FALSE_datExprNorm_FALSE_datExpr"
[15] "filterGenesMinCells_0.01_datExprLog_FALSE_datExprNorm_FALSE_datExpr" "filterGenesMinCells_0.02_datExprLog_FALSE_datExprNorm_FALSE_datExpr"
[17] "makePlots_gene_NULL" "makePlots_cell_NULL"
[19] "makePlots_gene_0.01" "makePlots_cell_0.01"
[21] "makePlots_gene_0.02" "makePlots_cell_0.02"
[23] "makePlots_gene_NULL_2" "makePlots_cell_NULL_2"
[25] "makePlots_gene_0.01_2" "makePlots_cell_0.01_2"
[27] "makePlots_gene_0.02_2" "makePlots_cell_0.02_2"
[29] "makePlots_gene_NULL_3" "makePlots_cell_NULL_3"
[31] "makePlots_gene_0.01_3" "makePlots_cell_0.01_3"
[33] "makePlots_gene_0.02_3" "makePlots_cell_0.02_3"
这与我想要的非常接近,但我坚持的是projectName
:我希望将三个项目名称之一用于最终目标,具体取决于前面步骤中产生的输入是否被规范化和/或对数转换.
目前,我生成了 18 个目标,因此我希望每个项目名称都映射到 6 个目标。
有什么办法可以做到这一点吗?