Import CellTypeDataset (CTD) references from a remote repository, standardize each, and then merge into one CTD. Optionally, can return these as a merged SingleCellExperiment.

merge_ctd(
  CTD_list,
  save_dir = tempdir(),
  standardise_CTD = FALSE,
  as_SCE = FALSE,
  gene_union = TRUE,
  merge_levels = seq(1, 5),
  save_split_SCE = FALSE,
  save_split_CTD = FALSE,
  save_merged_SCE = TRUE,
  force_new_quantiles = FALSE,
  numberOfBins = 40,
  as_sparse = TRUE,
  as_DelayedArray = FALSE,
  verbose = TRUE,
  ...
)

Arguments

CTD_list

(Named) list of CellTypeDatasets.

save_dir

The directory to save merged files in.

standardise_CTD

Whether to run standardise_ctd.

as_SCE

If TRUE (default), returns the merged results as a named list of SingleCellExperiments. If FALSE, returns as a CTD object.

gene_union

Whether to take the gene union or intersection when merging matrices (mean_exp,specificity, etc.).

merge_levels

Which CTD levels you want to merge. Can be a single value (e.g. merge_levels=5) or a list c(e.g. merge_levels=c(1:5)). If some CTD don't have the same number of levels, the maximum level depth available in that CTD will be used instead.

save_split_SCE

Whether to save individual SCE files in the subdirectory standardized_CTD_SCE.

save_split_CTD

Whether to save individual CTD files in the subdirectory standardized_CTD.

save_merged_SCE

Save the final merged SCE object, or simply to return it.

force_new_quantiles

If specificity quantiles matrix already exists, create a new one.

numberOfBins

Number of bins to compute specificity quantiles with.

as_sparse

Convert matrices to sparse matrix.

as_DelayedArray

Convert matrices to DelayedArray.

verbose

Print messages.

...

Additional arguments to be passed to standardise_ctd.

Value

List of CellTypeDatasets or SingleCellExperiments.

Examples

## Let's pretend these are different CTD datasets
ctd1 <- ewceData::ctd()
#> see ?ewceData and browseVignettes('ewceData') for documentation
#> loading from cache
ctd2 <- ctd1
CTD_list <- list(ctd1, ctd2)
CTD_merged <- EWCE::merge_ctd(CTD_list = CTD_list)
#> + Must set `as_SCE=TRUE` in order to merge CTD.
#> + Returning merged CTD.
#> 1 core(s) assigned as workers (3 reserved).
#> Converting to sparse matrix.
#> + Calculating normalized mean expression.
#> Converting to sparse matrix.
#> + Calculating normalized specificity.
#> Converting to sparse matrix.
#> Converting to sparse matrix.
#> + Saving results ==>  /tmp/RtmpLzmMED/ctd_file213a297af533level_1.rda
#> + Returning list of CTD file name, and the CTD itself.
#> 1 core(s) assigned as workers (3 reserved).
#> Converting to sparse matrix.
#> + Calculating normalized mean expression.
#> Converting to sparse matrix.
#> + Calculating normalized specificity.
#> Converting to sparse matrix.
#> Converting to sparse matrix.
#> + Saving results ==>  /tmp/RtmpLzmMED/ctd_file213a10cac977level_2.rda
#> + Returning list of CTD file name, and the CTD itself.