Attempt to recover raw counts from the normalized matrix.
Arguments
- srt
A Seurat object.
- assay
Name of assay to recover counts.
- trans
The transformation function to applied when data is presumed to be log-normalized.
- min_count
Minimum UMI count of genes.
- tolerance
When recovering the raw counts, the nCount of each cell is theoretically calculated as an integer. However, due to decimal point preservation during normalization, the calculated nCount is usually a floating point number close to the integer. The tolerance is its difference from the integer. Default is 0.1
- sf
Set the scaling factor manually.
- verbose
Whether to show messages.
Examples
data("pancreas_sub")
raw_counts <- pancreas_sub@assays$RNA@counts
# Normalized the data
pancreas_sub <- Seurat::NormalizeData(pancreas_sub)
# Now replace counts with the log-normalized data matrix
pancreas_sub@assays$RNA@counts <- pancreas_sub@assays$RNA@data
# Recover the counts and compare with the raw counts matrix
pancreas_sub <- RecoverCounts(pancreas_sub)
#> The data is presumed to be log-normalized.
#> Perform expm1 on the raw data.
#> The presumed scale factor: 10000
#> Error: No cell overlap between new meta data and Seurat object
identical(raw_counts, pancreas_sub@assays$RNA@counts)
#> [1] FALSE