Make a table of the number of cells for each group in the seurat object
✓ Published0🌍 Public
FFloWuenne
Last edited Mar 8, 2018
Created on Mar 8, 2018
The example builds a data frame of cell counts for each cluster in a Seurat object, broken down by treatment group. It first shows raw cell numbers per group per cluster, then adds normalized proportions relative to each group’s total cell count, making group compositions comparable despite unequal sample sizes. The code uses `Seurat` functions like `SubsetData` and the `@ident` and `@meta.data` slots, alongside `dplyr`’s `select` and `nrow` to count group memberships. It iterates over clusters, appending rows via `rbind`, and finally writes the result to a tab-separated file with `write.table`. The output table directly reveals per-cluster group distributions and their normalized percentages, aiding differential abundance analysis.
AI-generated description