Carlos-Francisco Méndez-Cruz

Transform soft file in XML file

......@@ -98,13 +98,13 @@ if __name__ == "__main__":
hashGcs[serie][sample][tag] = [content]
#print("New tag: {} and content: {}".format(tag, content.encode(encoding='utf-8', errors='replace')))
# print(hashGcs)
tags = ["Technique", "Orgn", "Strain", "Substrain", "Gversion", "Gtype", "Phase", "Phase", "Air", "Med", "Temp", "Supp"]
tags = ["Technique", "Orgn", "Strain", "Substrain", "Gversion", "Gtype", "Phase", "Air", "Med", "Temp", "Supp", "pH", "Press", "OD", "Rate", "Vess", "Agit", "Name", "Anti"]
#with open(os.path.join(options.outputPath, f.replace(".xml", ".report.csv")), "w", encoding="utf-8") as oFile:
with open(os.path.join(options.outputPath, f.replace(".xml", ".report.csv")), "w") as oFile:
output = 'Serie\tSample\t'
output = '"Serie","Sample",'
for tag in tags:
output = output + tag + '\t'
output = output.rstrip('\t')
output = output + '"' + tag + '",'
output = output.rstrip(',')
oFile.write(output + "\n")
for serie, hashSample in hashGcs.items():
print("Serie: {}".format(serie))
......@@ -117,10 +117,10 @@ if __name__ == "__main__":
else:
pTags.append('')
output = '{}\t{}\t'.format(serie, sample)
output = '"{}","{}",'.format(serie, sample)
for tag in pTags:
output = output + tag + '\t'
output = output.rstrip('\t')
output = output + '"' + tag + '",'
output = output.rstrip(',')
oFile.write(output + "\n")
# oFile.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(sample, serie, Technique, Orgn, Strain, Substrain, Gversion, Gtype, Phase, Air, Med, Temp, Supp))
# for tag, listContent in sorted(hashTag.items()):
......