Skip to content

Commit

Permalink
graphs now use the networks hrr limit for the control panel's slider …
Browse files Browse the repository at this point in the history
…+ fixed unit tests
  • Loading branch information
proost committed Sep 12, 2017
1 parent ce3ed4c commit b9d5cce
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion planet/controllers/custom_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def custom_network_main():
# make probe list unique
probes = list(set(probes))

network_method = ExpressionNetworkMethod.query.get_or_404(method_id)
network = ExpressionNetwork.get_custom_network(method_id, probes)

network_cytoscape = CytoscapeHelper.parse_network(network)
Expand All @@ -47,7 +48,8 @@ def custom_network_main():
network_cytoscape = CytoscapeHelper.add_cluster_data_nodes(network_cytoscape, cluster_method_id)
network_cytoscape = CytoscapeHelper.add_specificity_data_nodes(network_cytoscape, specificity_method_id)

return render_template("expression_graph.html", graph_data=Markup(json.dumps(network_cytoscape)))
return render_template("expression_graph.html", graph_data=Markup(json.dumps(network_cytoscape)),
cutoff=network_method.hrr_cutoff)
else:

example = {
Expand Down
4 changes: 3 additions & 1 deletion planet/controllers/expression_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def expression_cluster_graph(cluster_id, family_method_id=None):
else:
family_method_id = None

return render_template("expression_graph.html", cluster=cluster, family_method_id=family_method_id)
return render_template("expression_graph.html", cluster=cluster,
family_method_id=family_method_id,
cutoff=cluster.method.network_method.hrr_cutoff)


@expression_cluster.route('/json/<cluster_id>')
Expand Down
3 changes: 2 additions & 1 deletion planet/controllers/expression_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def expression_network_graph(node_id, family_method_id=None):

depth = 1 if enable_second_level else 0

return render_template("expression_graph.html", node=node, depth=depth, family_method_id=family_method_id)
return render_template("expression_graph.html", node=node, depth=depth, family_method_id=family_method_id,
cutoff=node.method.hrr_cutoff)


@expression_network.route('/download/neighbors/<node_id>')
Expand Down
4 changes: 3 additions & 1 deletion planet/controllers/graph_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ def graph_comparison_cluster(one, two, family_method_id=1):
cluster_one = CoexpressionCluster.query.get_or_404(one)
cluster_two = CoexpressionCluster.query.get_or_404(two)

cutoff = max([cluster_one.method.network_method.hrr_cutoff, cluster_two.method.network_method.hrr_cutoff])

return render_template('expression_graph.html', cluster_one=cluster_one, cluster_two=cluster_two,
family_method_id=family_method_id)
family_method_id=family_method_id, cutoff=cutoff)


@graph_comparison.route('/cluster/json/<int:one>/<int:two>')
Expand Down
4 changes: 2 additions & 2 deletions planet/templates/expression_graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
{% if not sequence %}
<li>
<div>
<br /><p><strong><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='hrr') }}" data-target="#helpModal">HRR</abbr> Score</strong> <span id="cy-edge-score-value" class="text-muted">30</span></p>
<input id="cy-edge-score" data-slider-id='cy-edge-score-slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="100" data-slider-tooltip="hide"/>
<br /><p><strong><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='hrr') }}" data-target="#helpModal">HRR</abbr> Score</strong> <span id="cy-edge-score-value" class="text-muted">{{cutoff}}</span></p>
<input id="cy-edge-score" data-slider-id='cy-edge-score-slider' type="text" data-slider-min="0" data-slider-max="{{cutoff}}" data-slider-step="1" data-slider-value="{{cutoff}}" data-slider-tooltip="hide"/>
</div>
</li>
{% endif %}
Expand Down
3 changes: 3 additions & 0 deletions tests/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def setUp(self):
db.session.commit()

test_expression_network_method = ExpressionNetworkMethod(test_species.id, "Test network method")
test_expression_network_method.pcc_cutoff = 0.0
test_expression_network_method.hrr_cutoff = 100
test_expression_network_method.enable_second_level = 0
db.session.add(test_expression_network_method)
db.session.commit()

Expand Down

0 comments on commit b9d5cce

Please sign in to comment.