aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-12-18 14:33:04 -0600
committerzsloan2020-12-18 14:33:04 -0600
commit66b8f70f162f2d6356c6e9af5066c5b90335f7c2 (patch)
tree09d83911d89b402269923d8b3a0ddd5599a2fb32
parent47c15cdbd8d54afca05bf939dec8d7d461cff5a5 (diff)
downloadgenenetwork2-66b8f70f162f2d6356c6e9af5066c5b90335f7c2.tar.gz
Changed views.py to accept sample data for loading page and mapping as JSON instead of having separate form parameters for each sample + removed some commented out code/logging
-rw-r--r--wqflask/wqflask/views.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 25563e86..c136711e 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -621,12 +621,13 @@ def loading_page():
wanted = initial_start_vars['wanted_inputs'].split(",")
start_vars = {}
for key, value in list(initial_start_vars.items()):
- if key in wanted or key.startswith(('value:')):
+ if key in wanted:
start_vars[key] = value
if 'n_samples' in start_vars:
n_samples = int(start_vars['n_samples'])
else:
+ sample_vals_dict = json.loads(start_vars['sample_vals'])
if 'group' in start_vars:
dataset = create_dataset(start_vars['dataset'], group_name = start_vars['group'])
else:
@@ -642,8 +643,7 @@ def loading_page():
samples = genofile_samples
for sample in samples:
- value = start_vars.get('value:' + sample)
- if value != "x":
+ if sample_vals_dict[sample] != "x":
n_samples += 1
start_vars['n_samples'] = n_samples
@@ -660,7 +660,6 @@ def loading_page():
@app.route("/run_mapping", methods=('POST',))
def mapping_results_page():
initial_start_vars = request.form
- #logger.debug("Mapping called with initial_start_vars:", initial_start_vars.items())
logger.info(request.url)
temp_uuid = initial_start_vars['temp_uuid']
wanted = (
@@ -670,6 +669,7 @@ def mapping_results_page():
'species',
'samples',
'vals',
+ 'sample_vals',
'first_run',
'output_files',
'geno_db_exists',
@@ -723,13 +723,11 @@ def mapping_results_page():
)
start_vars = {}
for key, value in list(initial_start_vars.items()):
- if key in wanted or key.startswith(('value:')):
+ if key in wanted:
start_vars[key] = value
- #logger.debug("Mapping called with start_vars:", start_vars)
version = "v3"
key = "mapping_results:{}:".format(version) + json.dumps(start_vars, sort_keys=True)
- #logger.info("key is:", pf(key))
with Bench("Loading cache"):
result = None # Just for testing
#result = Redis.get(key)
@@ -775,10 +773,6 @@ def mapping_results_page():
rendered_template = render_template("pair_scan_results.html", **result)
else:
gn1_template_vars = display_mapping_results.DisplayMappingResults(result).__dict__
- #pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL)
- #logger.info("pickled result length:", len(pickled_result))
- #Redis.set(key, pickled_result)
- #Redis.expire(key, 1*60)
with Bench("Rendering template"):
#if (gn1_template_vars['mapping_method'] == "gemma") or (gn1_template_vars['mapping_method'] == "plink"):