From dc3bc97b2ae2e751f68ad63359734d569895c711 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 20 Nov 2018 12:08:47 -0600 Subject: Added option to select chromosome from trait page when mapping Put transform/blocking tools into their own tab (still need to change formatting of tab's contents) Improved appearance of search result page table (still need to change a few other tables) Fixed issue that caused parent/f1 strains to not be blocked correctly when using "block by index" tool Basic Stats figures now load when the user clicks the tab, to improve initial page load time --- .../maintenance/generate_kinship_from_bimbam.py | 4 +- wqflask/maintenance/geno_to_json.py | 6 +- wqflask/wqflask/show_trait/SampleList.py | 5 +- wqflask/wqflask/show_trait/show_trait.py | 8 +- wqflask/wqflask/static/new/css/show_trait.css | 4 + .../new/javascript/dataset_menu_structure.json | 96 +++++++++++++++++++--- .../wqflask/static/new/javascript/show_trait.js | 80 +++++++++++++----- .../new/javascript/show_trait_mapping_tools.js | 29 +------ wqflask/wqflask/static/new/javascript/stats.js | 12 --- wqflask/wqflask/templates/mapping_results.html | 5 +- wqflask/wqflask/templates/search_result_page.html | 9 +- wqflask/wqflask/templates/show_trait.html | 33 +++++--- wqflask/wqflask/templates/show_trait_details.html | 9 +- .../wqflask/templates/show_trait_edit_data.html | 12 +-- .../templates/show_trait_mapping_tools.html | 67 ++++++++------- .../wqflask/templates/show_trait_statistics.html | 10 +-- .../templates/show_trait_transform_and_filter.html | 79 ++++++++++++++++++ 17 files changed, 322 insertions(+), 146 deletions(-) create mode 100644 wqflask/wqflask/templates/show_trait_transform_and_filter.html (limited to 'wqflask') diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py index ad0eb036..b53f5dda 100644 --- a/wqflask/maintenance/generate_kinship_from_bimbam.py +++ b/wqflask/maintenance/generate_kinship_from_bimbam.py @@ -54,8 +54,8 @@ class GenerateKinshipMatrices(object): if __name__=="__main__": - Geno_Directory = """/home/zas1024/genotype_files/genotype/""" - Bimbam_Directory = """/home/zas1024/genotype_files/genotype/bimbam/""" + Geno_Directory = """/export/local/home/zas1024/genotype_files/genotype/""" + Bimbam_Directory = """/export/local/home/zas1024/genotype_files/genotype/bimbam/""" GenerateKinshipMatrices.process_all(Geno_Directory, Bimbam_Directory) #./gemma -g /home/zas1024/genotype_files/genotype/bimbam/BXD_geno.txt -p /home/zas1024/genotype_files/genotype/bimbam/BXD_pheno.txt -gk 1 -o BXD \ No newline at end of file diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py index 789a1691..9579812a 100644 --- a/wqflask/maintenance/geno_to_json.py +++ b/wqflask/maintenance/geno_to_json.py @@ -24,6 +24,8 @@ import simplejson as json from pprint import pformat as pf +#from utility.tools import flat_files + class EmptyConfigurations(Exception): pass @@ -183,8 +185,8 @@ class ConvertGenoFile(object): if __name__=="__main__": - Old_Geno_Directory = """/home/zas1024/genotype_files/genotype/""" - New_Geno_Directory = """/home/zas1024/genotype_files/genotype/json/""" + Old_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype""" + New_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype/json""" #Input_File = """/home/zas1024/gene/genotype_files/genotypes/BXD.geno""" #Output_File = """/home/zas1024/gene/wqflask/wqflask/pylmm/data/bxd.snps""" #convertob = ConvertGenoFile("/home/zas1024/gene/genotype_files/genotypes/SRxSHRSPF2.geno", "/home/zas1024/gene/genotype_files/new_genotypes/SRxSHRSPF2.json") diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 31d47ff2..6d9f07a0 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -63,10 +63,7 @@ class SampleList(object): sample.extra_info['url'] = "/mouseCross.html#AXB/BXA" sample.extra_info['css_class'] = "fs12" - if sample_group_type == 'primary': - sample.this_id = "Primary_" + str(counter) - else: - sample.this_id = "Other_" + str(counter) + sample.this_id = str(counter) #### For extra attribute columns; currently only used by several datasets - Zach if self.sample_attribute_values: diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 34447853..7d6dd74e 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -153,7 +153,8 @@ class ShowTrait(object): hddn['group'] = self.temp_group hddn['species'] = self.temp_species hddn['use_outliers'] = False - hddn['method'] = "pylmm" + hddn['method'] = "gemma" + hddn['selected_chr'] = -1 hddn['mapping_display_all'] = True hddn['suggestive'] = 0 hddn['num_perm'] = 0 @@ -182,6 +183,11 @@ class ShowTrait(object): self.sample_group_types['samples_primary'] = self.dataset.group.name sample_lists = [group.sample_list for group in self.sample_groups] + #ZS: Get list of chromosomes to select for mapping + self.chr_list = [["All", -1]] + for i, this_chr in enumerate(self.species.chromosomes.chromosomes): + self.chr_list.append([self.species.chromosomes.chromosomes[this_chr].name, i]) + self.genofiles = get_genofiles(self.dataset) self.has_num_cases = has_num_cases(self.this_trait) diff --git a/wqflask/wqflask/static/new/css/show_trait.css b/wqflask/wqflask/static/new/css/show_trait.css index aa47d13f..c03b6103 100644 --- a/wqflask/wqflask/static/new/css/show_trait.css +++ b/wqflask/wqflask/static/new/css/show_trait.css @@ -27,6 +27,10 @@ table.dataTable thead .sorting_desc { background-image: url("../packages/DataTables/images/sort_desc_disabled.png"); } +table.dataTable thead th { + padding: 4px 18px 4px 10px; +} + table.dataTable tbody td { padding: 3px 20px 1px 10px; } diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 9c806a7f..72008225 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -1557,6 +1557,42 @@ ] ] }, + "AIL-LGSM-F34-A": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-APublish", + "AIL-LGSM-F34-A Phenotypes" + ] + ] + }, + "AIL-LGSM-F34-F39-43-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-F39-43-GBSPublish", + "AIL-LGSM-F34-F39-43-GBS Phenotypes" + ] + ] + }, + "AIL-LGSM-F34-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F34-GBSPublish", + "AIL-LGSM-F34-GBS Phenotypes" + ] + ] + }, + "AIL-LGSM-F39-43-GBS": { + "Phenotypes": [ + [ + "None", + "AIL-LGSM-F39-43-GBSPublish", + "AIL-LGSM-F39-43-GBS Phenotypes" + ] + ] + }, "AKXD": { "Genotypes": [ [ @@ -2590,6 +2626,11 @@ ] ], "Liver mRNA": [ + [ + "857", + "EPFLMouseLiverCDHFDRMA0818", + "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" + ], [ "859", "EPFLMouseLiverCDRMA0818", @@ -2620,11 +2661,6 @@ "NIA-AgBXD-Liv_HFD-0818", "NIA Aging BXD HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" ], - [ - "857", - "EPFLMouseLiverCDHFDRMA0818", - "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" - ], [ "430", "EPFLMouseLiverRMA0413", @@ -2640,6 +2676,11 @@ "EPFLMouseLiverCDRMA0413", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], + [ + "848", + "EPFLMouseLiverHFCEx0413", + "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" + ], [ "433", "EPFLMouseLiverBothExRMA0413", @@ -2650,11 +2691,6 @@ "EPFLMouseLiverCDEx0413", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" ], - [ - "848", - "EPFLMouseLiverHFCEx0413", - "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], [ "700", "UTHSC-VGX_MmBXDHepatocytesRMA1014", @@ -4001,6 +4037,22 @@ "AIL", "AIL Advanced Intercross Line" ], + [ + "AIL-LGSM-F34-A", + "AIL LGSM F34 (Array)" + ], + [ + "AIL-LGSM-F34-GBS", + "AIL LGSM F34 (GBS)" + ], + [ + "AIL-LGSM-F34-F39-43-GBS", + "AIL LGSM F34 and F39-43 (GBS)" + ], + [ + "AIL-LGSM-F39-43-GBS", + "AIL LGSM F39-43 (GBS)" + ], [ "AKXD", "AKXD RI Family" @@ -4929,6 +4981,30 @@ "Striatum mRNA" ] ], + "AIL-LGSM-F34-A": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F34-F39-43-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F34-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], + "AIL-LGSM-F39-43-GBS": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], "AKXD": [ [ "Genotypes", diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index df86e764..717d98b9 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -417,16 +417,27 @@ } console.log("towards end:", sample_sets); update_stat_values(sample_sets); - console.log("redrawing histogram"); - redraw_histogram(); - console.log("redrawing bar chart"); - redraw_bar_chart(); - console.log("redrawing box plot"); - redraw_box_plot(); - console.log("redrawing violin plot"); - redraw_violin_plot(); - console.log("redrawing probability plot"); - return redraw_prob_plot(); + + if ($('#histogram').hasClass('js-plotly-plot')){ + console.log("redrawing histogram"); + redraw_histogram(); + } + if ($('#bar_chart').hasClass('js-plotly-plot')){ + console.log("redrawing bar chart"); + redraw_bar_chart(); + } + if ($('#box_plot').hasClass('js-plotly-plot')){ + console.log("redrawing box plot"); + redraw_box_plot(); + } + if ($('#violin_plot').hasClass('js-plotly-plot')){ + console.log("redrawing violin plot"); + redraw_violin_plot(); + } + if ($('#prob_plot_div').hasClass('js-plotly-plot')){ + console.log("redrawing probability plot"); + return redraw_prob_plot(); + } }; show_hide_outliers = function() { var label; @@ -853,7 +864,13 @@ } }; root.bar_layout = layout - Plotly.newPlot('bar_chart', root.bar_data, root.bar_layout, root.modebar_options) + $('.bar_chart_tab').click(function() { + if ($('#bar_chart').hasClass('js-plotly-plot')){ + redraw_bar_chart(); + } else { + Plotly.newPlot('bar_chart', root.bar_data, root.bar_layout, root.modebar_options) + } + }); } if (full_sample_lists.length > 1) { @@ -957,11 +974,18 @@ ] } - obj = { + box_obj = { data: box_data, layout: root.box_layout } - Plotly.newPlot('box_plot', obj, root.modebar_options); + + $('.box_plot_tab').click(function() { + if ($('#box_plot').hasClass('js-plotly-plot')){ + redraw_box_plot(); + } else { + Plotly.newPlot('box_plot', box_obj, root.modebar_options); + } + }); // Violin Plot @@ -1066,12 +1090,18 @@ ] } - obj = { + violin_obj = { data: violin_data, layout: root.violin_layout } - Plotly.plot('violin_plot', obj, root.modebar_options) + $('.violin_plot_tab').click(function() { + if ($('#violin_plot').hasClass('js-plotly-plot')){ + redraw_violin_plot(); + } else { + Plotly.plot('violin_plot', violin_obj, root.modebar_options); + } + }); // Histogram var hist_trace = { @@ -1091,9 +1121,16 @@ b: 60 } }; - Plotly.newPlot('histogram', data, layout, root.modebar_options) - update_histogram_width() + $('.histogram_tab').click(function() { + if ($('#histogram').hasClass('js-plotly-plot')){ + redraw_histogram(); + update_histogram_width(); + } else { + Plotly.newPlot('histogram', data, layout, root.modebar_options) + update_histogram_width() + } + }); $('.histogram_samples_group').val(root.stats_group); $('.histogram_samples_group').change(function() { @@ -1119,13 +1156,18 @@ root.prob_plot_group = 'samples_primary'; $('.prob_plot_samples_group').val(root.prob_plot_group); + $('.prob_plot_tab').click(function() { + return redraw_prob_plot(); + }); $('.prob_plot_samples_group').change(function() { root.prob_plot_group = $(this).val(); return redraw_prob_plot(); }); - make_table(); - edit_data_change(); + $('.stats_panel').click(function() { + make_table(); + edit_data_change(); + }); $('#edit_sample_lists').change(edit_data_change); $('.edit_sample_value').change(edit_data_change); $('#block_by_index').click(edit_data_change); diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index daa5b3f2..4e82fff2 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -154,36 +154,12 @@ }; })(this)); - $("#pylmm_mapping_compute").on("mouseover", (function(_this) { - return function() { - if ($(".outlier").length && $(".outlier-alert").length < 1) { - return showalert(outlier_text, "alert-success outlier-alert"); - } - }; - })(this)); - - $("#pylmm_compute").on("click", (function(_this) { - return function() { - var form_data, url; - //$("#progress_bar_container").modal(); - url = "/loading"; - $('input[name=method]').val("pylmm"); - $('input[name=genofile]').val($('#genofile_pylmm').val()); - $('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val()); - $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_pylmm]:checked').val()); - form_data = $('#trait_data_form').serialize(); - console.log("form_data is:", form_data); - return submit_special(url); - //return do_ajax_post(url, form_data); - }; - })(this)); - $("#rqtl_geno_compute").on("click", (function(_this) { return function() { var form_data, url; - //$("#progress_bar_container").modal(); url = "/loading"; $('input[name=method]').val("rqtl_geno"); + $('input[name=selected_chr]').val($('#chr_rqtl_geno').val()); $('input[name=genofile]').val($('#genofile_rqtl_geno').val()); $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val()); @@ -203,7 +179,6 @@ } else { return submit_special(url); - //return do_ajax_post(url, form_data); } }; })(this)); @@ -214,6 +189,7 @@ console.log("RUNNING GEMMA"); url = "/loading"; $('input[name=method]').val("gemma"); + $('input[name=selected_chr]').val($('#chr_gemma').val()); $('input[name=num_perm]').val(0); $('input[name=genofile]').val($('#genofile_gemma').val()); $('input[name=maf]').val($('input[name=maf_gemma]').val()); @@ -230,6 +206,7 @@ //$("#progress_bar_container").modal(); url = "/loading"; $('input[name=method]').val("reaper"); + $('input[name=selected_chr]').val($('#chr_reaper').val()); $('input[name=genofile]').val($('#genofile_reaper').val()); $('input[name=num_perm]').val($('input[name=num_perm_reaper]').val()); $('input[name=control_marker]').val($('input[name=control_reaper]').val()); diff --git a/wqflask/wqflask/static/new/javascript/stats.js b/wqflask/wqflask/static/new/javascript/stats.js index 4f99982e..356d1cb0 100644 --- a/wqflask/wqflask/static/new/javascript/stats.js +++ b/wqflask/wqflask/static/new/javascript/stats.js @@ -154,16 +154,4 @@ Stats = (function() { })(); -bxd_only = new Stats([3, 5, 7, 8]); - -console.log("[xred] bxd_only mean:", bxd_only.mean()); - -console.log("[xgreen] bxd_only median:", bxd_only.median()); - -console.log("[xpurple] bxd_only std_dev:", bxd_only.std_dev()); - -console.log("[xmagenta] bxd_only std_error:", bxd_only.std_error()); - -console.log("[xyellow] bxd_only min:", bxd_only.min()); - window.Stats = Stats; diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 5fb2c95e..00d725ea 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -257,7 +257,7 @@
{% for header in header_fields %} {% if header == 'Max LRS' %} - | Max LRS | +Max LRS ? | {% elif header == 'Additive Effect' %} -Additive Effect | +Additive Effect ? | {% else %}{{header}} | {% endif %} @@ -99,9 +100,9 @@{% for header in header_fields %} {% if header == 'Max LRS' %} - | Max LRS | +Max LRS ? | {% elif header == 'Additive Effect' %} -Additive Effect | +Additive Effect ? | {% else %}{{header}} | {% endif %} diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 8726226c..f5e81060 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -52,7 +52,7 @@{{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }} |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Tissue | -{{ this_trait.dataset.tissue }} | -|||||||||||
Phenotype | {{ this_trait.description_fmt }} |
@@ -24,6 +20,11 @@
Journal | {{ this_trait.journal }} ({{ this_trait.year }}) | |||||||||
Tissue | +{{ this_trait.dataset.tissue }} | +|||||||||||
- | Index | +ID | Sample | Value | {% if sample_type.se_exists() %} @@ -113,7 +109,7 @@||||||||
{{ loop.index }} | diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 8e003897..e0bc8eb8 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -14,11 +14,6 @@