From 8d5397590206a3bc5d32985c532bac354313f0b2 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 12 Jan 2016 22:06:11 +0000 Subject: Mapping works for rqtl and centimorgan scale --- .../marker_regression/marker_regression_gn1.py | 38 ++++++++++++++-------- .../new/javascript/show_trait_mapping_tools.js | 20 +++++++----- .../wqflask/templates/marker_regression_gn1.html | 2 +- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index a0033bd2..23d5a631 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -517,10 +517,10 @@ class MarkerRegression(object): ################################################################ # Plots goes here ################################################################ - if self.plotScale != 'physic' or self.multipleInterval: - showLocusForm = webqtlUtil.genRandStr("fm_") - else: - showLocusForm = "" + #if self.plotScale != 'physic' or self.multipleInterval: + # showLocusForm = webqtlUtil.genRandStr("fm_") + #else: + showLocusForm = "" intCanvas = pid.PILCanvas(size=(self.graphWidth,self.graphHeight)) gifmap = self.plotIntMapping(intCanvas, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm) @@ -1789,7 +1789,8 @@ class MarkerRegression(object): edgeColor=rectColor,fillColor=rectColor,edgeWidth = 0) COORDS="%d,%d,%d,%d"%(xLeftOffset+offsetA-LRectHeight, yZero+40+Zorder*(LRectWidth+3),\ xLeftOffset+offsetA,yZero+40+Zorder*(LRectWidth+3)+LRectWidth) - HREF="javascript:showDatabase3('%s','%s','%s','');" % (showLocusForm,fd.RISet+"Geno", Lname) + HREF="/show_trait?trait_id=%s&dataset=%s" % (Lname, self.dataset.group.name+"Geno") + #HREF="javascript:showDatabase3('%s','%s','%s','');" % (showLocusForm,fd.RISet+"Geno", Lname) Areas=HT.Area(shape='rect',coords=COORDS,href=HREF, title="Locus : " + Lname) gifmap.areas.append(Areas) ##piddle bug @@ -1947,21 +1948,32 @@ class MarkerRegression(object): #DominanceCoordXY = [] #for k, _locus in enumerate(_chr): if 1 == 1: - if self.plotScale == 'physic': + Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale + #if self.plotScale == 'physic': #Xc = startPosX + (_locus.Mb-startMb)*plotXScale - Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale - else: + #Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale + #else: #Xc = startPosX + (_locus.cM-_chr[0].cM)*plotXScale - Xc = startPosX + (qtlresult['cM']-qtlresult[0]['cM'])*plotXScale + #Xc = startPosX + (qtlresult['cM']-qtlresult[0]['cM'])*plotXScale # updated by NL 06-18-2011: # fix the over limit LRS graph issue since genotype trait may give infinite LRS; # for any lrs is over than 460(LRS max in this system), it will be reset to 460 - if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf': - #if self.qtlresults[j]['lrs_value'] > 460 or self.qtlresults[j]['lrs_value']=='inf': - Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRSMax + if self.LRS_LOD == "LRS": + if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf': + Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRSMax + else: + Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRSMax else: - Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRSMax + if qtlresult['lod_score'] > 100 or qtlresult['lod_score']=='inf': + Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRSMax + else: + Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRSMax + #if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf': + #if self.qtlresults[j]['lrs_value'] > 460 or self.qtlresults[j]['lrs_value']=='inf': + # Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRSMax + #else: + # Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRSMax LRSCoordXY.append((Xc, Yc)) #if not self.multipleInterval and self.additiveChecked: 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 721752dd..16eeb8df 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -180,7 +180,7 @@ $("#rqtl_geno_compute").on("click", (function(_this) { return function() { var form_data, url; - $("#progress_bar_container").modal(); + //$("#progress_bar_container").modal(); url = "/marker_regression"; $('input[name=method]').val("rqtl_geno"); $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); @@ -189,20 +189,22 @@ $('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 do_ajax_post(url, form_data); + return submit_special(url); + //return do_ajax_post(url, form_data); }; })(this)); $("#plink_compute").on("click", (function(_this) { return function() { var form_data, url; - $("#static_progress_bar_container").modal(); + //$("#static_progress_bar_container").modal(); url = "/marker_regression"; $('input[name=method]').val("plink"); $('input[name=maf]').val($('input[name=maf_plink]').val()); form_data = $('#trait_data_form').serialize(); console.log("form_data is:", form_data); - return do_ajax_post(url, form_data); + return submit_special(url); + //return do_ajax_post(url, form_data); }; })(this)); @@ -210,13 +212,14 @@ return function() { var form_data, url; console.log("RUNNING GEMMA"); - $("#static_progress_bar_container").modal(); + //$("#static_progress_bar_container").modal(); url = "/marker_regression"; $('input[name=method]').val("gemma"); $('input[name=maf]').val($('input[name=maf_gemma]').val()); form_data = $('#trait_data_form').serialize(); console.log("form_data is:", form_data); - return do_ajax_post(url, form_data); + return submit_special(url); + //return do_ajax_post(url, form_data); }; })(this)); @@ -232,7 +235,7 @@ return function() { var form_data, url; console.log("In interval mapping"); - $("#progress_bar_container").modal(); + //$("#progress_bar_container").modal(); url = "/interval_mapping"; $('input[name=method]').val("reaper"); $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_reaper]:checked').val()); @@ -240,7 +243,8 @@ $('input[name=suggestive]').val($('input[name=suggestive_reaper]')); form_data = $('#trait_data_form').serialize(); console.log("form_data is:", form_data); - return do_ajax_post(url, form_data); + return submit_special(url); + //return do_ajax_post(url, form_data); }; })(this)); diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index f5bec6ea..05623462 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -59,7 +59,7 @@ value="{{ marker.name }}" checked="checked">