本文整理匯總了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)