### luhken_data.

R
###-----------------------------------------------------------------------### What: Calculation of summary statistics for data from Luhken et al. 2008
### Time-stamp: <2008-04-10 13:59:25 ggorjan>
###-----------------------------------------------------------------------### IMPORT DATA
podatki <- read.csv(file="luhken_data.csv")
## REORGANIZE DATA
basic <- c("Breed", "Country", "N")
hapNam <- c("ARR", "ARQ", "AHQ", "ARH", "ARK", "VRQ")
hapNam2 <- c("ARR", "AHQ", "ARH", "ARQ", "VRQ")
genNam <- c("ARR.ARR", "ARR.AHQ", "ARR.ARH", "ARR.ARQ", "ARR.VRQ",
"AHQ.AHQ", "AHQ.ARH", "AHQ.ARQ", "AHQ.VRQ",
"ARH.ARH", "ARQ.ARH", "ARH.VRQ",
"ARQ.ARQ", "ARQ.VRQ",
"VRQ.VRQ",
"ARQ.ARK")
genNam2 <- c("ARR.ARR",
"AHQ.AHQ",
"ARH.ARH",
"ARQ.ARQ",
"VRQ.VRQ")

"ARR.AHQ", "ARR.ARH", "ARR.ARQ", "ARR.VRQ",
"AHQ.ARH", "AHQ.ARQ", "AHQ.VRQ",
"ARQ.ARH", "ARH.VRQ",
"ARQ.VRQ",

hap <- podatki[, c(basic, hapNam)]
gen <- podatki[, c(basic, genNam)]
hap2 <- rbind(hap, data.frame(Breed="JS", Country="SL", N=3669, ARR=17.4,
ARQ=63.2, AHQ=7.4, ARH=8.3, ARK=0, VRQ=3.7))
gen2 <- rbind(gen, data.frame(Breed="JS", Country="SL", N=3669,
ARR.ARR=3.5, ARR.AHQ=2.6, ARR.ARH=2.9,
ARR.ARQ=21.2, ARR.VRQ=1.1, AHQ.AHQ=0.8,
AHQ.ARH=1, AHQ.ARQ=9.2, AHQ.VRQ=0.4,
ARH.ARH=0.7, ARQ.ARH=1, ARH.VRQ=0.5,
ARQ.ARQ=40, ARQ.VRQ=5, VRQ.VRQ=0.2,
ARQ.ARK=0))
## ALLELE (HAPLOTYPE)
nrow(hap)
summary(hap[, hapNam])
##
##
##
##
##
##
##
##
##
##
##
##
##

ARR
Min.
: 8.06
1st Qu.:22.28
Median :31.96
Mean
:31.98
3rd Qu.:43.38
Max.
:67.74
ARK
Min.
:0.00000
1st Qu.:0.00000
Median :0.00000
Mean
:0.02875
3rd Qu.:0.00000

ARQ
AHQ
Min.
: 9.68
Min.
: 0.000
1st Qu.:43.08
1st Qu.: 1.610
Median :54.15
Median : 4.840
Mean
:56.05
Mean
: 6.058
3rd Qu.:70.24
3rd Qu.: 8.060
Max.
:87.10
Max.
:27.420
VRQ
Min.
: 0.000
1st Qu.: 0.000
Median : 1.610
Mean
: 2.964
3rd Qu.: 3.708

ARH
Min.
: 0.000
1st Qu.: 0.000
Median : 0.000
Mean
: 2.922
3rd Qu.: 3.797
Max.
:38.240

##

Max.

:1.61000

Max.

:17.740

