-
Notifications
You must be signed in to change notification settings - Fork 3
/
cladereport.py
executable file
·46 lines (35 loc) · 1.48 KB
/
cladereport.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
#!/usr/bin/env python
"""Visualize CladeCompare output file(s) in an HTML page.
If given one file:
Display foreground and background consensus sequences as 2 rows, wrapped.
Color of foreground cells corresponds to p-value (#stars).
If given multiple files:
Display all foreground consensus sequences as N rows, wrapped.
Background is [undecided] either the bottom row, if the same across all
input seqs, or a separate block, or just not shown.
Color of foreground cells corresponds to p-value (#stars).
"""
from __future__ import print_function
import argparse
import logging
from cladecomparelib.report import do_single, do_multi, html_page_tpl
logging.basicConfig(level=logging.INFO,
format="%(module)s [@%(lineno)s]: %(message)s")
AP = argparse.ArgumentParser(__doc__)
AP.add_argument('outfiles', nargs='+',
help="Output file(s) generated by cladecompare.py")
AP.add_argument('-p', '--pattern',
help="Pattern file (.pttrn) generated by cladecompare.py")
AP.add_argument('-o', '--output',
help="HTML output file name. (Default: stdout)")
args = AP.parse_args()
if len(args.outfiles) == 1:
title, contents = do_single(args.outfiles[0], args.pattern)
else:
title, contents = do_multi(args.outfiles, args.pattern)
html_report = html_page_tpl % dict(title=title, contents=contents)
if args.output:
with open(args.output, 'w') as handle:
handle.write(html_report)
else:
print(html_report)