drisso / SingleCellExperiment

Clone of the Bioconductor repository for the SingleCellExperiment package, see https://bioconductor.org/packages/devel/bioc/html/SingleCellExperiment.html for the official development version.
63 stars 17 forks source link

Change in reducedDims slot in Bioc 10? #43

Closed hpliner closed 4 years ago

hpliner commented 4 years ago

Hello, I'm a developer for monocle3, which uses SingleCellExperiment as the base of its main data container. Since the update to bioconductor 3.10, some users have been reporting that they get the error: Error in checkSlotAssignment(object, name, value) : ‘reducedDims’ is not a slot in class “SingleCellExperiment”

when attempting to make new cell_data_set objects (monocle3's container) (see https://github.com/cole-trapnell-lab/monocle3/issues/246). I've been working on this for a bit, but I'll admit I'm a bit stumped. Even after matching the session info exactly of users with this error, I wasn't able to reproduce the error on one machine. I was able to reproduce it on the other machine, but strangely, I don't get the error when making a SingleCellExperiment object directly (and the reducedDims slots seem fine). Does anything obvious come to mind on this? Were there any major changes in the export of this object between the Bioc 9 and 10 releases?

I'll keep investigating on my end, but any ideas would be great! Hannah

LTLA commented 4 years ago

If I had to guess, I would say that the affected users should reinstall monocle3.

The underlying cause is that the class definition underwent some changes. The major one is the addition of the altExps() concept to better store alternative feature types (ADTs, CRISPR, spike-ins, etc.). We also simplified the internal definition so that - as you may have guessed - reducedDims is no longer a separate slot.

We modified the getter/setter methods so that they would quietly work with both old and new objects, so as long as users/client packages were using those methods (e.g., reducedDim(), reducedDim<-), they would not be impacted by the change. Any code using @ would break, which is why it shouldn't be used. (Yes, I'm looking at your new_cell_data_set() here. Use initialize() instead. Also note the SCE vignette's instructions on how you can extend an SCE without subclassing.)

Anyway, from examination of some of the tracebacks in the linked issue above, I would guess that S4 hard-codes the class definition during package installation. This means that existing installations of monocle3 would still be using/expecting the old SCE definition, even after updating SingleCellExperiment. If this guess is correct, a simple solution would be to just reinstall monocle3. This would have been done automatically if it was part of the latest BioC release.

mjsteinbaugh commented 4 years ago

@LTLA good call, forcing a reinstall of monocle3 fixes the issue for me.

remotes::install_github("cole-trapnell-lab/monocle3", force = TRUE)
hpliner commented 4 years ago

@LTLA Thanks, that all makes sense. I'll look into ditching the @s in new_cell_data_set as well

LTLA commented 4 years ago

Great. Don't be a stranger, help is right here if you need it.