This page explains how to estimate per-predictor heritabilities. These instructions require you to specify a Heritability Model; if analysing human SNP data, we recommend using the Baseline LD Model (version 2.2), while if analysing non-human or non-SNP data, we recommend using the LDAK-Thin Model (these models are formally defined in Technical Details).
Please note that it is no longer necessary to estimate per-predictor heritabilities when running MegaPRS. However, it can still be useful when running Elastic-Predict.
Always read the screen output, which suggests arguments and estimates memory usage.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Preparation:
You require genetic data (to calculate the tagging file and heritability matrix) and summary statistics (to estimate the heritability contributed by each predictor).
If you are analysing individual-level data, you will already have genetic data. You can obtain summary statistics using the command --linear <outfile>. For details on this command, see the example below or Single-Predictor Analysis.
If you are analysing summary statistics, you should make sure that these are in the format required by LDAK (see Summary Statistics for details), and that you have a (well-matched) Reference Panel.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Calculate a tagging file and heritability matrix:
Having decided which heritability model to use, you should calculate the corresponding tagging file and heritability matrix using the command --calc-taggings <outfile>. For details on this command, see the example below or Calculate Taggings. Note that you should use --extract <extractfile> to reduce to predictors for which you have summary statistics.
Note that if you are analysing individual-level data for tens of thousands of samples, it is not necessary to use all of these when calculating the tagging file and heritability matrix. Instead we suggest using --keep <keepfile> to specify 5000 randomly-selected samples, which will substantially reduce computational demands.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Estimate heritabilities:
Having calculated the tagging file and corresponding heritability matrix, you should regress the summary statistics onto these using the command --sum-hers <outfile>. For details on this command, see the example below or SNP Heritability. Note that you must add --matrix <matrixfile>, where <matrixfile> is the heritability matrix, so that LDAK calculates the per-predictor heritabilities.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Example:
Here we use the binary PLINK files human.bed, human.bim and human.fam, and the phenotype quant.pheno from the Test Datasets. We also use the file BaselineLD.zip from Resources.
We show how to estimate per-predictor heritabilities assuming the GCTA, LDAK-Thin and Baseline LD Models (as a reminder, we recommend using the Baseline LD Model if analysing human SNP data, else using the LDAK-Thin Model).
As we are analysing individual-level data, it is necessary to first obtain summary statistics. For this we can use the command
./ldak.out --linear quant --bfile human --pheno quant.pheno
The summary statistics are saved in quant.summaries (already in the format required by LDAK). For more details on this command, see Single-Predictor Analysis.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
1 - Estimate per-predictor heritabilities assuming the GCTA Model.
Run the commands
./ldak.out --calc-tagging gcta --bfile human --power -1
./ldak.out --sum-hers gcta --tagfile gcta.tagging --summary quant.summaries --matrix gcta.matrix
The per-predictor heritabilities are saved in gcta.ind.hers.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2 - Estimate per-predictor heritabilities assuming the LDAK-Thin Model.
To assume the LDAK-Thin Model, we must first create a weightsfile that gives weighting one to the predictors that remain after thinning for duplicates, and weighting zero to those removed. This can be achieved using the commands
./ldak.out --thin thin --bfile human --window-prune .98 --window-kb 100
awk < thin.in '{print $1, 1}' > weights.thin
Now we can run the commands
./ldak.out --calc-tagging ldak.thin --bfile human --weights weights.thin --power -.25
./ldak.out --sum-hers ldak.thin --tagfile ldak.thin.tagging --summary quant.summaries --matrix ldak.thin.matrix
The per-predictor heritabilities are saved in ldak.thin.ind.hers.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
3 - Estimate per-predictor heritabilities assuming the Baseline LD Model.
To assume the Baseline LD Model, we first extract the SNP annotations
unzip BaselineLD.zip
We then provide the first 86 annotations when calculating taggings
./ldak.out --calc-tagging BaselineLD --bfile human --power -.25 --annotation-number 86 --annotation-prefix BaselineLD
./ldak.out --sum-hers BaselineLD --tagfile BaselineLD.tagging --summary quant.summaries --matrix BaselineLD.matrix
The per-predictor heritabilities are saved in BaselineLD.ind.hers.
