load_config | R Documentation |
scdrake_list
.load_config()
loads a single YAML file as a scdrake_list()
.
load_pipeline_config()
, load_single_samples_configs()
, and load_integration_configs()
load a specific config group (pipeline, single-sample, integration) and return a named list of scdrake_list
s.
load_config(
yaml_file,
other_variables = NULL,
eval_code = TRUE,
verbose = getOption("scdrake_verbose")
)
load_pipeline_config(
dir = getOption("scdrake_pipeline_config_dir"),
process = TRUE,
...
)
load_single_sample_configs(
dir = getOption("scdrake_single_sample_config_dir"),
cfg_pipeline = NULL,
process = TRUE,
...
)
load_integration_configs(
dir = getOption("scdrake_integration_config_dir"),
cfg_pipeline = NULL,
process = TRUE,
...
)
yaml_file |
A character scalar: path to YAML file. |
other_variables |
A list of variables in whose environment the |
eval_code |
A logical scalar: if |
verbose |
A logical scalar: if |
dir |
A character scalar:
|
process |
A logical scalar: if |
... |
Passed to |
cfg_pipeline |
A |
Except load_pipeline_config()
, you can refer to variables from pipeline.yaml
and 00_main.yaml
configs
inside individual configs. For example, you can use CLUSTER_SC3_N_CORES: !code DRAKE_N_JOBS
in 02_norm_clustering.yaml
.
A scdrake_list()
of parameters loaded from the YAML file, or a named list of such lists.
All parameters in the yaml_file
whose value starts with !code
will be evaluated as R code.
Those can reference other parameters in the yaml_file
, or variables in the individual lists of the other_variables
list.
Note that you cannot reference other !code
parameters as their are not already evaluated during the runtime.
An example YAML file:
VAR_1: 5 VAR_2: !code VAR_1 + 5 VAR_3: "apple" VAR_4: VAR_4_1: !code str_upper(VAR_3) VAR_5: - VAR_5_1: a: !code VAR_1 + 1 VAR_5_2: b: !code 1:10 VAR_6: !code VAR_2 + 10
VAR_2
will be 10
.
VAR_4_1
will be "APPLE"
.
VAR_5_1
will be 6
.
VAR_5_2
will be a numeric vector.
VAR_6
will throw error, because VAR_2
will still be unevaluated, so R will try to add 10
to the character scalar.
Note that VAR_5
contains a single named list, and this structure is used quite often in scdrake
configs.
You have to keep an eye on the proper indentation :)
# If a scdrake project is in the current working directory.
## Not run:
cfg_1 <- load_config("config/pipeline.yaml")
cfg_2 <- load_config(
"config/single_sample/00_main.yaml",
other_variables = cfg_1
)
## End(Not run)
## Not run:
pipeline_config <- load_pipeline_config()
pipeline_config_other <- load_pipeline_config("some/other/dir/config.yaml")
## End(Not run)
## Not run:
single_sample_config <- load_single_sample_configs()
single_sample_config_other <- load_single_sample_configs("some/other/dir")
## End(Not run)
## Not run:
integration_config <- load_integration_configs()
single_sample_config_other <- load_integration_configs("some/other/dir")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.