This practical can be run on your own computer (if R is installed) or on the server.

This part of the practical uses a Shiny App developed within Prof. Peter Visscher laboratory by Dr Valentin Hivert, based on the previous versions that had input from Dr Luke Lloyd-Jones, Mr Alex Holloway and Dr Matt Robinson.

Start the App (link: https://shiny.cnsgenomics.com/Falconer2/)

Question 1. Choose parameters (e.g., frequency, additive and dominance deviation effect) that reflect (i) a rare recessive and (ii) a rare dominant locus. Contrast these two scenarios in terms of average affect, additive and dominance variance explained by the locus. Which one of these two scenarios could be more easily detected in a GWAS?

The R code below simulates genotypes of n=100000 independent individuals at a given SNP with minor allele frequency (MAF) p=0.2

p <- 0.2
n <- 100000
x <- rbinom(n, 2, p) # minor allele counts: 0, 1 or 2

We now simulate a phenotype y such that the additive and dominance effects at that SNP are a=5 and d=-1 respectively. We set the residual variance to Ve=1.

Ve <-  1
a  <-  5
d  <- -1
# Simulate phenotypes given the Falconer model
y  <- (x-1) * a + x*(2-x)*d + rnorm(n, 0, sqrt(Ve))
boxplot(y~x)

Question 2. Calculate (i) the mean and variance of y, (ii) the regression of y on x and (iii) the proportion of y variance explained by x. Verify that your observations match the theory (from the app).

mean(y); var(y)
summary( lm(y ~ x) )

Question 3. What statistical (regression) model can you fit to capture all the genetic variance at the locus?