Created
January 7, 2020 23:48
-
-
Save diazdc/a8a169423c3f760f50361d7a1714e8dc to your computer and use it in GitHub Desktop.
Print Seurat object slot sizes in MB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SeuratObjSize <- function(seurat_obj) { | |
all_slots <- slotNames(seurat_obj) | |
for (i in seq_along(all_slots)) { | |
obj_size <- object.size(slot(seurat_obj, all_slots[i])) | |
print(all_slots[i]) | |
print(obj_size, units = "MB") | |
cat("\n") | |
} | |
assay_names <- names(seurat_obj@assays) | |
for (i in seq_along(assay_names)) { | |
assay_size <- object.size(seurat_obj@assays[assay_names[i]]) | |
print(assay_names[i]) | |
print(assay_size, units = "MB") | |
cat("\n") | |
} | |
} | |
SeuratObjSize(seurat_obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment