diff --git a/conekt/models/expression/profiles.py b/conekt/models/expression/profiles.py index 305b87c..e970a4a 100644 --- a/conekt/models/expression/profiles.py +++ b/conekt/models/expression/profiles.py @@ -1,9 +1,9 @@ from conekt import db -from conekt.models.species import Species from conekt.models.sequences import Sequence from conekt.models.condition_tissue import ConditionTissue import json +import contextlib from collections import defaultdict from statistics import mean from math import log @@ -169,17 +169,11 @@ def get_heatmap(species_id, probes, zlog=True, raw=False): order = data['order'] experiments = data['data'] - try: + with contextlib.suppress(ValueError): not_found.remove(profile.probe.lower()) - except ValueError as _: - # Element not in list - pass - try: + with contextlib.suppress(ValueError): not_found.remove(profile.sequence.name.lower()) - except ValueError as _: - # Element not in list - pass values = {} @@ -205,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 fine profile for: %s" % ",".join(not_found), "warning") + flash("Couldn't find profile for: %s" % ",".join(not_found), "warning") return {'order': order, 'heatmap_data': output}