Skip to contents

Perform inverse-variance fixed-effects meta-analysis on two GWAS datasets that have been standardized to the package's expected schema.

Usage

meta_analyze_fe(x, y, ...)

# S3 method for class 'data.frame'
meta_analyze_fe(
  x,
  y,
  keep = c("overlap", "union"),
  allow_swaps = TRUE,
  ...
)

# S3 method for class 'tbl_df'
meta_analyze_fe(
  x,
  y,
  keep = c("overlap", "union"),
  allow_swaps = TRUE,
  ...
)

# S3 method for class 'GWASFormatter'
meta_analyze_fe(
  x,
  y,
  keep = c("overlap", "union"),
  allow_swaps = TRUE,
  ...
)

Arguments

x

A GWASFormatter object, data.frame, or tibble containing standardized GWAS results.

y

A second GWASFormatter object, data.frame, or tibble containing standardized GWAS results.

keep

Output row-set policy. "overlap" (default) keeps only variants present in both studies (intersection). "union" keeps variants present in either study; a variant found in only one study passes through with that study's estimate and N_studies = 1 (and matched_by of "x_only" or "y_only").

allow_swaps

Logical. If TRUE, simple REF/ALT swaps are harmonized by flipping the second study's BETA.

...

Additional arguments passed to methods.

Value

For GWASFormatter inputs, a modified GWASFormatter object whose data contains the meta-analysis result. For eager inputs, a tibble containing the harmonized overlap and fixed-effects summary statistics.

Details

By default (keep = "overlap") only the harmonized intersection of the two studies is returned. With keep = "union", variants present in either study are retained: overlapping variants are meta-analyzed as usual, while a variant seen in only one study passes through with that study's estimate and N_studies = 1. Exact allele matches are used directly. Simple REF/ALT swaps are supported by flipping the second study's BETA. The returned result preserves the package's standard GWAS columns, including CHROM, POS, REF, ALT, ID, BETA, SE, and PVALUE, so it can be used by downstream plotting and annotation functions.

When both inputs are GWASFormatter objects, the harmonization and fixed-effects computation are performed inside DuckDB against the objects' backing tables. Each GWASFormatter now owns its own DuckDB table rather than sharing a single global summary_stats table.

This implementation supports two studies and inverse-variance fixed-effects meta-analysis. For keep = "overlap", variants that cannot be harmonized by exact allele match or simple REF/ALT swap are excluded from the result.