Skip to content

Commit

Permalink
low transcript abundance warning in specificty comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Nov 8, 2017
1 parent 7c741bc commit 32b9df8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
19 changes: 15 additions & 4 deletions conekt/controllers/specificity_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def specificity_comparison_main():
sequence_id_left = [r.profile.sequence_id for r in results_a if r.profile.sequence_id is not None]
sequence_id_right = [r.profile.sequence_id for r in results_b if r.profile.sequence_id is not None]

abundance = defaultdict(lambda: False)

for r in results_a + results_b:
if r.profile.sequence_id is not None:
abundance[r.profile.sequence_id] = r.profile.low_abundance

interpro_id_to_name = {i.interpro_id: "%s (%s)" % (i.domain.label, i.domain.description if i.domain.description else "no description") for i in interpro_associations}

for i in interpro_associations:
Expand All @@ -83,12 +89,14 @@ def specificity_comparison_main():
if i.sequence_id in sequence_id_left:
table_data[i.interpro_id]['left_genes'].append({'id': i.sequence_id,
'name': i.sequence.name,
'shortest_alias': i.sequence.shortest_alias})
'shortest_alias': i.sequence.shortest_alias,
'low_abundance': abundance[i.sequence_id]})

if i.sequence_id in sequence_id_right:
table_data[i.interpro_id]['right_genes'].append({'id': i.sequence_id,
'name': i.sequence.name,
'shortest_alias': i.sequence.shortest_alias})
'shortest_alias': i.sequence.shortest_alias,
'low_abundance': abundance[i.sequence_id]})

if len(table_data[i.interpro_id]['left_genes']) > 0 and len(table_data[i.interpro_id]['right_genes']) == 0:
table_data[i.interpro_id]['type'] = 'left'
Expand Down Expand Up @@ -124,7 +132,8 @@ def specificity_comparison_main():

table_data[f]['left_genes'].append({'id': r.profile.sequence_id,
'name': r.profile.sequence.name,
'shortest_alias': r.profile.sequence.shortest_alias})
'shortest_alias': r.profile.sequence.shortest_alias,
'low_abundance': r.profile.low_abundance})

for r in results_b:
f = seq_to_fam[r.profile.sequence_id] if r.profile.sequence_id in seq_to_fam.keys() else None
Expand All @@ -137,7 +146,9 @@ def specificity_comparison_main():

table_data[f]['right_genes'].append({'id': r.profile.sequence_id,
'name': r.profile.sequence.name,
'shortest_alias': r.profile.sequence.shortest_alias})
'shortest_alias': r.profile.sequence.shortest_alias,
'low_abundance': r.profile.low_abundance
})

for f in table_data.keys():
if len(table_data[f]['left_genes']) > 0 and len(table_data[f]['right_genes']) == 0:
Expand Down
6 changes: 4 additions & 2 deletions conekt/templates/compare_specificity.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ <h2 class="text-muted"><em>{{ labels.left_species }}</em> {{ labels.left_conditi
{% for l in td.left_genes %}
<a href="{{ url_for('sequence.sequence_view', sequence_id=l.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('sequence.sequence_tooltip', sequence_id=l.id) }}">{{l.name}}</a>{%- if l.shortest_alias %} <span class="text-muted">({{ l.shortest_alias }})</span>{%- endif -%}{%- if not loop.last -%}, {%- endif -%}
qtip_href="{{ url_for('sequence.sequence_tooltip', sequence_id=l.id) }}">{{l.name}}</a>{%- if l.low_abundance %} <span class="warning-message qtip_tooltip"
qtip_href="{{ url_for('help.help_popup', topic='lowabundance') }}"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></span>{%- endif -%}{%- if l.shortest_alias %} <span class="text-muted">({{ l.shortest_alias }})</span>{%- endif -%}{%- if not loop.last -%}, {%- endif -%}
{% else %}
<span class="text-muted text-center">-</span>
{% endfor %}
Expand All @@ -139,7 +140,8 @@ <h2 class="text-muted"><em>{{ labels.left_species }}</em> {{ labels.left_conditi
{% for r in td.right_genes %}
<a href="{{ url_for('sequence.sequence_view', sequence_id=r.id) }}"
class="qtip_tooltip"
qtip_href="{{ url_for('sequence.sequence_tooltip', sequence_id=r.id) }}">{{r.name}}</a>{%- if r.shortest_alias %} <span class="text-muted">({{ r.shortest_alias }})</span>{%- endif -%}{%- if not loop.last -%}, {%- endif -%}
qtip_href="{{ url_for('sequence.sequence_tooltip', sequence_id=r.id) }}">{{r.name}}</a>{%- if r.low_abundance %} <span class="warning-message qtip_tooltip"
qtip_href="{{ url_for('help.help_popup', topic='lowabundance') }}"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></span>{%- endif -%}{%- if r.shortest_alias %} <span class="text-muted">({{ r.shortest_alias }})</span>{%- endif -%}{%- if not loop.last -%}, {%- endif -%}
{% else %}
<span class="text-muted text-center">-</span>
{% endfor %}
Expand Down

0 comments on commit 32b9df8

Please sign in to comment.