% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run_exposure_omics_association.R
\name{run_exposure_omics_association}
\alias{run_exposure_omics_association}
\title{Run Exposure-Omics Association}
\usage{
run_exposure_omics_association(
  exposomicset,
  exposures = NULL,
  exp_name = NULL,
  covariates = NULL,
  scaling_method = "none",
  correction_method = "fdr",
  top_pct = NULL,
  filter_by = c("variance", "mean"),
  action = "add"
)
}
\arguments{
\item{exposomicset}{A \code{MultiAssayExperiment} object containing exposome
and omics data.}

\item{exposures}{Character vector of exposure variable names to test.
If \code{NULL}, uses all variables from the codebook.}

\item{exp_name}{Name(s) of the omics assay(s) to test against. If \code{NULL},
uses all assays.}

\item{covariates}{Optional character vector of covariate names to include
in the model.}

\item{scaling_method}{Character. Scaling method to apply before modeling.
Options include \code{"none"} (default).}

\item{correction_method}{Method for p-value adjustment. Default is \code{"fdr"}.}

\item{top_pct}{Top X\% of features to retain using either mean or variance
which is specified by \code{filter_by}. If \code{NULL}, no features will be filtered.}

\item{filter_by}{Determination of how to filter omics features either by
mean or variance.}

\item{action}{If \code{"add"} (default), saves results to metadata,
if \code{"get"}, returns results as a data frame.}
}
\value{
If \code{action = "add"}, returns updated \code{MultiAssayExperiment}.
Otherwise, returns a tibble with association results.
}
\description{
Test associations between each exposure and each omics feature using
limma's linear modeling framework.
}
\details{
This function uses limma to test associations between multiple exposures
and omics features. For each exposure, a linear model is fit with the
exposure as the predictor and each omics feature as the outcome,
adjusting for covariates.

\code{omics_feature ~ exposure + covariate1 + covariate2 + ...}
}
\examples{
# create example data
mae <- make_example_data(
    n_samples = 10,
    return_mae = TRUE
)

# run exposure-omics association
mae <- mae |>
    run_exposure_omics_association(
        exposures = c("exposure_pm25", "exposure_no2"),
        covariates = c("age", "sex")
    )

}
