Skip to contents

Perform GLM-based association testing between a specified outcome and features from exposures, omics, latent factors, or GO PCs. Automatically adjusts for covariates and supports both Gaussian and binomial models.

Usage

run_association(
  expomicset,
  outcome,
  source = c("omics", "exposures", "factors", "go_pcs"),
  covariates = NULL,
  feature_set = NULL,
  top_n = NULL,
  family = "gaussian",
  correction_method = "fdr",
  action = "add",
  min_genes = 10,
  feature_col = NULL,
  mirna_assays = NULL,
  print = NULL
)

Arguments

expomicset

A MultiAssayExperiment object containing data and metadata.

outcome

The outcome variable name (must be in colData).

source

Source of features to test. One of "omics", "exposures", "factors", "go_pcs".

covariates

Optional vector of covariate names to include in the model.

feature_set

Optional character vector of exposure or GO terms to test.

top_n

Optional integer: if using omics source, select top n most variable features.

family

GLM family; "gaussian" or "binomial".

correction_method

Method for p-value adjustment (default: "fdr").

action

If "add" (default), saves results to metadata; else returns results as list.

min_genes

Minimum number of genes required to compute GO PCs.

feature_col

If using GO PCs, the column in rowData for matching gene symbols or IDs.

mirna_assays

Optional character vector of assays to exclude when extracting GO terms.

print

Optional variable name to print results for (useful for debugging).

Value

If action = "add", returns updated MultiAssayExperiment. Otherwise, returns a list of:

  • results_df: tidy summary of associations

  • covariates: the covariates used

  • model_data: model matrix used in the GLMs

Examples

if (FALSE) { # \dontrun{
run_association(expomicset, outcome = "BMI", source = "exposures", covariates = c("age", "sex"))
} # }