gregorgorjanc / AlphaSimR

R package for breeding program simulations
Other
0 stars 2 forks source link

Option matchID in pedigreeCross() and pedigreeCross2() does not work #7

Open AudreyAAMartin opened 5 months ago

AudreyAAMartin commented 5 months ago

matchID should allow to match founders with a specific ID within the population to be created by pedigreeCross. It works when founders are all on top of the pedigree, eg 1:n first individuals, but it won't work if there are founders (full/half) further down the pedigree. Those founders ID should be attributed directly when creating the founderpop which is not an option. The second option is to recode the pedigree accordingly with all founders as 1:n but problematic with sortPed() (linked to https://github.com/gregorgorjanc/AlphaSimR/issues/6#issue-2136808192).

Error can be reproduced by simply calling pedigreeCross with matchID set to TRUE.

founderPop = quickHaplo(nInd=5, nChr=1, segSites=10)
SP = SimParam$new(founderPop)
pop = newPop(founderPop, simParam=SP)
id = 1:10
mother = c(0,0,0,0,1,1,2,7,0,7)
father = c(0,0,0,0,3,3,4,5,6,6)
pop2 = pedigreeCross(pop, id, mother, father, simParam=SP, matchID = TRUE)
gregorgorjanc commented 5 months ago

@AudreyAAMartin again paste the error so we have all the info on how to move onwards

AudreyAAMartin commented 5 months ago

The error is because it is trying to match the ped ID and the ID within founderpop

Error in pedigreeCross(pop, id, mother, father, simParam = SP, matchID = TRUE) : 
  The following founders are missing: 0