Mercurial > repos > laurenmarazzi > netisce_test
comparison tools/myTools/bin/FVS_run.py @ 1:7e5c71b2e71f draft default tip
Uploaded
author | laurenmarazzi |
---|---|
date | Wed, 22 Dec 2021 16:00:34 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:f24d4892aaed | 1:7e5c71b2e71f |
---|---|
1 #!/usr/bin/env python3 | |
2 | |
3 import networkx as nx | |
4 import random | |
5 from FVS_python3 import FVS as FVS | |
6 import re | |
7 import csv | |
8 import sys | |
9 | |
10 outputfile=open('fvs.txt','w+') | |
11 edges=open(sys.argv[1]).readlines() #open network file | |
12 data1=[(line.strip().split()[0],line.strip().split()[1],line.strip().split()[2]) for line in edges] | |
13 for elem in data1: | |
14 if elem[0]==elem[2]: | |
15 if elem[1]=="inhibits": | |
16 data1.remove(elem) | |
17 data=[tuple([line[0],line[2]]) for line in data1] #creates tuple from file | |
18 G3=nx.DiGraph() | |
19 G3.add_edges_from(data) | |
20 | |
21 G3_FVS1=FVS.FVS(G3, T_0=0.6, alpha=0.99, maxMvt_factor=5, maxFail=10,randomseed=1) | |
22 G3_FVS1.sort() | |
23 | |
24 outputfile.write('name'+'\n') | |
25 outputfile.write("\n".join(map(str, G3_FVS1))) | |
26 | |
27 outputfile.close() |