-
Notifications
You must be signed in to change notification settings - Fork 0
/
1_Founders_mt.R
81 lines (52 loc) · 1.92 KB
/
1_Founders_mt.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Accounting for nuclear - and mito-genome in dairy cattle breeding: a simulation study
# Gabriela Mafra Fortuna
# Highlander Lab
# The Roslin Institute
# July 2020 - updated Aug 2021
# ------------------------------------------------------------------------------------------------------------------------
# ---------------------------------- Generate initial haplotypes & nuclear founder pop -----------------------------------
# ---------------------------------- Nuclear -----------------------------------
cat("Simulating nuclear haplotypes...\n")
FOUNDERPOP <- runMacs(nInd = nFem*2,
nChr = nChr,
segSites = nQtl+nSnp,
species = "CATTLE",
ploidy = 2L)
SP = SimParam$new(FOUNDERPOP)$
restrSegSites(nQtl, nSnp, overlap=FALSE)$
addTraitA(nQtlPerChr=nQtl, mean=0, var=varA)$
setSexes("yes_sys")$
addSnpChip(nSnp)
cat("Simulating founder population...\n")
founders <- newPop(FOUNDERPOP)
rm(FOUNDERPOP)
# ---------------------------------- Mitochondrial -----------------------------------
cat("Simulating mitochondrial haplotypes...\n")
i = 0
while(i < 400){
mtDNA = runMacs2(nInd = mtInd,
nChr = 1,
Ne = mNe,
bp = 16202,
genLen = 0,
mutRate = mu,
histNe = histMtNe,
histGen = histMtGen,
ploidy = 1)
i = mtDNA@nLoci
}
# Qtl and Snp par depending on scenario
mQtlmax = i
mSnpmax = mQtlmax
mQtlmin = 1
mSnpmin = i
SP2 = SimParam$new(mtDNA)$
restrSegSites(overlap=TRUE)$
addTraitA(nQtlPerChr=mQtlmax, mean = 0, var = varM)$
addSnpChip(nSnpPerChr = mSnpmax)
SP3 = SimParam$new(mtDNA)$
restrSegSites(overlap=TRUE)$
addTraitA(nQtlPerChr=mQtlmin, mean = 0, var = varM)$
addSnpChip(nSnpPerChr = mSnpmin)
cat("Saving data as 'founders.RData'...\n")
save.image("founders.RData")