本文整理汇总了Python中pybedtools.IntervalFile.seek方法的典型用法代码示例。如果您正苦于以下问题:Python IntervalFile.seek方法的具体用法?Python IntervalFile.seek怎么用?Python IntervalFile.seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybedtools.IntervalFile
的用法示例。
在下文中一共展示了IntervalFile.seek方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from pybedtools import IntervalFile [as 别名]
# 或者: from pybedtools.IntervalFile import seek [as 别名]
if not os.path.exists(A_idx_file):
index_bed.index(A_file)
if not os.path.exists(B_idx_file):
index_bed.index(B_file)
# load the indices for A and B
A_map = [] # list of chrom/offset tuples
for line in open(A_idx_file):
fields = line.strip().split("\t")
A_map.append((fields[0], int(fields[1]), int(fields[2]), int(fields[3]), int(fields[4])))
B_map = [] # list of chrom/offset tuples
for line in open(B_idx_file):
fields = line.strip().split("\t")
B_map.append((fields[0], int(fields[1]), int(fields[2]), int(fields[3]), int(fields[4])))
# sweep for each chrom in A, the "query file"
for entry in A_map:
a_chrom = entry[0]
a_offset = entry[1]
b_offset = entry[1]
# jump to the offset for this chrom
A.seek(a_offset)
B.seek(b_offset)
# sweep this chrom in A and B
A_cardinality = entry[3]
B_cardinality = entry[3]
sweep(A, B, A_cardinality, B_cardinality)