This repository has been archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse.py
49 lines (37 loc) · 1.41 KB
/
parse.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
44
45
46
47
48
import csv
import re
import parseH
import parseL
import outputAdapterTable
import outputAdapterODMax
from os import listdir
from os.path import isfile, join
indexFolder = "../tolScreenCleanerData/INDEX"
platesFolder = "../tolScreenCleanerData/PLATES"
outputFolder = "../tolScreenCleanerData/OUTPUT"
# Get available index files
indexFilesH = [ join(indexFolder,f) for f in listdir(indexFolder) if isfile(join(indexFolder,f)) and re.match("H.+.txt",f)]
indexFilesL = [ join(indexFolder,f) for f in listdir(indexFolder) if isfile(join(indexFolder,f)) and re.match("L\d+_STRAIN.txt",f)]
# Parse all Indexes
plates =[];
for fileL in indexFilesL:
plates.append(parseL.parseIndex(fileL));
for fileH in indexFilesH:
plates.append(parseH.parseIndex(fileH));
print('Found ' + str(len(plates)) + ' different plates:')
for plate in plates:
print ("\t",plate)
outputInfoTable = outputAdapterTable.createOutputFile(outputFolder);
outputInfoODMax = outputAdapterODMax.createOutputFile(outputFolder);
# go trough found Plates
for plate in plates:
if plate.MachineType=='H':
parseH.parsePlateData(plate, platesFolder)
elif plate.MachineType=='L':
parseL.parsePlateData(plate, platesFolder)
else:
raise NameError("Unknown plate type")
outputAdapterTable.outputPlateData(plate,outputInfoTable);
outputAdapterODMax.outputPlateData(plate,outputInfoODMax);
outputAdapterTable.finish(outputInfoTable)
outputAdapterODMax.finish(outputInfoODMax)