GSVA icon indicating copy to clipboard operation
GSVA copied to clipboard

reconsider S4 class hierarchy

Open axelklenk opened this issue 1 year ago • 0 comments

Along with the new object-oriented API a class union GsvaExprData was created for storing various expression data objects within parameter objects. Among others, classes SummarizedExperiment and SingleCellExperiment are part of this union and SpatialExperiment has recently been added in a dedicated branch.

Since SpatialExperiment inherits from SingleCellExperiment and SingleCellExperiment inherits from SummarizedExperiment, it would be desirable to reuse S4 methods for SummarizedExperiments on instances of the derived classes. Otherwise numerous methods for SummarizedExperiment will need to have identical definitions for SingleCellExperiment and SpatialExperiment as well as potential future class union members. However, with the current definition of the class union, S4 dispatches to GsvaExprData (instead of SummarizedExperiment) methods (AFAIU) because the derived classes are part of the class union.

Removing e.g. SingleCellExperiment from GsvaExprData solves this and SummarizedExperiment methods will be applied to SingleCellExperiment objects as expected while GsvaExprData can still be used for storage in parameter objects. Unfortunately, a number of new issues with method dispatch arises as a consequence of this change, in particular with methods show() and wrapData() and maybe more as yet undetected.

Hence, can we get this to work as expected and is it worth the effort?

axelklenk avatar Apr 02 '24 07:04 axelklenk