bed_read.py 文件源码

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

项目:pandas-plink 作者: limix 项目源码 文件源码
def read_bed_chunk(filepath, nrows, ncols, row_start, row_end, col_start,
                   col_end):

    X = zeros((row_end - row_start, col_end - col_start), int64)

    ptr = ffi.cast("uint64_t *", X.ctypes.data)
    strides = empty(2, int64)
    strides[:] = X.strides
    strides //= 8

    e = lib.read_bed_chunk(filepath, nrows, ncols, row_start, col_start,
                           row_end, col_end, ptr,
                           ffi.cast("uint64_t *", strides.ctypes.data))
    if e != 0:
        raise RuntimeError("Failure while reading BED file %s." % filepath)

    X = ascontiguousarray(X, float)
    X[X == 3] = nan
    return X
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号