Closed mjpeach closed 5 years ago
The code should do the same as Karl's. Looking xoi 0.67-4 package source: simStahl.c lines 118-126 first check whether p > 0, then sample a crossover count from a Poisson distribution with rate p * L, where L is the genetic length in Morgans. My code doesn't have a maximum number of crossovers (max_nxo in Karl's), but otherwise is identical.
While you're right that p * L will often be small, this is the model: often no events "escape", but occasionally one or rarely two do.
Thanks for your careful look over the code. I also do genealogy, which is one of my motivations for this research.
https://github.com/williamslab/ped-sim/blob/fbaa79e9cf4de7cfe90e2e4b21945d94c129e3ad/cointerfere.cc#L127
Sorry, I will follow-up with an e-mail; thought I ought to query this one: the result from 'no_interfere' will either be truncated or rounded to integer, and given the likely values of 'p' & 'Length' (e.g. those of Campbell et al) the following loop will seldom be entered? - I think you need to test 'p' within the loop (as Karl has done)?
n.b. I'm a Systems & Software Engineer with an interest in Genealogy - we're most interested in your upcoming Paper, which is underpinned by this software?
Regards, Malcolm Peach (BSc Hons, MSc)