Convert a redeemR variant & depth matrix into long format for downstream analysis
Source:R/convert_format.R
convert_redeem_matrix_long.RdThis function filters a variant count matrix (mat_var) to include only cells in the provided
whitelist and variants observed in at least two cells, applies the same filtering to the corresponding
depth matrix (mat_depth), and then melts both into a single long-format data.table. The output
contains one row per cell–variant pair with its count (a) and depth (d).
Arguments
- mat_var
A numeric matrix of variant UMI counts (cells × variants).
- mat_depth
A numeric matrix of total depth (same dimensions and row/column names as
mat_var).- cell_whitelist
A character vector of cell barcodes to retain (rows of
mat_var/mat_depth).- sample
Character; an identifier for this dataset (printed to the console).