meta_analysis: Meta-analysis across multiple studies

View source: R/meta_analysis.R

meta_analysisR Documentation

Meta-analysis across multiple studies

Description

Meta-analysis across multiple studies

Usage

meta_analysis(
  x,
  method = "FE",
  group = c("ID", "assay"),
  control = list(maxiter = 2000)
)

Arguments

x

data.frame rbind'ing results across genes, cell types and datasets

method

meta-analysis method. Values are fed into metafor::rma(), except for 'RE2C' which calls remaCor::RE2C().

group

colums in x to group by. For results from dreamlet::topTable(), results are aggregrated by gene and cell type (i.e. 'ID' and 'assay'). If x is not from this function, this argument allows the function to group results properly

control

passed to rma(..,control)

Details

  • 'FE': fixed effects meta-analysis

  • 'REML': random effects meta-analysis

  • 'RE2C': joint testing of fixed and random effects

Examples

library(dreamlet)
library(muscat)

data(example_sce)

# create pseudobulk for each sample and cell cluster
pb <- aggregateToPseudoBulk(example_sce,
  assay = "counts",
  cluster_id = "cluster_id",
  sample_id = "sample_id",
  verbose = FALSE
)

# voom-style normalization
# just 'CD14+ Monocytes' for speed
res.proc <- processAssays(pb, ~group_id, assays = "CD14+ Monocytes")

# dreamlet
res.dl <- dreamlet(res.proc, ~group_id)

tab1 <- topTable(res.dl, coef = "group_idstim", number = Inf)
tab1$Dataset <- "1"

# Results from a second cohort
# Here, just a copy of the same results for simplicity
tab2 <- tab1
tab2$Dataset <- "2"

# rbind
tab_combined <- rbind(tab1, tab2)

# Perform fixed effects meta-analysis
res <- meta_analysis(tab_combined, method = "FE")

res[1:3, ]

GabrielHoffman/dreamlet documentation built on May 20, 2024, 2:05 p.m.