Mating Strategies - reworkhow/XSim.jl GitHub Wiki

load XSim package
using XSim
set genome information
Example 1: One chromosome with 2000 loci
chrLength = 1.0
numChr    = 1
numLoci   = 2000
mutRate   = 0.0
locusInt  = chrLength/numLoci
mapPos   = collect(0:locusInt:(chrLength-0.0001))
geneFreq = fill(0.5,numLoci)
build_genome(numChr,chrLength,numLoci,geneFreq,mapPos,mutRate)
Example 2: Genome with 10 markers and one QTL on each of two chromosomes
chrLength= 0.1  #length of each chromosome 
numChr   = 2    #number of chromosomes
nmarkers = 10   #number of loci for each chromosome
nQTL     = 1    #number of QTL for each chromosomefects,mutRate);
build_genome(numChr,chrLength,nmarkers,nQTL)
random mating
#set genome information at first
#generate founders
popSizeFounder = 2
sires = sampleFounders(popSizeFounder);
dams  = sampleFounders(popSizeFounder);

#random mating
ngen,popSize = 5,10
sires1,dams1,gen1 = sampleRan(popSize, ngen, sires, dams);
selection
#selection
nSires,nDams = 2,2
popSize,ngen = 10,5
varRes = 1.0
sire2,dam2,gen2=sampleSel(popSize, nSires, nDams, ngen,sires, dams, varRes);
sample from a pedigree
myPed=[1 0 0
       2 0 0
       3 0 0
       4 0 0
       5 1 2
       6 3 4];

animals = samplePed(myPed);

others

#concat several cohorts
animals=concatCohorts(sires,dams);

#get a subset of a cohort
animals=cohortSubset(sires,[1,2]);