Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
warning in custom profiles for missing genes
  • Loading branch information
proost committed Jan 25, 2018
1 parent addb70b commit 8c1ad14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions conekt/controllers/profile_comparison.py
@@ -1,5 +1,6 @@
import json
import base64
import contextlib

from flask import Blueprint, request, render_template, flash, Markup, url_for
from sqlalchemy.orm import noload
Expand Down Expand Up @@ -85,12 +86,16 @@ def profile_comparison_main():
# get max 51 profiles, only show the first 50 (the extra one is fetched to throw the warning)
profiles = ExpressionProfile.get_profiles(species_id, probes, limit=51)

missing = []
for p in probes:
pass
not_found = [p.lower() for p in probes]
for p in profiles:
with contextlib.suppress(ValueError):
not_found.remove(p.probe.lower())

if len(missing) > 0:
flash("Warning! %s were not found in the database" % ', '.join(missing))
with contextlib.suppress(ValueError):
not_found.remove(p.sequence.name.lower())

if len(not_found) > 0:
flash("Couldn't find profile for: %s" % ", ".join(not_found), "warning")

if len(profiles) > 50:
flash(Markup(("To many profiles in this cluster only showing the <strong>first 50</strong>. <br />" +
Expand Down
2 changes: 1 addition & 1 deletion conekt/models/expression/profiles.py
Expand Up @@ -199,7 +199,7 @@ def get_heatmap(species_id, probes, zlog=True, raw=False):
"shortest_alias":profile.sequence.shortest_alias})

if len(not_found) > 0:
flash("Couldn't find profile for: %s" % ",".join(not_found), "warning")
flash("Couldn't find profile for: %s" % ", ".join(not_found), "warning")

return {'order': order, 'heatmap_data': output}

Expand Down

0 comments on commit 8c1ad14

Please sign in to comment.