gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
43 stars 18 forks source link

Founder population from AlphaSimR #18

Closed rthapa1 closed 2 years ago

rthapa1 commented 3 years ago

Hi hist_plot_founder , I am simulating a breeding program for synthetic cultivar. I checked the distribution of founder population. The allele frequency distribution looks like skewed inferring fixation of many alleles. I used the following parameter. Could you please see what is happening? I was expecting the allele frequency distribution to be normal distribution.

library(AlphaSimR) trait1=1; nInd=1000; nChr = 8; segSites = 10000; mean.DD.i <- 1 var.DD.i <- 10 h2.i <- 0.1

simulation

FOUNDERPOP = runMacs(nInd=nInd,nChr=nChr,segSites=segSites, inbred=FALSE, ploidy=4)

SP = SimParam$new(FOUNDERPOP) SP = SP$ addTraitAD(60, meanDD=mean.DD.i, varDD=var.DD.i)$ setVarE(h2=h2.i) SIMPARAM = SP$addSnpChip(8000)

founderpop = newPop(FOUNDERPOP, simParam=SIMPARAM) geno <- pullSnpGeno(founderpop)

gregorgorjanc commented 3 years ago

@rthapa1 why would you expect normal distribution for allele frequencies? Most neutral mutations will have low frequency or will be close to fixation by drift, hence U shaped distribution - I am not fully sure what MaCS does, but encoding alleles as 0 or 1 does not make difference for quantitative genetic analyses done in AlphaSimR (hence the half U shape) - we are working on improving this. Also note that the GENERIC species, the default in runMacs(), might not be what you would expect/need for your setting. You can build your own MaCS simulation usingrunMacs2()`.

rthapa1 commented 3 years ago

Thank you for your explanation. Is there a way to create population structure in the founder population?

gregorgorjanc commented 3 years ago

@rthapa1 Yes, by creating splits in the coalescent simulation with runMacs() we are working on leveraging other more modern back in time simulators for this as well. There are other posts on this forum that enable you to work with your genotype data, which will have the structure you want, but there are many other issues if you follow that path.

rthapa1 commented 3 years ago

Thank you. Is the nChr equals to haploid chromosome number or basic chromosome number? I am working on autotetraploid so I assume it would be 8. I would appreciate your answer.

gregorgorjanc commented 3 years ago

Basic chromosome number. We do have support for autotetraploids - see ploidy argument in runMacs()