-
Notifications
You must be signed in to change notification settings - Fork 2
/
SP_CSV_to_YAML.py
32 lines (27 loc) · 933 Bytes
/
SP_CSV_to_YAML.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
from os import path,system
from analysis import BH76_analysis
def conversion():
wdict = {}
with open('./FLOSIC/BH76data_flosic.csv','r') as infl:
for irow,arow in enumerate(infl):
tmp = arow.strip().split(',')
if irow == 0:
for i in range(1,len(tmp)):
wdict[tmp[i].strip()] = {}
dfas = list(wdict.keys())
Ndfa = len(dfas)
continue
mol = tmp[0]
for i in range(Ndfa):
wdict[dfas[i]][mol] = float(tmp[1+i])
for dfa in dfas:
if '@' in dfa:
tdir = './FLOSIC/'+dfa.split('@')[0]+'/'+dfa+'_BH76/'
else:
tdir = './FLOSIC/'+dfa+'/'+dfa+'_BH76/'
if not path.isdir(tdir):
system('mkdir -p '+tdir)
BH76_analysis(cdir=tdir,edict=wdict[dfa],wrc=True)
return
if __name__ == "__main__":
conversion()