Skip to main content

Crate rsomics_sc_scale

Crate rsomics_sc_scale 

Source

Structs§

CountMatrix
A single-cell count matrix in 10x MatrixMarket layout: rows are genes, columns are cells, stored as coordinate triplets. Counts are held as f64 because scanpy promotes the integer matrix to float before scaling.
Entry
GeneStats
Per-gene mean and standard deviation over all cells. The variance uses the ddof=1 (sample) convention scanpy enforces: var = (E[x²] - E[x]²)·n/(n-1). A zero-variance gene’s std collapses to 1 so its centered row stays at 0.
ScaleParams

Functions§

gene_stats
open_mtx
open_output
parse_max_value
--max-value accepts a positive float, or is absent for no clipping.
parse_mtx
Parse a MatrixMarket coordinate file (real, integer, or pattern; general). 10x stores genes on rows, cells on columns.
run
End-to-end: read the 10x matrix from dir, scale, write a dense matrix.
scale_dense
Z-score the matrix per gene and densify into a genes × cells buffer in column-major (cell-major) order: every gene of cell 0, then cell 1, … This is the MatrixMarket array layout the writer emits. An implicit zero count becomes -mean/std, which is why scaling densifies the matrix.
write_dense
Write the dense scaled matrix in MatrixMarket array real general layout: banner, n_genes n_cells, then one value per line in column-major order (matching scipy’s dense MatrixMarket and dense’s memory layout).