From e0c5c1aae3aaaa1d81bcec36835a97e169dcc2e2 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 18 Apr 2016 18:19:24 +0000 Subject: Additive effect lines are now separated by chromosome (like the qtl line in the last commit) Fixed order of stats table in trait page Removed the qtl results table from chromosome view; will add the Interval Analyst output later --- .../marker_regression/marker_regression_gn1.py | 38 +++++++++++++++++++++- .../wqflask/static/new/javascript/show_trait.js | 5 --- .../wqflask/templates/marker_regression_gn1.html | 2 ++ wqflask/wqflask/templates/show_trait.html | 14 ++++---- 4 files changed, 45 insertions(+), 14 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index c10aac73..01303b0f 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -2007,6 +2007,7 @@ class MarkerRegression(object): previous_chr = 1 previous_chr_as_int = 0 + lineWidth = 1 oldStartPosX = 0 startPosX = xLeftOffset for i, qtlresult in enumerate(self.qtlresults): @@ -2017,7 +2018,39 @@ class MarkerRegression(object): if qtlresult['chr'] != previous_chr and self.selectedChr == -1: if self.manhattan_plot != True: canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + + if not self.multipleInterval and self.additiveChecked: + plusColor = self.ADDITIVE_COLOR_POSITIVE + minusColor = self.ADDITIVE_COLOR_NEGATIVE + for k, aPoint in enumerate(AdditiveCoordXY): + if k > 0: + Xc0, Yc0 = AdditiveCoordXY[k-1] + Xc, Yc = aPoint + if (Yc0-yZero)*(Yc-yZero) < 0: + if Xc == Xc0: #genotype , locus distance is 0 + Xcm = Xc + else: + Xcm = (yZero-Yc0)/((Yc-Yc0)/(Xc-Xc0)) +Xc0 + if Yc0 < yZero: + canvas.drawLine(Xc0, Yc0, Xcm, yZero, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + canvas.drawLine(Xcm, yZero, Xc, yZero-(Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + else: + canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xcm, yZero, color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + canvas.drawLine(Xcm, yZero, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + elif (Yc0-yZero)*(Yc-yZero) > 0: + if Yc < yZero: + canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + else: + canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + else: + minYc = min(Yc-yZero, Yc0-yZero) + if minYc < 0: + canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + else: + canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + LRSCoordXY = [] + AdditiveCoordXY = [] previous_chr = qtlresult['chr'] previous_chr_as_int += 1 @@ -2091,7 +2124,9 @@ class MarkerRegression(object): m += 1 #canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) - lineWidth = 1 + if self.manhattan_plot != True: + canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + if not self.multipleInterval and self.additiveChecked: plusColor = self.ADDITIVE_COLOR_POSITIVE minusColor = self.ADDITIVE_COLOR_NEGATIVE @@ -2121,6 +2156,7 @@ class MarkerRegression(object): canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) else: canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) + if not self.multipleInterval and INTERCROSS and self.dominanceChecked: plusColor = self.DOMINANCE_COLOR_POSITIVE minusColor = self.DOMINANCE_COLOR_NEGATIVE diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 663f7f3b..9e249c28 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -174,7 +174,6 @@ make_table = function() { var header, key, row, row_line, table, the_id, the_rows, value, _i, _len, _ref, _ref1; header = " "; - console.log("js_data.sample_group_types:", js_data.sample_group_types); _ref = js_data.sample_group_types; for (key in _ref) { if (!__hasProp.call(_ref, key)) continue; @@ -189,14 +188,12 @@ if ((row.vn == "range_fold" || row.vn == "range") && js_data.dataset_type == "Publish"){ continue; } - console.log("rowing"); row_line = ""; if (row.url != null) { row_line += "" + row.pretty + ""; } else { row_line += "" + row.pretty + ""; } - console.log("box - js_data.sample_group_types:", js_data.sample_group_types); _ref1 = js_data.sample_group_types; for (key in _ref1) { if (!__hasProp.call(_ref1, key)) continue; @@ -205,12 +202,10 @@ row_line += "foo"; } row_line += ""; - console.log("row line:", row_line); the_rows += row_line; } the_rows += ""; table = header + the_rows; - console.log("table is:", table); return $("#stats_table").append(table); }; process_id = function() { diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index c65948c0..f3f33fad 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -165,6 +165,7 @@ + {% if selectedChr == -1 %}

Results @@ -222,6 +223,7 @@

+ {% endif %} diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 62a08d85..7429cd5f 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -257,12 +257,10 @@ console.log("SAMPLE GROUP TYPES:", js_data.sample_group_types) if (Object.keys(js_data.sample_group_types).length > 1) { $('#stats_table').DataTable( { - "columns": [ - { "bSortable": false }, - { "bSortable": false }, - { "bSortable": false }, - { "bSortable": false } + "columnDefs": [ + { "orderable": false, "targets": [0, 1, 2, 3] } ], + "order": [], "sDom": "tr", "iDisplayLength": -1, "autoWidth": false, @@ -274,10 +272,10 @@ } else { $('#stats_table').DataTable( { - "columns": [ - { "bSortable": false }, - { "bSortable": false } + "columnDefs": [ + { "orderable": false, "targets": [0, 1] } ], + "order": [], "sDom": "tr", "iDisplayLength": -1, "autoWidth": false, -- cgit v1.2.3