source: orange-bioinformatics/doc/modules/obiOMIM-disease-network.py @ 1162:8da916fa0c0a

Revision 1162:8da916fa0c0a, 621 bytes checked in by ales_erjavec <ales.erjavec@…>, 4 years ago (diff)
Line 
1import obiOMIM
2
3diseases = obiOMIM.diseases()
4genes = [obiOMIM.disease_genes(disease) for disease in diseases]
5
6vertices = []
7edges = []
8for i in range(len(diseases)):
9    vertices.append('%i "%s"\n' % (i + 1, diseases[i].name))
10    for j in range(i + 1, len(diseases)):
11        intersection = set(genes[i]).intersection(genes[j])
12        if intersection:
13            edges.append('%i %i %i l "%s"\n' %(i + 1, j + 1, len(intersection), ",".join(sorted(intersection))))
14
15file = open("disease.net", "wb")
16file.write("*Vertices %i 2\n" % len(vertices))
17file.writelines(vertices)
18file.write("*Edges\n")
19file.writelines(edges)
Note: See TracBrowser for help on using the repository browser.