metsAssoc: Basic metabolomics association analysis.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/metsAssoc.R

Description

This function will run a basic association analysis adjusted for covariates for a given list of metabolites. Depending on the outcome, the function will choose a linear or logistic regression model. It will calculate the associations between outcome and each metabolite, merge with the metadata files, and return an organized table.

Usage

1
metsAssoc(dat, biochem, outcome, metabolites, covariates=NULL, normalize=T)

Arguments

dat

data frame containing your metabolites and covariates

biochem

The biochemical metadata file. Typically this is in the $biochem element of the metabolites list. You can subset this data frame any way you wish, some variables are probably unneeded. Recommend that you subset to only include COMP_ID, BIOCHEMICAL, SUPER_PATHWAY, SUB_PATHWAY.

outcome

Outcome for the analysis. Logistic regression must be coded [0,1]; linear regression must be continuous numeric. Function will identify which is which and will provide an error message if you code it wrong.

compid

Vector of COMP_IDs used for the models

covariates

Optional. Vector of covariate names from the dat data frame.

normalize

Logical. Set to TRUE if you haven't already mean-centered and glog transformed your metabolite data. Default is TRUE.

Details

This function will run simple association models (either linear or logistic regressions). I recommend that you use the metsModels() function which is a wrapper for all sorts of metabolomics models. It will either run metsAssoc() or metsInt() depending on the inputs.

Value

Data frame organizing the associations and p-values for all metabolites.

Author(s)

Brian Carter

See Also

normalizeMets, metsInt, metsModels,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
breast_metabolomics <- getMetabolites("breast_metabolomics")
data(survey)
df <- left_join(survey,breast_metabolomics$metabolites,"ID")
covars<- c("AGE_INT","LASTATE")
comp.id <- names(breast_metabolomics$metabolites)[-1]
biochem <- breast_metabolomics$biochem[,c("COMP_ID","BIOCHEMICAL")]

# Linear regression models
out <- metsAssoc(dat=df,
                       biochem=biochem,
                       outcome="BMI",
                       compid=comp.id[1:10],
                       covariates=covars,
                       normalize=T)  # normalizing data

# Logistic regression models
out <- metsAssoc(dat=df,
                       biochem=biochem,
                       outcome="BMIBIN",
                       compid=comp.id[1:10],
                       covariates=covars,
                       normalize=T)  # normalizing data

buddha2490/BERGMets documentation built on Sept. 6, 2020, 5:11 p.m.