From 9a0eaa6d0231c0d4415f89b0ad80ac67274d8551 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 20 Dec 2017 19:08:26 +0000
Subject: Fixed the way PLINK outputs phenotype files (though there's still
some problem preventing it from working)
Added some code related to new plotly probability plot, though it's commented out until it looks how I want it to
Added some code for adding the BNW link to GN2, though it's not working yet
Updated dataset menu structure JSON file
---
wqflask/wqflask/marker_regression/plink_mapping.py | 6 +++---
.../static/new/javascript/dataset_menu_structure.json | 6 +++---
wqflask/wqflask/static/new/javascript/search_results.js | 15 ++++++++++++---
wqflask/wqflask/templates/show_trait.html | 3 ++-
wqflask/wqflask/templates/show_trait_details.html | 4 ++++
wqflask/wqflask/templates/show_trait_statistics.html | 2 +-
wqflask/wqflask/views.py | 6 ++++++
7 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/wqflask/wqflask/marker_regression/plink_mapping.py b/wqflask/wqflask/marker_regression/plink_mapping.py
index 3d31da1a..4de88f00 100644
--- a/wqflask/wqflask/marker_regression/plink_mapping.py
+++ b/wqflask/wqflask/marker_regression/plink_mapping.py
@@ -14,7 +14,7 @@ def run_plink(this_trait, dataset, species, vals, maf):
gen_pheno_txt_file(dataset, vals)
#gen_pheno_txt_file_plink(this_trait, dataset, vals, pheno_filename = plink_output_filename)
- plink_command = PLINK_COMMAND + ' --noweb --bfile %s/%s --no-fid --no-parents --no-sex --maf %s --missing-phenotype -9 --out %s/%s --assoc ' % (
+ plink_command = PLINK_COMMAND + ' --noweb --bfile %s/%s --no-pheno --no-fid --no-parents --no-sex --maf %s --out %s%s --assoc ' % (
flat_files('mapping'), dataset.group.name, maf, TMPDIR, plink_output_filename)
logger.debug("plink_command:", plink_command)
@@ -48,7 +48,7 @@ def gen_pheno_txt_file(this_dataset, vals):
this_val = -9
else:
this_val = vals[i]
- outfile.write(line[1] + " " + line[1] + " " + line[2] + " " + line[3] + " " + line[4] + " " + str(this_val) + "\n")
+ outfile.write("0 " + line[1] + " " + line[2] + " " + line[3] + " " + line[4] + " " + str(this_val) + "\n")
def gen_pheno_txt_file_plink(this_trait, dataset, vals, pheno_filename = ''):
ped_sample_list = get_samples_from_ped_file(dataset)
@@ -106,7 +106,7 @@ def parse_plink_output(output_filename, species):
threshold_p_value = 1
- result_fp = open("%s/%s.qassoc"% (TMPDIR, output_filename), "rb")
+ result_fp = open("%s%s.qassoc"% (TMPDIR, output_filename), "rb")
header_line = result_fp.readline()# read header line
line = result_fp.readline()
diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
index eabddbc4..8de85a86 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
+++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
@@ -1918,12 +1918,12 @@
[
"797",
"EPFL_AdiPro0416",
- "EPFL/ETHZ BXD Brown Adipose, Total Tissue Proteome, Chow Diet (Apr16) Light SWATH **"
+ "EPFL/ETHZ BXD Brown Adipose, Total Tissue Proteome, Chow Diet (Apr16) Light SWATH"
],
[
"798",
"EPFL_AdiMitPro0416",
- "EPFL/ETHZ BXD Brown Adipose, Isolated Mitochondria Proteome, Chow Diet (Apr16) Light SWATH **"
+ "EPFL/ETHZ BXD Brown Adipose, Isolated Mitochondria Proteome, Chow Diet (Apr16) Light SWATH"
]
],
"Adipose mRNA": [
@@ -3583,7 +3583,7 @@
[
"799",
"FGUCAS_BAdip0516",
- "FGUCAS BXH/HXB Brown Adipose Affy Rat Gene 2.0 ST (May16) log2 **"
+ "FGUCAS BXH/HXB Brown Adipose Affy Rat Gene 2.0 ST (May16) log2"
]
],
"Adrenal Gland mRNA": [
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index 40fdff70..2b878087 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -154,11 +154,15 @@ $(function() {
}
};
+ submit_bnw = function() {
+ trait_data = get_traits_from_table("trait_table", "submit_bnw")
+ }
+
export_traits = function() {
- trait_data = get_traits_from_table("trait_table")
+ trait_data = get_traits_from_table("trait_table", "export_csv")
};
- get_traits_from_table = function(table_name) {
+ get_traits_from_table = function(table_name, destination) {
trait_table = $('#'+table_name);
table_dict = {};
@@ -199,7 +203,11 @@ $(function() {
json_table_dict = JSON.stringify(table_dict);
$('input[name=export_data]').val(json_table_dict);
- $('#export_form').attr('action', '/export_traits_csv');
+ if (destination == "export_csv"){
+ $('#export_form').attr('action', '/export_traits_csv');
+ } else{
+ $('#export_form').attr('action', '/submit_bnw');
+ }
$('#export_form').submit();
};
@@ -208,6 +216,7 @@ $(function() {
$("#invert").click(invert);
$("#add").click(add);
$("#remove").click(remove);
+ $("#submit_bnw").click(submit_bnw);
$("#export_traits").click(export_traits);
$('.trait_checkbox, .btn').click(change_buttons);
});
\ No newline at end of file
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index d41f4dfb..a291baf3 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -141,7 +141,8 @@
-
+
+
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index a0c40c7f..2a62733e 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -70,6 +70,10 @@
Genotation
+
+ GTEx Portal
+
+
{% endif %}
diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html
index 48ac468a..aa95b083 100644
--- a/wqflask/wqflask/templates/show_trait_statistics.html
+++ b/wqflask/wqflask/templates/show_trait_statistics.html
@@ -105,7 +105,6 @@
{% endfor %}
-
{% endif %}
@@ -113,6 +112,7 @@