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
评论列表
文章目录