You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It makes sense to me to move the following generics (and methods) from DelayedArray to DelayedMatrixStats:
colMaxs()
colMins()
colRanges()
rowMaxs()
rowMins()
The obvious complication of moving these is that any users of these generics and methods would have to update their code accordingly (but I doubt there are many). It would, however, tidy things up somewhat and slightly simplify ongoing development.
The complicated one
The final generic is:
rowRanges()
This is more complicated because it is a generic that is serving 2 very distinct use cases:
Get the row-ranges of a SummarizedExperiment-based object
Compute the row-wise ranges of a matrix-like object
This is something we're stuck with. The S4 generic should remain where it is to avoid having SummarizedExperiment depend upon DelayedMatrixStats . It also must have a slightly different signature to the rest of the methods due to this dual role; compare rowRanges() to colRanges()
suppressPackageStartupMessages(library(DelayedMatrixStats))
rowRanges#> standardGeneric for "rowRanges" defined from package "DelayedArray"#> #> function (x, ...) #> standardGeneric("rowRanges")#> <environment: 0x7fe2e9354958>#> Methods may be defined for arguments: x#> Use showMethods("rowRanges") for currently available ones.colRanges#> standardGeneric for "colRanges" defined from package "DelayedArray"#> #> function (x, rows = NULL, cols = NULL, na.rm = FALSE, dim. = dim(x), #> ...) #> standardGeneric("colRanges")#> <environment: 0x7fe2e7e3ee00>#> Methods may be defined for arguments: x#> Use showMethods("colRanges") for currently available ones.
S4 methods
Each of these S4 generics from DelayedArray have a ANY-method implemented. This is in contrast to what I have elected to do for the generics defined in DelayedMatrixStats: I specifically implemented a matrix-method but no ANY-method. E.g., compare the following
suppressPackageStartupMessages(library(DelayedMatrixStats))
# Has an ANY-method
showMethods("colRanges")
#> Function: colRanges (package DelayedArray)#> x="ANY"#> x="DelayedMatrix"# Has a matrix-method instead of an ANY-method
showMethods("colMedians")
#> Function: colMedians (package DelayedMatrixStats)#> x="DelayedMatrix"#> x="matrix"
The ANY-method of these generics are the correspondingly named matrixStats functions. Now, the matrixStats functions of the same names do check their inputs, so will error if given, say, a data frame. However, the real reason I took great pains to avoid introducing an ANY-method for the S4 generics defined in DelayedMatrixStats is because of the way I have implemented S4 dispatch based on the seed of the DelayedMatrix object - when an appropriate method does not exist for the seed, then the default 'block-processing' method is used. If an ANY-method exists, however, then there always exists a method for the seed but it is (erroneously) the corresponding function from matrixStats, which obviously only works with matrix objects.
Summary
I need to discuss these issues with members of the Bioconductor core team.
The text was updated successfully, but these errors were encountered:
There are several generics and methods already implemented in DelayedArray that 'belong' in DelayedMatrixStats; see https://github.com/PeteHaitch/DelayedMatrixStats/blob/master/README.md and note that I'm using 'belong' loosely here.
S4 generics
The simple ones
It makes sense to me to move the following generics (and methods) from DelayedArray to DelayedMatrixStats:
colMaxs()
colMins()
colRanges()
rowMaxs()
rowMins()
The obvious complication of moving these is that any users of these generics and methods would have to update their code accordingly (but I doubt there are many). It would, however, tidy things up somewhat and slightly simplify ongoing development.
The complicated one
The final generic is:
rowRanges()
This is more complicated because it is a generic that is serving 2 very distinct use cases:
This is something we're stuck with. The S4 generic should remain where it is to avoid having SummarizedExperiment depend upon DelayedMatrixStats . It also must have a slightly different signature to the rest of the methods due to this dual role; compare
rowRanges()
tocolRanges()
S4 methods
Each of these S4 generics from DelayedArray have a
ANY-method
implemented. This is in contrast to what I have elected to do for the generics defined in DelayedMatrixStats: I specifically implemented amatrix-method
but noANY-method
. E.g., compare the followingThe
ANY-method
of these generics are the correspondingly named matrixStats functions. Now, the matrixStats functions of the same names do check their inputs, so will error if given, say, a data frame. However, the real reason I took great pains to avoid introducing anANY-method
for the S4 generics defined in DelayedMatrixStats is because of the way I have implemented S4 dispatch based on the seed of the DelayedMatrix object - when an appropriate method does not exist for the seed, then the default 'block-processing' method is used. If anANY-method
exists, however, then there always exists a method for the seed but it is (erroneously) the corresponding function from matrixStats, which obviously only works with matrix objects.Summary
I need to discuss these issues with members of the Bioconductor core team.
The text was updated successfully, but these errors were encountered: