average_clusters_rowwise {colorrepel} | R Documentation |
Rowwise math from matrix/data.frame per cluster based on another vector/metadata, similar to clustifyr::average_clusters but ids as rows
Description
Rowwise math from matrix/data.frame per cluster based on another vector/metadata, similar to clustifyr::average_clusters but ids as rows
Usage
average_clusters_rowwise(
mat,
metadata,
cluster_col = "cluster",
if_log = FALSE,
cell_col = NULL,
low_threshold = 0,
method = "mean",
output_log = FALSE,
cut_n = NULL,
trim = FALSE
)
Arguments
mat |
expression matrix |
metadata |
data.frame or vector containing cluster assignments per cell. Order must match column order in supplied matrix. If a data.frame provide the cluster_col parameters. |
cluster_col |
column in metadata with cluster number |
if_log |
input data is natural log, averaging will be done on unlogged data |
cell_col |
if provided, will reorder matrix first |
low_threshold |
option to remove clusters with too few cells |
method |
whether to take mean (default), median, 10% truncated mean, or trimean, max, min |
output_log |
whether to report log results |
cut_n |
set on a limit of genes as expressed, lower ranked genes are set to 0, considered unexpressed |
trim |
whether to remove 1 percentile when doing min caluculation |
Value
average expression matrix, with genes for row names, and clusters for column names
Examples
mat <- average_clusters_rowwise(data.frame(y = c(1, 2, 3, 4, 5, 6),
x = c(1, 2, 3, 4, 5, 6)), metadata = c(1, 2, 1, 2, 1, 2), method = "min")