Mercurial > repos > jankanis > blast2html
changeset 27:4e6ac737ba17
improve the galaxy html stripping warning; make sure the tool can find the template from within galaxy
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Thu, 15 May 2014 16:46:09 +0200 |
parents | eee23a36c582 |
children | 8a8c0c71b5d1 |
files | blast2html.html.jinja blast2html.py |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/blast2html.html.jinja Thu May 15 12:44:44 2014 +0200 +++ b/blast2html.html.jinja Thu May 15 16:46:09 2014 +0200 @@ -371,8 +371,16 @@ <body> - <div id="strip_html_warning" style="border: 3px solid red; color: red"> - This html seems to have been stripped by Galaxy. Disable Galaxy's html sanitization feature to view the full page, or download this page instead of viewing it in Galaxy. + + <div id="strip_html_warning"> + <!-- This div should be hidden by the header css block. Galaxy + strips all css, breaking this page but making this warning + visible. This warning contains some ugly old skool tabular html + layout that is not stripped. --> + <table bgcolor="#FFE5C9"><tr><td><font color="red"><b> + <font size=5><center>This html page seems to have been stripped by Galaxy.</center></font> + Disable Galaxy's html sanitization feature to view the full page (see <font face=monospace>sanitize_all_html</font> in your galaxy's universe_wsgi.ini), or download this page instead of viewing it in Galaxy. + </b></font></td></tr></table> </div> <div id=content>
--- a/blast2html.py Thu May 15 12:44:44 2014 +0200 +++ b/blast2html.py Thu May 15 16:46:09 2014 +0200 @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# Actually runs under either python 2 or 3 # Copyright The Hyve B.V. 2014 # License: GPL version 3 or higher @@ -273,8 +274,10 @@ ident = "{:.0%}".format(float(min(hsp.Hsp_identity / blastxml_len(hsp) for hsp in hsps))), accession = hit.Hit_accession) + def main(): - + default_template = path.join(path.dirname(__file__), 'blast2html.html.jinja') + parser = argparse.ArgumentParser(description="Convert a BLAST XML result into a nicely readable html page", usage="{} [-i] INPUT [-o OUTPUT]".format(sys.argv[0])) input_group = parser.add_mutually_exclusive_group(required=True) @@ -289,7 +292,7 @@ # handle the errors. This introduces a small race condition when # jinja later tries to re-open the template file, but we don't # care too much. - parser.add_argument('--template', type=argparse.FileType(mode='r'), default='blast2html.html.jinja', + parser.add_argument('--template', type=argparse.FileType(mode='r'), default=default_template, help='The template file to use. Defaults to blast_html.html.jinja') args = parser.parse_args()