diff options
author | zsloan | 2020-11-05 15:21:28 -0600 |
---|---|---|
committer | zsloan | 2020-11-05 15:21:28 -0600 |
commit | 8f70b408c6df130ba9bef2b159c32ef0c8d6c327 (patch) | |
tree | 286ed4142f0f7c4fa5dfdf756f0d2a3226dc9648 /wqflask | |
parent | 7932f962aff0ac35dd53b84e483f405de81c0612 (diff) | |
download | genenetwork2-8f70b408c6df130ba9bef2b159c32ef0c8d6c327.tar.gz |
Removed html from generate_corr_json since that will be done by the column definitions after passing the data to DataTables as JSON
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/correlation/show_corr_results.py | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 4c2b64ba..f0187ef9 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -484,30 +484,26 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap if trait.view == False: continue results_dict = {} - if not for_api: - results_dict['checkbox'] = "<INPUT TYPE='checkbox' NAME='searchResult' class='checkbox trait_checkbox' style='padding-right: 0px;' VALUE='" + hmac.hmac_creation('{}:{}'.format(trait.name, trait.dataset.name)) + "'>" - results_dict['index'] = i + 1 - results_dict['trait_id'] = "<a href='/show_trait?trait_id="+str(trait.name)+"&dataset="+str(dataset.name)+"'>"+str(trait.name)+"</a>" - else: - results_dict['trait_id'] = trait.name + results_dict['index'] = i + 1 + results_dict['trait_id'] = trait.name if target_dataset.type == "ProbeSet": results_dict['symbol'] = trait.symbol results_dict['description'] = trait.description_display results_dict['location'] = trait.location_repr - results_dict['mean'] = float(trait.mean) + if trait.mean and trait.mean != "": + results_dict['mean'] = float(trait.mean) + else: + results_dict['mean'] = "N/A" if trait.LRS_score_repr != "N/A": results_dict['lrs_score'] = "%.1f" % float(trait.LRS_score_repr) else: results_dict['lrs_score'] = "N/A" results_dict['lrs_location'] = trait.LRS_location_repr - if trait.additive != "": + if trait.additive and trait.additive != "": results_dict['additive'] = "%0.3f" % float(trait.additive) else: results_dict['additive'] = "N/A" - if for_api: - results_dict['sample_r'] = "%0.3f" % float(trait.sample_r) - else: - results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % float(trait.sample_r) + "</a>" + results_dict['sample_r'] = "%0.3f" % float(trait.sample_r) results_dict['num_overlap'] = trait.num_overlap results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) if trait.lit_corr == "" or trait.lit_corr == 0: @@ -535,22 +531,16 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap results_dict['pubmed'] = "N/A" results_dict['lrs_score'] = trait.LRS_score_repr results_dict['lrs_location'] = trait.LRS_location_repr - if trait.additive != "": + if trait.additive and trait.additive != "": results_dict['additive'] = "%0.3f" % float(trait.additive) else: results_dict['additive'] = "N/A" - if for_api: - results_dict['sample_r'] = "%0.3f" % trait.sample_r - else: - results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % trait.sample_r + "</a>" + results_dict['sample_r'] = "%0.3f" % trait.sample_r results_dict['num_overlap'] = trait.num_overlap results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) else: results_dict['lrs_location'] = trait.LRS_location_repr - if for_api: - results_dict['sample_r'] = "%0.3f" % trait.sample_r - else: - results_dict['sample_r'] = "<a target='_blank' href='corr_scatter_plot?dataset_1=" + str(dataset.name) + "&dataset_2=" + str(trait.dataset.name) + "&trait_1=" + str(this_trait.name) + "&trait_2=" + str(trait.name) + "'>" + "%0.3f" % float(trait.sample_r) + "</a>" + results_dict['sample_r'] = "%0.3f" % trait.sample_r results_dict['num_overlap'] = trait.num_overlap results_dict['sample_p'] = "%0.3e" % float(trait.sample_p) |