-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess2.py
57 lines (43 loc) · 1.03 KB
/
process2.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
if (True):
name_prots = "out/nmr_ids_prots.txt"
name_out = "out/nmr_ids_goa.txt"
if (False):
name_prots = "out/bw_ids_prots.txt"
name_out = "out/bw_ids_goa.txt"
if (False):
name_prots = "out/m_ids_prots.txt"
name_out = "out/m_ids_goa.txt"
if (False):
name_prots = "out/bb_ids_prots.txt"
name_out = "out/bb_ids_goa.txt"
if (False):
name_prots = "out/c_ids_prots.txt"
name_out = "out/c_ids_goa.txt"
if (False):
name_prots = "out/gw_ids_prots.txt"
name_out = "out/gw_ids_goa.txt"
###
fprots = open(name_prots, "r")
fout = open(name_out, "w")
fgoa = open("/media/dmitriy/ssd2/data/goa_uniprot_p.gaf", "r")
prots = {}
for line in fprots:
fields = line[:-1].split()
prots[fields[2]] = set()
i = 0
for line in fgoa:
i += 1
if (i % 1000000 == 0):
print(i)
if (i<=9):
continue
else:
fields = line.split()
prot = fields[1]
if (prot in prots.keys()):
prots[prot].add(fields[4])
for key in prots.keys():
res = key
for go in prots[key]:
res += " " + go
fout.write("{}\n".format(res))