PctCellsAboveX: Percentage of Cells Above Threshold

View source: R/Seurat.Utils.Visualization.R

PctCellsAboveXR Documentation

Percentage of Cells Above Threshold

Description

This function calculates the percentage of cells above a specified threshold for a given feature in a Seurat object. It can subset the data based on a specified identity and values.

Usage

PctCellsAboveX(
  obj = combined.obj,
  feature = "TOP2A",
  ident = GetNamedClusteringRuns(obj = obj, v = FALSE)[1],
  threshold = 2,
  suffix = ppp(substitute_deparse(obj), ncol(obj), "thr", threshold),
  box = FALSE,
  ident.box = NULL,
  subset_ident = NULL,
  subset_values = NULL,
  omit.na = TRUE,
  assay = "RNA",
  plot = TRUE,
  caption = NULL,
  ylab = "% cells above threshold",
  ...
)

Arguments

obj

A Seurat object. Default: combined.obj.

feature

The feature to evaluate.

ident

The identity class to split the data by. Default: GetNamedClusteringRuns(obj)1.

threshold

The threshold value to evaluate the feature against. Default: 2.

box

Logical value indicating whether to plot the boxplot. Default: TRUE.

subset_ident

The identity class to subset the data by. Default: NULL.

subset_values

The values of the identity class to keep in the subset. Default: NULL.

omit.na

Logical value indicating whether to omit NA values. Default: TRUE.

assay

The assay to use for feature extraction. Default: 'RNA'.

plot

Logical value indicating whether to plot the results. Default: TRUE.

ylab

The label for the y-axis of the plot. Default: "% cells above threshold".

...

Additional parameters to pass to the plotting function.

box.ident

The identity class to split the data by for individual dots in the boxplot. Ident will be used for the boxes displayed (matching the barplot). Default: NULL.

Value

A named vector with the percentage of cells above the threshold for each identity class.

Examples

## Not run: 
PctCellsAboveX(obj = seurat_object, feature = "GeneA", ident = "CellType", threshold = 1.5)

## End(Not run)

vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.