
Clean a Filebacked Big Matrix (FBM) by log-transforming and handling NAs
Source:R/utils.R
cleanFBM.RdThis function inspects an FBM to determine if log-transformation is needed
(based on value range) and whether NA values are present. If the maximum
value is >= 100 and log2_transform = TRUE, it applies a log2(x + 1)
transformation in-place. If any
NA values are detected, they are replaced with 0.
Arguments
- fbm
A
bigmemory::FBMorbigstatsr::FBMobject.- ncores
Integer; number of cores to use for parallel operations (default 1).
- log2_transform
Logical; enable automatic
log2(x + 1)transformation when the maximum value is at least 100 (default TRUE). Set to FALSE to skip transformation. Missing values are still replaced with zero.
Value
A list with:
- max_value
The maximum value encountered in the FBM (after log transformation if applied).
- had_na
Logical indicating whether any NA values were found and filled.
Details
Modifies the FBM in place. Uses bigstatsr::big_apply() to process in
parallel-safe chunks.