Skip to content

Commit

Permalink
tooltips for co-expression clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Oct 26, 2017
1 parent 0544a8b commit d79f079
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 7 deletions.
8 changes: 8 additions & 0 deletions planet/controllers/expression_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ def avg_profile(cluster_id):
return Response(json.dumps(avg_profile), mimetype='application/json')


@expression_cluster.route('/tooltip/<cluster_id>')
@cache.cached()
def cluster_tooltip(cluster_id):
current_cluster = CoexpressionCluster.query.get(cluster_id)

return render_template('tooltips/cluster.html', cluster=current_cluster)


@expression_cluster.route('/ajax/interpro/<cluster_id>')
@cache.cached()
def cluster_interpro_ajax(cluster_id):
Expand Down
3 changes: 1 addition & 2 deletions planet/controllers/expression_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ def export_expression_levels():
"""
Will return a table with all (!) genes and their expression levels
:param species_id: internal ID of species to export
:return:
:return: either form with settings (on GET) or response with results (on POST)
"""
form = ExportConditionForm(request.form)
form.populate_form()
Expand Down
4 changes: 3 additions & 1 deletion planet/templates/expression_heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
<li class="active"><strong>Results</strong></li>
</ol>
{% if cluster %}
<h1>Heatmap: <strong>{{ cluster.name }}</strong> <small>({{ cluster.method.method }})</small></h1>
<h1>Heatmap: <strong><a href="{{ url_for('expression_cluster.expression_cluster_view', cluster_id=cluster.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('expression_cluster.cluster_tooltip', cluster_id=cluster.id) }}">{{ cluster.name }}</a></strong> <small>({{ cluster.method.method }})</small></h1>
{% import "macros/cluster_actions.html" as ca %}
<div class="row">
<div class="col-lg-6 col-sm-6 col-xs-12">
Expand Down
4 changes: 3 additions & 1 deletion planet/templates/expression_profile_comparison.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
</ol>

{% if cluster %}
<h1>Profile comparison: <strong>{{ cluster.name }}</strong> <small>({{ cluster.method.method }})</small></h1>
<h1>Profile comparison: <strong><a href="{{ url_for('expression_cluster.expression_cluster_view', cluster_id=cluster.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('expression_cluster.cluster_tooltip', cluster_id=cluster.id) }}">{{ cluster.name }}</a></strong> <small>({{ cluster.method.method }})</small></h1>
{% import "macros/cluster_actions.html" as ca %}
<div class="row">
<div class="col-xs-6"><p><strong>View as: </strong>{{ ca.cluster_actions(cluster.id, exclude=["profile"]) }}</p></div>
Expand Down
4 changes: 3 additions & 1 deletion planet/templates/find_enriched_clusters.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ <h1>Search results</h1>
{% if g.debug %}<td>{{ c.cluster_id }}</td>{% endif %}
<td><em>{{ c.cluster.method.network_method.species.name }}</em></td>
<td>{{ c.cluster.method.method }}</td>
<td>{{ c.cluster.name }}</td>
<td><a href="{{ url_for('expression_cluster.expression_cluster_view', cluster_id=c.cluster_id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('expression_cluster.cluster_tooltip', cluster_id=c.cluster_id) }}">{{ c.cluster.name }}</a></td>
<td>{{ c.enrichment|round(2) }}</td>
<td>{{ (c.cluster_count*100/c.cluster_size)|round(2) }}% <span class="text-muted">({{c.cluster_count}}/{{c.cluster_size}})</span> </td>
<td>{{ c.p_value|round(5) }}</td>
Expand Down
4 changes: 3 additions & 1 deletion planet/templates/go.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ <h1>{{ go.label }}: <strong>{{ go.name }}</strong> <small>({{ go.readable_type }
{% for cluster in clusters %}
{% if cluster.corrected_p_value <= 0.05 %}
<tr>
<td>{{ cluster.cluster.name }}</td>
<td><a href="{{ url_for('expression_cluster.expression_cluster_view', cluster_id=cluster.cluster.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('expression_cluster.cluster_tooltip', cluster_id=cluster.cluster.id) }}">{{ cluster.cluster.name }}</a></td>
<td><em>{{ cluster.cluster.method.network_method.species.name }}</em></td>
<td>{{ cluster.cluster_percentage|round(2) }} %</td>
<td>{{ cluster.p_value|round(6) }}</td>
Expand Down
4 changes: 3 additions & 1 deletion planet/templates/sequence.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ <h3 class="banner-blue" id="coexpression_networks">Co-expression Networks</h3>
{% for cluster in coexpression_clusters %}
<tr>
<td><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='cluster') }}" data-target="#helpModal">Cluster</abbr></td>
<td>{{ cluster.method.method }}: <strong>{{ cluster.name }}</strong></td>
<td>{{ cluster.method.method }}: <strong><a href="{{ url_for('expression_cluster.expression_cluster_view', cluster_id=cluster.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('expression_cluster.cluster_tooltip', cluster_id=cluster.id) }}">{{ cluster.name }}</a></strong></td>
<td>{{ ca.cluster_actions(cluster.id) }}</td>
</tr>
{% endfor %}
Expand Down
11 changes: 11 additions & 0 deletions planet/templates/tooltips/cluster.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div>
<div><strong>Species: </strong><em>{{ cluster.method.network_method.species.name }}</em></div>
<div><strong>Method: </strong>{{ cluster.method.method }}</div>
<hr />
<div><strong>Enriched GO terms</strong> <span class="text-muted">(top 5)</span>:</div>
{% for go_enrichment in (cluster.go_enrichment|sort(attribute='enrichment', reverse = True))[:5] %}
{{ go_enrichment.go.name }} <span class="text-muted">({{ go_enrichment.go.short_type }})</span>{%- if not loop.last -%}, {%- endif -%}
{% else %}
<span class="text-muted">No enriched GO terms available for this cluster</span>
{% endfor %}
</div>

0 comments on commit d79f079

Please sign in to comment.