Update the slots and/or meta data of the sparse eset object
updateSparseEset.Rd
This function is used to update the three slots ('assayData', 'phenoData', 'featureData') and/or 'meta data' of sparse eset object.
Usage
updateSparseEset(
input_eset,
dataMatrix = NULL,
cellData = NULL,
featureData = NULL,
addMetaData = FALSE
)
Arguments
- input_eset
The sparse eset object to update
- dataMatrix
A data matrix with Features/Genes as the rows and Cells as the columns. It's row.names and colnames must be consistent with the
input_eset
. Default:NULL
.- cellData
A data frame containing meta data of cells or
NULL
. It's row.names should be consistent with the colnames ofinput_eset
. Default:NULL
.- featureData
A data frame containing meata data of features or
NULL
. It's row.names should be consistent with the row.names ofinput_eset
. Default:NULL
.- addMetaData
Logical, whether to update the meta data of features and cells based on the expression matrix. Default:
FALSE
.
Examples
data("pbmc14k_expression.eset")
## 1. Update the QC metrics: this will recalculate the 'nUMI', 'nFeature', 'pctMito', 'pctSpikeIn' and 'nCell'. This is very helpful when the SparseEset is subsetted or combined.
pbmc14k_raw.eset <- updateSparseEset(input_eset = pbmc14k_expression.eset, addMetaData = TRUE)
#> Updating meta data based on data matrix ...
#> Warning: The data matrix might not be a raw count matrix, since non-integer values were found. The 'nUMI' column is only valid when the values in data matrix are raw UMI counts.
## 2. Update the meta data of cells: with this, the user can add more information of cells, like clustering results, cell type.
true_label <- read.table(system.file("extdata/demo_pbmc14k/PBMC14k_trueLabel.txt.gz", package = "scMINER"), header = TRUE, row.names = 1, sep = "\t", quote = "", stringsAsFactors = FALSE)
pbmc14k_raw.eset <- updateSparseEset(input_eset = pbmc14k_expression.eset, cellData = true_label, addMetaData = TRUE)
#> The cell information of input_eset has been updated!
#> Updating meta data based on data matrix ...
#> Warning: The data matrix might not be a raw count matrix, since non-integer values were found. The 'nUMI' column is only valid when the values in data matrix are raw UMI counts.