Efficiently calculate TXI values for sparse single-cell expression matrices using batch processing and parallel computation.
cpp_txi_sc(expression, strata_values, batch_size = 2000L, ncores = 10L)Numeric vector of TXI values for each cell
Sparse expression matrix (genes x cells) - dgCMatrix format
Numeric vector of phylostratum values for each gene
Integer, number of cells to process per batch (default: 2000)
Integer, number of cores to use for parallel processing (default: 10, automatically capped at available cores)
Kristian K Ullrich
This function processes large sparse single-cell expression matrices efficiently by: - Splitting cells into batches to manage memory usage - Using parallel processing across batches - Leveraging sparse matrix operations to skip zero entries - Handling cells with zero expression by returning NA