const-ae / const-ae/transformGamPoi
estimate_size_factors with poscounts fails for dgCMatrix
- Dominant language
- R
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Hi Constantin,
since there is no `colMedians()` method for `dgeMatrix` objects, I get the following error from `MatrixGenerics`
```
Error in MatrixGenerics:::.load_next_suggested_package_to_search(x) :
Failed to find a colMedians() method for dgeMatrix objects.
```
Casting to `matrix` somewhere around
https://github.com/const-ae/transformGamPoi/blob/d408b11e728fa44805a52ad9aa059b54f6b195a4/R/helpers.R#L126-L131
should fix the issue.
Best,
Christoph
Reproducible example:
```
set.seed(42)
counts <- scales::squish(x = rpois(n = 200, lambda = 3) - 3, range = c(0, Inf))
counts <- Matrix::Matrix(data = counts, nrow = 10, ncol = 20)
sf <- transformGamPoi:::estimate_size_factors(Y = counts, method = 'poscounts')
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.