-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_distance.py
28 lines (25 loc) · 950 Bytes
/
add_distance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if __name__ == '__main__':
map_addr = ''
raw_addr = ''
new_map_addr = ''
chr_list = {}
snp_2_dist = {}
with open(raw_addr,'r') as raw_file:
for line in raw_file:
data = line.strip().split()
snp_2_dist[data[0]] = data[3]
counter = 0
with open(map_addr,'r') as map_file:
with open(new_map_addr,'w') as new_map_file:
for line in map_file:
data = line.strip().split()
if data[1] not in snp_2_dist:
print(data)
print("WOW, again? ")
snp_2_dist[data[1]] = 'NA'
counter += 1
new_map_file.write(data[0]+'\t'+
data[1]+'\t'+snp_2_dist[data[1]]+'\t'+data[3]+'\n')
print("COUNTER:"+str(counter))
#new_map_file.write(data[0]+'\t'+
# data[1]+'\t'+chr_list[data[0]][data[3]]+'\t'+data[3]+'\n')