Skip to content

Suggestion: Add model saving capabilities to R implementation #8

@wmacnair

Description

@wmacnair

Hi

I tried saving a Rcpp_SlalomModel object in an RData file, and found out that C++ pointer problems mean that it doesn't work when you then try to reload it.

I appreciate that addResultsToSingleCellExperiment allows you to record some of the results, but (a) it doesn't save them all and (b) you can't use the updated sce object as an input to e.g. plotTerms.

My workaround was the following code:

cpp_names 		= ls( envir=slalom_model@.xData )
slalom_list 		= lapply(cpp_names, function(x) slalom_model[[x]])
names(slalom_list) 	= cpp_names

plus commenting out

if (!methods::is(object, "Rcpp_SlalomModel")) 
    stop("object must be of class Rcpp_SlalomModel")

in topTerms, plotTerms etc.

I would find it helpful to have some similar save capability, plus making the plotting/topterms functions work with either an Rcpp_SlalomModel object or a saved list / appropriate other data structure. Being able to save model outputs is especially important when you're dealing with large numbers of cells, and trying out lots of factors...

Thanks for all the work on the package!
Will

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions