Skip to content

Instantly share code, notes, and snippets.

@diazdc
Created January 7, 2020 23:48
Show Gist options
  • Save diazdc/a8a169423c3f760f50361d7a1714e8dc to your computer and use it in GitHub Desktop.
Save diazdc/a8a169423c3f760f50361d7a1714e8dc to your computer and use it in GitHub Desktop.
Print Seurat object slot sizes in MB
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