testGeneComboCountsPairwise: Test for DE gene combinations

Description Usage Arguments Details Value Author(s) Examples

View source: R/testGeneComboCounts.R

Description

Test for differential expression of gene combinations between pairs of groups using Fisher's exact test.

Usage

1

Arguments

counts

A SummarizedExperiment containing cell counts for each gene combination (row) and group (column), such as that produced by countCellsPerGeneCombo. Alternatively, a count matrix containing the same information.

...

Further arguments to pass to combineMarkers.

Details

This performs pairwise tests for differential expression of each gene combination in each group compared to every other group. For each gene combination and for each pair of groups, we construct a 2-by-2 contigency matrix using the number of cells expressing that combination in the two groups. We condition on the total number of cells - see ?countCellsPerGeneCombo for comments on cell count normalization - and then apply a one-sided Fisher's exact test.

Once we obtain p-values and log-odds ratios for all pairwise comparisons, we consolidate them into a ranked list for each group using the combineMarkers function. This provides a convenient per-group summary of the genes upregulated in each group compared to all others. See ?combineMarkers for more details.

Value

A List containing one DataFrame per group. Each row of a DataFrame for a particular group corresponds to a gene combination, ordered by the degree of upregulation of that combination in the current group compared to all other groups. Columns contain the combined p-value across all pairwise comparisons involving the current group as well as the log-odds ratio against each other group.

Author(s)

Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
df <- data.frame(
    cell.id=sample(LETTERS, 30, replace=TRUE),
    v_gene=sample(c("TRAV1", "TRAV2", "TRAV3"), 30, replace=TRUE),
    j_gene=sample(c("TRAJ4", "TRAJ5", "TRAV6"), 30, replace=TRUE)
)

y <- splitDataFrameByCell(df, field="cell.id")
out <- countCellsPerGeneCombo(y, c("v_gene", "j_gene"), 
   group=sample(3, length(y), replace=TRUE))

de <- testGeneComboCountsPairwise(out)
de[[1]]

LTLA/RepertoireUtils documentation built on Feb. 9, 2020, 12:51 p.m.