Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downsampleMatrix returns sparse when it should return dense result #32

Open
mschubert opened this issue Oct 1, 2024 · 3 comments
Open

Comments

@mschubert
Copy link

The ?scuttle::downsampleMatrix documentation states:

By default, the output format will be a dense matrix for an ordinary matrix ‘x’, and a sparse matrix for any sparse format (i.e., if ‘is_sparse(x)’ returns ‘TRUE’).

However, I get a sparse result for a dense input in scuttle_1.14.0:

scuttle::downsampleMatrix(matrix(1000), prop=0.5)
# 1 x 1 sparse Matrix of class "dgCMatrix"
#
# [1,] 500

It seems that either the behavior or the documentation is wrong here.

@LTLA
Copy link
Owner

LTLA commented Oct 1, 2024

The documentation I see in ?downsampleMatrix is

An numeric matrix-like object of downsampled counts. This is a dgCMatrix unless ‘sink’ is set, in which case it is a DelayedMatrix.

Session info
R version 4.4.1 Patched (2024-06-20 r86796)
Platform: aarch64-apple-darwin22.6.0
Running under: macOS Ventura 13.6.9

Matrix products: default
BLAS:   /Users/luna/Software/R/R-4-4-branch/lib/libRblas.dylib
LAPACK: /Users/luna/Software/R/R-4-4-branch/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
 [1] scuttle_1.15.4              SingleCellExperiment_1.27.2
 [3] SummarizedExperiment_1.35.2 Biobase_2.65.1
 [5] GenomicRanges_1.57.1        GenomeInfoDb_1.41.1
 [7] IRanges_2.39.2              S4Vectors_0.43.2
 [9] BiocGenerics_0.51.2         MatrixGenerics_1.17.0
[11] matrixStats_1.4.1

loaded via a namespace (and not attached):
 [1] crayon_1.5.3            httr_1.4.7              UCSC.utils_1.1.0
 [4] jsonlite_1.8.9          DelayedArray_0.31.12    grid_4.4.1
 [7] abind_1.4-8             compiler_4.4.1          codetools_0.2-20
[10] Rcpp_1.0.13             XVector_0.45.0          BiocParallel_1.39.0
[13] lattice_0.22-6          R6_2.5.1                SparseArray_1.5.41
[16] parallel_4.4.1          GenomeInfoDbData_1.2.13 Matrix_1.7-0
[19] tools_4.4.1             beachmat_2.21.6         zlibbioc_1.51.1
[22] S4Arrays_1.5.9

@mschubert
Copy link
Author

@LTLA
Copy link
Owner

LTLA commented Oct 1, 2024

Looks like that part of the documentation didn't get updated in 5b2ce63. Perhaps you can put together a PR with the fix, otherwise I'll get to it when I have some spare time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants