LDAK can generate genotypic and phenotypic data. This is useful if wishing to perform simulation studies. For example, you can generate phenotypes for a variety of genetic architectures (e.g., assuming different Heritability Models), and compare how well different tools are able to identify the causal variants, construct prediction models or estimate heritability.
Always read the screen output, which suggests arguments and estimates memory usage.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Simulating genotypes:
The main argument is --make-snps <outfile>.
This requires the following options
--num-samples <integer> - to specify the number of samples.
--num-snps <integer> - to specify the number of SNPs.
LDAK will generate SNPs in a very simple fashion, assuming both Hardy-Weinberg and linkage equilibrium. By default, the MAF of each SNP will be randomly picked from 0.01 to 0.5, there will be 22 chromosomes, and SNPs will have no missing values (change the MAF range using --maf-low <float> and --maf-high <float>, change the number of chromosomes using --num-chr <integer>, and introduce missing values using --missing-rate <float>).
By default, LDAK will assume all individuals are unrelated and from a single population. To generate family-based data, use --family-size <integer> and --relatedness <float> (e.g., if you add --family-size 2 and --relatedness 0.5, LDAK will construct data resembling pairs of full-siblings). To generate different populations, use --populations <integer> (e.g., if you add --populations 3, LDAK will assume there are three evenly-sized populations).
The new data will be saved in binary PLINK format in the files <outfile>.bed, <outfile>.bim and <outfile>.fam.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Simulating phenotypes:
The main argument is --make-phenos <outfile>.
This requires the options
--bfile/--gen/--sp/--speed <datastem> or --bgen <datafile> - to specify the genetic data files (see File Formats).
--power <float> - to specify how predictors are scaled.
--her <float> - to specify the heritability for the simulated phenotypes (i.e., the proportion of total phenotypic variation explained by the genetic contribution).
--num-phenos <integer> - to specify the number of phenotypes to generate.
--num-causals <integer> - to specify the number of predictors contributing to each phenotype (to specify that all predictors are causal, use --num-causals ALL).
When the genetic predictors are SNPs, LDAK generates phenotypes as follows. LDAK first randomly picks C causal SNPs from all available SNPs. Let the vector Sj contains the raw genotypes for the jth causal SNP (i.e., each element of Sj is 0, 1 or 2). LDAK then constructs the scaled genotypes Xj=(Sj - mj) [2fj(1-fj)]alpha/2, where mj and fj are, respectively, the mean and MAF of Sj, while alpha is the value specified by the option --power. Each Xj will have mean zero and expected variance [2fj(1-fj)](1+alpha) (the latter assumes the SNP is in Hardy-Weinberg Equilibrium). Note that if Sj contains missing values, these are replaced with mj, meaning that the corresponding value of Xj will be zero.
Having constructed Xj, LDAK finally generates phenotypes of the form Y = X1b1 + X2b2 + ... + XCbC + e, where bj, the effect size for the jth (scaled) causal SNP, is sampled from a standard Gaussian distribution, and e, the vector of environmental noise, is sampled from a mean-zero Gaussian distribution, whose variance ensures the phenotypes have the specified heritability (e.g., if the user specifies heritability 0.5, and the genetic component X1b1 + X2b2 + ... + XCbC has variance 3, then LDAK samples noise from a Gaussian distribution with variance 3). Finally, LDAK scales the phenotypes to have variance one. The above construction ensures that E[h2j], the expected heritability of the jth causal variant, is proportional to [fj(1-fj)](1+alpha). When the genetic predictors are not SNPs, LDAK uses the same process, except that [2fj(1-fj)] is replaced by the observed variance of the jth causal predictor.
If you would like to specify which predictors are causal for each phenotype (instead of letting LDAK pick them at random), use --causals <causalsfile>. If you would like to specify bj, the effect sizes for each scaled predictors (instead of letting LDAK sample them from a standard Gaussian distribution), use --effects <effectsfile>. Both <causalsfile> and <effectsfile> should be text files with one row per phenotype and one column per causal predictor.
You can provide predictor weightings using --weights <weightsfile> (in which case the predictors are scaled so that the expected heritability of the jth causal predictor is proportional to wj x [fj(1-fj)](1+alpha), where wj is the weighting provided for the jth causal SNP).
To generate phenotypes where covariates explain variation, use --covar <covarfile> and --covar-her <float>. LDAK will then switch to the model Y = X1b1 + ... + XCbC + Z1t1 + ... + Zptp + e, where Zj is the jth covariate, and tj is the corresponding coefficient. Note that the tj will be sampled from a normal distribution, whose variance is set so that each covariate is expected to explain an equal share of phenotypic variance (e.g., if you provide five covariates and use --covar-her 0.1, then each covariate will be expected to explain 2% of phenotypic variation).
To generate binary phenotypes, add the option --prevalence <float>. LDAK will then treat the just-generated phenotypes as liabilities, so that samples with value above Inverse_CDF(<float>) will become cases, while those below this threshold will become controls.
To generate correlated phenotypes, add the option --bivar <float>; LDAK will then generate pairs of traits with the specified genetic correlation. For example, if you use --her 0.8, --num-phenos 4 and --bivar 0.5, then LDAK will generate four phenotypes with heritability 0.8, such that Phenotypes 1 & 2 will have correlation 0.5, and likewise Phenotypes 3 and 4 (whereas the remaining phenotype pairs and will be uncorrelated). If you use --bivar-env <float>, then LDAK will generate pairs of traits whose environmental noise terms are correlated.
LDAK will save the phenotypes in the file <outfile>.pheno. Details of the causal predictors will be saved in <outfile>.effects, while the genetic contribution towards each phenotype will be saved in <outfile>.breeding. Note that if constructing binary phenotypes, the liabilities will be stored in <outfile>.liab.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Example:
To generate SNP genotypes for 100 samples and 1000 SNPs, we run
./ldak.out --make-snps snps --num-samples 100 --num-snps 1000
The genotypes are saved in the files snps.bed, snps.bim and snps.fam, while a covariate file is saved in snps.covar.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
To generate 10 phenotypes assuming the Uniform Model. each with heritability 0.5 and 100 causal SNPs, we run
./ldak.out --make-phenos UNI --bfile snps --power -1 --her 0.5 --num-phenos 10 --num-causals 100
The simulated phenotypes will be saved in UNI.pheno.
To instead generate phenotypes assuming the Human Default Model, we run
./ldak.out --make-phenos HumDef --bfile snps --power -.25 --her 0.5 --num-phenos 10 --num-causals 100
The simulated phenotypes will be saved in HumDef.pheno.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
