Skip to main content

Crate rsomics_sc_normalize

Crate rsomics_sc_normalize 

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 normalizes after promoting the integer matrix to float.
Entry
NormalizeParams

Functions§

normalize
Normalize each cell to target_sum (or the median of totals) then optionally apply ln(1+x). Mirrors scanpy: a zero-count cell’s scaling factor collapses to 1, leaving its (empty) row untouched, and the sparsity pattern is exact because log1p(0) = 0.
open_mtx
Resolve the 10x triple inside dir, accepting both gzipped (v3) and plain (v2) layouts. Only the matrix is required for normalization.
open_output
Output destination — stdout for -, otherwise a file.
parse_mtx
Parse a MatrixMarket coordinate file (real, integer, or pattern; general). 10x stores genes on rows, cells on columns.
parse_target_sum
--target-sum accepts a positive float or the literal median.
run
End-to-end: read the 10x matrix from dir, normalize, write to out.
write_mtx
Write the matrix back in genes×cells MatrixMarket real coordinate layout, preserving the input entry order. A big buffer plus ryu float formatting keeps the matrix-sized write I/O-bound rather than format-bound.