Skip to contents

By update is meant the following: if a default config contains a new parameter, it will be appended to a local config. If a parameter is present in both configs, its value from the local config will be used. In case the local config does not exist, the default one will be simply copied. See vignette("config", package = "scdrake") for details.

update_config() will update a single config file.

update_*_config() functions update a specific config group (pipeline, single-sample, integration).

update_configs() will run all update_*_config().

Usage

update_config(
  default_file,
  use_default_structure = FALSE,
  force = FALSE,
  yq_binary = getOption("scdrake_yq_binary"),
  verbose = getOption("scdrake_verbose")
)

update_pipeline_config(
  dir = getOption("scdrake_pipeline_config_dir"),
  verbose = getOption("scdrake_verbose"),
  ...
)

update_single_sample_configs(
  dir = getOption("scdrake_single_sample_config_dir"),
  verbose = getOption("scdrake_verbose"),
  ...
)

update_integration_configs(
  dir = getOption("scdrake_integration_config_dir"),
  verbose = getOption("scdrake_verbose"),
  ...
)

update_configs(
  pipeline_config_dir = getOption("scdrake_pipeline_config_dir"),
  single_sample_config_dir = getOption("scdrake_single_sample_config_dir"),
  integration_config_dir = getOption("scdrake_integration_config_dir"),
  verbose = getOption("scdrake_verbose"),
  ...
)

Arguments

default_file

A character scalar: path to the default YAML config file. Must have a .default.yaml extension.

use_default_structure

A logical scalar: if TRUE, a structure (comments, order of parameters) of the default config will be used, otherwise a structure of the local config will be preserved. See description for more details.

force

A logical scalar: if TRUE, overwrite local configs with default ones (instead of updating them).

yq_binary

A character scalar: path to yq tool's binary.

verbose

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

dir

A character scalar:

  • For update_pipeline_config(): a path to directory with pipeline.default.yaml file.

  • For update_single_sample_configs(): a path to directory with 00_main.default.yaml, 01_input_qc.default.yaml, 02_norm_clustering.default.yaml, cluster_markers.default.yaml, and contrasts.default.yaml files.

  • For update_integration_configs(): a path to directory with 00_main.default.yaml, 01_integration.default.yaml, 02_int_clustering.default.yaml, cluster_markers.default.yaml, and contrasts.default.yaml files.

...

Passed to update_config().

pipeline_config_dir

Passed to update_pipeline_config().

single_sample_config_dir

Passed to update_single_sample_configs().

integration_config_dir

Passed to update_integration_configs().

Value

Invisibly NULL.

Details

Internally, the yq tool (version 3) is used for merging of YAML files.

Using default config structure

Consider the following example of config update, showing also differences in the use_default_structure parameter:

Default config:

# Comment 1.
PARAM_1: 1
PARAM_2: 2
PARAM_3: 3

Local config:

# Comment 2.
PARAM_2: 6
# Comment 3.
PARAM_1: 5

With use_default_structure = TRUE, the result of update will be:

# Comment 1.
PARAM_1: 5
PARAM_2: 6
PARAM_3: 3

With use_default_structure = FALSE:

# Comment 2.
PARAM_2: 6
# Comment 3.
PARAM_1: 5
PARAM_3: 3

NOTE: yq tool, which is used internally for merging (updating) of YAML files, cannot ovewrite comments, and thus we need to use this schema to preserve local structure.

Examples

# If a scdrake project is in the current working directory.
if (FALSE) {
update_config("config/pipeline.default.yaml")
}

if (FALSE) {
update_pipeline_config("config")
}

if (FALSE) {
update_single_sample_configs("config/single_sample")
}
if (FALSE) {
update_integration_configs("config/integration")
}