feature_percent: Proportion of features

View source: R/Functions.R

feature_percentR Documentation

Proportion of features

Description

Check the Proportion of positive cells (default: expression above 0) in certain clusters

Usage

feature_percent(
  seu,
  feature,
  ident = NULL,
  group.by = NULL,
  DefaultAssay = "RNA",
  above = 0,
  total = F,
  if.expressed = F,
  min.pct = 0.1
)

Arguments

seu

Seurat object

feature

Features to plot (gene expression, metrics, PC scores, anything that can be retreived by FetchData)

ident

cluster name, Default: all clusters

group.by

A variable name in meta.data to group by, if you don't want to use default Idents of Seurat object

DefaultAssay

Assay to use, Default: 'RNA'

above

Above which value will be considered as positive cell, Default: 0

total

If to calculate proportion in total cells of selected clusters, Default: F

if.expressed

If only return logical value, Default: F

min.pct

Minimum fraction of min.pct cells in the cluster will be considered "expressed", only use this parameter when "if.expressed" is set to TRUE. Default: 0.1

Details

None.

Value

A matrix

Examples

genes <- VariableFeatures(pbmc)[1:10]

feature_percent(pbmc, feature = genes)

# Count one cell as positive only the expression is above 2
feature_percent(pbmc, feature = genes, above = 2)

# Only check subset of clusters
feature_percent(pbmc, feature = genes, ident = c("B cell", "CD8 T cell"))

# Group by a different variable
feature_percent(pbmc, feature = genes, group.by = "orig.ident")

# Also check the proportion of expressed cells in total clusters
feature_percent(pbmc, feature = genes, total = T)

# only show logical value; 'TRUE' if more than 20% cells are positive
feature_percent(pbmc, feature = genes, if.expressed = T, min.pct = 0.2)


huayc09/SeuratExtend documentation built on July 15, 2024, 6:22 p.m.