diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/trait.py | 15 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/marker_regression.py | 11 | ||||
-rwxr-xr-x | wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js | 18 | ||||
-rwxr-xr-x | wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css | 4 | ||||
-rwxr-xr-x | wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js | 122 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/base.html | 2 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/collections/view.html | 20 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/correlation_page.html | 252 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_gene.html | 129 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_pheno.html | 102 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/index_page.html | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/pair_scan_results.html | 2 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/search_result_page.html | 85 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_edit_data.html | 17 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 66 |
15 files changed, 449 insertions, 402 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 0c962331..a71d8157 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -444,9 +444,9 @@ class GeneralTrait(object): self.locus_chr = result[0] self.locus_mb = result[1] else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: self.locus = self.locus_chr = self.locus_mb = self.lrs = self.pvalue = self.mean = self.additive = "" @@ -476,9 +476,9 @@ class GeneralTrait(object): self.locus_chr = result[0] self.locus_mb = result[1] else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: - self.locus = self.locus_chr = self.locus_mb = "" + self.locus = self.locus_chr = self.locus_mb = self.additive = "" else: self.locus = self.lrs = self.additive = "" @@ -492,9 +492,10 @@ class GeneralTrait(object): else: LRS_location_value = ord(str(self.locus_chr).upper()[0])*1000 + float(self.locus_mb) - self.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (self.locus_chr, float(self.locus_mb)) - self.LRS_score_repr = LRS_score_repr = '%3.1f' % self.lrs - self.LRS_score_value = LRS_score_value = self.lrs + self.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (self.locus_chr, float(self.locus_mb)) + if self.lrs != "": + self.LRS_score_repr = LRS_score_repr = '%3.1f' % self.lrs + self.LRS_score_value = LRS_score_value = self.lrs else: raise KeyError, `self.name`+' information is not found in the database.' diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 1e0a618e..26da95b9 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -37,7 +37,7 @@ from utility import temp_data from utility.benchmark import Bench from wqflask.marker_regression import gemma_mapping -from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND +from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND, TEMPDIR from utility.external import shell from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR @@ -213,7 +213,8 @@ class MarkerRegression(object): if 'lod_score' in marker.keys(): self.qtl_results.append(marker) - self.trimmed_markers = trim_markers_for_table(results) + + self.trimmed_markers = results for qtl in enumerate(self.qtl_results): self.json_data['chr1'].append(str(qtl['chr1'])) @@ -228,7 +229,7 @@ class MarkerRegression(object): maf = self.maf, manhattan_plot = self.manhattan_plot, mapping_scale = self.mapping_scale, - qtl_results = self.qtl_results, + qtl_results = self.qtl_results ) else: @@ -388,7 +389,7 @@ class MarkerRegression(object): r_sum = ro.r["sum"] # Map the sum function plot = ro.r["plot"] # Map the plot function postscript = ro.r["postscript"] # Map the postscript function - png = ro.r["png"] # Map the png function + png = ro.r["png"] # Map the png function dev_off = ro.r["dev.off"] # Map the device off function print(r_library("qtl")) # Load R/qtl @@ -430,7 +431,7 @@ class MarkerRegression(object): #print("Pair scan results:", result_data_frame) self.pair_scan_filename = webqtlUtil.genRandStr("scantwo_") + ".png" - png(file=TMPDIR+self.pair_scan_filename) + png(file=TEMPDIR+self.pair_scan_filename) plot(result_data_frame) dev_off() 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 519d1304..3b1a1205 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -135,6 +135,8 @@ outlier_text = "One or more outliers exist in this data set. Please review values before mapping. Including outliers when mapping may lead to misleading results. We recommend <A HREF=\"http://en.wikipedia.org/wiki/Winsorising\">winsorising</A> the outliers or simply deleting them."; + runtime_warning_text = "This function could take as long as 10-20 minutes to run, so please do not close your browser window until it finishes." + showalert = function(message, alerttype) { return $('#alert_placeholder').append('<div id="alertdiv" class="alert ' + alerttype + '"><a class="close" data-dismiss="alert">�</a><span>' + message + '</span></div>'); }; @@ -187,8 +189,20 @@ $('input[name=do_control]').val($('input[name=do_control_rqtl]: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); + if ($('input[name=pair_scan]:checked').val() == "true") { + console.log("PAIR SCAN:", $('input[name=pair_scan]:checked').val()) + run_pair_scan = confirm(runtime_warning_text) + if (run_pair_scan == true) { + submit_special(url); + } + else { + return false + } + } + else { + return submit_special(url); + //return do_ajax_post(url, form_data); + } }; })(this)); diff --git a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css index 931ec6b3..6540d01f 100755 --- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css +++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css @@ -20,7 +20,7 @@ table.dataTable tfoot th { } table.dataTable thead th, table.dataTable thead td { - padding: 10px 18px; + padding: 10px 18px 10px 0px; border-bottom: 1px solid #111; } table.dataTable thead th:active, @@ -69,7 +69,7 @@ table.dataTable tbody tr.selected { } table.dataTable tbody th, table.dataTable tbody td { - padding: 8px 10px; + padding: 4px 5px; } table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { border-top: 1px solid #ddd; diff --git a/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js b/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js index c9e26682..8b7fa8fd 100755 --- a/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js +++ b/wqflask/wqflask/static/new/packages/DataTables/js/dataTables.naturalSort.js @@ -1,56 +1,68 @@ -(function() {
-
-/*
- * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
- * Author: Jim Palmer (based on chunking idea from Dave Koelle)
- * Contributors: Mike Grier (mgrier.com), Clint Priest, Kyle Adams, guillermo
- * See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js
- */
-function naturalSort (a, b) {
- var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
- sre = /(^[ ]*|[ ]*$)/g,
- dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
- hre = /^0x[0-9a-f]+$/i,
- ore = /^0/,
- // convert all to strings and trim()
- x = a.toString().replace(sre, '') || '',
- y = b.toString().replace(sre, '') || '',
- // chunk/tokenize
- xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
- yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
- // numeric, hex or date detection
- xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
- yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null;
- // first try and sort Hex codes or Dates
- if (yD)
- if ( xD < yD ) return -1;
- else if ( xD > yD ) return 1;
- // natural sorting through split numeric strings and default strings
- for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
- // find floats not starting with '0', string or 0 if not defined (Clint Priest)
- var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
- var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
- // handle numeric vs string comparison - number < string - (Kyle Adams)
- if (isNaN(oFxNcL) !== isNaN(oFyNcL)) return (isNaN(oFxNcL)) ? 1 : -1;
- // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
- else if (typeof oFxNcL !== typeof oFyNcL) {
- oFxNcL += '';
- oFyNcL += '';
- }
- if (oFxNcL < oFyNcL) return -1;
- if (oFxNcL > oFyNcL) return 1;
- }
- return 0;
-}
-
-jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "natural-asc": function ( a, b ) {
- return naturalSort(a,b);
- },
-
- "natural-desc": function ( a, b ) {
- return naturalSort(a,b) * -1;
- }
-} );
-
+(function() { + +/* + * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license + * Author: Jim Palmer (based on chunking idea from Dave Koelle) + * Contributors: Mike Grier (mgrier.com), Clint Priest, Kyle Adams, guillermo + * See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js + */ +function naturalSort (a, b) { + var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, + sre = /(^[ ]*|[ ]*$)/g, + dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, + hre = /^0x[0-9a-f]+$/i, + ore = /^0/, + // convert all to strings and trim() + x = a.toString().replace(sre, '') || '', + y = b.toString().replace(sre, '') || '', + // chunk/tokenize + xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), + yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), + // numeric, hex or date detection + xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)), + yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null; + + // first try and sort Hex codes or Dates + if (yD) + if ( xD < yD ) return -1; + else if ( xD > yD ) return 1; + + // natural sorting through split numeric strings and default strings + for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) { + // find floats not starting with '0', string or 0 if not defined (Clint Priest) + var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0; + var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0; + // handle numeric vs string comparison - number < string - (Kyle Adams) + if (isNaN(oFxNcL) !== isNaN(oFyNcL)) return (isNaN(oFxNcL)) ? 1 : -1; + // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2' + else if (typeof oFxNcL !== typeof oFyNcL) { + oFxNcL += ''; + oFyNcL += ''; + } + if (oFxNcL < oFyNcL) return -1; + if (oFxNcL > oFyNcL) return 1; + } + + return 0; +} + +jQuery.extend( jQuery.fn.dataTableExt.oSort, { + "natural-asc": function ( a, b ) { + // first check if null or n/a + if (a == "N/A" || a == "NA" || a == "" || a == "--") return 1; + else if (b == "N/A" || b == "NA" || b == "" || b == "--") return -1; + else { + return naturalSort(a,b); + } + }, + + "natural-desc": function ( a, b ) { + if (a == "N/A" || a == "NA" || a == "" || a == "--") return 1; + else if (b == "N/A" || b == "NA" || b == "" || b == "--") return -1; + else { + return naturalSort(a,b) * -1; + } + } +} ); + }());
\ No newline at end of file diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index b4fdbd8e..759c4a8d 100755 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -19,7 +19,7 @@ </head> -<body style="width: 1500px !important;"> +<body style="width: 100% !important;"> <!-- Navbar ================================================== --> <div class="navbar navbar-inverse navbar-static-top pull-left" role="navigation"> diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index c1563b9c..288207e7 100755 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -92,18 +92,19 @@ <button class="btn" id="remove" disabled="disabled"><i class="icon-minus-sign"></i> Remove Record</button> <br /> <br /> + <div style="background-color: #eeeeee; border: 1px solid black;"> <table class="table table-hover table-striped" id='trait_table'> <thead> <tr> - <th></th> - <th>Index</th> - <th>Record</th> - <th>Description</th> - <th>Location</th> - <th>Mean</th> - <th>Max LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th>Max LRS Location</th> - <th>Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Record</th> + <th style="background-color: #eeeeee;">Description</th> + <th style="background-color: #eeeeee;">Location</th> + <th style="background-color: #eeeeee;">Mean</th> + <th style="background-color: #eeeeee;">Max LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;">Max LRS Location</th> + <th style="background-color: #eeeeee;">Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </thead> @@ -136,6 +137,7 @@ </tbody> </table> + </div> <br /> </div> </div> diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index efc94c42..c5b4477b 100755 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -3,8 +3,6 @@ <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> - <link href="//cdn.datatables.net/fixedheader/2.1.2/css/dataTables.fixedHeader.css" rel="stylesheet"> - <link href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} @@ -34,55 +32,65 @@ <br /> <br /> - <div> - <table id="trait_table" class="table table-hover table-striped"> + <div style="width: {% if target_dataset.type == "ProbeSet" %}1600px{% elif target_dataset.type == "Publish" %}1200px{% else %}800px{% endif %}; background-color: #eeeeee; border: 1px solid black;"> + <table width="1600px" id="trait_table" class="table table-hover table-striped"> <thead> <tr> - <th style="width: 30px;"></th> + <th style="width: 30px; background-color: #eeeeee;"></th> {% for header in target_dataset.header_fields %} - {% if header == 'Max LRS' %} - <th style="text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + {% if header == 'Year' %} + <th style="text-align: right; background-color: #eeeeee;">{{header}}</th> + {% elif header == 'Max LRS' %} + <th style="text-align: right; background-color: #eeeeee;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + {% elif header == 'Max LRS Location' %} + <th style="text-align: right; background-color: #eeeeee;">{{header}}</th> + {% elif header == 'Location' %} + <th style="text-align: right; background-color: #eeeeee;">{{header}}</th> + {% elif header == 'Mean' %} + <th style="text-align: right; background-color: #eeeeee;">{{header}}</th> {% elif header == 'Additive Effect' %} - <th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="text-align: right; background-color: #eeeeee;">Add <br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + {% elif header == 'Index' %} + <th style="text-align: right; background-color: #eeeeee; padding-left: 0px; margin-left: 0px;">{{header}}</th> + {% elif header == 'N' %} + <th style="text-align: right; background-color: #eeeeee;">{{header}}</th> {% else %} - <th>{{header}}</th> + <th style="background-color: #eeeeee;">{{header}}</th> {% endif %} {% endfor %} - {% if target_dataset.type == "ProbeSet" %} + {% if target_dataset.type == "ProbeSet" %} {% if corr_method == 'pearson' %} - <th>Sample r</th> - <th>N Cases</th> - <th>Sample p(r)</th> - <th>Lit Corr</th> - <th>Tissue r</th> - <th>Tissue p(r)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample r</th> + <th style="text-align: right; background-color: #eeeeee;"> N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(r)</th> + <th style="text-align: right; background-color: #eeeeee;">Lit r</th> + <th style="text-align: right; background-color: #eeeeee;">Tissue r</th> {% else %} - <th>Sample rho</th> - <th>N Cases</th> - <th>Sample p(rho)</th> - <th>Lit Corr</th> - <th>Tissue rho</th> - <th>Tissue p(rho)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample rho</th> + <th style="text-align: right; background-color: #eeeeee;">N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(rho)</th> + <th style="text-align: right; background-color: #eeeeee;">Lit r</th> + <th style="text-align: right; background-color: #eeeeee;">Tissue rho</th> {% endif %} {% elif target_dataset.type == "Publish" %} {% if corr_method == 'pearson' %} - <th>Sample r</th> - <th>N Cases</th> - <th>Sample p(r)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample r</th> + <th style="text-align: right; background-color: #eeeeee;"> N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(r)</th> {% else %} - <th>Sample rho</th> - <th>N Cases</th> - <th>Sample p(rho)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample rho</th> + <th style="text-align: right; background-color: #eeeeee;"> N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(rho)</th> {% endif %} {% elif target_dataset.type == "Geno" %} {% if corr_method == 'pearson' %} - <th>Sample r</th> - <th>N Cases</th> - <th>Sample p(r)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample r</th> + <th style="text-align: right; background-color: #eeeeee;">N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(r)</th> {% else %} - <th>Sample rho</th> - <th>N Cases</th> - <th>Sample p(rho)</th> + <th style="text-align: right; background-color: #eeeeee;">Sample rho</th> + <th style="text-align: right; background-color: #eeeeee;">N</th> + <th style="text-align: right; background-color: #eeeeee;">Sample p(rho)</th> {% endif %} {% endif %} </tr> @@ -91,58 +99,56 @@ <tbody> {% for trait in correlation_results %} <tr> - <TD><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) }}"> - </TD> - <TD align="right">{{ loop.index }}</TD> - <TD> + <td> <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(trait.name, trait.dataset.name)) }}"></td> + <td align="right">{{ loop.index }}</td> + <td> <a href="{{ url_for('show_trait_page', trait_id = trait.name, dataset = dataset.name )}}"> {{ trait.name }} </a> - </TD> + </td> {% if target_dataset.type == 'ProbeSet' %} - <TD>{{ trait.symbol }}</TD> - <TD>{{ trait.description_display }}</TD> - <TD style="white-space: nowrap;">{{ trait.location_repr }}</TD> - <TD align="right">{{ '%0.3f' % trait.mean|float }}</TD> - <TD align="right">{{ '%0.3f' % trait.LRS_score_repr|float }}</TD> - <TD style="white-space: nowrap;">{{ trait.LRS_location_repr }}</TD> - <TD align="right">{{ '%0.3f' % trait.additive|float }}</TD> - <TD><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></TD> - <TD>{{ trait.num_overlap }}</TD> - <TD>{{'%0.3e'|format(trait.sample_p)}}</TD> + <td>{{ trait.symbol }}</td> + <td>{{ trait.description_display }}</TD> + <td align="right"style="white-space: nowrap;">{{ trait.location_repr }}</td> + <td align="right">{{ '%0.3f' % trait.mean|float }}</td> + <td align="right" style="padding-right: 15px;">{% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td> + <td align="right" style="padding-right: 15px;">{{ trait.LRS_location_repr }}</td> + <td align="right" style="padding-right: 15px;">{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}</td> + <td align="right" style="padding-right: 15px;"><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td> + <td align="right" style="padding-right: 15px;">{{ trait.num_overlap }}</td> + <td align="right" style="padding-right: 15px;">{{'%0.3e'|format(trait.sample_p)}}</td> {% if trait.lit_corr == "" or trait.lit_corr == 0.000 %} - <TD>--</TD> + <td align="right" style="padding-right: 15px;">--</td> {% else %} - <TD>{{'%0.3f'|format(trait.lit_corr)}}</TD> + <td align="right" style="padding-right: 15px;">{{'%0.3f'|format(trait.lit_corr)}}</td> {% endif %} {% if trait.tissue_corr == "" or trait.tissue_corr == 0.000 %} - <TD>--</TD> + <td align="right" style="padding-right: 15px;">--</td> {% else %} - <TD>{{'%0.3f'|format(trait.tissue_corr)}}</TD> + <td align="right" style="padding-right: 15px;">{{'%0.3f'|format(trait.tissue_corr)}}</td> {% endif %} - <TD>{{'%0.3e'|format(trait.tissue_pvalue)}}</TD> {% elif target_dataset.type == "Publish" %} - <TD>{{ trait.description_display }}</TD> - <TD>{{ trait.authors }}</TD> - <TD> + <td>{{ trait.description_display }}</td> + <td>{{ trait.authors }}</td> + <td> <a href="{{ trait.pubmed_link }}"> {{ trait.pubmed_text }} </a> - </TD> - <TD>{{ trait.LRS_score_repr }}</TD> - <TD>{{ trait.LRS_location_repr }}</TD> - <TD>{{ '%0.3f' % trait.additive|float }}</TD> - <TD><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></TD> - <TD>{{ trait.num_overlap }}</TD> - <TD>{{'%0.3e'|format(trait.sample_p)}}</TD> + </td> + <td align="right" style="padding-right: 15px;">{{ trait.LRS_score_repr }}</td> + <td align="right" style="padding-right: 15px;">{{ trait.LRS_location_repr }}</td> + <td align="right" style="padding-right: 15px;">{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}</td> + <td align="right" style="padding-right: 15px;"><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td> + <td align="right" style="padding-right: 15px;">{{ trait.num_overlap }}</td> + <td align="right" style="padding-right: 15px;">{{'%0.3e'|format(trait.sample_p)}}</td> {% elif target_dataset.type == "Geno" %} - <TD>{{ trait.location_repr }}</TD> - <TD><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></TD> - <TD>{{ trait.num_overlap }}</TD> - <TD>{{'%0.3e'|format(trait.sample_p)}}</TD> + <td align="right" style="padding-right: 15px;">{{ trait.location_repr }}</TD> + <td align="right" style="padding-right: 15px;"><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td> + <td align="right" style="padding-right: 15px;">{{ trait.num_overlap }}</td> + <td align="right" style="padding-right: 15px;">{{'%0.3e'|format(trait.sample_p)}}</td> {% endif %} </tr> {% endfor %} @@ -161,12 +167,8 @@ <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script> <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> - <script language="javascript" type="text/javascript" src="//cdn.datatables.net/fixedheader/2.1.2/js/dataTables.fixedHeader.min.js"></script> - <script language="javascript" type="text/javascript" src="//cdn.datatables.net/fixedcolumns/3.0.4/js/dataTables.fixedColumns.min.js"></script> <script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script> <script type="text/javascript" charset="utf-8"> function getValue(x) { @@ -229,15 +231,28 @@ console.time("Creating table"); {% if target_dataset.type == "ProbeSet" %} - - $('#trait_table').dataTable( { + "paging": false, + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'correlation_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + } + } + ], + "columnDefs": [ + { "targets": 0, "orderable": false } + ], "columns": [ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, + { "type": "natural", "width": "20%" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, @@ -247,19 +262,14 @@ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, { "type": "natural" } ], - "buttons": [ - 'csvHtml5' - ], - "sDom": "RZBtir", - "iDisplayLength": -1, + "order": [[10, "desc" ]], + "sDom": "Btir", + "autoWidth": false, "bDeferRender": true, - "bSortClasses": false, - //"scrollY": "700px", - //"scrollCollapse": false, - "paging": false + "scrollY": "800px", + "scrollCollapse": false } ); var table = $('#trait_table').DataTable(); @@ -267,12 +277,27 @@ {% elif target_dataset.type == "Publish" %} $('#trait_table').dataTable( { + "paging": false, + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'correlation_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + } + } + ], + "columnDefs": [ + { "targets": 0, "orderable": false } + ], "columns": [ { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, + { "type": "natural", "width": "25%" }, + { "type": "natural", "width": "10%" }, { "type": "natural" }, { "type": "natural" }, { "type": "natural" }, @@ -281,24 +306,30 @@ { "type": "natural" }, { "type": "natural" } ], - "buttons": [ - 'csvHtml5' - ], - "sDom": "RZBtir", - "iDisplayLength": -1, - "autoWidth": true, - "bLengthChange": true, + "order": [[9, "desc" ]], + "sDom": "Btir", + "autoWidth": false, "bDeferRender": true, - "bSortClasses": false, - "scrollY": "700px", - "scrollCollapse": false, - "colResize": { - "tableWidthFixed": false - }, - "paging": false + "scrollY": "800px", + "scrollCollapse": false } ); {% elif target_dataset.type == "Geno" %} $('#trait_table').dataTable( { + "paging": false, + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'correlation_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6] + } + } + ], + "columnDefs": [ + { "targets": 0, "orderable": false } + ], "columns": [ { "type": "natural" }, { "type": "natural" }, @@ -308,21 +339,12 @@ { "type": "natural" }, { "type": "natural" } ], - "buttons": [ - 'csvHtml5' - ], - "sDom": "RZBtir", - "iDisplayLength": -1, - "autoWidth": true, - "bLengthChange": true, + "order": [[4, "desc" ]], + "sDom": "Btir", + "autoWidth": false, "bDeferRender": true, - "bSortClasses": false, - "scrollY": "700px", - "scrollCollapse": false, - "colResize": { - "tableWidthFixed": false - }, - "paging": false + "scrollY": "800px", + "scrollCollapse": false } ); {% endif %} console.timeEnd("Creating table"); diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 37e26817..70cafcfe 100755 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -23,24 +23,24 @@ <br /> <br /> - <div style="width: 2000px;"> + <div style="width: 2000px; background-color: #eeeeee; border: 1px solid black;"> <table width="2000px" id="trait_table" class="table table-hover table-striped" > <thead> <tr> - <th></th> - <th>Index</th> - <th>Species</th> - <th>Group</th> - <th>Tissue</th> - <th>Dataset</th> - <th>Record</th> - <th>Symbol</th> - <th>Description</th> - <th>Location</th> - <th>Mean</th> - <th>Max<br>LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th>Max LRS Location</th> - <th>Additive<br>Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Species</th> + <th style="background-color: #eeeeee;">Group</th> + <th style="background-color: #eeeeee;">Tissue</th> + <th style="background-color: #eeeeee;">Dataset</th> + <th style="background-color: #eeeeee;">Record</th> + <th style="background-color: #eeeeee;">Symbol</th> + <th style="background-color: #eeeeee;">Description</th> + <th style="background-color: #eeeeee;">Location</th> + <th style="background-color: #eeeeee;">Mean</th> + <th style="background-color: #eeeeee;">Max <br>LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;">Max LRS Location</th> + <th style="background-color: #eeeeee;">Additive<br>Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </thead> <tbody> @@ -55,13 +55,32 @@ <td><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></td> <td>{{ this_trait.symbol }}</td> <td>{{ this_trait.description_display }}</td> - <td>{{ this_trait.location_repr }}</td> - <td>{{ this_trait.mean }}</td> - <td>{{ this_trait.LRS_score_repr }}</td> - <td>{{ this_trait.LRS_location_repr }}</td> - <td>{{ this_trait.additive }}</td> + <td align="right">{{ this_trait.location_repr }}</td> + <td align="right">{{ '%0.3f' % this_trait.mean|float }}</td> + <td align="right">{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td> + <td align="right">{{ this_trait.LRS_location_repr }}</td> + <td align="right">{% if this_trait.additive != "" %}{{ '%0.3f' % this_trait.additive|float }}{% else %}N/A{% endif %}</td> </tr> {% endfor %} + </tbody> + <tfoot> + <tr> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Species</th> + <th style="background-color: #eeeeee;">Group</th> + <th style="background-color: #eeeeee;">Tissue</th> + <th style="background-color: #eeeeee;">Dataset</th> + <th style="background-color: #eeeeee;">Record</th> + <th style="background-color: #eeeeee;">Symbol</th> + <th style="background-color: #eeeeee;">Description</th> + <th style="background-color: #eeeeee;">Location</th> + <th style="background-color: #eeeeee;">Mean</th> + <th style="background-color: #eeeeee;">Max <br>LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;">Max LRS Location</th> + <th style="background-color: #eeeeee;">Additive<br>Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + </tr> + </tfoot> </table> </div> </div> @@ -100,42 +119,6 @@ } return parseFloat(x); } - - jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) { - var x = getValue(a); - var y = getValue(b); - - if (x == 'N/A' || x == '') { - return 1; - } - else if (y == 'N/A' || y == '') { - return -1; - } - else { - return ((x < y) ? -1 : ((x > y) ? 1 : 0)); - } - }; - - jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) { - var x = getValue(a); - var y = getValue(b); - - if (x == 'N/A' || x == '') { - return 1; - } - else if (y == 'N/A' || y == '') { - return -1; - } - else { - return ((x < y) ? -1 : ((x > y) ? 1 : 0)); - } - }; - - jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) { - var x = getValue(a); - var y = getValue(b); - return ((x < y) ? 1 : ((x > y) ? -1 : 0)); - }; $.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col ) { @@ -167,25 +150,27 @@ } ], "columns": [ - { "data": "checkbox", "orderable" : false }, - { "data": "index", "orderable" : true }, - { "data": "species", "orderable" : true }, - { "data": "group", "orderable" : true }, - { "data": "tissue", "orderable" : true }, - { "data": "dataset", "orderable" : true }, - { "data": "record", "orderable" : true }, - { "data": "symbol", "orderable" : true }, - { "data": "description", "orderable" : true }, - { "data": "location", "orderable" : true }, - { "data": "mean", "orderable" : true }, - { "data": "max_lrs", "orderable" : true }, - { "data": "max_lrs_location", "orderable" : true }, - { "data": "additive_effect", "orderable" : true } + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural", "width": "8%" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural", "width": "8%" }, + { "type": "natural" }, + { "type": "natural", "width": "5%" }, + { "type": "natural", "width": "8%" }, + { "type": "natural" } ], - "sDom": "RZBtir", + "order": [[1, "asc" ]], + "sDom": "Btir", "autoWidth": false, + "bDeferRender": true, "scrollY": "800px", - "bDeferRender": true + "scrollCollapse": false } ); console.timeEnd("Creating table"); diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 3c9f6841..9be0349f 100755 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -25,40 +25,57 @@ <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ..."> <br /> <br /> - <table class="table table-hover table-striped" id='trait_table' style="float: left;"> + <div style="width: 1500px; background-color: #eeeeee; border: 1px solid black;"> + <table width="1500px" id="trait_table" class="table table-hover table-striped"> <thead> <tr> - <th style="width: 30px;"></th> - <th>Index</th> - <th>Species</th> - <th>Group</th> - <th>Record</th> - <th>Description</th> - <th>Authors</th> - <th>Year</th> - <th style="text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> - <th>Max LRS Location</th> - <th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Species</th> + <th style="background-color: #eeeeee;">Group</th> + <th style="background-color: #eeeeee;">Record</th> + <th style="background-color: #eeeeee;">Description</th> + <th style="background-color: #eeeeee;">Authors</th> + <th style="background-color: #eeeeee;">Year</th> + <th style="background-color: #eeeeee; text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;">Max LRS Location</th> + <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </thead> <tbody> {% for this_trait in trait_list %} <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> - <TD><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></TD> - <TD>{{ loop.index }}</TD> - <TD>{{ this_trait.dataset.group.species }}</TD> - <TD>{{ this_trait.dataset.group.name }}</TD> - <TD><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></TD> - <TD>{{ this_trait.description_display }}</TD> - <TD>{{ this_trait.authors }}</TD> - <TD><a href="{{ this_trait.pubmed_link }}">{{ this_trait.pubmed_text }}</a></TD> - <TD>{{ this_trait.LRS_score_repr }}</TD> - <TD>{{ this_trait.LRS_location_repr }}</TD> - <TD>{{ '%0.3f' % this_trait.additive|float }}</TD> + <td><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td> + <td>{{ loop.index }}</td> + <td>{{ this_trait.dataset.group.species }}</td> + <td>{{ this_trait.dataset.group.name }}</td> + <td><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></td> + <td>{{ this_trait.description_display }}</td> + <td>{{ this_trait.authors }}</td> + <td><a href="{{ this_trait.pubmed_link }}">{{ this_trait.pubmed_text }}</a></td> + <td align="right">{% if this_trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % this_trait.LRS_score_repr|float }}{% else %}N/A{% endif %}</td> + <td align="right">{{ this_trait.LRS_location_repr }}</td> + <td align="right">{% if this_trait.additive != "" %}{{ this_trait.additive }}{% else %}N/A{% endif %}</td> </TR> {% endfor %} </tbody> + <tfoot> + <tr> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Species</th> + <th style="background-color: #eeeeee;">Group</th> + <th style="background-color: #eeeeee;">Record</th> + <th style="background-color: #eeeeee;">Description</th> + <th style="background-color: #eeeeee;">Authors</th> + <th style="background-color: #eeeeee;">Year</th> + <th style="background-color: #eeeeee; text-align: right;">Max <br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee;">Max LRS Location</th> + <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + </tr> + </tfoot> </table> + </div> </div> </div> @@ -127,20 +144,7 @@ console.time("Creating table"); $('#trait_table').DataTable( { - "columns": [ - { "bSortClasses": false }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural", "width": "20%"}, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural", "width": "12%"}, - { "type": "natural" } - ], - "order": [[ 1, "asc" ]], + "paging": false, "buttons": [ { extend: 'csvHtml5', @@ -152,15 +156,25 @@ } } ], - "sDom": "RZBtir", + "columns": [ + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural", "width": "30%"}, + { "type": "natural", "width": "25%"}, + { "type": "natural" }, + { "type": "natural", "width": "8%"}, + { "type": "natural", "width": "12%"}, + { "type": "natural" } + ], + "order": [[1, "asc" ]], + "sDom": "Btir", "autoWidth": false, - "bLengthChange": true, "bDeferRender": true, - "scrollCollapse": false, - "colResize": { - "tableWidthFixed": false, - }, - "paging": false + "scrollY": "800px", + "scrollCollapse": false } ); console.timeEnd("Creating table"); }); diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html index 5cc15682..9e029911 100755 --- a/wqflask/wqflask/templates/index_page.html +++ b/wqflask/wqflask/templates/index_page.html @@ -207,12 +207,12 @@ <li><a href="http://galaxy.genenetwork.org/" target="_blank">Galaxy</a> at UTHSC</li> - <li>GeneNetwork at <a href="http://ec2.genenetwork.org/" target="_blank">Amazon + <li>GeneNetwork 1 at <a href="http://ec2.genenetwork.org/" target="_blank">Amazon Cloud (EC2)</a></li> - <li>GeneNetwork Source Code at <a href="http://sourceforge.net/projects/genenetwork/" target="_blank">SourceForge</a></li> + <li>GeneNetwork 1 Source Code at <a href="http://sourceforge.net/projects/genenetwork/" target="_blank">SourceForge</a></li> - <li>GeneNetwork Source Code at <a href="https://github.com/genenetwork/genenetwork" target="_blank">GitHub</a></li> + <li>GeneNetwork 2 Source Code at <a href="https://github.com/genenetwork/genenetwork2" target="_blank">GitHub</a></li> </ul> <h3>GN1 Mirror and development sites</h3> diff --git a/wqflask/wqflask/templates/pair_scan_results.html b/wqflask/wqflask/templates/pair_scan_results.html index ab4a36bb..1ccb2b27 100644 --- a/wqflask/wqflask/templates/pair_scan_results.html +++ b/wqflask/wqflask/templates/pair_scan_results.html @@ -44,7 +44,7 @@ </tr> </thead> <tbody> - {% for marker in filtered_markers %} + {% for marker in trimmed_markers %} <tr> <td>{{loop.index}}</td> <td>{{marker.name}}</td> diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index a4ef68b9..02c97862 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -21,44 +21,30 @@ to find all records {% for word in search_terms %} {% if word.key|lower == "rif" %} - with <u>GeneRIF</u> containing <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %} + with <u>GeneRIF</u> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.key|lower == "go" %} - with <u>Gene Ontology ID</u> <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %} + with <u>Gene Ontology ID</u> <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.key|lower == "wiki" %} - with <u>GeneWiki</u> containing <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %} + with <u>GeneWiki</u> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.key|lower == "mean" %} - with <u>MEAN</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if not loop.last %} and {% endif %} + with <u>MEAN</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.key|lower == "lrs" or word.key|lower == "translrs" or word.key|lower == "cislrs" %} {% if word.search_term|length == 1 %} - with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} <strong>{{ word.search_term[0] }}</strong>{% if not loop.last %} and {% endif %} + with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.search_term|length == 2 %} - with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if not loop.last %} and {% endif %} + with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.search_term|length == 3 %} - with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong>{% if not loop.last %} and {% endif %} + with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong>{% if loop.last %}.{% else %} and {% endif %} {% elif word.search_term|length == 5 %} - with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong> between <strong>{{ word.search_term[3] }}</strong> and <strong>{{ word.search_term[4] }}</strong> Mb{% if not loop.last %} and {% endif %} + with <u>LRS</u> between <strong>{{ word.search_term[0] }}</strong> and <strong>{{ word.search_term[1] }}</strong> on chromosome <strong>{{ word.search_term[2] }}</strong> between <strong>{{ word.search_term[3] }}</strong> and <strong>{{ word.search_term[4] }}</strong> Mb{% if loop.last %}.{% else %} and {% endif %} {% endif %} {% elif word.key|lower == "position" %} - with <u>target genes</u> on chromosome <strong>{% if word.search_term[0].split('chr')|length > 1 %}{{ word.search_term[0].split('chr')[1] }}{% elif word.search_term[0].split('CHR')|length > 1 %}{{ word.search_term[0].split('CHR')[1] }}{% else %}{{ word.search_term[0] }}{% endif %}</strong> between <strong>{{ word.search_term[1] }}</strong> and <strong>{{ word.search_term[2] }}</strong> Mb{% if not loop.last %} and {% endif %} + with <u>target genes</u> on chromosome <strong>{% if word.search_term[0].split('chr')|length > 1 %}{{ word.search_term[0].split('chr')[1] }}{% elif word.search_term[0].split('CHR')|length > 1 %}{{ word.search_term[0].split('CHR')[1] }}{% else %}{{ word.search_term[0] }}{% endif %}</strong> between <strong>{{ word.search_term[1] }}</strong> and <strong>{{ word.search_term[2] }}</strong> Mb{% if loop.last %}.{% else %} and {% endif %} {% else %} - with {{ word.key|lower }} matching {{ word.search_term[0] }} + that match the term {{ word.search_term[0] }}. {% endif %} - <!--<strong>{{word.search_term[0]}}</strong> {% if not loop.last %} or {% endif %}--> - {% endfor %}. - - </p> - - <!-- - <ul> - {% if search_terms %} - <li> - {% for word in search_terms %} - <strong>{{word.search_term[0]}}</strong> {% if not loop.last %} or {% endif %} {% endfor %} - </li> - {% endif %} - </ul> - --> + </p> <p>To study a record, click on its ID below. Check records below and click Add button to add to selection.</p> @@ -89,18 +75,18 @@ {% endif %} --> - <div id="table_container"> + <div id="table_container" style="background-color: #eeeeee; border: 1px solid black;"> <table class="table table-hover table-striped" id='trait_table' {% if dataset.type == 'Geno' %}width="400px"{% endif %} style="float: left;"> <thead> <tr> - <th style="width: 30px;"></th> + <th style="background-color: #eeeeee;"></th> {% for header in header_fields %} {% if header == 'Max LRS' %} - <th style="text-align: right;">Max <br>LRS</th> + <th style="background-color: #eeeeee; text-align: right;">Max<br>LRS</th> {% elif header == 'Additive Effect' %} - <th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> {% else %} - <th>{{header}}</th> + <th style="background-color: #eeeeee;">{{header}}</th> {% endif %} {% endfor %} </tr> @@ -145,7 +131,22 @@ </TR> {% endfor %} </tbody> - + {% if trait_list|length > 20 %} + <tfoot> + <tr> + <th style="width: 30px;"></th> + {% for header in header_fields %} + {% if header == 'Max LRS' %} + <th style="text-align: right;">Max<br>LRS</th> + {% elif header == 'Additive Effect' %} + <th style="text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + {% else %} + <th>{{header}}</th> + {% endif %} + {% endfor %} + </tr> + </tfoot> + {% endif %} </table> </div> </div> @@ -219,26 +220,6 @@ } }); -/* - serverSide: true, - ajax: function ( data, callback, settings ) { - var out = []; - - for ( var i=data.start, ien=data.start+data.length ; i<ien ; i++ ) { - out.push( [ i+'-1', i+'-2', i+'-3', i+'-4', i+'-5' ] ); - } - - setTimeout( function () { - callback( { - draw: data.draw, - data: out, - recordsTotal: 5000000, - recordsFiltered: 5000000 - } ); - }, 50 ); - }, -*/ - console.time("Creating table"); {% if dataset.type == 'ProbeSet' %} //ZS: Need to make sort by symbol, also need to make sure blank symbol fields at the bottom and symbols starting with numbers below letters @@ -271,7 +252,7 @@ "iDisplayLength": -1, "bDeferRender": true, "bSortClasses": false, - "scrollY": "700px", + "scrollY": true, "scrollCollapse": false, "paging": false } ); diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index 228ef362..ff5f0c87 100755 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -77,20 +77,20 @@ {% for sample_type in sample_groups %} <div class="sample_group" style="width:{{ trait_table_width }}%;"> <h3>{{ sample_type.header }}</h3> - + <div id="table_container" style="background-color: #eeeeee; border: 1px solid black;"> <table class="table-hover table-striped" id="samples_{{ sample_type.sample_group_type }}" style="float: left;"> <thead> <tr> - <th></th> - <th>Index</th> - <th>Sample</th> - <th>Value</th> + <th style="background-color: #eeeeee;"></th> + <th style="background-color: #eeeeee;">Index</th> + <th style="background-color: #eeeeee;">Sample</th> + <th style="background-color: #eeeeee;">Value</th> {% if sample_type.se_exists() %} - <th> </th> - <th>SE</th> + <th style="background-color: #eeeeee;"> </th> + <th style="background-color: #eeeeee;">SE</th> {% endif %} {% for attribute in sample_type.attributes|sort() %} - <th> + <th style="background-color: #eeeeee;"> {{ sample_type.attributes[attribute].name }} </th> {% endfor %} @@ -144,6 +144,7 @@ {% endfor %} </tbody> </table> + </div> </div> {% endfor %} <!--</div>--> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index b7fcfa1d..df1f77bc 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -457,33 +457,47 @@ def marker_regression_page(): result = template_vars.__dict__ - #for item in template_vars.__dict__.keys(): - # print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item)) - - gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__ - - #qtl_length = len(result['js_data']['qtl_results']) - #print("qtl_length:", qtl_length) - pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) - #print("pickled result length:", len(pickled_result)) - Redis.set(key, pickled_result) - Redis.expire(key, 1*60) - - with Bench("Rendering template"): - if result['pair_scan'] == True: - img_path = result['pair_scan_filename'] - print("img_path:", img_path) - initial_start_vars = request.form - print("initial_start_vars:", initial_start_vars) - imgfile = open(TEMPDIR + '/' + img_path, 'rb') - imgdata = imgfile.read() - imgB64 = imgdata.encode("base64") - bytesarray = array.array('B', imgB64) - result['pair_scan_array'] = bytesarray - rendered_template = render_template("pair_scan_results.html", **result) + if result['pair_scan']: + with Bench("Rendering template"): + img_path = result['pair_scan_filename'] + print("img_path:", img_path) + initial_start_vars = request.form + print("initial_start_vars:", initial_start_vars) + imgfile = open(TEMPDIR + img_path, 'rb') + imgdata = imgfile.read() + imgB64 = imgdata.encode("base64") + bytesarray = array.array('B', imgB64) + result['pair_scan_array'] = bytesarray + rendered_template = render_template("pair_scan_results.html", **result) else: - #rendered_template = render_template("marker_regression.html", **result) - rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars) + #for item in template_vars.__dict__.keys(): + # print(" ---**--- {}: {}".format(type(template_vars.__dict__[item]), item)) + + gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__ + + pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) + print("pickled result length:", len(pickled_result)) + Redis.set(key, pickled_result) + Redis.expire(key, 1*60) + + with Bench("Rendering template"): + rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars) + + # with Bench("Rendering template"): + # if result['pair_scan'] == True: + # img_path = result['pair_scan_filename'] + # print("img_path:", img_path) + # initial_start_vars = request.form + # print("initial_start_vars:", initial_start_vars) + # imgfile = open(TEMPDIR + '/' + img_path, 'rb') + # imgdata = imgfile.read() + # imgB64 = imgdata.encode("base64") + # bytesarray = array.array('B', imgB64) + # result['pair_scan_array'] = bytesarray + # rendered_template = render_template("pair_scan_results.html", **result) + # else: + # rendered_template = render_template("marker_regression.html", **result) + # rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars) return rendered_template |