comparison gene_family_classifier.py @ 111:5f77ac9fbb46 draft

Uploaded
author greg
date Mon, 27 Feb 2017 14:44:47 -0500
parents 6cb3520313b9
children 9e688af74aae
comparison
equal deleted inserted replaced
110:6cb3520313b9 111:5f77ac9fbb46
84 84
85 85
86 def write_html_output(output, title, dir): 86 def write_html_output(output, title, dir):
87 with open(output, 'w') as fh: 87 with open(output, 'w') as fh:
88 fh.write('<html><head><title>%s</title></head>\n' % title) 88 fh.write('<html><head><title>%s</title></head>\n' % title)
89 fh.write('<body><p/><table>\n') 89 fh.write('<body><p/><table cellpadding="5" cellspacing="5">\n')
90 fh.write('<tr><th>Size</th><th>Name</th></tr>\n') 90 fh.write('<tr><th>Size</th><th>Name</th></tr>\n')
91 for fname in os.listdir(dir): 91 for fname in os.listdir(dir):
92 try: 92 try:
93 size = str(os.path.getsize(fname)) 93 size = str(os.path.getsize(os.path.join(dir, fname)))
94 except: 94 except:
95 size = 'unknown' 95 size = 'unknown'
96 link = '<a href="%s" type="text/plain">%s</a>\n' % (fname, fname) 96 link = '<a href="%s" type="text/plain">%s</a>\n' % (fname, fname)
97 fh.write('<tr><td>%s</td><td>%s</td></tr>\n' % (size, link)) 97 fh.write('<tr><td>%s</td><td>%s</td></tr>\n' % (size, link))
98 fh.write('</table></body></html>\n') 98 fh.write('</table></body></html>\n')