diff blast2html.py @ 105:b3b5ee557170

update test
author Jan Kanis <jan.code@jankanis.nl>
date Mon, 07 Jul 2014 11:42:43 +0200
parents a22c909c9b57
children ee2b105d772a
line wrap: on
line diff
--- a/blast2html.py	Mon Jul 07 11:29:10 2014 +0200
+++ b/blast2html.py	Mon Jul 07 11:42:43 2014 +0200
@@ -409,7 +409,7 @@
     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="{0} [-i] INPUT [-o OUTPUT]".format(sys.argv[0]))
+                                     usage="{0} [-i] INPUT [-o OUTPUT] [--genelink-template URL_TEMPLATE]".format(sys.argv[0]))
     input_group = parser.add_mutually_exclusive_group(required=True)
     input_group.add_argument('positional_arg', metavar='INPUT', nargs='?', type=argparse.FileType(mode='r'),
                              help='The input Blast XML file, same as -i/--input')
@@ -426,7 +426,8 @@
                         help='The template file to use. Defaults to blast_html.html.jinja')
     
     dblink_group = parser.add_mutually_exclusive_group()
-    dblink_group.add_argument('--genelink-template', default='http://www.ncbi.nlm.nih.gov/nucleotide/{accession}?report=genbank&log$=nuclalign',
+    dblink_group.add_argument('--genelink-template', metavar='URL_TEMPLATE',
+                              default='http://www.ncbi.nlm.nih.gov/nucleotide/{accession}?report=genbank&log$=nuclalign',
                               help="""A link template to link hits to a gene bank webpage. The template string is a 
                               Python format string. It can contain the following replacement elements: {id[N]}, {fullid}, 
                               {defline[N]}, {fulldefline}, {accession}, where N is a number. id[N] and defline[N] will be 
@@ -451,14 +452,15 @@
 
     if six.PY2:
         # The argparse.FileType wrapper doesn't support an encoding
-        # argument or such, so for python 2 we need to wrap or reopen
-        # the output. The input files are already read as utf-8 by the
+        # argument, so for python 2 we need to wrap or reopen the
+        # output. The input files are already read as utf-8 by the
         # respective libraries.
 
         # One option is using codecs, but the codecs' writelines()
         # method doesn't support streaming but collects all output and
-        # writes at once. On the other hand the io module is slower
-        # (though not significantly).
+        # writes at once (see Python issues #5445 and #21910). On the
+        # other hand the io module is slower (though not
+        # significantly).
 
         # args.output = codecs.getwriter('utf-8')(args.output)
         args.output = io.open(args.output.name, 'w')