gaynorr / AlphaSimR

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

document recHist #210

Open hannesbecher opened 4 days ago

hannesbecher commented 4 days ago

Is your feature request related to a problem? Please describe. The recHist slot/property of the SimParam class is not documented/described, it seems.

Describe the solution you'd like This is related to #94 of course, but as a start, it would be helpful to add a documentation page to the package explaining the nested structure of the recHist object.

Describe alternatives you've considered

94

Additional context An ASR simulation of tetraploids with 3 autosomes:

library(AlphaSimR)

nmp <- runMacs(nInd = 10, segSites = 10000, nChr = 3, ploidy = 4)
nmp

SP <- SimParam$new(nmp)
SP$setTrackPed(isTrackPed = T)
SP$setTrackRec(isTrackRec = T)
g00 <- newPop(nmp)

SP$pedigree

g01 <- randCross(g00, nCrosses = 10)
g02 <- randCross(g01, nCrosses = 10)
g03 <- randCross(g02, nCrosses = 10)
g04 <- randCross(g03, nCrosses = 10)
g05 <- randCross(g04, nCrosses = 10)
g06 <- randCross(g05, nCrosses = 10)
g07 <- randCross(g06, nCrosses = 10)
g08 <- randCross(g07, nCrosses = 10)
g09 <- randCross(g08, nCrosses = 10)
g09

SP$recHist[[100]] # 3 homologous sets
SP$recHist[[100]][1,1][[1]] # homologous set 1 (of 4 chromosomes)

SP$recHist[[100]][1,1][[1]][1,1][[1]] # the focal individual's chromosome 1st homologous chromosome in set 1
SP$recHist[[100]][1,1][[1]][2,1][[1]] # the focal individual's chromosome 2nd homologous chromosome in set 1
SP$recHist[[100]][1,1][[1]][3,1][[1]] # the focal individual's chromosome 3rd homologous chromosome in set 1
SP$recHist[[100]][1,1][[1]][4,1][[1]] # the focal individual's chromosome 4th homologous chromosome in set 1

The 1st and 2nd chromosome of each set come from the same parent, I think. Which one is it, mother or father?

Feel fee to assign to me/ happy to send a PR.

gregorgorjanc commented 4 days ago

@hannesbecher I replied to this question https://github.com/gaynorr/AlphaSimR/issues/34 with an example that you can use/adapt-to-your-case as a starting point - you could lift and polish that explanation ...

hannesbecher commented 4 days ago

Cool thanks, did nt think to look into the closed issues, @gregorgorjanc. Where should this information best be moved to, a vignette? A documentation page? I guess both would be useful? @gaynorr ? Doc page I guess documentation pages can be hard to find if they are not for a specific function. The SimParam class has a very complicated doc page but only its methods are explained. Where would one best document the recHist slot/property of SimParam?
Vignette I think a general vignette on recombination in ASR would be useful. It might cover:

gregorgorjanc commented 4 days ago

@hannesbecher this would be best handled by a vignette in my opinion and we have an open issue about this at https://github.com/gaynorr/AlphaSimR/issues/94 - I asked @AprilYUZhang to lead on this one, but I reckon we should all pul our shoulder to the wheel to make it happen. I see she started with some edits in https://github.com/AprilYUZhang/AlphaSimR/commit/7971e9bb398fdf0792c95b7180f5c74dfb331c8b, but we should move those to a separate independent vignette. Can you lead on this and pull @AprilYUZhang and me as needed and then @gaynorr will surely jump at some point in;)

gregorgorjanc commented 4 days ago

@hannesbecher yes, you have raised good points that should be mentioned in the vignette - how to specify recombination rate, map, marker vs bp level, distances, recHist!