From a15dda37ffa6f77dbbc349302760c9a25541df9e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 24 Sep 2016 08:27:22 +0000 Subject: I was getting below error with the small database. This commit, at least, does not assume the item exists. ERROR:wqflask:Exception on /marker_regression [POST] Traceback (most recent call last): File "/home/wrk/.guix-profile/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/home/wrk/.guix-profile/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/wrk/.guix-profile/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/wrk/.guix-profile/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/home/wrk/.guix-profile/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/export2/izip/git/opensource/genenetwork/sumo_gn2/wqflask/wqflask/views.py", line 460, in marker_regression_page template_vars = marker_regression.MarkerRegression(start_vars, temp_uuid) File "/export2/izip/git/opensource/genenetwork/sumo_gn2/wqflask/wqflask/marker_regression/marker_regression.py", line 74, in __init__ value = start_vars['value:' + sample] KeyError: 'value:BXD80' --- wqflask/wqflask/marker_regression/marker_regression.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index a1065adc..d2b27991 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -59,6 +59,7 @@ class MarkerRegression(object): primary_sample_names = list(all_samples_ordered) for sample in self.dataset.group.samplelist: + # sample is actually the name of an individual in_trait_data = False for item in self.this_trait.data: if self.this_trait.data[item].name == sample: @@ -68,9 +69,10 @@ class MarkerRegression(object): in_trait_data = True break if not in_trait_data: - value = start_vars['value:' + sample] - self.samples.append(sample) - self.vals.append(value) + value = start_vars.get('value:' + sample) + if value: + self.samples.append(sample) + self.vals.append(value) self.mapping_method = start_vars['method'] if start_vars['manhattan_plot'] == "True": -- cgit v1.2.3