calc.cluster.averages: calc.cluster.averages

View source: R/Seurat.Utils.R

calc.cluster.averagesR Documentation

calc.cluster.averages

Description

Calculates the average of a metadata column (numeric) per cluster.

Usage

calc.cluster.averages(
  col_name = "Score.GO.0006096",
  plot.UMAP.too = TRUE,
  return.plot = FALSE,
  obj = combined.obj,
  split_by = GetNamedClusteringRuns()[1],
  scale.zscore = FALSE,
  simplify = TRUE,
  plotit = TRUE,
  histogram = FALSE,
  nbins = 50,
  suffix = NULL,
  stat = c("mean", "median")[2],
  quantile.thr = 0.9,
  absolute.thr = FALSE,
  filter = c(FALSE, "above", "below")[1],
  ylab.text = paste("Cluster", stat, "score"),
  title = paste("Cluster", stat, col_name),
  prefix.cl.names = FALSE,
  report = TRUE,
  subtitle = NULL,
  width = 8,
  height = 6,
  ...,
  xlb = if (absolute.thr) {
     paste("Threshold at", absolute.thr)
 } else {
    
    paste("Black lines: ", kppd(Stringendo::percentage_formatter(c(1 - quantile.thr,
    quantile.thr))), "quantiles |", "Cl. >",
    Stringendo::percentage_formatter(quantile.thr), "are highlighted. |", split_by)
 },
  fname = ppp(col_name, split_by, "cluster.average.barplot.pdf", ...)
)

Arguments

col_name

The name of the column for which the average is calculated. Default: 'Score.GO.0006096'.

plot.UMAP.too

Whether to plot a UMAP as well. Default: TRUE.

return.plot

Whether to return the plot. Default: FALSE.

obj

The main Seurat object used for calculations. Default: combined.obj.

split_by

Cluster to split by. Default: First entry of GetNamedClusteringRuns().

scale.zscore

Whether to scale z-scores. Default: FALSE.

simplify

Whether to simplify the result. Default: TRUE.

plotit

Whether to plot the results. Default: TRUE.

histogram

Whether to produce a histogram. Default: FALSE.

nbins

The number of bins for the histogram. Default: 50.

suffix

Suffix added to the filename. Default: NULL.

stat

Statistical method applied, "mean" or "median". Default: "median".

quantile.thr

The threshold for quantiles. Default: 0.9.

absolute.thr

Absolute threshold used in computations. Default: FALSE.

filter

The filter mode: 'above', 'below', or FALSE. Default: FALSE.

ylab.text

Text for the y-axis label. Default: "Cluster" followed by the statistical method and "score".

title

Title for the plot. Default: "Cluster" followed by the statistical method and column name.

subtitle

The subtitle for the plot. Default: NULL.

width

The width of the plot. Default: 8.

height

The height of the plot. Default: 6.

...

Additional parameters passed to the internally called functions.

xlb

The label for the x-axis. Default depends on the 'absolute.thr' parameter.

fname

The filename for the plot. Default: based on column name and split_by value.


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