Repository 'blast2html'
hg clone https://toolshed.g2.bx.psu.edu/repos/jankanis/blast2html

Changeset 126:0fa962dd83b4 (2015-07-22)
Previous changeset 125:8205546ba86c (2015-07-07) Next changeset 127:532aa200dbe9 (2015-07-23)
Commit message:
Add README and license
modified:
blast2html.html.jinja
blast2html.py
added:
LICENSE.txt
README.rst
images/blast2html_screenshot1.png
images/thehyve_logo.png
b
diff -r 8205546ba86c -r 0fa962dd83b4 LICENSE.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.txt Wed Jul 22 16:10:25 2015 +0200
b
b'@@ -0,0 +1,674 @@\n+                    GNU GENERAL PUBLIC LICENSE\n+                       Version 3, 29 June 2007\n+\n+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n+ Everyone is permitted to copy and distribute verbatim copies\n+ of this license document, but changing it is not allowed.\n+\n+                            Preamble\n+\n+  The GNU General Public License is a free, copyleft license for\n+software and other kinds of works.\n+\n+  The licenses for most software and other practical works are designed\n+to take away your freedom to share and change the works.  By contrast,\n+the GNU General Public License is intended to guarantee your freedom to\n+share and change all versions of a program--to make sure it remains free\n+software for all its users.  We, the Free Software Foundation, use the\n+GNU General Public License for most of our software; it applies also to\n+any other work released this way by its authors.  You can apply it to\n+your programs, too.\n+\n+  When we speak of free software, we are referring to freedom, not\n+price.  Our General Public Licenses are designed to make sure that you\n+have the freedom to distribute copies of free software (and charge for\n+them if you wish), that you receive source code or can get it if you\n+want it, that you can change the software or use pieces of it in new\n+free programs, and that you know you can do these things.\n+\n+  To protect your rights, we need to prevent others from denying you\n+these rights or asking you to surrender the rights.  Therefore, you have\n+certain responsibilities if you distribute copies of the software, or if\n+you modify it: responsibilities to respect the freedom of others.\n+\n+  For example, if you distribute copies of such a program, whether\n+gratis or for a fee, you must pass on to the recipients the same\n+freedoms that you received.  You must make sure that they, too, receive\n+or can get the source code.  And you must show them these terms so they\n+know their rights.\n+\n+  Developers that use the GNU GPL protect your rights with two steps:\n+(1) assert copyright on the software, and (2) offer you this License\n+giving you legal permission to copy, distribute and/or modify it.\n+\n+  For the developers\' and authors\' protection, the GPL clearly explains\n+that there is no warranty for this free software.  For both users\' and\n+authors\' sake, the GPL requires that modified versions be marked as\n+changed, so that their problems will not be attributed erroneously to\n+authors of previous versions.\n+\n+  Some devices are designed to deny users access to install or run\n+modified versions of the software inside them, although the manufacturer\n+can do so.  This is fundamentally incompatible with the aim of\n+protecting users\' freedom to change the software.  The systematic\n+pattern of such abuse occurs in the area of products for individuals to\n+use, which is precisely where it is most unacceptable.  Therefore, we\n+have designed this version of the GPL to prohibit the practice for those\n+products.  If such problems arise substantially in other domains, we\n+stand ready to extend this provision to those domains in future versions\n+of the GPL, as needed to protect the freedom of users.\n+\n+  Finally, every program is threatened constantly by software patents.\n+States should not allow patents to restrict development and use of\n+software on general-purpose computers, but in those that do, we wish to\n+avoid the special danger that patents applied to a free program could\n+make it effectively proprietary.  To prevent this, the GPL assures that\n+patents cannot be used to render the program non-free.\n+\n+  The precise terms and conditions for copying, distribution and\n+modification follow.\n+\n+                       TERMS AND CONDITIONS\n+\n+  0. Definitions.\n+\n+  "This License" refers to version 3 of the GNU General Public License.\n+\n+  "Copyright" also means copyright-like laws that apply to other kinds of\n+works, such as semiconductor masks.\n+\n+  "The Program" refers to a'..b'THE PROGRAM\n+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n+\n+  16. Limitation of Liability.\n+\n+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\n+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\n+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\n+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\n+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\n+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\n+SUCH DAMAGES.\n+\n+  17. Interpretation of Sections 15 and 16.\n+\n+  If the disclaimer of warranty and limitation of liability provided\n+above cannot be given local legal effect according to their terms,\n+reviewing courts shall apply local law that most closely approximates\n+an absolute waiver of all civil liability in connection with the\n+Program, unless a warranty or assumption of liability accompanies a\n+copy of the Program in return for a fee.\n+\n+                     END OF TERMS AND CONDITIONS\n+\n+            How to Apply These Terms to Your New Programs\n+\n+  If you develop a new program, and you want it to be of the greatest\n+possible use to the public, the best way to achieve this is to make it\n+free software which everyone can redistribute and change under these terms.\n+\n+  To do so, attach the following notices to the program.  It is safest\n+to attach them to the start of each source file to most effectively\n+state the exclusion of warranty; and each file should have at least\n+the "copyright" line and a pointer to where the full notice is found.\n+\n+    <one line to give the program\'s name and a brief idea of what it does.>\n+    Copyright (C) <year>  <name of author>\n+\n+    This program is free software: you can redistribute it and/or modify\n+    it under the terms of the GNU General Public License as published by\n+    the Free Software Foundation, either version 3 of the License, or\n+    (at your option) any later version.\n+\n+    This program is distributed in the hope that it will be useful,\n+    but WITHOUT ANY WARRANTY; without even the implied warranty of\n+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+    GNU General Public License for more details.\n+\n+    You should have received a copy of the GNU General Public License\n+    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+\n+Also add information on how to contact you by electronic and paper mail.\n+\n+  If the program does terminal interaction, make it output a short\n+notice like this when it starts in an interactive mode:\n+\n+    <program>  Copyright (C) <year>  <name of author>\n+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w\'.\n+    This is free software, and you are welcome to redistribute it\n+    under certain conditions; type `show c\' for details.\n+\n+The hypothetical commands `show w\' and `show c\' should show the appropriate\n+parts of the General Public License.  Of course, your program\'s commands\n+might be different; for a GUI interface, you would use an "about box".\n+\n+  You should also get your employer (if you work as a programmer) or school,\n+if any, to sign a "copyright disclaimer" for the program, if necessary.\n+For more information on this, and how to apply and follow the GNU GPL, see\n+<http://www.gnu.org/licenses/>.\n+\n+  The GNU General Public License does not permit incorporating your program\n+into proprietary programs.  If your program is a subroutine library, you\n+may consider it more useful to permit linking proprietary applications with\n+the library.  If this is what you want to do, use the GNU Lesser General\n+Public License instead of this License.  But first, please read\n+<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n'
b
diff -r 8205546ba86c -r 0fa962dd83b4 README.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst Wed Jul 22 16:10:25 2015 +0200
[
@@ -0,0 +1,124 @@
+Blast2html: Blast XML to HTML conversion tool
+=============================================
+
+This tool accepts Blast XML as input, and creates an HTML page with a human readable version of the result. The output includes graphical displays of where a sequence matches a target and metrics on the quality of the match.
+
+Example output:
+
+.. image:: images/blast2html_screenshot1.png
+    :alt: Screenshot of sample output
+    :align: center
+
+The output format is based on the graphical summary pages on the `NCBI Blast website`_. But as the code for generating such pages is not available we implemented our own clone. 
+
+.. _`NCBI Blast website`: http://blast.ncbi.nlm.nih.gov/Blast.cgi
+
+
+Galaxy configuration
+--------------------
+
+This tool generates an HTML page from Blast XML input. It can be used as a stand-alone command line tool, but it is meant to be used in workflows in Galaxy_. To use this tool in Galaxy some configuration may be required.
+
+By default Galaxy strips a lot of style information from HTML files before showing them on the screen. The results of this tool will still be somewhat useful but they will be a lot uglier without the styles. You can still download the original generated HTML of course. If you want to view the full result within Galaxy you need to disable this stripping of style information by adding the following line to your Galaxy's ``galaxy.ini``::
+
+    sanitize_all_html = False
+
+In order to generate links to a gene bank in the result, you will need to tell blast2html what gene bank to use. If you do not configure a gene bank the result will contain links to the NCBI gene bank, and as a name for the gene bank the generic "Gene Bank" is used. These links will only work if the database you are using uses the same accession codes as the NCBI gene bank. To show links to a different gene bank this needs to be configured in Galaxy.
+
+As at the moment this tool was built Galaxy did not have a good way to specify such configuration directives to tools, we use a slightly ugly solution. The gene bank configuration are added to the NCBI BLAST+ database definition files in Galaxy's ``tool-data`` directory. This directory should contain some files named ``blastdb.loc``, ``blastdb_p.loc``, ``blastdb_d.loc`` etc. that define the databases that the NCBI BLAST+ tool knows about. For BLAST, these files contain three columns of tab-separated data that define the databases. The normal format is::
+
+  <unique_id>    <database_caption>      <base_name_path>
+
+with tabs separating the three components. For blast2html we extend this format with two columns that contain a human-readable gene bank name, and a link template. So each row then contains these tab-separated items::
+
+  <unique_id>    <database_caption>      <base_name_path>     <genebank_name>     <genebank_link_template>
+
+NCBI Blast+ will ignore the extra fields in the file.
+
+So, for example, for a database named ``nt`` with path ``/depot/data2/galaxy/blastdb/nt/nt.chunk`` that uses NCBI nucleontide database accession codes you can use the following definition line::
+
+  nt_02_Dec_2009 nt 02 Dec 2009 /depot/data2/galaxy/blastdb/nt/nt.chunk NCBI Gene Bank http://www.ncbi.nlm.nih.gov/nucleotide/{accession}?report=genbank&log$=nuclalign
+
+The syntax for the link template is the same as that used by the ``--genelink-template`` command line option (see next section):  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 replaced by the Nth element of the id or defline, where '``|``' is the field separator.
+
+
+.. _Galaxy: https://www.galaxyproject.org/
+
+
+Command line usage
+------------------
+
+::
+
+    usage: ./blast2html.py [-i] INPUT [-o OUTPUT] [--genelink-template URL_TEMPLATE] [--dbname DBNAME]
+
+    Convert a BLAST XML result into a nicely readable html page
+
+    positional arguments:
+      INPUT                 The input Blast XML file, same as -i/--input
+
+    optional arguments:
+      -h, --help            show this help message and exit
+      -i INPUT, --input INPUT
+     The input Blast XML file
+      -o OUTPUT, --output OUTPUT
+     The output html file
+      --template TEMPLATE   The template file to use. Defaults to
+     blast_html.html.jinja
+      --dbname DBNAME       The link text to use for external links to a gene bank
+     database. Defaults to 'Gene Bank'
+      --genelink-template URL_TEMPLATE
+     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
+     replaced by the Nth element of the id or defline,
+     where '|' is the field separator. The default is 'http
+     ://www.ncbi.nlm.nih.gov/nucleotide/{accession}?report=
+     genbank&log$=nuclalign', which is a link to the NCBI
+     nucleotide database.
+      --db-config-dir DB_CONFIG_DIR
+     The directory where databases are configured in
+     blastdb*.loc files. These files are consulted for
+     creating a gene bank link. The files should conform to
+     the format that Galaxy's BLAST expect, i.e. tab-
+     separated tables (with lines starting with '#'
+     ignored), with two extra fields, for a total of five
+     fields per line instead of three.. The third field of
+     each line should be a database path as used by BLAST.
+     The fourth field is the human readable database name,
+     and the fifth a template link to the gene bank
+     conforming to the syntax for the --genelink-template
+     option. Entries in these config files override links
+     specified using --genelink-template and --dbname.
+
+
+Authorship
+----------
+
+This tool was created and published by `The Hyve B.V.`_ open source bioinformatics solutions.
+
+.. image:: images/thehyve_logo.png
+    :alt: The Hyve
+    :align: center
+    :target: http://thehyve.nl
+
+.. _`The Hyve B.V.`: http://thehyve.nl/
+
+
+Licensing information
+---------------------
+
+Blast2html is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
b
diff -r 8205546ba86c -r 0fa962dd83b4 blast2html.html.jinja
--- a/blast2html.html.jinja Tue Jul 07 09:28:08 2015 +0200
+++ b/blast2html.html.jinja Wed Jul 22 16:10:25 2015 +0200
b
@@ -1,4 +1,8 @@
-{# -*- coding: utf-8 -*- #}
+{# -*- coding: utf-8 -*-
+
+Copyright The Hyve B.V. 2014-2015
+License: GPL version 3 or (at your option) any higher version
+#}
 <!DOCTYPE html>
 <html>
   <head>
b
diff -r 8205546ba86c -r 0fa962dd83b4 blast2html.py
--- a/blast2html.py Tue Jul 07 09:28:08 2015 +0200
+++ b/blast2html.py Wed Jul 22 16:10:25 2015 +0200
b
@@ -3,7 +3,7 @@
 
 # Actually this program works with both python 2 and 3, tested against python 2.6
 
-# Copyright The Hyve B.V. 2014
+# Copyright The Hyve B.V. 2014-2015
 # License: GPL version 3 or (at your option) any higher version
 
 from __future__ import unicode_literals, division
@@ -450,9 +450,11 @@
                         help="""The directory where databases are configured in blastdb*.loc files. These files
                         are consulted for creating a gene bank link. The files should conform to the format that
                         Galaxy's BLAST expect, i.e. tab-separated tables (with lines starting with '#' ignored),
-                        with two extra fields. The third field of a line should be a database path and the fourth
-                        a genebank link template conforming to the --genelink-template option syntax. Entries in
-                        these config files override links specified using --genelink-template and --dbname.""")
+                        with two extra fields, for a total of five fields per line instead of three.. The third 
+                        field of each line should be a database path as used by BLAST. The fourth field is the 
+                        human readable database name, and the fifth a template link to the gene bank conforming
+                        to the syntax for the --genelink-template option. Entries in these config files override 
+                        links specified using --genelink-template and --dbname.""")
     
     args = parser.parse_args()
     if args.input == None:
b
diff -r 8205546ba86c -r 0fa962dd83b4 images/blast2html_screenshot1.png
b
Binary file images/blast2html_screenshot1.png has changed
b
diff -r 8205546ba86c -r 0fa962dd83b4 images/thehyve_logo.png
b
Binary file images/thehyve_logo.png has changed