-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrequencyAnalysis.py
More file actions
34 lines (26 loc) · 1008 Bytes
/
FrequencyAnalysis.py
File metadata and controls
34 lines (26 loc) · 1008 Bytes
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
#YuEnoch 30-07-2024
#FrequencyAnalysis.py
#Purpose: converts the individual Frequency Analysis files into one file
import sys
import csv
treatments = sys.argv[1]
treatments = treatments.split(',')
treatmentNames = sys.argv[2]
treatmentNames = treatmentNames.split(',')
AAList = ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y']
for i in range(len(treatments)):
input = open(treatments[i]+"_ObsExp", "r")
globals()['list%s' % treatments[i]] = []
for line in input:
line = line.strip().split(' ')[2]
globals()['list%s' % treatments[i]].append(line)
output = open("ObsExp_Frequencies.csv", 'w', newline = '')
writer = csv.writer(output)
header = ["Obs/Exp"] + treatments
writer.writerow(header)
for i in range(len(AAList)):
lis = [AAList[i]]
for j in range(len(treatments)):
lis.append(globals()['list%s' % treatments[j]][i])
writer.writerow(lis)
output.close()