Population Genetics Chpt 2 End

Chapter 2 End Problems


## Problem 2 ##

Let’s call PGI-2a ‘a’ and PGI-2b ‘b’

1
2
3
4
5
6
7
8
9
10
11
12
phenotypes <- c("aa","ab","bb")
observed <- c(35,19,3)
total <- sum(observed)


Freq.a <- (2*35 + 19)/(2*total)
Freq.b <- (19 + 2*3)/(2*total)

expected <- c((Freq.a^2)*total, 2*(Freq.a*Freq.b)*total, (Freq.b^2)*total)
expected <- round(expected, 2)

data.frame( cbind( phenotypes, observed, expected ))
1
2
3
4
##   phenotypes observed expected
## 1 aa 35 34.74
## 2 ab 19 19.52
## 3 bb 3 2.74

## Problem 3 ##
1
2
3
4
5
6
7
8
9
10
11
12
phenotypes <- c("MM","MN","NN")
observed <- c(1101,1496,503)
total <- sum(observed)


Freq.M <- (2*observed[1] + observed[2])/(2*total)
Freq.N <- (observed[2] + 2*observed[3])/(2*total)

expected <- c((Freq.M^2)*total, 2*(Freq.M*Freq.N)*total, (Freq.N^2)*total)
expected <- round(expected, 2)

data.frame( cbind( phenotypes, observed, expected ))
1
2
3
4
##   phenotypes observed expected
## 1 MM 1101 1102.84
## 2 MN 1496 1492.32
## 3 NN 503 504.84
1
2
exp.freq <- expected/total
chisq.test(observed, p = exp.freq, rescale.p=TRUE, correct=FALSE )
1
2
3
4
5
## 
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 0.018851, df = 2, p-value = 0.9906

Null hypothesis: linkage equilibrium. No reason to reject.


## Problem 4 ##
1
2
3
4
5
6
phenotypes <- c("DD","Dd","dd")
observed <- c(230,170) #230 is DD + Dd count
total <- sum(observed)

Freq.d <- sqrt(170/total)
Freq.d
1
## [1] 0.6519202
1
2
Freq.D <- 1-Freq.d
Freq.D
1
## [1] 0.3480798
1
2
heterozygotes <- 2*Freq.D*Freq.d*total
heterozygotes
1
## [1] 181.5362

## Problem 5 ##
1
2
3
4
5
6
phenotypes <- c("pp","pq","qq")
observed <- c(9999, 1) #9999 is pp + pq count
total <- sum(observed)

Freq.q <- sqrt(1/total)
Freq.q
1
## [1] 0.01
1
2
Freq.p <- 1-Freq.q
Freq.p
1
## [1] 0.99
1
2
heterozygotes <- 2*Freq.p*Freq.q
heterozygotes
1
## [1] 0.0198

Therefore about 2% of the Caucasian population is a carrier (~1/50)


## Problem 8 ##
1
2
3
4
5
6
7
8
9
10
11
12
A1 <- 0.1
A2 <- 0.2
A3 <- 0.3
A4 <- 0.4

alleles <- c( A1, A2, A3, A4 )

#here is a hack to get at the frequencies more effortlessly (maybe)
#take the outer product of the vector 'alleles'. This will multiply all
#combinations of alleles e.g. all p*q combinations.
initial <- alleles %o% alleles
initial
1
2
3
4
5
##      [,1] [,2] [,3] [,4]
## [1,] 0.01 0.02 0.03 0.04
## [2,] 0.02 0.04 0.06 0.08
## [3,] 0.03 0.06 0.09 0.12
## [4,] 0.04 0.08 0.12 0.16
1
2
3
4
5
6
7
#This is correct for homozygotes e.g. p^2 (on the diagonal), but heterozygotes are 2pq.  
#All elements of the matrix except the diagonal need to be multiplied
#by 2, the diagonal by 1
#
multiplier <- matrix( 2, nrow=4, ncol=4)
diag(multiplier) <- 1
multiplier
1
2
3
4
5
##      [,1] [,2] [,3] [,4]
## [1,] 1 2 2 2
## [2,] 2 1 2 2
## [3,] 2 2 1 2
## [4,] 2 2 2 1
1
2
3
4
results <- data.frame(initial*multiplier)
rownames(results) <- c("A1","A2","A3","A4")
colnames(results) <- c("A1","A2","A3","A4")
results
1
2
3
4
5
##      A1   A2   A3   A4
## A1 0.01 0.04 0.06 0.08
## A2 0.04 0.04 0.12 0.16
## A3 0.06 0.12 0.09 0.24
## A4 0.08 0.16 0.24 0.16

Frequencies for the genetypes can be read off of the table above.


## Problem 9 ##

If p1 = 0.3 then p2 = 1-0.3 = 0.7

If q1 = 0.2 and q2 = 0.3 then q3 = 1-0.2-0.3 = 0.5

1
2
3
4
5
6
7
locus.A <- c(rep("A1",3), rep("A2", 3))
locus.B <- rep( c("B1","B2","B3"),2)
freq.A <- c(rep(0.3, 3), rep(0.7, 3))
freq.B <- rep(c(0.2, 0.3, 0.5), 2)
result <- freq.A*freq.B

data.frame( locus.A, locus.B, freq.A, freq.B, result)
1
2
3
4
5
6
7
##   locus.A locus.B freq.A freq.B result
## 1 A1 B1 0.3 0.2 0.06
## 2 A1 B2 0.3 0.3 0.09
## 3 A1 B3 0.3 0.5 0.15
## 4 A2 B1 0.7 0.2 0.14
## 5 A2 B2 0.7 0.3 0.21
## 6 A2 B3 0.7 0.5 0.35
1
sum(result)
1
## [1] 1

Share