-
Notifications
You must be signed in to change notification settings - Fork 1
/
prog5_mergeKS.py
45 lines (31 loc) · 965 Bytes
/
prog5_mergeKS.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
input='E:/evolutinoarypattern/RMB2_B10.freebayes_snps/RMB2_B10.res.2.csv'
pInput='E:/evolutinoarypattern/RMB2_B10.freebayes_snps/RMB2_B10.pVal.csv'
output='E:/evolutinoarypattern/RMB2_B10.freebayes_snps/RMB2_B10.res.ks.csv'
timePoint = 12
iFile = open(input,'r')
pFile = open(pInput, 'r')
oFile = open(output, 'w')
pVals = pFile.readlines()
oFile.write('CHROM,POS,TIMEPOINT,REF,ALT,TOTAL,ALT_ALL,P_ALL,pValue,P0,P140,P240,P335,P415,P505,P585,P665,P745,P825,P910,P1000')
oFile.write('\n')
p=0
iFile.readline()
while (True):
line = []
time = iFile.readline()
tmp = time.strip().split(',')
if(time == ''): break
line = tmp[0:5]
line.append(tmp[8])
line.append(tmp[9])
line.append(tmp[11])
line.append(pVals[p].rstrip())
line.append(tmp[10])
p = p + 1
for i in range(0, timePoint-1):
time = iFile.readline()
if(time == ''): break
tmp = time.strip().split(',')
line.append(tmp[10])
oFile.write(','.join(line))
oFile.write('\n')