View source: R/Seurat.Utils.Metadata.R
calculateAverageMetaData | R Documentation |
Computes specified metrics (e.g., median, mean) for given metadata features across each category defined by an identity column in a Seurat object's metadata. This function allows for flexible metric calculation on specified features, providing insights into the data distribution.
calculateAverageMetaData(
obj = combined.obj,
meta.features = c("nFeature_RNA", "percent.ribo", "percent.mito"),
ident = GetClusteringRuns()[1],
metrics = list(median = median, mean = mean),
verbose = TRUE,
max.categ = 30
)
obj |
A Seurat object containing metadata to be analyzed. Defaults to |
meta.features |
A character vector specifying which metadata features to calculate metrics for. Defaults to c("nFeature_RNA", "percent.ribo", "percent.mito"). |
ident |
The name of the identity column used to group the data before calculating metrics.
The default is the second entry from |
metrics |
A list of named metrics to calculate for the metadata features, where names are the metric names (e.g., 'median', 'mean') and values are the corresponding functions. Defaults to list('median' = median, 'mean' = mean). |
verbose |
Logical flag indicating whether to print detailed information about the metrics calculation process. Defaults to TRUE. |
max.categ |
max number of groups in ident. |
A list containing data frames with calculated metrics for each specified metadata feature, grouped by the identity categories. Each data frame corresponds to one of the specified metrics.
# Assuming `combined.obj` is a Seurat object with relevant metadata columns:
results <- calculateAverageMetaData(
obj = combined.obj,
meta.features = c("nFeature_RNA", "nCount_RNA"),
metrics = list("median" = median, "mean" = mean),
verbose = TRUE
)
# This will return a list with data frames containing the median and mean
# of "nFeature_RNA" and "percent.ribo" for each category in "ident_column_name".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.