我试图在两个文件之间进行链式比较,如果在指定的时间间隔内,则打印/写出结果。
这就是我目前所拥有的。
test1文件:
A0AUZ9,7,17 #just this one line
测试2文件:
A0AUZ8, DOC_PP1_RVXF_1, 8, 16, PF00149, O24930
A0AUZ9, LIG_BRCT_BRCA1_2, 127, 134, PF00533, O25336
A0AUZ9, LIG_BRCT_BRCA1_1, 127, 132, PF00533, O25336
A0AUZ9, DOC_PP1_RVXF_1, 8, 16, PF00149, O25685
A0AUZ9, DOC_PP1_RVXF_1, 8, 16, PF00149, O25155
results = []
with open('test1', 'r') as disorder:
for lines in disorder:
cells = lines.strip().split(',')
with open('test2', 'r') as helpy:
for lines in helpy:
blocks = lines.strip().split(',')
if blocks[0] != cells[0]:
continue
elif cells[1] <= blocks[2] and blocks[3] <= cells[2]:
results.append(blocks)
with open('test3','wt') as outfile:
for i in results:
outfile.write("%s\n" % i)
在第一列中有匹配的ID
我没有得到任何输出,我不确定哪里出了问题。