diff options
author | zsloan | 2017-12-20 19:08:26 +0000 |
---|---|---|
committer | zsloan | 2017-12-20 19:08:26 +0000 |
commit | 9a0eaa6d0231c0d4415f89b0ad80ac67274d8551 (patch) | |
tree | 71f14ee090d0bea1b971de6fd681719f35f119a4 | |
parent | d692e4f79f61691ecac7a14d0d7c7e93ead919e4 (diff) | |
download | genenetwork2-9a0eaa6d0231c0d4415f89b0ad80ac67274d8551.tar.gz |
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
-rw-r--r-- | wqflask/wqflask/marker_regression/plink_mapping.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_menu_structure.json | 6 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/search_results.js | 15 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait.html | 3 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_details.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_statistics.html | 2 | ||||
-rw-r--r-- | 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 @@ <script type="text/javascript" src="/static/new/javascript/box_plot.js"></script> <script type="text/javascript" src="/static/new/javascript/scatterplot.js"></script> <script type="text/javascript" src="/static/new/javascript/scatter-matrix.js"></script> - <script type="text/javascript" src="/static/new/javascript/draw_probability_plot.js"></script> + <script type="text/javascript" src="/static/new/javascript/draw_probability_plot.js"></script> + <!--<script type="text/javascript" src="/static/new/javascript/plotly_probability_plot.js"></script>--> <script type="text/javascript" src="/static/new/javascript/compare_traits_scatterplot.js"></script> <script language="javascript" type="text/javascript" src="/static/new/javascript/get_covariates_from_collection.js"></script> 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 </a> + <a href="https://www.gtexportal.org/home/gene/{{ this_trait.symbol }}" title="GTEx Portal"> + GTEx Portal + </a> + {% endif %} </td> </tr> 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 @@ <option value="{{ group }}">{{ pretty_group }}</option> {% endfor %} </select> - <!--<button type="button" class="btn btn-default" id="down_prob_plot">Export as PNG</button>--> <br> <br> {% endif %} @@ -113,6 +112,7 @@ <div id="prob_plot_container"> <div id="prob_plot_title"></div> <svg></svg> + <!--<div id="prob_plot_div"></div>--> </div> <div id="shapiro_wilk_text"></div> <div> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 40806450..68e779a1 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -38,6 +38,7 @@ from wqflask import gsearch from wqflask import update_search_results from wqflask import docs from wqflask import news +from wqflask.submit_bnw import get_bnw_input from base.data_set import DataSet # Used by YAML in marker_regression from wqflask.show_trait import show_trait from wqflask.show_trait import export_trait_data @@ -760,6 +761,11 @@ def corr_scatter_plot_page(): indent=" ") return render_template("corr_scatterplot.html", **template_vars.__dict__) +@app.route("/submit_bnw", methods=('POST',)) +def submit_bnw(): + logger.error(request.url) + template_vars = get_bnw_input(request.form) + return render_template("empty_collection.html", **{'tool':'Correlation Matrix'}) # Todo: Can we simplify this? -Sam def sharing_info_page(): |