Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
heatmap now throws warning if genes are skipped
  • Loading branch information
proost committed Jan 25, 2018
1 parent b1e5885 commit 92f305d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions conekt/models/expression/profiles.py
Expand Up @@ -9,6 +9,7 @@
from math import log

from sqlalchemy.orm import joinedload, undefer
from flask import flash

SQL_COLLATION = 'NOCASE' if db.engine.name == 'sqlite' else ''

Expand Down Expand Up @@ -160,12 +161,26 @@ def get_heatmap(species_id, probes, zlog=True, raw=False):

output = []

not_found = [p.lower() for p in probes]

for profile in profiles:
name = profile.probe
data = json.loads(profile.profile)
order = data['order']
experiments = data['data']

try:
not_found.remove(profile.probe.lower())
except ValueError as _:
# Element not in list
pass

try:
not_found.remove(profile.sequence.name.lower())
except ValueError as _:
# Element not in list
pass

values = {}

for o in order:
Expand All @@ -189,6 +204,9 @@ def get_heatmap(species_id, probes, zlog=True, raw=False):
"sequence_id": profile.sequence_id,
"shortest_alias":profile.sequence.shortest_alias})

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

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

@staticmethod
Expand Down

0 comments on commit 92f305d

Please sign in to comment.