count_cells: Count cells in Seurat object.

Description Usage Arguments Value Examples

View source: R/convenience_funcs.R

Description

count_cells returns a tibble with counts.

Usage

1
count_cells(seurat_object, group_by_var, subgroup_var)

Arguments

seurat_object

Seurat object.

group_by_var

A character value for grouping the cells. Must correspond to a column in Seurat@meta.data.

subgroup_var

Optional parameter. A character value for sub-groups within each group. Must correspond to a column in Seurat@meta.data.

Value

Tibble with cell counts and percentages. If subgroup_var is provided, percentages are calculated from the sub-groups making up groups; otherwise, percentages are calculated from the total cell count across the groups.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# load example dataset from Seurat
data("pbmc_small", package="Seurat")

# Count group-sub-group combinations and calculate % of sub-groups making up groups.
count_cells(pbmc_small, "groups", "RNA_snn_res.0.8")

# Count groups and calculate % of the total that each group consists of.
count_cells(pbmc_small, "groups")

## Not run: 
count_cells(pbmc_small)

## End(Not run)

genomics-kl/seurathelpeR documentation built on Nov. 4, 2019, 1:04 p.m.