Perform gene set analysis on the result of differential expression using linear (mixed) modeling with `variancePartition::dream`

by considering the correlation between gene expression traits. This package is a slight modification of `limma::camera`

to 1) be compatible with dream, and 2) allow identification of gene sets with log fold changes with mixed sign.

## Usage

```
zenith(
fit,
coef,
index,
use.ranks = FALSE,
allow.neg.cor = FALSE,
progressbar = TRUE,
inter.gene.cor = 0.01
)
```

## Arguments

- fit
result of differential expression with dream

- coef
coefficient to test using

`topTable(fit, coef)`

- index
an index vector or a list of index vectors. Can be any vector such that

`fit[index,]`

selects the rows corresponding to the test set. The list can be made using`ids2indices`

.- use.ranks
do a rank-based test (

`TRUE`

) or a parametric test ('FALSE')?- allow.neg.cor
should reduced variance inflation factors be allowed for negative correlations?

- progressbar
if TRUE, show progress bar

- inter.gene.cor
if NA, estimate correlation from data. Otherwise, use specified value

## Value

`NGenes`

: number of genes in this set`Correlation`

: mean correlation between expression of genes in this set`delta`

: difference in mean t-statistic for genes in this set compared to genes not in this set`se`

: standard error of`delta`

`p.less`

: p-value for hypothesis test of`H0: delta < 0`

`p.greater`

: p-value for hypothesis test of`H0: delta > 0`

`PValue`

: p-value for hypothesis test`H0: delta != 0`

`Direction`

: direction of effect based on sign(delta)`FDR`

: false discovery rate based on Benjamini-Hochberg method in`p.adjust`

## Details

`zenith`

gives the same results as `camera(..., inter.gene.cor=NA)`

which estimates the correlation with each gene set.

For differential expression with dream using linear (mixed) models see Hoffman and Roussos (2020). For the original camera gene set test see Wu and Smyth (2012).

## References

Hoffman GE, Roussos P (2020).
“dream: Powerful differential expression analysis for repeated measures designs.”
*Bioinformatics*.
doi:10.1093/bioinformatics/btaa687
. Wu D, Smyth GK (2012).
“Camera: a competitive gene set test accounting for inter-gene correlation.”
*Nucleic acids research*, **40**(17), e133.
doi:10.1093/nar/gks461
.

## Examples

```
library(variancePartition)
# simulate meta-data
info <- data.frame(Age=c(20, 31, 52, 35, 43, 45),Group=c(0,0,0,1,1,1))
# simulate expression data
y <- matrix(rnorm(1000*6),1000,6)
rownames(y) = paste0("gene", 1:1000)
colnames(y) = rownames(info)
# First set of 20 genes are genuinely differentially expressed
index1 <- 1:20
y[index1,4:6] <- y[index1,4:6]+1
# Second set of 20 genes are not DE
index2 <- 21:40
# perform differential expression analysis with dream
fit = dream(y, ~ Age + Group, info)
fit = eBayes(fit)
# perform gene set analysis testing Age
res = zenith(fit, "Age", list(set1=index1,set2=index2) )
head(res)
#> NGenes Correlation delta se p.less p.greater PValue
#> set1 20 0.01 -0.3663795 0.2351088 0.1085188 0.8914812 0.2170376
#> set2 20 0.01 0.2763873 0.2352550 0.8375895 0.1624105 0.3248210
#> Direction FDR
#> set1 Down 0.324821
#> set2 Up 0.324821
```