pdf(file="PrP_haplotype_freq.pdf")
par(mfrow=c(2, 3), pty="m", mex=0.7, mar=c(4, 4, 1.5, 0))
hist(hap$ARR, xlim=c(0, 100), main="ARR", xlab="Haplotype
hist(hap$AHQ, xlim=c(0, 100), main="AHQ", xlab="Haplotype
hist(hap$ARH, xlim=c(0, 100), main="ARH", xlab="Haplotype
hist(hap$ARQ, xlim=c(0, 100), main="ARQ", xlab="Haplotype
hist(hap$VRQ, xlim=c(0, 100), main="VRQ", xlab="Haplotype
dev.off()

frequency")
frequency")
frequency")
frequency")
frequency")

library(MASS)
pdf(file="PrP_haplotype_parallel.pdf")
parcoord(hap2[, hapNam2], col=c(rep("grey", times=nrow(hap2)-1), "red"),
var.label=TRUE)
dev.off()
## THEORETICAL PIC = 1 - Sum_i(p^2_i) - Sum^{n-1}_{i=1}(Sum^{n}_{j=i+1}(2 p^2_i
p^2_j))
hap[, hapNam] <- hap[, hapNam] / 100
PICTeo <- 1 - (hap$ARR/100^2 + hap$AHQ^2 + hap$ARH^2 + hap$ARQ^2 + hap$VRQ^2) (
(2 * hap$ARR^2 * hap$AHQ^2 + 2 * hap$ARR^2 * hap$ARH^2 + 2 *
hap$ARR^2 * hap$ARQ^2 + 2 * hap$ARR^2 * hap$VRQ^2)
+ (2 * hap$AHQ^2 * hap$ARQ^2 + 2 * hap$AHQ^2 * hap$ARQ^2 + 2 *
hap$AHQ^2 * hap$VRQ^2)
+ (2 * hap$ARH^2 * hap$ARQ^2 + 2 * hap$ARH^2 * hap$VRQ^2)
+ (2 * hap$ARQ^2 * hap$VRQ^2)
)
PICTeo
summary(PICTeo)
hist(PICTeo)
hap[which.max(PICTeo), ]
## GENOTYPE
summary(gen[, genNam])
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##

ARR.ARR
Min.
: 0.000
1st Qu.: 3.305
Median : 9.680
Mean
:11.898
3rd Qu.:16.670
Max.
:41.940
ARR.VRQ
Min.
: 0.000
1st Qu.: 0.000
Median : 0.000
Mean
: 3.012
3rd Qu.: 3.230
Max.
:32.260
AHQ.VRQ
Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.3457
3rd Qu.:0.0000

ARR.AHQ
Min.
: 0.000
1st Qu.: 0.000
Median : 1.615
Mean
: 3.958
3rd Qu.: 6.450
Max.
:19.350
AHQ.AHQ
Min.
: 0.000
1st Qu.: 0.000
Median : 0.000
Mean
: 1.051
3rd Qu.: 0.000
Max.
:10.000
ARH.ARH
Min.
: 0.0000
1st Qu.: 0.0000
Median : 0.0000
Mean
: 0.3254
3rd Qu.: 0.0000

ARR.ARH
Min.
:0.000
1st Qu.:0.000
Median :0.000
Mean
:1.728
3rd Qu.:3.230
Max.
:9.680
AHQ.ARH
Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.3516
3rd Qu.:0.0000
Max.
:6.6700
ARQ.ARH
Min.
: 0.000
1st Qu.: 0.000
Median : 0.000
Mean
: 2.999
3rd Qu.: 3.230

ARR.ARQ
Min.
:11.76
1st Qu.:23.75
Median :29.52
Mean
:31.46
3rd Qu.:39.03
Max.
:54.84
AHQ.ARQ
Min.
: 0.00
1st Qu.: 0.00
Median : 3.23
Mean
: 5.36
3rd Qu.: 9.68
Max.
:22.58
ARH.VRQ
Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.1171
3rd Qu.:0.0000

##
##
##
##
##
##
##
##

Max.
:9.6800
ARQ.ARQ
Min.
: 0.00
1st Qu.:19.35
Median :32.26
Mean
:35.12
3rd Qu.:51.61
Max.
:77.42

Max.
:11.7600
ARQ.VRQ
Min.
: 0.000
1st Qu.: 0.000
Median : 0.000
Mean
: 1.991
3rd Qu.: 3.230
Max.
:20.690

Max.
:47.060
VRQ.VRQ
Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.2323
3rd Qu.:0.0000
Max.
:6.4500

Max.
:3.3300
ARQ.ARK
Min.
:0.00000
1st Qu.:0.00000
Median :0.00000
Mean
:0.05768
3rd Qu.:0.00000
Max.
:3.23000

pdf(file="PrP_genotype_freq.pdf")
par(mfrow=c(3, 5), pty="m", mex=0.7, mar=c(4, 4, 1.5, 0))
hist(gen$ARR.ARR, xlim=c(0, 100), main="ARR.ARR", xlab="Gen.
hist(gen$ARR.AHQ, xlim=c(0, 100), main="ARR.AHQ", xlab="Gen.
hist(gen$ARR.ARH, xlim=c(0, 100), main="ARR.ARH", xlab="Gen.
hist(gen$ARR.ARQ, xlim=c(0, 100), main="ARR.ARQ", xlab="Gen.
hist(gen$ARR.VRQ, xlim=c(0, 100), main="ARR.VRQ", xlab="Gen.

freq.")
freq.")
freq.")
freq.")
freq.")

hist(gen$AHQ.AHQ,
hist(gen$AHQ.ARH,
hist(gen$AHQ.ARQ,
hist(gen$AHQ.VRQ,

freq.")
freq.")
freq.")
freq.")

xlim=c(0,
xlim=c(0,
xlim=c(0,
xlim=c(0,

100),
100),
100),
100),

main="AHQ.AHQ",
main="AHQ.ARH",
main="AHQ.ARQ",
main="AHQ.VRQ",

xlab="Gen.
xlab="Gen.
xlab="Gen.
xlab="Gen.

hist(gen$ARH.ARH, xlim=c(0, 100), main="ARH.ARH", xlab="Gen. freq.")
hist(gen$ARQ.ARH, xlim=c(0, 100), main="ARH.ARQ", xlab="Gen. freq.")
hist(gen$ARH.VRQ, xlim=c(0, 100), main="ARH.VRQ", xlab="Gen. freq.")
hist(gen$ARQ.ARQ, xlim=c(0, 100), main="ARQ.ARQ", xlab="Gen. freq.")
hist(gen$ARQ.VRQ, xlim=c(0, 100), main="ARQ.VRQ", xlab="Gen. freq.")
hist(gen$VRQ.VRQ, xlim=c(0, 100), main="VRQ.VRQ", xlab="Gen. freq.")
dev.off()
rowSums(hap[, hapNam])
rowSums(gen[, genNam])
pdf(file="PrP_genotype_parallel.pdf")
parcoord(gen2[, genNam2], col=c(rep("grey", times=nrow(gen2)-1), "red"),
var.label=TRUE)
dev.off()
###-----------------------------------------------------------------------### luhken_data.R ends here