A fit stores the fitted means and the contamination offsets as dense cells by
genes matrices. On a real cohort those dominate its size, and nothing
downstream needs them kept: paceDecompose() and paceDrivers() read
per-cell-type summaries the fit also holds, and rebuild the matrices from the
counts when they are absent.
Usage
compactFit(
object,
which = c("mu", "mu_bio", "mu_spill", "technical_offset_mat", "bleed_offset_mat")
)Arguments
- object
A PACEFit.
- which
The matrices to drop. The default is all of them.
Details
Use this before saving a fit. Every readout still works afterwards, and re-decomposing a compacted fit reproduces the tables it already carries.
See also
stashPACE() for keeping the readouts with the data.
Examples
fit <- readRDS(system.file("extdata", "pace_fit_example.rds", package = "PACE"))
small <- compactFit(fit)
c(before = object.size(fit), after = object.size(small)) |> format(units = "MB")
#> before after
#> "7086784" "7086784"
