def xover(rate):
"""
This is a mimic of a fwdpp
recombination policy.
We return a sorted list of breakpoints
on the interval [0,1). The list is capped
with the max value of a float (C/C++ double),
which is a trick fwdpp uses.
It happens that we generate the exact same value
from time to time. Internall, fwdpp doesn't care,
and recoginizes that as a "double x-over". However,
msprime cares, b/c it results in an edge with
left == right and an Exception gets raised. So,
we purge out double x-overs via np.unique.
"""
nbreaks = np.random.poisson(rate)
if nbreaks == 0:
return np.empty([0], dtype=np.float)
rv = np.random.random_sample(nbreaks)
rv = np.unique(rv)
rv = np.insert(rv, len(rv), np.finfo(np.float).max)
return rv
prototype_regular_gc.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录