% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epiage_estimation.R
\name{epiage_estimation}
\alias{epiage_estimation}
\title{Estimates age in skeletal muscle from calibrated DNA methylation profiles.}
\usage{
epiage_estimation(SE = NULL, age_col_name = NULL)
}
\arguments{
\item{SE}{A \code{\link[SummarizedExperiment]{SummarizedExperiment-class}} object.
The "assays" component of \code{SE} should contain a beta-matrix of
DNA methylation beta-values called "beta" that has been cleaned with
\code{\link{clean_beta}} and calibrated with \code{\link{BMIQcalibration}}.
\code{SE} may optionally contain annotation information on the CpGs
stored in "rowData" and sample phenotypes stored in "colData".}

\item{age_col_name}{The name of the column in colData from \code{SE} that
contains age (in years).}
}
\value{
A \code{\link[SummarizedExperiment]{SummarizedExperiment-class}} object
identical to the input \code{SE}, with components added to colData. If no
phenotypes were provided in the colData of the input \code{SE},
\code{epiage_estimation} will put in colData a tibble containing a single
column called "DNAmage", corresponding to epigenetic age (in years) for each
sample. If phenotypes were provided in the colData of the input \code{SE},
\code{epiage_estimation} will add to the existing colData three columns:
\enumerate{
  \item \code{DNAmage} epigenetic age (in years)
  \item \code{AAdiff} the difference between predicted and actual age
  (in years).
  \item \code{AAresid} the residuals of a linear model
  (using \code{\link[stats]{lm}}) of DNAmage against actual age.
  \code{AAresid} is only returned if the number of samples is > 2, as
  \code{AAresid} cannot be calculated with < 2 samples.
}
}
\description{
\code{epiage_estimation} takes as input a
\code{\link[SummarizedExperiment]{SummarizedExperiment-class}} object whose
assays contain a beta-matrix called "beta". This beta-matrix should contain
DNA methylation profiles in skeletal muscle that have been cleaned with
\code{\link{clean_beta}} and calibrated with \code{\link{BMIQcalibration}}.
\code{epiage_estimation} will use the muscle clock to estimate epigenetic age
in each sample.
}
\details{
\code{epiage_estimation} estimates epigenetic age for each sample in the
input \code{SE} based on DNA methylation profiles. \code{SE} needs to be a
\code{\link[SummarizedExperiment]{SummarizedExperiment-class}} object containing
a matrix of beta-values called "beta" in assays. Beta must have been
calibrated to the gold standard GSE50498 using \code{\link{BMIQcalibration}}
to obtain good estimates of epigenetic age.
}
\examples{
# Load matrix of beta-values of two individuals from dataset GSE121961
data("GSE121961", envir = environment())
# Load phenotypes of the two individuals from dataset GSE121961
data("GSE121961_pheno", envir = environment())

# Create a SummarizedExperiment object to coordinate phenotypes and
# methylation into one object.
library(SummarizedExperiment)
GSE121961_SE <- SummarizedExperiment(assays=list(beta=GSE121961),
colData=GSE121961_pheno)

# Run clean_beta() to clean the beta-matrix
GSE121961_SE_clean <- clean_beta(SE = GSE121961_SE)

# Run BMIQcalibration() to calibrate the clean beta-matrix
GSE121961_SE_calibrated <- BMIQcalibration(SE = GSE121961_SE_clean)

# Run epiage_estimation() to obtain DNAmage + optionally AAdiff and AAresid
GSE121961_SE_epiage <- epiage_estimation(SE = GSE121961_SE_calibrated,
age_col_name = "Age")
colData(GSE121961_SE_epiage)
}
\seealso{
\code{\link[wateRmelon]{BMIQ}} for the original BMIQ algorithm,
\url{https://genomebiology.biomedcentral.com/articles/10.1186/gb-2013-14-10-r115}
for the adapted version of the BMIQ algorithm, and
\url{https://www.biorxiv.org/content/10.1101/821009v3}
for the elastic net model of the muscle clock.
}
