Skip to content

Commit

Permalink
added check for number of neighbors in network on sequence pages
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Sep 19, 2017
1 parent 6d913f9 commit 7b4b425
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions planet/models/expression/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ def __init__(self, probe, sequence_id, network, method_id):
self.network = network
self.method_id = method_id

@property
def neighbors_count(self):
data = json.loads(self.network)

return len(data)

@property
def neighbors_table(self):
data = json.loads(self.network)
Expand Down
6 changes: 5 additions & 1 deletion planet/templates/sequence.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ <h3 class="banner-blue" id="coexpression_networks">Co-expression Networks</h3>
<tr>
<td><abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='neighborhood') }}" data-target="#helpModal">Neighborhood</abbr></td>
<td>{{ network.method.description }}: <strong>{{ network.probe }}</strong></td>
<td>{{ na.neighborhood_actions(network.id) }}</td>
{% if network.neighbors_count > 0 %}
<td>{{ na.neighborhood_actions(network.id) }}</td>
{% else %}
<td><span class="text-muted"><em>No neighbors in network</em></span></td>
{% endif %}
</tr>
{% endfor %}
{% for cluster in coexpression_clusters %}
Expand Down

0 comments on commit 7b4b425

Please sign in to comment.