Bioconductor / RaggedExperiment

Matrix-like representations of mutation and CN data
https://bioconductor.org/packages/RaggedExperiment
4 stars 3 forks source link

length returns 1 #3

Closed LiNk-NY closed 6 years ago

LiNk-NY commented 7 years ago

Hi Martin, @mtmorgan

In the example:

library(RaggedExperiment)
example("RaggedExperiment")
length(re3)

The length returned is 1. In SummarizedExperiment, length returns the number of rows (odd?). Should this output be accepted for RaggedExperiment?

Considering this to be a matrix representation, length should return something like dim[[1]] * dim[[2]]?

Marcel

mtmorgan commented 7 years ago

yes, length(<S4Object>) is 1 by default; I agree it should be prod(dim). Thanks Marcel

lawremi commented 7 years ago

That would only make sense if it were modeled as a vector. Ordinary R matrices expose their vector implementation and support length() and x[i], but that drops them to a vector. Do you really want to mimic that behavior, i.e., what would x[i] do? What is the i'th element of a RE?

LiNk-NY commented 7 years ago

Hi Michael, @lawremi

That's a good question.

x[i] represents a subset of the i'th rows in a features by samples representation. Actually, it doesn't follow the matrix contract closely because you get an endomorphic subset of the rows rather than the first element of this vector ([1, 1]) when doing x[1].

Marcel

lawremi commented 7 years ago

In that case, it should behave like SummarizedExperiment and return the number of rows. It's effectively a vector of rows. A bit weird, but that's how many of our classes behave. I often wonder whether that confuses users.