diff options
Diffstat (limited to 'wqflask')
9 files changed, 49 insertions, 14 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 1524143e..539bc995 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -61,6 +61,8 @@ class MarkerRegression(object): self.mapping_method = start_vars['method']
self.maf = start_vars['maf'] # Minor allele frequency
+ self.suggestive = ""
+ self.significant = ""
#print("self.maf:", self.maf)
self.dataset.group.get_markers()
@@ -103,6 +105,9 @@ class MarkerRegression(object): self.json_data['lod.hk'] = []
self.json_data['markernames'] = []
+ self.json_data['suggestive'] = self.suggestive
+ self.json_data['significant'] = self.significant
+
#Need to convert the QTL objects that qtl reaper returns into a json serializable dictionary
self.qtl_results = []
for qtl in self.filtered_markers:
@@ -293,24 +298,42 @@ class MarkerRegression(object): r_string = 'scanone(the_cross, pheno.col="the_pheno", n.perm='+self.num_perm+', addcovar=covariates, intcovar=covariates[,'+ str(len(control_markers)) +'])'
print("r_string:", r_string)
- if self.num_perm > 0:
+ if int(self.num_perm) > 0:
thresholds = robjects.r(r_string)
- print("thresholds:", thresholds)
-
+ self.suggestive, self.significant = self.process_rqtl_perm_results(results)
+ r_string = 'scanone(the_cross, pheno.col="the_pheno", addcovar=covariates, intcovar=covariates[,'+ str(len(control_markers)) +'])'
+
#r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+', addcovar='+control_as_string+')'
else:
#r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+', n.perm='+self.num_perm+')'
r_string = 'scanone(the_cross, pheno.col="the_pheno", n.perm='+self.num_perm+')'
+ if int(self.num_perm) > 0:
+ results = robjects.r(r_string)
+ self.suggestive, self.significant = self.process_rqtl_perm_results(results)
+ r_string = 'scanone(the_cross, pheno.col="the_pheno")'
print("r_string:", r_string)
result_data_frame = robjects.r(r_string)
#print("results:", result_data_frame)
qtl_results = self.process_rqtl_results(result_data_frame)
-
+
return qtl_results
+ def process_rqtl_perm_results(self, results):
+
+ perm_vals = []
+ for line in str(results).split("\n")[1:(int(self.num_perm)+1)]:
+ print("line:", line.split())
+ perm_vals.append(float(line.split()[1]))
+
+ self.suggestive = np.percentile(np.array(perm_vals), 67)
+ self.significant = np.percentile(np.array(perm_vals), 95)
+
+ return self.suggestive, self.significant
+
+
def process_rqtl_results(self, result):
qtl_results = []
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 51cf337c..833c3b06 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -92,7 +92,7 @@ class ShowTrait(object): #Get nearest marker for composite mapping - if self.dataset.type != "Geno": + if self.dataset.type != "Geno" and self.dataset.type != "Publish": self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] self.nearest_marker2 = get_nearest_marker(self.this_trait, self.dataset)[1] @@ -109,8 +109,10 @@ class ShowTrait(object): hddn['suggestive'] = 0 hddn['num_perm'] = 0 hddn['manhattan_plot'] = False - if self.dataset.type != "Geno": + if self.dataset.type != "Geno" and self.dataset.type != "Publish": hddn['control_marker'] = self.nearest_marker1+","+self.nearest_marker2 + else: + hddn['control_marker'] = "" hddn['maf'] = 0.01 hddn['compare_traits'] = [] @@ -489,10 +491,14 @@ class ShowTrait(object): #self.cursor.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = '%s'" % this_trait.symbol) #try: - this_chr, txst, txen = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone() - if this_chr and txst and txen and this_trait.refseq_transcriptid : - txst = int(txst*1000000) - txen = int(txen*1000000) + print("this_trait.symbol:", this_trait.symbol) + result = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone() + if result != None: + this_chr, txst, txen = result[0], result[1], result[2] + #this_chr, txst, txen = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone() + if this_chr and txst and txen and this_trait.refseq_transcriptid : + txst = int(txst*1000000) + txen = int(txen*1000000) #tSpan.append(HT.Span(HT.Href(text= 'UCSC',target="mainFrame",\ # title= 'Info from UCSC Genome Browser', url = webqtlConfig.UCSC_REFSEQ % ('mm9', # this_trait.refseq_transcriptid, diff --git a/wqflask/wqflask/static/new/javascript/create_interval_map.coffee b/wqflask/wqflask/static/new/javascript/create_interval_map.coffee index c8e1b318..b01e2651 100644 --- a/wqflask/wqflask/static/new/javascript/create_interval_map.coffee +++ b/wqflask/wqflask/static/new/javascript/create_interval_map.coffee @@ -12,7 +12,7 @@ create_interval_map = () -> .height(h)
.width(w)
.margin(margin)
-
+
data = js_data.json_data
d3.select("div#topchart")
diff --git a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee index 0cd9e124..a4c41227 100644 --- a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee +++ b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee @@ -14,6 +14,7 @@ create_manhattan_plot = -> .height(h)
.width(w)
.margin(margin)
+ .ylab("LOD score")
.manhattanPlot(js_data.manhattan_plot)
data = js_data.json_data
diff --git a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js index d30e8e6a..c577fb93 100644 --- a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js +++ b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js @@ -16,7 +16,7 @@ create_manhattan_plot = function() { totalh = halfh * 2; totalw = w + margin.left + margin.right; console.log("js_data:", js_data); - mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin).manhattanPlot(js_data.manhattan_plot); + mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin).ylab("LOD score").manhattanPlot(js_data.manhattan_plot); data = js_data.json_data; d3.select("div#topchart").datum(data).call(mychart); chrrect = mychart.chrSelect(); diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index 959f2366..d522b667 100755 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -16,6 +16,9 @@ class Lod_Chart @this_trait = js_data.this_trait
@data_set = js_data.data_set
@maf = js_data.maf #Minor allele frequency
+
+ @suggestive = js_data.suggestive
+ @significant = js_data.significant
@total_length = 0 diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index 1bdc784f..a033cf0c 100755 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -24,6 +24,8 @@ Lod_Chart = (function() { this.this_trait = js_data.this_trait; this.data_set = js_data.data_set; this.maf = js_data.maf; + this.suggestive = js_data.suggestive; + this.significant = js_data.significant; this.total_length = 0; this.max_chr = this.get_max_chr(); this.x_coords = []; diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee index 72d2bbe4..d25c1d3a 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee @@ -213,7 +213,7 @@ $ -> $("#plink_compute").click(() => $("#static_progress_bar_container").modal() url = "/marker_regression" - $('input[name=method]').val("plink") + $('input[nsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssegbame=method]').val("plink") $('input[name=mapping_display_all]').val($('input[name=display_all_plink]').val()) $('input[name=suggestive]').val($('input[name=suggestive_plink]').val()) $('input[name=maf]').val($('input[name=maf_plink]').val()) 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 4eaceffe..d178879c 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -149,7 +149,7 @@ $(function() { var form_data, url; $("#static_progress_bar_container").modal(); url = "/marker_regression"; - $('input[name=method]').val("plink"); + $('input[nsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssegbame=method]').val("plink"); $('input[name=mapping_display_all]').val($('input[name=display_all_plink]').val()); $('input[name=suggestive]').val($('input[name=suggestive_plink]').val()); $('input[name=maf]').val($('input[name=maf_plink]').val()); |