Permalink
Browse files

BLAST results are in.

  • Loading branch information...
1 parent 63a7e1f commit b9f51227852192e5defe60919eea3321812df103 @meren meren committed Apr 3, 2012
Showing with 40 additions and 7 deletions.
  1. +3 −1 utils/html/generate.py
  2. +10 −6 utils/html/templates/index.tmpl
  3. +27 −0 utils/html/templates/oligo.tmpl
View
@@ -97,6 +97,7 @@ def copy_as(source, dest_name):
html_dict['entropy_components'] = [int(x) for x in html_dict['bases_of_interest_locs'].split(',')]
html_dict['datasets_dict'] = get_datasets_dict_from_environment_file(run_info_dict['environment_file_path'])
html_dict['datasets'] = sorted(html_dict['datasets_dict'].keys())
+ html_dict['blast_results_found'] = False
# get alignment length
html_dict['alignment_length'] = get_alignment_length(run_info_dict['alignment'])
@@ -201,7 +202,8 @@ def get_oligo_reps_dict(html_dict, html_output_directory):
blast_results_file_path = alignment_base_path + '_unique_BLAST.xml'
if os.path.exists(blast_results_file_path):
- oligo_reps_dict['blast_results'][oligo] = get_blast_results_dict(open(blast_results_file_path), num_results = 1)
+ html_dict['blast_results_found'] = True
+ oligo_reps_dict['blast_results'][oligo] = get_blast_results_dict(open(blast_results_file_path), num_results = 50)
else:
oligo_reps_dict['blast_results'][oligo] = None
@@ -77,8 +77,7 @@
</div>
-<div class="smallhead">Oligotypes</div>
-<p class="smallheadtitle">» Abundant oligotypes after quality control: {{oligos|join:', '}}
+<div class="smallhead">Oligotypes</div><p class="smallheadtitle">» Abundan oligotypes with their frequencies within the dataset are shown below along with the most frequent sequence within the group of oligotype. {% if blast_results_found %}<span class="check">✓</span> indicates that the most frequent sequence which was represented by the given oligotype hit something duing the BLAST search with 100% identity. In contrary, <span class="cross">✗</span> sign means that there was no perfect hit during the BLAST search. <br /><br /> Here are the oligotypes with a perfect hit: {% for oligo in oligos %} {% if oligo_reps_dict.blast_results|lookup:oligo|lookup:0|lookup:"identity" == 100.0 %} {{oligo}}, {% endif %}{% endfor %}{% else %}BLAST results are missing for this analysis.{% endif %}
{% if output_directory_for_reps %}
<div class="wrap">
@@ -91,11 +90,16 @@
<span style="color: white;"> <strong>{{oligos.0}}</strong> b {{ component_reference|safe }}</span>
{% for oligo in oligos %}
<p>
- {% if oligo_reps_dict.blast_results|lookup:oligo|lookup:0|lookup:"identity" == 100.0 %}
- <span class="check">✓</span>
+ {% if blast_results_found %}
+ {% if oligo_reps_dict.blast_results|lookup:oligo|lookup:0|lookup:"identity" == 100.0 %}
+ <span class="check">✓</span>
+ {% else %}
+ <span class="cross">✗</span>
+ {% endif %}
{% else %}
- <span class="cross">✗</span>
- {% endif %}</span>
+ <span class="check">&nbsp;</span>
+ {% endif %}
+ </span>
<span class="frequency">{{ frequency|lookup:oligo }}</span>
<span style="background-color:{{color_dict|lookup:oligo}}; border: 1px solid black;">&nbsp;&nbsp;</span>
<span style="border-bottom:1px solid {{ color_dict|lookup:oligo }}"> <strong><a onmouseover="popup('<img src={{oligo_reps_dict.imgs|lookup:oligo}} width=&quot;790&quot;>', 800)" href="oligo_{{oligo}}.html">{{oligo}}</a></strong> <em><a title="BLAST search this sequence in NCBI" href="http://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastn&BLAST_PROGRAMS=megaBlast&PAGE_TYPE=BlastSearch&SHOW_DEFAULTS=on&LINK_LOC=blasthome&DATABASE=nr&QUERY=>{{ oligo }}%0d{{ rep_oligo_seqs_clean_dict|lookup:oligo|cleangaps }}">b</a></em> {{ rep_oligo_seqs_fancy_dict|lookup:oligo|safe }}</span>
@@ -22,6 +22,33 @@
<p class="smallheadtitle">» Abundance curve of unique sequences within oligotype along with entropy values associated with these new set of alignments.
<p align="center"><a href="{{ oligo_reps_dict.imgs|lookup:oligo }}"><img src="{{ oligo_reps_dict.imgs|lookup:oligo }}" style="width:1200px" border="0"></a>
+
+<div class="smallhead">BLAST Hits</div>
+<p class="smallheadtitle">» Alignments obtained for the most frequent sequence of {{ oligo }} are shown below.
+<div class="wrap">
+{% if oligo_reps_dict.blast_results|lookup:oligo %}
+ <div id='sequences' style="height: 400px;">
+ <div style="width: {{alignment_length|multiply:9}}px; position: relative;">
+ {% for i in oligo_reps_dict.blast_results|lookup:oligo|length|mklist %}
+ <p><strong>{{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"hit_def" }}</strong>
+ <br />Accession: <a href="{{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"ncbi_link" }}">
+ {{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"accession" }}</a></em>
+ <br />Identity : {{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"identity"|floatformat:1 }}%</em>
+ <br />Coverage : {{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"coverage"|floatformat:1 }}%</em>
+ <p>&nbsp;
+ <br /><em>QUERY: </em>{{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"hsp_query" }}</em>
+ <br /><em>MATCH: </em>{{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"hsp_match" }}</em>
+ <br /><em>SUBJE: </em>{{ oligo_reps_dict.blast_results|lookup:oligo|lookup:i|lookup:"hsp_subject" }}</em>
+ <p>&nbsp;
+ <p>&nbsp;
+ {% endfor %}
+ </div>
+ </div>
+{% else %}
+ <p><em>BLAST results are missing.</em>
+{% endif %}
+</div>
+
<div class="smallhead">Sequences</div>
<p class="smallheadtitle">» First 20 Unique sequences
<div class="wrap">

0 comments on commit b9f5122

Please sign in to comment.