Tutorial Online Calculator
Tutorial Online Calculator
This tutorial illustrates how to calculate DNA methylation age using the online calculator.
Mandatory input: A (compressed) file with beta values, e.g. measured on the Illumina 27k or
450k platform. Optionally, you can compress the comma delimited file (.csv files) into a file that
ends either with .zip or with .bz2. Other compression formats cannot yet be used.
Output:
Optional, additional input: I recommend that you also input a sample annotation file that
specifies age, tissue, etc. In this case use the following variable names "Age" (note it starts with
capital A), "Female" (with values 1 for female, 0 for male, NA for missing info), "Tissue". Make
sure that the rows (samples) in the sample annotation file have the same order as the columns
(samples) in the methylation file. If you provide a sample annotation file then you will obtain the
following variables:
If you applied the Illumina 450K platform to blood then you can get a host of additional output
by selecting the AdvancedAnalysisBlood option. In this case, the software will output
Horvath S (2013) DNA methylation age of human tissues and cell types. Genome Biol
14(10):R115 PMID: 24138928
1
Contents
How to upload the data?.............................................................................................................................4
Upload form................................................................................................................................................5
Strategies for uploading very large data sets..............................................................................................5
Normalization, imputation..........................................................................................................................6
Uploading the sample annotation file.........................................................................................................7
After you push the submit button...............................................................................................................8
Output file...................................................................................................................................................9
Log file.......................................................................................................................................................10
Advanced Analysis in Blood.......................................................................................................................10
1) BioAge1HO, BioAge2HO, BioAge3HO, BioAge4HO............................................................................10
2) BioAge1HA, BioAge2HA, BioAge3HA, BioAge4HA.............................................................................10
3) BioAge2HOStatic, BioAge3HOStatic, BioAge4HOStatic......................................................................10
4) BioAge2HAStatic, BioAge3HAStatic, BioAge4HAStatic.......................................................................11
5) BioAge1HOAdjAge, BioAge2HOAdjAge, BioAge3HOAdjAge, BioAge4HOAdjAge...............................11
6) BioAge1HAAdjAge, BioAge2HAAdjAge, BioAge3HAAdjAge, BioAge4HAAdjAge................................11
7) BioAge2HOStaticAdjAge, BioAge3HOStaticAdjAge, BioAge4HOStaticAdjAge...................................11
8) BioAge2HAStaticAdjAge, BioAge3HAStaticAdjAge, BioAge4HAStaticAdjAge....................................11
9) PlasmaBlastAdjAge, CD8pCD28nCD45RAnAdjAge, CD8.naiveAdjAge, CD4.naiveAdjAge.................11
10) Cell count measures: CD8T, CD4T, NK, Bcell, Mono, Gran...............................................................11
11) PlasmaBlast, CD8pCD28nCD45RAn, CD8.naive, CD4.naive..............................................................12
12) Cell count measures for multivariate regression models................................................................12
12) AAHOAdjCellCounts and AAHAAdjCellCounts.................................................................................13
Why does the web based calculator not return any results for my data set?...........................................13
Frequently asked questions.......................................................................................................................14
Q: Does the order of the samples in the sample annotation file have to match that of the
methylation file?................................................................................................................................14
Q: Are additional columns allowed in the sample annotation file?...................................................14
Q: Does the order of the columns matter in the sample annotation file? It seems like you will
require the first column to be "SampleID", second column "Age"....................................................14
Q: In the "Advanced Analysis in Blood" option, the 4 weighted averages are a bit of a mystery as
currently described. Can you elaborate on how the weighted averages were calculated?...............14
2
Q: In the advanced analysis option, it appears that only 2 age acceleration measure account for cell
types (e.g. "AAHOAdjCellcounts" and "AAHAAdjCellcounts" ). Which epigenetic age measure is
being used?.......................................................................................................................................14
References.................................................................................................................................................15
Instructions
To run this tutorial, download the following example data set from the webpage
MethylationDataExample55.csv
The following screen shot shows that this input file is a comma delimited Excel file whose first
column reports probe identifiers. The remaining columns correspond to samples (i.e. DNA meth
arrays) for which DNAm age will be estimated.
3
GEO accession GSE38608
Citation for the data set:
Ginsberg MR, Rubin RA, Falcone T, Ting AH et al. Brain transcriptional and epigenetic
associations with autism. PLoS One 2012;7(9):e44736. PMID: 22984548
4
Upload form
In the online form, enter your
1. Name:
2. Organization:
3. Email address. The results will be sent to this email address. Make sure it works.
4. Data file: Select the comma delimited file that contains your data. As mentioned before
you can upload a zipped version of this file.
Strategy 1: Compress the file into a file that ends either with .zip or with .bz2. Other compression
formats cannot yet be used.
Strategy 2: Turn your Illumina 450K data into a "reduced" file that only contains probes that can
be found in the file datMiniAnnotation.csv (which is on our webpage). This does not result in
any information loss since the epigenetic clock only uses probes that can be found in this file.
After implementing this step, compress the resulting file (i.e. apply Strategy 1).
CpG probes that were not measured in your data set (e.g. are not present on the 450K array)
should lead to a row filled with NAs.
Here is some relevant R code that assume your large data file is called "dat0" and the first
column of dat0 contains the probe identifiers.
5
library(sqldf)
#change the setwd filepath to that of the folder with your data. Note the forward slash
setwd("C:/Users/SHorvath/Documents/DNAmAge/Example55")
dat0=read.csv.sql("MethylationData.csv") ;
datMiniAnnotation=read.csv("datMiniAnnotation.csv")
match1=match(datMiniAnnotation[,1], dat0[,1] )
dat0Reduced=dat0[match1,]
dat0Reduced[,1]=as.character(dat0Reduced[,1])
dat0Reduced[is.na(match1),1]= as.character(datMiniAnnotation[is.na(match1),1])
datout=data.frame(dat0Reduced)
Strategy 3: Split the data into batches, e.g. batches of 500 samples each. Next apply strategies 1
or 2.
Strategy 4: Email Steve Horvath or Yining Zhao to increase the upload limit for you.
Normalization, imputation
Additional buttons for the DNAm Age calculator allow you to check whether you want to
normalize the data. It is strongly recommended to use the default setting (i.e. check "Normalize
Data") since it often improves the predictive accuracy.
I have noticed that some users don't select this option since they think that they have their own
superior normalization method. You should still check "Normalize Data". Reason: your
normalization method has a different goal from my normalization method. The purpose of my
normalization method is to make your data comparable to the training data of the epigenetic
clock.
6
I advise against using the fast imputation method. However, if you have hundreds of samples
with missing data and want to get a quick result then check "Fast Imputation".
Requirements: The sample annotation file should be comma delimited text file whose rows
correspond to samples (e.g. human subjects). Make sure that the rows (samples) in the sample
annotation file have the same order as the columns (samples) in the methylation file.
1) Not necessary but highly recommended: The first column should report the sample
identifiers (matching those of the DNA methylation data, e.g. "Subject1", etc).
2) Mandatory: a column whose name is spelled "Age". This column should report the
(chronological) age in years, e.g. 0 for a newborn, 0.5 encodes a 6 month old child, 30 for a 30
year old. Prenatal samples would get a negative value, i.e. -.5 for a sample measured half a year
before the expected birth. If you don't have age values, simply fill up the column with "NA".
3) Optional: I strongly recommend that you include gender information since this allows us
to check whether the data are properly normalized etc. Toward this end, please insert a column
called "Female" (note the capitalization) which takes a value of 1 if the subject is female, 0 if the
subject is male, and NA if the information is not available. If you don't use ones or zeros, you
will get an error message. The calculator will output a column called "predictedGender". If the
gender prediction does not match the known gender then there may be data quality issues.
4) Optional: I strongly recommend that you include a column that reports the DNA source (e.g.
tissue). Toward this end, please insert a column called "Tissue" (note the capitalization) which
takes a descriptive value. The tissue prediction tool is not yet published and its predictions
should be interpreted with all due caution. I include this early version since it may help you
identify mislabeled/suspicious samples.
Check whether one of the following descriptive terms matches your DNA source. If so, please
use it. Otherwise simply report the best name that describes your DNA source.
7
[12] "Brain FCTX"
[13] "Brain Occipital Cortex"
[14] "Brain PONS"
[15] "Brain Prefr.CTX"
[16] "Brain TCTX"
[17] "Breast"
[18] "Breast NL"
[19] "Buccal"
[20] "Cartilage Knee"
[21] "Colon"
[22] "Dermal fibroblast"
[23] "Epidermis"
[24] "Fat Adip"
[25] "Gastric"
[26] "GlialCell"
[27] "Head+Neck"
[28] "Heart"
[29] "Kidney"
[30] "Liver"
[31] "Liver "
[32] "Lung"
[33] "MSC" note that this stands for mesenchymal stromal cells
[34] "Muscle"
[35] "Neuron"
[36] "Placenta"
[37] "Prostate NL"
[38] "Saliva"
[39] "Sperm"
[40] "Stomach"
[41] "Thyroid"
[42] "Uterine Cervix"
[43] "Uterine Endomet"
The software will output a column called predictedTissue, which reports the predicted DNA
source, i.e. one of the above mentioned DNA sources. Future versions of the age predictor will
report more potential DNA sources.
How long does it take to get an email after your submitted your data?
8
That depends on your sample size and whether or not you want the software to normalize the
data. If you don't normalized the data, you should get an email within a couple of minutes. In
contrast, normalizing several hundred samples could take several hours.
If you don't get any email, it means that your data crashed the R program. In this case, please
carefully look at your input data. Do they meet the requirements? Maybe your methylation data
set contains non-numeric variables (apart from the identifiers in the first column).
Output file
Note that the output file contains a host of useful information e.g.
SampleID=sample identifier
DNAmAge=DNA methylation age=predicted age
Comment=A comment is only added if a sample looks suspicious.
noMissingPerSample=number of missing beta values per sample
meanMethBySample, minMethBySample=the mean and min beta value before
normalization
corSampleVSgoldstandard=correlation between the sample and the gold standard
(defined by averaging the beta values across the samples from the largest blood data set).
A low value spells trouble and a comment will be added.
meanAbsDifferenceSampleVSgoldstandard=mean absolute difference between the
sample and the gold standard. A large value spells trouble and a comment will be added.
predictedGender=predicted gender based on the mean across the X chromosomal
markers. The sample is problematic if the predicted gender does not match the known
gender.
meanXchromosome= mean beta value across the X chromosomal markers. This variable
is used for predicting gender. Female samples should have a higher value than male
samples if X chromosomal inactivation is applicable.
predictedTissue=the predicted DNA source (i.e. it does not have to be a tissue)
ProbabilityFrom.Blood.PBMC=probability that the DNA derives from peripheral blood
mononuclear cells.
ProbabilityFrom.Brain.Cerebellar=probability that it comes from cerebellar brain samples
ProbabilityFrom.Brain.FCTX=probability that it comes from frontal cortex
ETC
AgeAccelerationDiff=Age acceleration measure defined simply as difference, i.e.
DNAmAge minus Age
AgeAccelerationResidual=Age acceleration measure defined as residual from regressing
DNAm age on chronological age. In R language: residuals(lm(DNAmAge-Age))
9
Log file
The second email attachment (ending in log.txt) is a log file that briefly describes the data and
provides some feedback, e.g. warnings or error messages.
The advanced analysis option leads to a host of additional output: various measures of biological
age, age acceleration and blood cell counts.
10
4) BioAge2HAStatic, BioAge3HAStatic, BioAge4HAStatic
These measures are analogous to those described in 2) BioAge1HA, BioAge2HA, BioAge3HA,
BioAge4HA but the weights are static (meaning constant). In particular, these measures can be
calculated even if the column "Age" is filled with missing values or all subjects have the same
chronological age.
In other words, a positive (negative) value indicates that the biological age of the sample is
higher (lower) than expected based on chronological age. Specifically, these measures were
defined as residuals (observed minus predicted) resulting from a simple linear regression model
that regressed biological age on chronological age. By definition, these measures are not
correlated with chronological age, which is an attractive property. A disadvantage of these
measures is that they can only be defined if "Age" has a non-zero variance and is available for at
least 4 subjects.
10) Cell count measures: CD8T, CD4T, NK, Bcell, Mono, Gran
These are estimated proportions of CD8 T cells, CD4T cells, natural killer cells, B cells,
monocytes and granulocytes. Toward this end, I used the method and R code described in
Houseman et al (2012). Specifically, I used the R command "projectCellType" in the minfi R
11
package (Aryee et al 2014). If you use these cell types in your work, make sure to cite Houseman
et al 2014.
Biology:
a) CD8+CD28-CD45RA- T cells have characteristics of both memory and effector T cells. These
cells increase with chronological age.
c) Here naive CD8 and CD4 T cells are defined as CD45RA+CCR7+ cells.
d) Plasma cells, also called plasma B cells, and effector B cells, are white blood cells that secrete
large volumes of antibodies. From Wikipedia: Upon stimulation by a T cell, which usually
occurs in germinal centers of secondary lymphoid organs like the spleen and lymph nodes, the
activated B cell begins to differentiate into more specialized cells. Germinal center B cells may
differentiate into memory B cells or plasma cells. Most of these B cells will become
plasmablasts, and eventually plasma cells, and begin producing large volumes of antibodies.
Statistical method for estimating these cell abundance measures: A penalized regression model
(elastic net) was used regress cell count measures on DNA methylation levels. Estimated values
are predicted values based on this penalized regression model.
12
Since many of the cells are highly correlated with each other, I dropped the B cell and CD8T cell
estimates from the Houseman method. When studying various diseases, it is probably a good
idea to replace "Bcell" by "PlasmaBlast" (related to B cells) since the latter is often more disease
relevant. Further, I usually replace "CD8T" by the two measures "CD8.naive"
"CD8pCD28nCD45RAn" since the latter are probably more disease relevant. I rarely use
CD4.naive since CD8.naive is often more relevant.
To assess whether DNAmAge relates to a disease outcome, I use the following covariate list
Obviously, you would also adjust for standard variables such as gender, race, body mass index, prior
history of disease e.g. cancer, type II diabetes status, etc.
Why does the web based calculator not return any results for my data
set?
Answer: A small data set (say fewer than 100 samples) should lead to a response within an hour or so. Try a
small subset of your data to see whether you get a response. If not, your data lead to an error. Here are some
common remedies.
a) If you uploaded a sample annotation file, make sure that its numbers of rows correspond to the number of
samples, i.e. the numbers of columns of dat0 minus 1.
b) Make sure that your DNA methylation data file contains all the necessary probes. While it is OK to have
missing DNA methylation levels, it is not OK to have missing probe IDs. Unless you use all probes on the
450K array or the 27K array, please make sure that your file includes all CpGs listed in datMiniAnnotation.csv
Probes that were not measured in your data set should lead to a row filled with NAs. But the probe name needs
to be listed. The advanced analysis option for blood requires that your data were measured on the
Illumina450K platform but it only uses the probes in datMiniAnnotation.
13
c) Line feeds: I have noticed that the session breaks down when users upload the wrong line breaks. It should
be CR+LF (carriage return and line feed) and not just LF or CR. A simple remedy is to open the csv file in
Excel and save it as a .csv file for Windows.
d) Make sure that you upload numeric data (missing values should be coded as NA and not as null or NULL).
Sometimes a user uploads a file that also contains various annotations (e.g. chromosome number, gene name).
Carefully look at dat0 before you upload it. The first column should contain CpG identifiers. The remaining
columns should only contain numeric values. If a column (sample) only contains missing values, remove it
from dat0 and datSample. If need be, run the following R code before you upload the data.
Q: Does the order of the columns matter in the sample annotation file? It seems like you will
require the first column to be "SampleID", second column "Age".
A: No the order does not matter. The first column does *not* have to be called SampleID. However, it is very
important that the file contains columns called "Age", "Female", and "Tissue". The capitalization has to be as
specified. Don't use variable names such as age, AGE, female, tissue, TISSUE.
Q: In the "Advanced Analysis in Blood" option, the 4 weighted averages are a bit of a mystery
as currently described. Can you elaborate on how the weighted averages were calculated?
These measures have not yet been published. Please email Steve Horvath to request a relevant manuscript.
Q: In the advanced analysis option, it appears that only 2 age acceleration measure account
for cell types (e.g. "AAHOAdjCellcounts" and "AAHAAdjCellcounts" ). Which epigenetic age
measure is being used?
A: It turns out that multiple measures of biological age lead to the same adjusted measure, which is why it is
sufficient to calculate only two age acceleration measures that account for cell counts. Specifically, each of the
following four measures 1) BioAge1HO, BioAge2HO, BioAge3HO, BioAge4HO leads to the same measure
AAHOAdjCellCounts.Similarly, each of the following four measures 2) BioAge1HA, BioAge2HA,
BioAge3HA, BioAge4HA leads to the same measure AAHAAdjCellCounts.
14
References
Horvath S (2013) DNA methylation age of human tissues and cell types. Genome Biol
14(10):R115 PMID: 24138928
Hannum G, Guinney J, Zhao L, Zhang L, Hughes G, Sadda S, Klotzle B, Bibikova M,
Fan JB, Gao Y, Deconde R, Chen M, Rajapakse I, Friend S, Ideker T, Zhang K (2013)
Genome-wide methylation profiles reveal quantitative views of human aging rates. Mol
Cell. 2013 Jan 24;49(2):359-67.
Houseman EA, Accomando WP, Koestler DC, Christensen BC, Marsit CJ, Nelson HH,
Wiencke JK, Kelsey KT (2012) DNA methylation arrays as surrogate measures of cell
mixture distribution. BMC Bioinformatics 2012, 13:86 doi:10.1186/1471-2105-13-86
Aryee MJ, Jaffe AE, Corrada-Bravo H, Ladd-Acosta C, Feinberg AP, Hansen KD,
Irizarry RA (2014) Minfi: a flexible and comprehensive Bioconductor package for the
analysis of Infinium DNA methylation microarrays. Bioinformatics. 2014 May
15;30(10):1363-9. doi: 10.1093/bioinformatics/btu049.
15