
Calculate the number of possible group combinations
Source:R/countCombinations.R
countCombinations.RdGiven two groups of replicates, this function calculates the number of unique
ways to divide the replicates into two groups while preserving group sizes.
The formula is: C = n!/(k!(n-k)!). (see base function choose)
Usage
countCombinations(
object = NULL,
metadata = NULL,
replicate_labels = NULL,
group_labels = NULL,
use_cells = NULL,
n_replicates = NULL,
n_group1 = NULL
)Arguments
- object
An optional 'Seurat' or 'SingleCellExperiment' object. If
NULL,countCombinationswill expect either (1) vector input to parametersreplicate_labelandgroup_labelor (2) numeric input to parametersn_replicatesandn_group1.- metadata
An optional dataframe containing relevant metadata columns corresponding to the data provided to parameter
object. Default =NULLlooks for metadata inobjector other provided inputs.- replicate_labels
A string indicating the name of the metadata column containing the biological replicate labels or a character vector containing the biological replicate labels in order.
- group_labels
A string indicating the name of the column containing the two comparison group labels or a character vector containing the comparison labels in order.
- use_cells
A vector of cell names to subset prior to calculating possible group comibinations. Default =
NULLwill use all cells.- n_replicates
A numeric value indicating the total number of replicates. Defaults to
NULL.- n_group1
A numeric value indicating the number of replicates in one group (doesn't matter which). Defaults to
NULL.
Details
Users may provide input in three ways:
(1) A vector of replicate labels and a vector of group labels (in order)
(2) The total number of replicates (n) and the number of replicates in one group (k) (doesn't matter which group).
(3) Column names indicating replicate and group metadata columns in a provided 'Seurat' or 'SingleCellExperiment' object or a provided metadata dataframe.