prototype_regular_gc.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:fwdpy11_arg_example 作者: molpopgen 项目源码 文件源码
def split_breakpoints(breakpoints):
    """
    Take the breakpoints from a meiosis,
    and return them as segments contributed
    by gamete 1 and gamete 2

    Note: bug source could be here. If breakpoints[0] == 0.0,
    we will insert stuff 2x into s1. This needs updating, 
    and so does the C++ version that this is copied from...
    """
    s1 = np.array([(0.0, breakpoints[0])], dtype=[
                  ('left', np.float), ('right', np.float)])
    s2 = np.empty([0], dtype=s1.dtype)
    for i in range(1, len(breakpoints)):
        a = breakpoints[i - 1]
        b = breakpoints[i] if i < len(breakpoints) - 1 else 1.0
        assert(a != b)
        if i % 2 == 0.:
            s1 = np.insert(s1, len(s1), (a, b))
        else:
            s2 = np.insert(s2, len(s2), (a, b))
    return (s1, s2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号