gaynorr / AlphaSimR

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

Simulate sex chromosome and genetically determine sex #35

Open gregorgorjanc opened 2 years ago

gregorgorjanc commented 2 years ago

Ino Curik and Lubos Vostry contacted me about this feature. It would indeed be a useful addition. How should we implement this @gaynorr? I guess determining sex could be done with the finalise function for the pop class, but how should we simulate inheritance of the sex chromosomes in a generic way (say, mammals vs birds, etc.)? Provide a sex chromosome specific recombination map?

gaynorr commented 2 years ago

You'd have to handle the sex determination by adding a function to finalizePop in SimParam. Recombination in sex chromosomes is easily modeled using the sex specific genetic maps. This would let there be recombination in one sex (female for mammals) and no or limited recombination in the other (modeling of pseudo autosomal region).

gregorgorjanc commented 2 years ago

That's what I thought so - I haven't seen any example of the finalisePop() function - do you care to show me a prototype and we could make this into a vignette, with the sex example?

gregorgorjanc commented 2 years ago

Just to add here that sometimes there is random inactivation of one of the sex chromosomes in females (not sure what happens with the PAR region in males?!). Could we also handle this with finalisePop() too (need to think what we would actually do)? We could subtract the contribution from the sex chromosome and then add back whatever we want to add back in (50% of effect from each chromosome). The point here is that we should get the full dose of dominance/inbreeding in each cell. Does this make sense?

In total my plan is to:

1) Set female and male recombination rates, with males having 0 recombination outside the pseudo autosomal region (PAR) (check SimParam$switchMaleMap) 2) Set alleles on the second male chromosome (Y) to 0 so that we would get no quantitative trait contribution from outside the PAR 3) Determine sex via the SimParam$finalisePop() (how? a hack would be to look for all 0 on the non-PAR, or maybe better via recombination tracking, the latter would be the cleanest I think) 4) Expand finalisePop() to deal with random inactivation as alluded above