Commit 5531345a authored by simon verdez's avatar simon verdez

change output in create html

parent f13b5639
......@@ -202,7 +202,7 @@ def main():
if opt in ("-t"):
tsvfile = arg
elif opt in ("-o"):
sys.stdout = open(arg, 'w')
outputfile = arg
except getopt.GetoptError:
print("please use this command as follow: ")
print('usage : python2.7 create_html.py -v <vcf/file> -h <report/from/HLAscan> -t tableau_pharmgkb.tsv -o <path/to/file/results>')
......@@ -222,6 +222,10 @@ def main():
print('No tsv file given')
print('usage : python2.7 create_html.py -v <vcf/file> -h <report/from/HLAscan> -t tableau_pharmgkb.tsv -o <path/to/file/results>')
sys.exit(1)
if not vars().has_key('outputfile'):
print('No output file given')
print('usage : python2.7 create_html.py -v <vcf/file> -h <report/from/HLAscan> -t tableau_pharmgkb.tsv -o <path/to/file/results>')
sys.exit(1)
# Check files
try:
......@@ -242,6 +246,12 @@ def main():
except IOError:
print('PharmGKB tsv file does not exist')
sys.exit(1)
try:
f = open(outputfile, 'w')
f.close()
except IOError:
print("Can't open output file" )
sys.exit(1)
#execute
......@@ -251,7 +261,8 @@ def main():
body=extract_rs(tsvfile,vcfSNP,DictRs,body)
body=extract_HLA(report,DictHLA,body)
print(htmltag.HTML(head+body))
with open(outputfile,'w') as output:
output.write(htmltag.HTML(head+body))
if __name__ == "__main__":
main()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment