Aggregate rows of a matrix for many:1 mappings, using a grouping vector.

aggregate_rows(
  X,
  groupings,
  agg_fun = "sum",
  agg_method = c("monocle3", "stats"),
  as_sparse = TRUE,
  as_DelayedArray = TRUE,
  dropNA = TRUE,
  verbose = TRUE
)

Source

data("exp_mouse_enst") X <- exp_mouse_enst gene_map <- map_genes(genes = rownames(X),species = "mouse") X_agg <- orthogene:::aggregate_rows(X = X, groupings = gene_map$name) sum(duplicated(rownames(exp_mouse))) # 0 sum(duplicated(rownames(X))) # 1215 sum(duplicated(rownames(X_agg))) # 0

Arguments

X

Input matrix.

groupings

Gene groups of the same length as nrow(X).

agg_fun

Aggregation function.

agg_method

Aggregation method.

as_sparse

Convert aggregated matrix to sparse matrix.

as_DelayedArray

Convert aggregated matrix to DelayedArray.

dropNA

Drop genes assigned to NA in groupings.

verbose

Print messages.

Value

Aggregated matrix