scdrake_make: Execute a 'scdrake"s pipeline plan.

View source: R/make.R

scdrake_makeR Documentation

Execute a scdrake's pipeline plan.

Description

This is a wrapper around drake::make() with some sensible defaults. Before a plan is executed, this function sets locally some options, environment variables and other things. That means no side effects are left. Note that this is a less reproducible way to run the scdrake pipeline since it is executed in the current R session. Also note that create_single_sample_dirs() or create_integration_dirs() must be run before.

The preferred way is calling the scdrake_r_make() function, which is a wrapper around drake::r_make() (details). It will start a fresh new R session, source ⁠_drake.R⁠ (or a similar file) and execute the plan. The current ⁠_drake.R⁠-like files copied when a new scdrake project is initialized are:

  • ⁠_drake_single_sample.R⁠ for the single-sample pipeline

  • ⁠_drake_integration.R⁠ for the integration pipeline

Internally, ⁠_drake_single_sample.R⁠ and ⁠_drake_integration.R⁠ do almost the same as code in scdrake_make(), except there is no need for isolation of side effects. Also, by default, it relies on environment variables, such as paths to config directories, e.g. SCDRAKE_SINGLE_SAMPLE_CONFIG_DIR whose value is used as the default for option used in load_single_sample_configs(dir = getOption("scdrake_single_sample_config_dir")).

Usage

scdrake_make(
  plan,
  cfg_pipeline = NULL,
  cfg_main = NULL,
  verbose = getOption("scdrake_verbose"),
  prework = "",
  log_worker = TRUE,
  options = list(),
  ...
)

scdrake_r_make(drake_file = NULL, ...)

Arguments

plan

A drake plan.

cfg_pipeline

One of:

  • A scdrake_list object: pipeline config (see load_pipeline_config()) obtained from pipeline.yaml file located in a pipeline config directory

  • NULL: the config will be loaded using the path defined in the scdrake_pipeline_config_dir option

cfg_main

A scdrake_list object: main config (see load_config) obtained from ⁠00_main.yaml⁠ file located in single-sample or integration config directory.

verbose

A logical scalar: if TRUE, be verbose. The default value is obtained from getOption("scdrake_verbose").

prework, log_worker, ...

Passed to drake::make(). prework must be a character scalar.

options

A list: additional base::options() to be set (locally).

drake_file

A character scalar: path to ⁠_drake.R⁠ (default for NULL) or similar file (details).

Value

Invisibly TRUE if plan execution finishes without errors.


bioinfocz/scdrake documentation built on Jan. 29, 2024, 10:24 a.m.