全座位が明らかでないときにはどうするか:未検出座位

  • 一部の座位はわかっていてジェノタイプが得られる
  • 一部の座位はわかっいないとする
## 一部のリスク座位はわかっている
## 多数の座位は不明で、その一部はリスク座位

# No. loci
n.marker <- 10
# population size
N <- 10^5
# Genotype matrix
g <- matrix(0,N,n.marker)
# allele freq of markers
f <- 0.1 + runif(n.marker) * 0.4
# HWE and random genotype generation
for(i in 1:n.marker){
	g[,i] <- sample(0:2,N,replace=TRUE,prob=c(f[i]^2,2*f[i]*(1-f[i]),(1-f[i])^2))
}

# Unknown loci
n.marker.unknown <- 100
# Unknown Genotype matrix
g.unknown <- matrix(0,N,n.marker.unknown)
# allele freq of markers
f <- 0.1 + runif(n.marker) * 0.4
# HWE and random genotype generation
for(i in 1:n.marker){
	g.unknown[,i] <- sample(0:2,N,replace=TRUE,prob=c(f[i]^2,2*f[i]*(1-f[i]),(1-f[i])^2))
}


# Risk of each marker's allele
r <- rnorm(n.marker)

# Risk of each unknown marker's allele
# only a part of markers are truely risky
n.unknown.true <- 10
r.unknown <- rep(0,n.marker.unknown)
r.unknown[1:n.unknown.true] <- rnorm(n.unknown.true)

# Total genetic risk when addtive model
R <- rep(0,N)
for(i in 1:n.marker){
	R[which(g[,i]==1)] <- R[which(g[,i]==1)] + r[i]
	R[which(g[,i]==2)] <- R[which(g[,i]==2)] + r[i]*2

}

# Total genetic risk when addtive model
R.unknown <- rep(0,N)
for(i in 1:n.marker){
	R.unknown[which(g.unknown[,i]==1)] <- R.unknown[which(g.unknown[,i]==1)] + r.unknown[i]
	R.unknown[which(g.unknown[,i]==2)] <- R.unknown[which(g.unknown[,i]==2)] + r.unknown[i]*2
}

# Total risk
R.total <- R + R.unknown

# narrow-sense heritability
h <- 0.7
# environmental variance 
eV <- (1-h)/h * var(R.total)
# sum of genetic and environmental risks
R. <- R.total + rnorm(N,0,sqrt(eV))
# phenotype is R. itself
pheno <- R.

# narrow-sense heritability of whole loci
lm.out.whole <- lm(pheno~cbind(g,g.unknown))
pheno.whole <- lm.out.whole$fitted

hwhole <- var(pheno.whole)/var(pheno)
hwhole
# narrow-sense heritability of known loci only
lm.out.partial <- lm(pheno~g)
pheno.partial <- lm.out.partial$fitted

hpartial <- var(pheno.partial)/var(pheno)
hpartial
  • もちろん、全部の座位を使えば遺伝率がきちんと算出され、見つかっていなければ、低く計算される
> hwhole
[1] 0.6980088
> # narrow-sense heritability of known loci only
> lm.out.partial <- lm(pheno~g)
> pheno.partial <- lm.out.partial$fitted
> 
> hpartial <- var(pheno.partial)/var(pheno)
> hpartial
[1] 0.5391937