
Target factory for PCA run and missing values imputation on each omics dataset
Source:R/multidataset_pca.R
pca_complete_data_factory.RdCreates a list of targets that perform a PCA run for each omics dataset from
a MultiDataSet object using dynamic branching, and imputes the missing
values in those datasets using the results of the PCA runs.
Usage
pca_complete_data_factory(
mo_data_target,
dataset_names = NULL,
target_name_prefix = "",
complete_data_name = NULL,
...
)Arguments
- mo_data_target
Symbol, the name of the target containing the
MultiDataSetobject.- dataset_names
Character vector, the names of the datasets on which a PCA should be run. If
NULL, a PCA will be run on all datasets. Default value isNULL.- target_name_prefix
Character, prefix to add to the name of the targets created by the factory. Default value is
"".- complete_data_name
Character, the name of the target containing the
MultiDataSetwith missing data imputed to be created. IfNULL, will be selected automatically. Default value isNULL.- ...
Further arguments passed to the
run_pca_matrix()function.
Value
A List of targets. If target_name_prefix = "" and
complete_data_name = NULL, the following targets are created:
dataset_names_pca: target containing a character vector that gives the names of the datasets on which a PCA should be run.dataset_mats_pca: a dynamic branching target that applies theget_dataset_matrix()function to each dataset specified indataset_names. The results are saved in a list. Note that because it is using dynamic branching, the names of the list are not meaningful. Rather, usesapply(pca_pca_runs_listruns_list, attr, "dataset_name")to assess which element of the list corresponds to which omics dataset.pca_runs_list: a dynamic branching target that applies therun_pca_matrix()function to each matrix indataset_mats_pca. The results are saved in a list. Note that because it is using dynamic branching, the names of the list are not meaningful. Rather, usesapply(pca_runs_list, attr, "dataset_name")to assess which element of the list corresponds to which omics dataset.complete_set: a target that returns aMultiDataSetin which missing values have been imputed.
Examples
if (FALSE) { # \dontrun{
## in the _targets.R
library(moiraine)
list(
# ... code for importing datasets etc
## mo_set is the target containing the MultiDataSet object
## Example 1: running a PCA on all datasets
run_pca_factory(mo_set),
## Example 2: running a PCA on 'rnaseq' and 'metabolome' datasets
run_pca_factory(
mo_set,
c("rnaseq", "metabolome"),
complete_data_name = "mo_data_complete"
)
)
} # }