-
Notifications
You must be signed in to change notification settings - Fork 15
Multi trait Simulation
Hao Cheng edited this page Apr 23, 2020
·
1 revision
using XSim
numChr = 3
chrLength = [1.0, 1.1, 0.9]
numLoci = [10 ,15 ,20]
nTraits = 2
geneFreq = Array{Array{Float64,1},1}(undef,0)
qtlIndex = Array{Array{Int64,1},1}(undef,0)
qtlEffects = Array{Array{Float64,2},1}(undef,0)
numQTLOnChr =[2, 3, 1]
numQTL=6
qtlIndex = [[1; 4],[3;7;9],[5]]
geneFreq = [[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5],[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5],[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5]]
mPos = [[.05;.1;.15;.2;.25;.3;.35;.40;.45;.5],[.05;.1;.15;.2;.25;.3;.35;.40;.45;.5;.55;.65;.75;.85;.95],[.05;.1;.15;.2;.25;.3;.35;.4;.45;.5;.54;.58;.65;.75;.758;.759;.8;.85;.851;.859]]
push!(qtlEffects,randn(2,2))
push!(qtlEffects,randn(3,2))
push!(qtlEffects,randn(1,2))
G0 = [1. 0.5;0.5 2.]
XSim.build_genome(numChr,chrLength,numLoci,geneFreq,mPos,qtlIndex,qtlEffects,nTraits,G0)
XSim.setResidualVariance(G0)
popSizeFounder = 10
sires = sampleFounders(popSizeFounder);
dams = sampleFounders(popSizeFounder);
nSires,nDams = 2,2
popSize,ngen = 10,5
sire2,dam2,gen2=sampleSel(popSize, nSires, nDams, ngen,sires, dams);
numChr=3
chrLength = [1.0, 1.1, 0.9]
numLoci=[10 ,15 ,20]
geneFreq = Array{Array{Float64,1},1}(undef,0)
qtlIndex = Array{Array{Int64,1},1}(undef,0)
qtlEffects = Array{Array{Float64,2},1}(undef,0)
numQTLOnChr =[2, 3, 1]
numQTL=6
qtlIndex = [[1; 4],[3;7;9],[5]]
geneFreq = [[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5],[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5],[.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5;.5]]
mPos = [[.05;.1;.15;.2;.25;.3;.35;.40;.45;.5],[.05;.1;.15;.2;.25;.3;.35;.40;.45;.5;.55;.65;.75;.85;.95],[.05;.1;.15;.2;.25;.3;.35;.4;.45;.5;.54;.58;.65;.75;.758;.759;.8;.85;.851;.859]]
push!(qtlEffects,randn(2,1))
push!(qtlEffects,randn(3,1))
push!(qtlEffects,randn(1,1))
G0 = Array{Float64,2}(undef,1,1)
G0[1,1] = 1
nTraits = 1
XSim.build_genome(numChr,chrLength,numLoci,geneFreq,mPos,qtlIndex,qtlEffects,nTraits,G0)
XSim.setResidualVariance(G0)
popSizeFounder = 2
sires = sampleFounders(popSizeFounder);
dams = sampleFounders(popSizeFounder);
nSires,nDams = 2,2
popSize,ngen = 10,5
sire2,dam2,gen2=sampleSel(popSize, nSires, nDams, ngen,sires, dams);