Skip to content

Commit

Permalink
added low abundance warning on profile pages
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Sep 19, 2017
1 parent 8e6e4cc commit 02a3a6a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions planet/models/expression/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ def tissue_table(self, condition_tissue_id, use_means=True):
)
return table

@property
def low_abundance(self, cutoff=10):
"""
Checks if the mean expression value in any conditions in the plot is higher than the desired cutoff
:param cutoff: cutoff for expression, default = 10
:return: True in case of low abundance otherwise False
"""
data = json.loads(self.profile)

checks = [mean(v) > cutoff for _, v in data["data"].items()]

return not any(checks)

def tissue_profile(self, condition_tissue_id, use_means=True):
"""
Applies a conversion to the profile, grouping several condition into one more general feature (e.g. tissue).
Expand Down
4 changes: 4 additions & 0 deletions planet/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,8 @@ div#phyd3 .table-responsive > table {

.global-message {
color: #31708f;
}

.warning-message {
color: #a94442;
}
7 changes: 7 additions & 0 deletions planet/templates/expression_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ <h1>Expression profile for <strong><a href="{{url_for('sequence.sequence_view',
<h1>Expression profile for: <strong>{{ profile.probe }}</strong></h1>
{% endif %}

{% if profile.low_abundance %}
<br />
<span class="warning-message"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <strong>Attention:</strong> This gene has <strong>low abundance</strong>.</span>
<br /><br />
{% endif %}

{% for s in profile.specificities %}
<span>{{ s.method.description }}: <strong>{{ s.condition }}</strong> (<abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='spm') }}" data-target="#helpModal">SPM</abbr>: {{ s.score|round(2) }},
<abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='entropy') }}" data-target="#helpModal">entropy</abbr>: {{ s.entropy|round(2) }}{%- if s.tau -%}, <abbr title="Click to show help" href="{{ url_for('help.help_topic', topic='tau') }}" data-target="#helpModal">tau</abbr>: {{ s.tau|round(2) }}{% endif %})</span><br />
{% endfor %}


<br/>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
Expand Down

0 comments on commit 02a3a6a

Please sign in to comment.