Skip to contents

This function is used to combine the sparse expression set objects. The combined eset object contains all cells and features of all input eset objects. If the eset objects are of different features, NA values will be generated and automatically imputed by the minimum value of the combined gene expression matrix.

Usage

combineSparseEset(
  eset_list,
  projectID = NULL,
  addPrefix = NULL,
  addSurfix = NULL,
  addMetaData = TRUE,
  imputeNA = TRUE
)

Arguments

eset_list

A vector of sparse expression set objects to combine

projectID

A character vector or NULL, set the project names of the eset objects to combine. Default: NULL.

addPrefix

A character vector or NULL, add a prefix to the cell barcodes of each eset object to combine. It is highly recommended to use a prefix containing letters and/or numbers only, and not starting with numbers. Default: NULL.

addSurfix

A character vector or NULL, add a surfix to the cell barcodes of each eset object to combine. It is highly recommended to use a surfix containing letters and/or numbers only, and not starting with numbers. Default: NULL.

addMetaData

Logical, whether to update the meta data of cells and features after combination. Default: TRUE.

imputeNA

Logical, whether to impute NA values in combined matrix. If TRUE, the min value of the matrix will be used to replace the NAs. If FALSE, NA values will retain. Default: TRUE.

Value

A sparse eset object with combined features and cells of multiple eset objects.

Examples

demo1_mtx <- readInput_10x.dir(input_dir = system.file("extdata/demo_inputs/cell_matrix_10x", package = "scMINER"),
                               featureType = "gene_symbol", removeSuffix = TRUE)
#> Reading 10x Genomcis data from: /private/var/folders/v0/njhqcmrs32xgrjgx2wz8d50r0000gp/T/Rtmpf8JULY/temp_libpath11ae7194479/scMINER/extdata/demo_inputs/cell_matrix_10x ...
#> 	Multiple data modalities were found: Gene Expression, Peaks . Only the gene expression data (under "Gene Expression") was kept.
#> Done! The sparse gene expression matrix has been generated: 500 genes, 100 cells.
demo1.eset <- createSparseEset(input_matrix = demo1_mtx, projectID = "demo1", addMetaData = TRUE)
#> Creating sparse eset from the input_matrix ...
#> 	Adding meta data based on input_matrix ...
#> Done! The sparse eset has been generated: 500 genes, 100 cells.
demo2_mtx <- readInput_table(table_file = system.file("extdata/demo_inputs/table_file/demoData2.txt.gz", package = "scMINER"),
                             is.geneBYcell = TRUE, removeSuffix = TRUE)
#> Reading table file: /private/var/folders/v0/njhqcmrs32xgrjgx2wz8d50r0000gp/T/Rtmpf8JULY/temp_libpath11ae7194479/scMINER/extdata/demo_inputs/table_file/demoData2.txt.gz ...
#> 	Suffix removal was specified but skipped, since some barcodes do not carry "-1" suffix.
#> Done! The sparse gene expression matrix has been generated: 1000 genes, 100 cells.
demo2.eset <- createSparseEset(input_matrix = demo2_mtx, projectID = "demo2", addMetaData = TRUE)
#> Creating sparse eset from the input_matrix ...
#> 	Adding meta data based on input_matrix ...
#> Done! The sparse eset has been generated: 1000 genes, 100 cells.
combined.eset <- combineSparseEset(eset_list = c(demo1.eset, demo2.eset),
                                   projectID = c("sample1", "sample2"),
                                   addPrefix = c("demo1", "demo2"),
                                   addSurfix = NULL,
                                   addMetaData = TRUE,
                                   imputeNA = TRUE)
#> Combining the input sparse eSets ...
#> NA values were found in the merged matrix and have been replaced by the minimum value:  0 .
#> Adding meta data based on merged data matrix ...
#> Done! The combined sparse eset has been generated: 1500 genes, 200 cells.