Skip to content

Commit

Permalink
fixed bug when attempting to create an empty heatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Nov 30, 2017
1 parent e20a2bc commit 4c88161
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions conekt/controllers/heatmap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Blueprint, request, render_template, Response
from flask import Blueprint, request, render_template, Response, redirect, flash, url_for

import json

Expand Down Expand Up @@ -77,15 +77,17 @@ def heatmap_custom_default():
form.populate_species()
form.populate_options()

terms = request.form.get('probes').split()
probes = request.form.get('probes').split()
species_id = request.form.get('species_id')

option = request.form.get('options')

probes = terms
if len(probes) == 0:
flash("No genes selected!", "warning")
return redirect(url_for('heatmap.heatmap_main'))

# also do search by gene ID
sequences = Sequence.query.filter(Sequence.name.in_(terms)).all()
sequences = Sequence.query.filter(Sequence.name.in_(probes)).all()

for s in sequences:
for ep in s.expression_profiles:
Expand Down Expand Up @@ -113,6 +115,10 @@ def heatmap_custom_comparable():

option = request.form.get('options')

if len(terms) == 0:
flash("No genes selected!", "warning")
return redirect(url_for('heatmap.heatmap_main'))

sequences = Sequence.query.filter(Sequence.name.in_(terms)).all()
sequence_ids = [s.id for s in sequences]

Expand Down

0 comments on commit 4c88161

Please sign in to comment.