Mercurial > repos > greg > gene_family_classifier
comparison gene_family_classifier.py @ 115:713719f9210a draft
Uploaded
| author | greg |
|---|---|
| date | Mon, 27 Feb 2017 15:02:39 -0500 |
| parents | 1f357ae51fc4 |
| children | 7789adec8707 |
comparison
equal
deleted
inserted
replaced
| 114:1f357ae51fc4 | 115:713719f9210a |
|---|---|
| 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><h3>%s</h3></head>\n' % title) | 88 fh.write('<html><head><h3>%s</h3></head>\n' % title) |
| 89 fh.write('<body><p/><table cellpadding="2">\n') | 89 fh.write('<body><p/><table cellpadding="2">\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 sorted(os.listdir(dir)): | 91 for index, fname in enumerate(sorted(os.listdir(dir))): |
| 92 if index % 2 == 0: | |
| 93 bgcolor = '#FFFFCC' | |
| 94 else: | |
| 95 bgcolor = '#FFFFFF' | |
| 92 try: | 96 try: |
| 93 size = str(os.path.getsize(os.path.join(dir, fname))) | 97 size = str(os.path.getsize(os.path.join(dir, fname))) |
| 94 except: | 98 except: |
| 95 size = 'unknown' | 99 size = 'unknown' |
| 96 link = '<a href="%s" type="text/plain">%s</a>\n' % (fname, fname) | 100 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)) | 101 fh.write('<tr bgcolor="%s"><td>%s</td><td>%s</td></tr>\n' % (bgcolor, size, link)) |
| 98 fh.write('</table></body></html>\n') | 102 fh.write('</table></body></html>\n') |
| 99 | 103 |
| 100 | 104 |
| 101 # Define command response buffers. | 105 # Define command response buffers. |
| 102 tmp_out = tempfile.NamedTemporaryFile().name | 106 tmp_out = tempfile.NamedTemporaryFile().name |
