Mercurial > repos > jankanis > blast2html
changeset 20:53cd304c5f26
Add index for multiple results; fix layout of query ruler for edge case
The query ruler did not layout nicely if the last segment was too short to contain the text. For very short last segments the text is now
displayed after the ruler.
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Wed, 14 May 2014 16:20:29 +0200 |
parents | 67ddcb807b7d |
children | 9596fea636bb |
files | blast_html.html.jinja blast_html.py |
diffstat | 2 files changed, 49 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/blast_html.html.jinja Tue May 13 18:06:36 2014 +0200 +++ b/blast_html.html.jinja Wed May 14 16:20:29 2014 +0200 @@ -54,6 +54,12 @@ #nodata { font-weight: bold; } + + .index div.indexentry { + margin: .6em; + font-weight: bold; + font-size: 100%; + } .headerdata { font-size: 90%; @@ -94,7 +100,7 @@ .graphic { background-color: white; border: 2px solid black; - padding: .5em 1.5em; + padding: 1.5em; margin: auto; } @@ -157,6 +163,9 @@ margin: .5em 0 .5em 0; color: white; } + .scale .graphicitem { + position: relative; + } .scale .graphicitem div { margin: 0 1px; padding: 0 2px; @@ -170,6 +179,13 @@ .scale .graphicitem:last-child div { margin-right: 0px; } + .scale .graphicitem .lastlabel { + position: absolute; + top: 0px; + left: 100%; + background-color: transparent; + color: red; + } a.matchresult { display: block; @@ -349,9 +365,25 @@ </section> {% else %} + + {% if blast.BlastOutput_iterations.findall('Iteration') | length > 1 %} + <section class=index> + <h1>Queries</h1> + + {% for result in blast.BlastOutput_iterations.Iteration %} + <div class=indexentry><a href="#match{{result['Iteration_iter-num']}}"> + {% set hits = result|hits %} + {{result['Iteration_query-ID']}}: {{result['Iteration_query-def']}} + ({{result|len}} letters, {{hits|length}} hits) + </a></div> + {% endfor %} + + </section> + {% endif %} + {% for result in blast.BlastOutput_iterations.Iteration %} - <section class=match> + <section class=match id=match{{result['Iteration_iter-num']}}> <h1>Nucleotide Sequence ({{result|len}} letters)</h1> @@ -401,11 +433,18 @@ <div class=scale> <div>query:</div> <div class=graphicrow> - {% for s in result|queryscale %} - <div class=graphicitem style="width: {{s.width}}%"> - <div>{{s.label}}</div> + <div> + {% for s in result|queryscale %} + <div class=graphicitem style="width: {{s.width}}%"> + {% if s.width > 3.0 %} + <div>{{s.label}}</div> + {% else %} + <div> </div> + <div class=lastlabel>{{s.label}}</div> + {% endif %} + </div> + {% endfor %} </div> - {% endfor %} </div> <div style="clear: left"></div> </div>
--- a/blast_html.py Tue May 13 18:06:36 2014 +0200 +++ b/blast_html.py Wed May 14 16:20:29 2014 +0200 @@ -232,9 +232,11 @@ percent_multiplier = 100 / query_length for i in range(1, query_length+1): if i % skip == 0: - yield dict(label = i, width = skip * percent_multiplier) + yield dict(label = i, width = skip * percent_multiplier, shorter = False) if query_length % skip != 0: - yield dict(label = query_length, width = (query_length % skip) * percent_multiplier) + yield dict(label = query_length, + width = (query_length % skip) * percent_multiplier, + shorter = True) @filter def hit_info(self, result):