hesselberthlab / scrunchy

R toolkit for the analysis of single-cell functional heterogeneity
https://scrunchy.hesselberthlab.org/
Other
2 stars 3 forks source link

Sparse matrices #9

Closed jayhesselberth closed 6 years ago

jayhesselberth commented 6 years ago

Should we use slam instead of Matrix for sparse matrices? Sparse matrices in slam are (can be?) smaller.

http://www.johnmyleswhite.com/notebook/2011/10/31/using-sparse-matrices-in-r/

kriemo commented 6 years ago

My preference would be to use Matrix as it is a more commonly used format and it seems that the slam format isn't appreciably smaller for these data types.

library(Seurat)
library(slam)

# sparseMatrix from Matrix
print(object.size(Seurat::pbmc_small@raw.data), unit = "Kb")
#> 91.3 Kb

slam_mat <- as.simple_triplet_matrix(Seurat::pbmc_small@raw.data)

# sparseMatrix from slam
print(object.size(slam_mat), unit = "Kb")
#> 91.1 Kb

Created on 2018-11-07 by the reprex package (v0.2.1)

jayhesselberth commented 6 years ago

Got it.

PS Nice headshot!