RGLab / MAST

Tools and methods for analysis of single cell assay data in R
226 stars 57 forks source link

zlm() still depends on SingleCellAssay #91

Closed uhlitz closed 6 years ago

uhlitz commented 6 years ago

When running zlm() on a SingleCellExperiment object, I get

`sce` must inherit from `data.frame` or `SingleCellAssay`

MAST version: 1.7.0

gfinak commented 6 years ago

Here is the class definition for a SingleCellAssay:

setClass('SingleCellAssay', contains='SingleCellExperiment',
         slots=list(cmap='character', fmap='character'),
         prototype=list(cmap=Mandatory_Cellvars,
                        fmap=Mandatory_Featurevars))

It inherits from a SingleCellExperiment, but MAST must be run on a SingleCellAssay object, so you have to create one from your SingleCellExperiment. I'm just looking at the code and I'm not sure @amcdavid has provided such a constructor? To do this you would do something like:

sce = new("SingleCellAssay",mySummarizedExperimentObject)

and then proceed to fill in the slots of sce that are unique to it.

We'll get an appropriate constructor into the code if it's indeed missing.

amcdavid commented 6 years ago

Yeah, we do either have:

The SingleCellAssay class has had different behaviors over the years, but now only serves to sanity check that log-scale data is in some slot of the assay, and to preferentially use thresholded data if that is available. So it might be argued that we could drop the dependency, but I think the more forward-compatible change is for the moment, add the constructor/coercion method. I'll do that.

uhlitz commented 6 years ago

I see, but would you consider to entirely transition your package to the SingleCellExperiment class (for BioConductor compatibility) and do the sanity checking independent of that?

amcdavid commented 6 years ago

Yes, I think that is worth considering. This will have rather far-reaching implications, so the moment, I'm more inclined to introduce the wrapper and associated API. Later if we realize that it's superfluous we can turn it into a no-op. That's a smaller change than giving up all chance at abstraction.

Do you have a use case where making a coercion poses a barrier?

uhlitz commented 6 years ago

92 might be an example. But it might be solved by using an appropriate constructor instead of just pretending a SingleCellExperiment to be a SingleCellAssay.

amcdavid commented 6 years ago

Closed in ba5f0b3b35cbaeb03a7d3ee10aa5735b64aa341f with SceToSingleCellAssay()