Skip to contents

updateObject() brings a ScMaSigPro object saved by an earlier version of scMaSigPro, for example with saveRDS() or save(), up to date. Call it on such an object after readRDS() or load(), before the next step of the workflow.

Usage

# S4 method for class 'ScMaSigPro'
updateObject(object, ..., verbose = FALSE)

Arguments

object

A ScMaSigPro object.

...

Passed to the updateObject() methods of the Sparse and Dense slots.

verbose

Whether to print a message when the object is updated.

Value

The updated ScMaSigPro object.

Details

Objects saved before the version slot was added (scMaSigPro 0.0.5 and earlier) fail validObject(); updateObject() adds the slot with the version of the package that is running. For every object, the Sparse and Dense slots are passed to the updateObject() method of SingleCellExperiment, and the result is checked with validObject(). A current object, such as one created by this version of the package, is returned unchanged.

Objects saved before the min_counts and min_bins_expressed parameters existed get both set to 0, the values that keep every gene (sc.p.vector() had no such filter then), and the version of the package that is running.

Objects saved before the test parameter existed get it set to "chisq", the test of sc.p.vector() then, and the version of the package that is running.

Objects saved with the log_offset parameter lose it. The fits of an object saved with log_offset = FALSE, the default, used the size factor of each bin as the offset: updateObject() stores the logarithm of the size factors instead, the offset of sc.p.vector() and sc.t.fit(), and warns that the fits in the Profile and Estimate slots were made with the size factors, until sc.p.vector() is run again. The offsets of an object saved with log_offset = TRUE are kept. An object whose fits used no offset, or that was not fitted, keeps no offset: the offsets that an earlier fit left in it, or the zeros of sc.set.poly(), are removed.

Objects fitted with link = "identity" by scMaSigPro 0.0.5 or earlier hold a family labelled with the identity link but with the link functions of the log link, with which their fits were made: updateObject() warns, and sc.t.fit() stops on them, until sc.p.vector() is run again.

Objects binned by scMaSigPro 0.0.4 cannot be updated: their Dense slot is not a valid SingleCellExperiment, and the cell metadata of their Sparse slot may not be in the order of the counts. updateObject() stops with the command that bins the cells of the Sparse slot again with sc.squeeze(); the later steps of the workflow must then be run again.

Author

Priyansh Srivastava spriyansh29@gmail.com

Examples

data("scmp.ob", package = "scMaSigPro")
path <- tempfile(fileext = ".rds")
saveRDS(scmp.ob, path)

# Later, possibly with a newer version of scMaSigPro
ob <- updateObject(readRDS(path))
unlink(path)