Closed mjsteinbaugh closed 4 years ago
Is there a practical reason for this? I don't feel any particular need to follow DESeq2's conventions, and restricting to numeric
will require an additional method to set NULL
.
Here's why I think this would be practical, and setting a separate NULL
method is worth it. Currently, you can do operations like this, which make no sense to me:
sizeFactors(sce) <- "XXX"
head(sizeFactors(sce))
## [1] "XXX" "XXX" "XXX" "XXX" "XXX" "XXX"
Also, from the ANY
method it's not immediately obvious that you can set the sizeFactors as NULL
using the assignment method, which isn't always the case for certain S4 generics.
I'd be surprised if anyone actually did set sizeFactors
to a character vector, but I suppose it's better to be safe than sorry.
The counter-argument against restricting to numeric
is that it prevents people from storing size factors in numeric-like S4 vectors, e.g., run-length encodings. However, this is an unlikely use case given that the size factors don't take much memory to store anyway.
I can't say I'm thrilled with the break from the existing coding style, but if you add a NULL
method I will accept this and clean it up later.
I think you're right that it may be better to keep it as is to support S4 numerics like Rle
, in case the matrices start to get really large or have repetitive size factor values. I'll close this for now -- it was just something I came across when unit testing my code and figured we could tighten up a bit. Thanks!
I'm still up for this, I don't really think that anyone will be storing size factors as anything other than numeric vectors.
Can we restrict the default
sizeFactors<-
assignment method to usenumeric
rather thanANY
? This follows the conventions used in DESeq2.Note that I didn't update the roxygen documentation and NAMESPACE in this pull request.