diff options
Diffstat (limited to 'wqflask')
25 files changed, 279 insertions, 457 deletions
diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index ca3e2350..15f60765 100755 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -13,7 +13,8 @@ def get_species_dataset_trait(self, start_vars): print("After creating species") self.this_trait = GeneralTrait(dataset=self.dataset, name=start_vars['trait_id'], - cellid=None) + cellid=None, + get_qtl_info=True) print("After creating trait") #if read_genotype: diff --git a/wqflask/wqflask/interval_mapping/interval_mapping.py b/wqflask/wqflask/interval_mapping/interval_mapping.py index e70f11cb..1b651411 100755 --- a/wqflask/wqflask/interval_mapping/interval_mapping.py +++ b/wqflask/wqflask/interval_mapping/interval_mapping.py @@ -95,7 +95,7 @@ class IntervalMapping(object): #if self.plotScale == 'physic' and not fd.genotype.Mbmap: # self.plotScale = 'morgan' #self.method = start_vars['mapping_method'] - self.num_permutations = int(start_vars['num_permutations']) + self.num_permutations = int(start_vars['num_perm']) #self.do_bootstrap = start_vars['do_bootstrap'] #self.selected_chr = start_vars['chromosome'] if start_vars['display_additive'] == "yes": diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 59d87b36..1524143e 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -71,7 +71,10 @@ class MarkerRegression(object): elif self.mapping_method == "rqtl_geno":
self.num_perm = start_vars['num_perm']
self.control = start_vars['control_marker']
- self.control_db = start_vars['control_marker_db']
+ if start_vars['manhattan_plot'] == "true":
+ self.manhattan_plot = True
+ else:
+ self.manhattan_plot = False
print("doing rqtl_geno")
qtl_results = self.run_rqtl_geno()
print("qtl_results:", qtl_results)
@@ -122,11 +125,13 @@ class MarkerRegression(object): print("json_data:", self.json_data)
+
self.js_data = dict(
json_data = self.json_data,
this_trait = self.this_trait.name,
data_set = self.dataset.name,
maf = self.maf,
+ manhattan_plot = self.manhattan_plot,
chromosomes = chromosome_mb_lengths,
qtl_results = self.filtered_markers,
)
@@ -218,6 +223,7 @@ class MarkerRegression(object): robjects.packages.importr("qtl")
robjects.r('the_cross <- read.cross(format="csvr", dir="/home/zas1024/PLINK2RQTL/test", file="BXD.csvr")')
robjects.r('the_cross <- calc.genoprob(the_cross)')
+
pheno_as_string = "c("
#for i, val in enumerate(self.vals):
# if val == "x":
@@ -243,47 +249,59 @@ class MarkerRegression(object): pheno_as_string += ")"
+ robjects.r('the_cross$pheno <- cbind(pull.pheno(the_cross), the_pheno = '+ pheno_as_string +')')
+
print("self.control:", self.control)
+
if self.control != "":
- print("self.control_db:", self.control_db)
- control_trait = GeneralTrait(name=str(self.control), dataset_name=str(self.control_db))
- control_vals = []
- for sample in self.dataset.group.samplelist:
- if sample in control_trait.data:
- control_vals.append(control_trait.data[sample].value)
- else:
- control_vals.append("x")
- print("control_vals:", control_vals)
- control_as_string = "c("
- for j, val2 in enumerate(control_vals):
- if val2 == "x":
- if j < (len(control_vals) - 1):
- control_as_string += "NA,"
+ control_markers = self.control.split(",")
+ control_string = ""
+ for i, control in enumerate(control_markers):
+ control_trait = GeneralTrait(name=str(control), dataset_name=str(self.dataset.group.name + "Geno"))
+ control_vals = []
+ for sample in self.dataset.group.samplelist:
+ if sample in control_trait.data:
+ control_vals.append(control_trait.data[sample].value)
else:
- control_as_string += "NA"
- else:
- if j < (len(control_vals) - 1):
- control_as_string += str(val2) + ","
+ control_vals.append("x")
+ print("control_vals:", control_vals)
+ control_as_string = "c("
+ for j, val2 in enumerate(control_vals):
+ if val2 == "x":
+ if j < (len(control_vals) - 1):
+ control_as_string += "NA,"
+ else:
+ control_as_string += "NA"
else:
- control_as_string += str(val2)
- #if i < (len(control_vals) - 1):
- # control_as_string += str(new_val2) + ","
- #else:
- # control_as_string += str(new_val2)
- control_as_string += ")"
- print("control_as_string:", control_as_string)
-
- r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+', n.perm='+self.num_perm+', addcovar='+control_as_string+')'
+ if j < (len(control_vals) - 1):
+ control_as_string += str(val2) + ","
+ else:
+ control_as_string += str(val2)
+ #if i < (len(control_vals) - 1):
+ # control_as_string += str(new_val2) + ","
+ #else:
+ # control_as_string += str(new_val2)
+ control_as_string += ")"
+ print("control_as_string:", control_as_string)
+ if i < (len(control_markers)-1):
+ control_string += control_as_string + ","
+ else:
+ control_string += control_as_string
+
+ robjects.r('covariates <- cbind( '+ control_string +')')
+
+ 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:
thresholds = robjects.r(r_string)
print("thresholds:", thresholds)
#r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+', addcovar='+control_as_string+')'
- print("r_string:", r_string)
+
else:
#r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+', n.perm='+self.num_perm+')'
- r_string = 'scanone(the_cross, pheno.col='+pheno_as_string+')'
+ r_string = 'scanone(the_cross, pheno.col="the_pheno", n.perm='+self.num_perm+')'
print("r_string:", r_string)
result_data_frame = robjects.r(r_string)
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index a4a24fd4..51cf337c 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -91,8 +91,10 @@ class ShowTrait(object): self.build_correlation_tools(self.this_trait) #Get nearest marker for composite mapping - self.nearest_marker, self.nearest_marker_db = get_nearest_marker(self.this_trait) - + + if self.dataset.type != "Geno": + self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] + self.nearest_marker2 = get_nearest_marker(self.this_trait, self.dataset)[1] self.make_sample_lists(self.this_trait) @@ -106,8 +108,9 @@ class ShowTrait(object): hddn['mapping_display_all'] = True hddn['suggestive'] = 0 hddn['num_perm'] = 0 - hddn['control_marker'] = self.nearest_marker - hddn['control_marker_db'] = self.nearest_marker_db + hddn['manhattan_plot'] = False + if self.dataset.type != "Geno": + hddn['control_marker'] = self.nearest_marker1+","+self.nearest_marker2 hddn['maf'] = 0.01 hddn['compare_traits'] = [] @@ -1275,20 +1278,23 @@ def get_samplelist_from_trait_data(this_trait, all_samples_ordered): return other_sample_names, all_samples_ordered -def get_nearest_marker(this_trait): - this_chr = this_trait.chr - this_mb = this_trait.mb - query = """SELECT ProbeSet.Name, ProbeSetFreeze.Name - FROM ProbeSet, ProbeSetXRef, ProbeSetFreeze - WHERE ProbeSet.Chr = '{}' AND - ProbeSet.Id=ProbeSetXRef.ProbeSetId AND - ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id AND - ProbeSetFreeze.Name='{}' - ORDER BY ABS( Mb - {}) LIMIT 2""".format(this_trait.chr, this_trait.dataset.name, this_trait.mb) +def get_nearest_marker(this_trait, this_db): + this_chr = this_trait.locus_chr + print("this_chr:", this_chr) + this_mb = this_trait.locus_mb + print("this_mb:", this_mb) + query = """SELECT Geno.Name + FROM Geno, GenoXRef, GenoFreeze + WHERE Geno.Chr = '{}' AND + GenoXRef.GenoId = Geno.Id AND + GenoFreeze.Id = GenoXRef.GenoFreezeId AND + GenoFreeze.Name = '{}' + ORDER BY ABS( Geno.Mb - {}) LIMIT 2""".format(this_chr, this_db.group.name+"Geno", this_mb) print("query:", query) result = g.db.execute(query).fetchall() + print("result:", result) - return result[1][0], result[1][1] + return result[0][0], result[1][0] diff --git a/wqflask/wqflask/static/new/css/panelutil.css b/wqflask/wqflask/static/new/css/panelutil.css index ff363e49..ccd7eb01 100644 --- a/wqflask/wqflask/static/new/css/panelutil.css +++ b/wqflask/wqflask/static/new/css/panelutil.css @@ -43,12 +43,12 @@ div.qtlcharts line.x.axis.grid { div.qtlcharts line.y.axis.grid {
stroke: white;
-}
+}*/
div.qtlcharts .extent {
fill: #cac;
opacity: 0.3;
-}*/
+}
div.qtlcharts circle.selected {
fill: hotpink;
diff --git a/wqflask/wqflask/static/new/javascript/chr_interval_map.coffee b/wqflask/wqflask/static/new/javascript/chr_interval_map.coffee index 62ce4d3d..e1993032 100644 --- a/wqflask/wqflask/static/new/javascript/chr_interval_map.coffee +++ b/wqflask/wqflask/static/new/javascript/chr_interval_map.coffee @@ -214,69 +214,6 @@ class Chr_Interval_Map .attr("stroke-width", 1)
.attr("fill", "none")
-
- #add_plot_points: () ->
- # @plot_point = @svg.selectAll("circle")
- # .data(@plot_coordinates)
- # .enter()
- # .append("circle")
- # .attr("cx", (d) =>
- # return @x_scale(d[0])
- # )
- # .attr("cy", (d) =>
- # return @y_scale(d[1])
- # )
- # .attr("r", (d) =>
- # #if d[1] > 2
- # # return 3
- # #else
- # return 2
- # )
- # .attr("fill", (d) =>
- # #if d[1] > 2
- # # return "white"
- # #else
- # return "black"
- # )
- # .attr("stroke", "black")
- # .attr("stroke-width", "1")
- # .attr("id", (d) =>
- # return "point_" + String(d[2])
- # )
- # .classed("circle", true)
- # .on("mouseover", (d) =>
- # console.log("d3.event is:", d3.event)
- # console.log("d is:", d)
- # this_id = "point_" + String(d[2])
- # d3.select("#" + this_id).classed("d3_highlight", true)
- # .attr("r", 5)
- # .attr("stroke", "none")
- # .attr("fill", "blue")
- # .call(@show_marker_in_table(d))
- # )
- # .on("mouseout", (d) =>
- # this_id = "point_" + String(d[2])
- # d3.select("#" + this_id).classed("d3_highlight", false)
- # .attr("r", (d) =>
- # #if d[1] > 2
- # # return 3
- # #else
- # return 2
- # )
- # .attr("fill", (d) =>
- # #if d[1] > 2
- # # return "white"
- # #else
- # return "black"
- # )
- # .attr("stroke", "black")
- # .attr("stroke-width", "1")
- # )
- # .append("svg:title")
- # .text((d) =>
- # return d[2]
- # )
-
return_to_full_view: () ->
$('#topchart').remove()
$('#chart_container').append('<div class="qtlcharts" id="topchart"></div>')
diff --git a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee index 05ad5419..0cd9e124 100644 --- a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee +++ b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.coffee @@ -6,13 +6,16 @@ create_manhattan_plot = -> totalh = halfh*2
totalw = (w+margin.left+margin.right)
+ console.log("js_data:", js_data)
+
# simplest use
#d3.json "data.json", (data) ->
mychart = lodchart().lodvarname("lod.hk")
.height(h)
.width(w)
.margin(margin)
-
+ .manhattanPlot(js_data.manhattan_plot)
+
data = js_data.json_data
d3.select("div#topchart")
diff --git a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js index 62584fb2..d30e8e6a 100644 --- a/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js +++ b/wqflask/wqflask/static/new/javascript/create_manhattan_plot.js @@ -15,7 +15,8 @@ create_manhattan_plot = function() { halfh = h + margin.top + margin.bottom; totalh = halfh * 2; totalw = w + margin.left + margin.right; - mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin); + console.log("js_data:", js_data); + mychart = lodchart().lodvarname("lod.hk").height(h).width(w).margin(margin).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/get_traits_from_collection.coffee b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee index 78d69f7a..ff7c041c 100755 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee @@ -109,9 +109,10 @@ get_trait_data = (trait_data, textStatus, jqXHR) -> #console.log("json_data[1]:", json_data[1]) console.log("THE LENGTH IS:", $('input[name=vals]').length) - if $('input[name=vals]').length == 1 - create_scatterplot(samples, [this_trait_vals, vals]) + #if $('input[name=vals]').length == 1 + # create_scatterplot(samples, [this_trait_vals, vals]) + color_by_trait(trait_sample_data) get_this_trait_vals = (samples) -> this_trait_vals = [] @@ -142,7 +143,7 @@ assemble_into_json = (this_trait_vals) -> color_by_trait = (trait_sample_data, textStatus, jqXHR) -> #trait_sample_data = trait_sample_data - #console.log('in color_by_trait:', trait_sample_data) + console.log('in color_by_trait:', trait_sample_data) root.bar_chart.color_by_trait(trait_sample_data) process_traits = (trait_data, textStatus, jqXHR) -> diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index 402d62f4..68635118 100755 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -111,9 +111,7 @@ get_trait_data = function(trait_data, textStatus, jqXHR) { $('#hidden_inputs').append('<input type="hidden" name="vals" value="[' + vals.toString() + ']" />'); this_trait_vals = get_this_trait_vals(samples); console.log("THE LENGTH IS:", $('input[name=vals]').length); - if ($('input[name=vals]').length === 1) { - return create_scatterplot(samples, [this_trait_vals, vals]); - } + return color_by_trait(trait_sample_data); }; get_this_trait_vals = function(samples) { @@ -149,6 +147,7 @@ assemble_into_json = function(this_trait_vals) { }; color_by_trait = function(trait_sample_data, textStatus, jqXHR) { + console.log('in color_by_trait:', trait_sample_data); return root.bar_chart.color_by_trait(trait_sample_data); }; diff --git a/wqflask/wqflask/static/new/javascript/lod_chart.coffee b/wqflask/wqflask/static/new/javascript/lod_chart.coffee index dd2ad31d..309cec9e 100644 --- a/wqflask/wqflask/static/new/javascript/lod_chart.coffee +++ b/wqflask/wqflask/static/new/javascript/lod_chart.coffee @@ -4,6 +4,7 @@ lodchart = () -> margin = {left:60, top:40, right:40, bottom: 40, inner:5}
axispos = {xtitle:25, ytitle:30, xlabel:5, ylabel:5}
titlepos = 20
+ manhattanPlot = false
ylim = null
additive_ylim = null
nyticks = 5
@@ -34,6 +35,7 @@ lodchart = () -> markerSelect = null
chrSelect = null
pointsAtMarkers = true
+
## the main function
chart = (selection) ->
@@ -41,6 +43,10 @@ lodchart = () -> #console.log("data:", data)
+ if manhattanPlot == true
+ pointcolor = "darkslateblue"
+ pointsize = 2
+
lodvarname = lodvarname ? data.lodnames[0]
data[lodvarname] = (Math.abs(x) for x in data[lodvarname]) # take absolute values
if 'additive' of data
@@ -115,6 +121,7 @@ lodchart = () -> lightrect)
.attr("stroke", "none")
.on("click", (d) ->
+ console.log("d is:", d)
redraw_plot(d)
)
@@ -146,7 +153,7 @@ lodchart = () -> #console.log("chr_length is:", chr_ob[1])
$('#topchart').remove()
$('#chart_container').append('<div class="qtlcharts" id="topchart"></div>')
- chr_plot = new Chr_Interval_Map(600, 1200, chr_ob)
+ chr_plot = new Chr_Manhattan_Plot(600, 1200, chr_ob)
# y-axis
rotate_ylab = rotate_ylab ? (ylab.length > 1)
@@ -247,43 +254,46 @@ lodchart = () -> .attr("stroke", significantcolor)
.attr("stroke-width", 5)
.style("pointer-events", "none")
-
- # lod curves by chr
- lodcurve = (chr, lodcolumn) ->
- d3.svg.line()
- .x((d) -> xscale[chr](d))
- .y((d,i) -> yscale(data.lodByChr[chr][i][lodcolumn]))
-
- #if 'additive' of data
- # additivecurve = (chr, lodcolumn) ->
- # d3.svg.line()
- # .x((d) -> xscale[chr](d))
- # .y((d,i) -> additive_yscale(data.additiveByChr[chr][i][lodcolumn]))
-
- curves = g.append("g").attr("id", "curves")
-
- for chr in data.chrnames
- curves.append("path")
- .datum(data.posByChr[chr[0]])
- .attr("d", lodcurve(chr[0], lodvarnum))
- .attr("stroke", lodlinecolor)
- .attr("fill", "none")
- .attr("stroke-width", linewidth)
- .style("pointer-events", "none")
+
+ if manhattanPlot == false
+ # lod curves by chr
+ lodcurve = (chr, lodcolumn) ->
+ d3.svg.line()
+ .x((d) -> xscale[chr](d))
+ .y((d,i) -> yscale(data.lodByChr[chr][i][lodcolumn]))
+
+ #if 'additive' of data
+ # additivecurve = (chr, lodcolumn) ->
+ # d3.svg.line()
+ # .x((d) -> xscale[chr](d))
+ # .y((d,i) -> additive_yscale(data.additiveByChr[chr][i][lodcolumn]))
+
+ curves = g.append("g").attr("id", "curves")
+
+ for chr in data.chrnames
+ curves.append("path")
+ .datum(data.posByChr[chr[0]])
+ .attr("d", lodcurve(chr[0], lodvarnum))
+ .attr("stroke", lodlinecolor)
+ .attr("fill", "none")
+ .attr("stroke-width", linewidth)
+ .style("pointer-events", "none")
+
+ ##if data['additive'].length > 0
+ #if 'additive' of data
+ # for chr in data.chrnames
+ # curves.append("path")
+ # .datum(data.posByChr[chr[0]])
+ # .attr("d", additivecurve(chr[0], lodvarnum))
+ # .attr("stroke", additivelinecolor)
+ # .attr("fill", "none")
+ # .attr("stroke-width", 1)
+ # .style("pointer-events", "none")
- ##if data['additive'].length > 0
- #if 'additive' of data
- # for chr in data.chrnames
- # curves.append("path")
- # .datum(data.posByChr[chr[0]])
- # .attr("d", additivecurve(chr[0], lodvarnum))
- # .attr("stroke", additivelinecolor)
- # .attr("fill", "none")
- # .attr("stroke-width", 1)
- # .style("pointer-events", "none")
- #
# points at markers
+ console.log("before pointsize")
if pointsize > 0
+ console.log("pointsize > 0 !!!")
markerpoints = g.append("g").attr("id", "markerpoints_visible")
markerpoints.selectAll("empty")
.data(data.markers)
@@ -347,8 +357,6 @@ lodchart = () -> d3.select(this).attr("opacity", 0)
.call(markertip.hide)
-
-
## configuration parameters
chart.width = (value) ->
return width unless arguments.length
@@ -374,6 +382,11 @@ lodchart = () -> return axispos unless arguments.length
axispos = value
chart
+
+ chart.manhattanPlot = (value) ->
+ return manhattanPlot unless arguments.length
+ manhattanPlot = value
+ chart
chart.ylim = (value) ->
return ylim unless arguments.length
@@ -481,8 +494,9 @@ lodchart = () -> chart.xscale = () ->
return xscale
- chart.lodcurve = () ->
- return lodcurve
+ if manhattanPlot == false
+ chart.lodcurve = () ->
+ return lodcurve
#if data['additive'].length > 0
chart.additivecurve = () ->
@@ -497,99 +511,3 @@ lodchart = () -> # return the chart function
chart
-# reorganize lod/pos by chromosome
-# lodvarname==null -> case for multiple LOD columns (lodheatmap)
-# lodvarname provided -> case for one LOD column (lodchart)
-#reorgLodData = (data, lodvarname=null) ->
-# data.posByChr = {}
-# data.lodByChr = {}
-# data.additiveByChr = {}
-#
-# for chr,i in data.chrnames
-# data.posByChr[chr[0]] = []
-# data.lodByChr[chr[0]] = []
-# data.additiveByChr[chr[0]] = []
-# for pos, j in data.pos
-# if data.chr[j] == chr[0]
-# data.posByChr[chr[0]].push(pos)
-# data.lodnames = [data.lodnames] unless Array.isArray(data.lodnames)
-# if 'additive' of data
-# #if data['additive'].length > 0
-# additiveval = (data['additive'][j] for lodcolumn in data.lodnames)
-# lodval = (data[lodcolumn][j] for lodcolumn in data.lodnames)
-# data.additiveByChr[chr[0]].push(additiveval)
-# data.lodByChr[chr[0]].push(lodval)
-#
-#
-# if lodvarname?
-# data.markers = []
-# for marker,i in data.markernames
-# if marker != ""
-# data.markers.push({name:marker, chr:data.chr[i], pos:data.pos[i], lod:data[lodvarname][i]})
-#
-# data
-
-
-# calculate chromosome start/end + scales, for heat map
-#chrscales = (data, width, chrGap, leftMargin, pad4heatmap) ->
-# # start and end of chromosome positions
-# chrStart = []
-# chrEnd = []
-# chrLength = []
-# totalChrLength = 0
-# maxd = 0
-# for chr in data.chrnames
-# d = maxdiff(data.posByChr[chr[0]])
-# maxd = d if d > maxd
-#
-# rng = d3.extent(data.posByChr[chr[0]])
-# chrStart.push(rng[0])
-# chrEnd.push(rng[1])
-# L = rng[1] - rng[0]
-# chrLength.push(L)
-# totalChrLength += L
-#
-# # adjust lengths for heatmap
-# if pad4heatmap
-# data.recwidth = maxd
-# chrStart = chrStart.map (x) -> x-maxd/2
-# chrEnd = chrEnd.map (x) -> x+maxd/2
-# chrLength = chrLength.map (x) -> x+maxd
-# totalChrLength += (chrLength.length*maxd)
-#
-# # break up x axis into chromosomes by length, with gaps
-# data.chrStart = []
-# data.chrEnd = []
-# cur = leftMargin
-# cur += chrGap/2 unless pad4heatmap
-# data.xscale = {}
-# for chr,i in data.chrnames
-# data.chrStart.push(cur)
-# w = Math.round((width-chrGap*(data.chrnames.length-pad4heatmap))/totalChrLength*chrLength[i])
-# data.chrEnd.push(cur + w)
-# cur = data.chrEnd[i] + chrGap
-# # x-axis scales, by chromosome
-# data.xscale[chr[0]] = d3.scale.linear()
-# .domain([chrStart[i], chrEnd[i]])
-# .range([data.chrStart[i], data.chrEnd[i]])
-#
-# # return data with new stuff added
-# data
-
-# maximum difference between adjacent values in a vector
-#maxdiff = (x) ->
-# return null if x.length < 2
-# result = x[1] - x[0]
-# return result if x.length < 3
-# for i in [2...x.length]
-# d = x[i] - x[i-1]
-# result = d if d > result
-# result
-#
-## determine rounding of axis labels
-#formatAxis = (d) ->
-# d = d[1] - d[0]
-# ndig = Math.floor( Math.log(d % 10) / Math.log(10) )
-# ndig = 0 if ndig > 0
-# ndig = Math.abs(ndig)
-# d3.format(".#{ndig}f")
diff --git a/wqflask/wqflask/static/new/javascript/lod_chart.js b/wqflask/wqflask/static/new/javascript/lod_chart.js index 49ca962f..e6f34854 100644 --- a/wqflask/wqflask/static/new/javascript/lod_chart.js +++ b/wqflask/wqflask/static/new/javascript/lod_chart.js @@ -2,7 +2,7 @@ var lodchart; lodchart = function() { - var additive_ylab, additive_ylim, additive_yscale, additive_yticks, additivelinecolor, axispos, chart, chrGap, chrSelect, darkrect, height, lightrect, linewidth, lodcurve, lodlinecolor, lodvarname, margin, markerSelect, nyticks, pad4heatmap, pointcolor, pointsAtMarkers, pointsize, pointstroke, rotate_ylab, significantcolor, suggestivecolor, title, titlepos, width, xlab, xscale, ylab, ylim, yscale, yticks; + var additive_ylab, additive_ylim, additive_yscale, additive_yticks, additivelinecolor, axispos, chart, chrGap, chrSelect, darkrect, height, lightrect, linewidth, lodcurve, lodlinecolor, lodvarname, manhattanPlot, margin, markerSelect, nyticks, pad4heatmap, pointcolor, pointsAtMarkers, pointsize, pointstroke, rotate_ylab, significantcolor, suggestivecolor, title, titlepos, width, xlab, xscale, ylab, ylim, yscale, yticks; width = 800; height = 500; margin = { @@ -19,6 +19,7 @@ lodchart = function() { ylabel: 5 }; titlepos = 20; + manhattanPlot = false; ylim = null; additive_ylim = null; nyticks = 5; @@ -52,6 +53,10 @@ lodchart = function() { chart = function(selection) { return selection.each(function(data) { var additive_yaxis, chr, curves, g, gEnter, hiddenpoints, lodvarnum, markerpoints, markertip, redraw_plot, rotate_additive_ylab, suggestive_bar, svg, titlegrp, x, xaxis, yaxis, _i, _len, _ref; + if (manhattanPlot === true) { + pointcolor = "darkslateblue"; + pointsize = 2; + } lodvarname = lodvarname != null ? lodvarname : data.lodnames[0]; data[lodvarname] = (function() { var _i, _len, _ref, _results; @@ -114,6 +119,7 @@ lodchart = function() { } return lightrect; }).attr("stroke", "none").on("click", function(d) { + console.log("d is:", d); return redraw_plot(d); }); xaxis = g.append("g").attr("class", "x axis"); @@ -129,7 +135,7 @@ lodchart = function() { var chr_plot; $('#topchart').remove(); $('#chart_container').append('<div class="qtlcharts" id="topchart"></div>'); - return chr_plot = new Chr_Interval_Map(600, 1200, chr_ob); + return chr_plot = new Chr_Manhattan_Plot(600, 1200, chr_ob); }; rotate_ylab = rotate_ylab != null ? rotate_ylab : ylab.length > 1; yaxis = g.append("g").attr("class", "y axis"); @@ -175,27 +181,31 @@ lodchart = function() { return yscale(d); }).attr("x1", margin.left).attr("x2", margin.left + width).attr("fill", "none").attr("stroke", significantcolor).attr("stroke-width", 5).style("pointer-events", "none"); } - lodcurve = function(chr, lodcolumn) { - return d3.svg.line().x(function(d) { - return xscale[chr](d); - }).y(function(d, i) { - return yscale(data.lodByChr[chr][i][lodcolumn]); - }); - }; - curves = g.append("g").attr("id", "curves"); - _ref = data.chrnames; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - chr = _ref[_i]; - curves.append("path").datum(data.posByChr[chr[0]]).attr("d", lodcurve(chr[0], lodvarnum)).attr("stroke", lodlinecolor).attr("fill", "none").attr("stroke-width", linewidth).style("pointer-events", "none"); + if (manhattanPlot === false) { + lodcurve = function(chr, lodcolumn) { + return d3.svg.line().x(function(d) { + return xscale[chr](d); + }).y(function(d, i) { + return yscale(data.lodByChr[chr][i][lodcolumn]); + }); + }; + curves = g.append("g").attr("id", "curves"); + _ref = data.chrnames; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + chr = _ref[_i]; + curves.append("path").datum(data.posByChr[chr[0]]).attr("d", lodcurve(chr[0], lodvarnum)).attr("stroke", lodlinecolor).attr("fill", "none").attr("stroke-width", linewidth).style("pointer-events", "none"); + } } + console.log("before pointsize"); if (pointsize > 0) { - markerpoints = g.append("g").attr("id", "markerpoints_visible"); - markerpoints.selectAll("empty").data(data.markers).enter().append("circle").attr("cx", function(d) { - return xscale[d.chr](d.pos); - }).attr("cy", function(d) { - return yscale(d.lod); - }).attr("r", pointsize).attr("fill", pointcolor).attr("stroke", pointstroke).attr("pointer-events", "hidden"); + console.log("pointsize > 0 !!!"); } + markerpoints = g.append("g").attr("id", "markerpoints_visible"); + markerpoints.selectAll("empty").data(data.markers).enter().append("circle").attr("cx", function(d) { + return xscale[d.chr](d.pos); + }).attr("cy", function(d) { + return yscale(d.lod); + }).attr("r", pointsize).attr("fill", pointcolor).attr("stroke", pointstroke).attr("pointer-events", "hidden"); titlegrp = g.append("g").attr("class", "title").append("text").attr("x", margin.left + width / 2).attr("y", margin.top - titlepos).text(title); g.append("rect").attr("x", margin.left).attr("y", margin.top).attr("height", height).attr("width", function() { if (pad4heatmap) { @@ -259,6 +269,13 @@ lodchart = function() { axispos = value; return chart; }; + chart.manhattanPlot = function(value) { + if (!arguments.length) { + return manhattanPlot; + } + manhattanPlot = value; + return chart; + }; chart.ylim = function(value) { if (!arguments.length) { return ylim; @@ -402,9 +419,11 @@ lodchart = function() { chart.xscale = function() { return xscale; }; - chart.lodcurve = function() { - return lodcurve; - }; + if (manhattanPlot === false) { + chart.lodcurve = function() { + return lodcurve; + }; + } chart.additivecurve = function() { return additivecurve; }; diff --git a/wqflask/wqflask/static/new/javascript/manhattan_plot.coffee b/wqflask/wqflask/static/new/javascript/manhattan_plot.coffee index cc087493..d637183d 100644 --- a/wqflask/wqflask/static/new/javascript/manhattan_plot.coffee +++ b/wqflask/wqflask/static/new/javascript/manhattan_plot.coffee @@ -370,95 +370,3 @@ lodchart = () -> # return the chart function
chart
-
-
-# reorganize lod/pos by chromosome
-# lodvarname==null -> case for multiple LOD columns (lodheatmap)
-# lodvarname provided -> case for one LOD column (lodchart)
-#reorgLodData = (data, lodvarname=null) ->
-# data.posByChr = {}
-# data.lodByChr = {}
-#
-# for chr,i in data.chrnames
-# data.posByChr[chr[0]] = []
-# data.lodByChr[chr[0]] = []
-# for pos, j in data.pos
-# if data.chr[j] == chr[0]
-# data.posByChr[chr[0]].push(pos)
-# data.lodnames = [data.lodnames] unless Array.isArray(data.lodnames)
-# lodval = (data[lodcolumn][j] for lodcolumn in data.lodnames)
-# data.lodByChr[chr[0]].push(lodval)
-#
-#
-# if lodvarname?
-# data.markers = []
-# for marker,i in data.markernames
-# if marker != ""
-# data.markers.push({name:marker, chr:data.chr[i], pos:data.pos[i], lod:data[lodvarname][i]})
-#
-# data
-
-
-# calculate chromosome start/end + scales, for heat map
-#chrscales = (data, width, chrGap, leftMargin, pad4heatmap) ->
-# # start and end of chromosome positions
-# chrStart = []
-# chrEnd = []
-# chrLength = []
-# totalChrLength = 0
-# maxd = 0
-# for chr in data.chrnames
-# d = maxdiff(data.posByChr[chr[0]])
-# maxd = d if d > maxd
-#
-# rng = d3.extent(data.posByChr[chr[0]])
-# chrStart.push(rng[0])
-# chrEnd.push(rng[1])
-# L = rng[1] - rng[0]
-# chrLength.push(L)
-# totalChrLength += L
-#
-# # adjust lengths for heatmap
-# if pad4heatmap
-# data.recwidth = maxd
-# chrStart = chrStart.map (x) -> x-maxd/2
-# chrEnd = chrEnd.map (x) -> x+maxd/2
-# chrLength = chrLength.map (x) -> x+maxd
-# totalChrLength += (chrLength.length*maxd)
-#
-# # break up x axis into chromosomes by length, with gaps
-# data.chrStart = []
-# data.chrEnd = []
-# cur = leftMargin
-# cur += chrGap/2 unless pad4heatmap
-# data.xscale = {}
-# for chr,i in data.chrnames
-# data.chrStart.push(cur)
-# w = Math.round((width-chrGap*(data.chrnames.length-pad4heatmap))/totalChrLength*chrLength[i])
-# data.chrEnd.push(cur + w)
-# cur = data.chrEnd[i] + chrGap
-# # x-axis scales, by chromosome
-# data.xscale[chr[0]] = d3.scale.linear()
-# .domain([chrStart[i], chrEnd[i]])
-# .range([data.chrStart[i], data.chrEnd[i]])
-#
-# # return data with new stuff added
-# data
-#
-## maximum difference between adjacent values in a vector
-#maxdiff = (x) ->
-# return null if x.length < 2
-# result = x[1] - x[0]
-# return result if x.length < 3
-# for i in [2...x.length]
-# d = x[i] - x[i-1]
-# result = d if d > result
-# result
-#
-## determine rounding of axis labels
-#formatAxis = (d) ->
-# d = d[1] - d[0]
-# ndig = Math.floor( Math.log(d % 10) / Math.log(10) )
-# ndig = 0 if ndig > 0
-# ndig = Math.abs(ndig)
-# d3.format(".#{ndig}f")
diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.coffee b/wqflask/wqflask/static/new/javascript/marker_regression.coffee index 203c174c..959f2366 100755 --- a/wqflask/wqflask/static/new/javascript/marker_regression.coffee +++ b/wqflask/wqflask/static/new/javascript/marker_regression.coffee @@ -1,6 +1,6 @@ root = exports ? this -class Manhattan_Plot
+class Lod_Chart
darkrect = "#F1F1F9"
lightrect = "#FBFBFF"
@@ -375,36 +375,7 @@ class Manhattan_Plot else
return lightrect
)
- )
- - - #fill_chr_areas2: () -> - # console.log("cumu_chr_lengths:", @cumulative_chr_lengths) - # console.log("example:", @x_scale(@cumulative_chr_lengths[0])) - # @svg.selectAll("rect.chr_fill_area") - # .data(_.zip(@chr_lengths, @cumulative_chr_lengths), (d) => - # return d - # ) - # .enter() - # .append("rect") - # .attr("x", (d) => - # if i == 0 - # return @x_scale(0) - # else - # return @x_scale(d[1]) - # ) - # .attr("y", @y_buffer) - # .attr("width", (d) => - # return @x_scale(d[0]) - # ) - # .attr("height", @height-@y_buffer) - # .attr("fill", (d, i) => - # return "whitesmoke" - # #if i%2 - # # return "whitesmoke" - # #else - # # return "none" - # ) + ) add_chr_labels: () -> chr_names = [] @@ -533,6 +504,6 @@ class Manhattan_Plot @svg.select("path.line").attr("d", line); -root.Manhattan_Plot = Manhattan_Plot +#root.LodChart = Lod_Chart -new Manhattan_Plot(600, 1200)
\ No newline at end of file +new Lod_Chart(600, 1200)
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/marker_regression.js b/wqflask/wqflask/static/new/javascript/marker_regression.js index 1fcee9fd..1bdc784f 100755 --- a/wqflask/wqflask/static/new/javascript/marker_regression.js +++ b/wqflask/wqflask/static/new/javascript/marker_regression.js @@ -1,10 +1,10 @@ // Generated by CoffeeScript 1.7.1 -var Manhattan_Plot, root, +var Lod_Chart, root, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; root = typeof exports !== "undefined" && exports !== null ? exports : this; -Manhattan_Plot = (function() { +Lod_Chart = (function() { var darkrect, hoverrect, lightrect; darkrect = "#F1F1F9"; @@ -13,7 +13,7 @@ Manhattan_Plot = (function() { hoverrect = "#E9CFEC"; - function Manhattan_Plot(height, width) { + function Lod_Chart(height, width) { var _ref; this.height = height != null ? height : 800; this.width = width != null ? width : 1200; @@ -54,7 +54,7 @@ Manhattan_Plot = (function() { console.timeEnd('Create graph'); } - Manhattan_Plot.prototype.get_max_chr = function() { + Lod_Chart.prototype.get_max_chr = function() { var chr, max_chr, result, _i, _len, _ref; max_chr = 0; _ref = this.qtl_results; @@ -71,7 +71,7 @@ Manhattan_Plot = (function() { return max_chr; }; - Manhattan_Plot.prototype.get_chr_lengths = function() { + Lod_Chart.prototype.get_chr_lengths = function() { /* *Gets a list of both individual and cumulative (the position of one on the graph @@ -93,7 +93,7 @@ Manhattan_Plot = (function() { return [chr_lengths, cumulative_chr_lengths]; }; - Manhattan_Plot.prototype.get_qtl_count = function() { + Lod_Chart.prototype.get_qtl_count = function() { var high_qtl_count, result, _i, _len, _ref; high_qtl_count = 0; _ref = js_data.qtl_results; @@ -107,7 +107,7 @@ Manhattan_Plot = (function() { return this.y_axis_filter = 0; }; - Manhattan_Plot.prototype.create_coordinates = function() { + Lod_Chart.prototype.create_coordinates = function() { var chr_length, chr_lengths, chr_seen, result, _i, _len, _ref, _ref1; chr_lengths = []; chr_seen = []; @@ -139,7 +139,7 @@ Manhattan_Plot = (function() { return this.total_length += parseFloat(chr_lengths[chr_lengths.length - 1]); }; - Manhattan_Plot.prototype.show_marker_in_table = function(marker_info) { + Lod_Chart.prototype.show_marker_in_table = function(marker_info) { var marker_name; console.log("in show_marker_in_table"); @@ -150,13 +150,13 @@ Manhattan_Plot = (function() { } }; - Manhattan_Plot.prototype.create_svg = function() { + Lod_Chart.prototype.create_svg = function() { var svg; svg = d3.select("#manhattan_plot").append("svg").attr("class", "manhattan_plot").attr("width", this.width + this.x_buffer).attr("height", this.height + this.y_buffer).append("g"); return svg; }; - Manhattan_Plot.prototype.create_graph = function() { + Lod_Chart.prototype.create_graph = function() { this.create_legend(); this.add_border(); this.add_x_axis(); @@ -168,12 +168,12 @@ Manhattan_Plot = (function() { return this.add_plot_points(); }; - Manhattan_Plot.prototype.create_legend = function() { + Lod_Chart.prototype.create_legend = function() { this.svg.append("text").attr("class", "legend").text("Trait: " + this.this_trait + " : " + this.data_set).attr("x", this.x_buffer).attr("y", 20).attr("dx", "0em").attr("text-anchor", "left").attr("font-family", "sans-serif").attr("font-size", "16px").attr("fill", "black"); return this.svg.append("text").attr("class", "legend").text("MAF: " + this.maf).attr("x", this.x_buffer).attr("y", 38).attr("dx", "0em").attr("text-anchor", "left").attr("font-family", "sans-serif").attr("font-size", "16px").attr("fill", "black"); }; - Manhattan_Plot.prototype.add_border = function() { + Lod_Chart.prototype.add_border = function() { var border_coords; border_coords = [[this.y_buffer + this.legend_buffer, this.height, this.x_buffer, this.x_buffer], [this.y_buffer + this.legend_buffer, this.height, this.width, this.width], [this.y_buffer + this.legend_buffer, this.y_buffer + this.legend_buffer, this.x_buffer, this.width], [this.height, this.height, this.x_buffer, this.width]]; return this.svg.selectAll("line").data(border_coords).enter().append("line").attr("y1", (function(_this) { @@ -195,7 +195,7 @@ Manhattan_Plot = (function() { })(this)).style("stroke", "#000"); }; - Manhattan_Plot.prototype.create_scales = function() { + Lod_Chart.prototype.create_scales = function() { console.log("y_axis_filter:", this.y_axis_filter); if ('24' in this.chromosomes) { console.log("@chromosomes[24]:", this.chromosomes['24']); @@ -209,7 +209,7 @@ Manhattan_Plot = (function() { return this.y_scale = d3.scale.linear().domain([this.y_axis_filter, this.y_max]).range([this.height, this.y_buffer + this.legend_buffer]); }; - Manhattan_Plot.prototype.create_x_axis_tick_values = function() { + Lod_Chart.prototype.create_x_axis_tick_values = function() { var chr_ticks, i, length, tick, tick_count, tick_val, tick_vals, val, _i, _j, _k, _len, _ref, _ref1, _ref2; tick_vals = []; for (val = _i = 25, _ref = this.cumulative_chr_lengths[0]; 25 <= _ref ? _i <= _ref : _i >= _ref; val = 25 <= _ref ? ++_i : --_i) { @@ -235,7 +235,7 @@ Manhattan_Plot = (function() { return tick_vals; }; - Manhattan_Plot.prototype.add_x_axis = function() { + Lod_Chart.prototype.add_x_axis = function() { var next_chr, tmp_tick_val; this.xAxis = d3.svg.axis().scale(this.x_scale).orient("bottom").tickValues(this.create_x_axis_tick_values()); next_chr = 1; @@ -267,16 +267,16 @@ Manhattan_Plot = (function() { })(this)); }; - Manhattan_Plot.prototype.add_y_axis = function() { + Lod_Chart.prototype.add_y_axis = function() { this.yAxis = d3.svg.axis().scale(this.y_scale).orient("left").ticks(5); return this.svg.append("g").attr("class", "y_axis").attr("transform", "translate(" + this.x_buffer + ",0)").call(this.yAxis); }; - Manhattan_Plot.prototype.add_axis_labels = function() { + Lod_Chart.prototype.add_axis_labels = function() { return this.svg.append("text").attr("transform", "rotate(-90)").attr("y", 0 - (this.height / 2)).attr("x", this.x_buffer).attr("dy", "1em").style("text-anchor", "middle").text("LOD Score"); }; - Manhattan_Plot.prototype.add_chr_lines = function() { + Lod_Chart.prototype.add_chr_lines = function() { return this.svg.selectAll("line").data(this.cumulative_chr_lengths, (function(_this) { return function(d) { return d; @@ -284,7 +284,7 @@ Manhattan_Plot = (function() { })(this)).enter().append("line").attr("x1", this.x_scale).attr("x2", this.x_scale).attr("y1", this.y_buffer + this.legend_buffer).attr("y2", this.height).style("stroke", "#ccc"); }; - Manhattan_Plot.prototype.fill_chr_areas = function() { + Lod_Chart.prototype.fill_chr_areas = function() { console.log("cumu_chr_lengths:", this.cumulative_chr_lengths); console.log("example:", this.x_scale(this.cumulative_chr_lengths[0])); return this.svg.selectAll("rect.chr_fill_area").data(_.zip(this.chr_lengths, this.cumulative_chr_lengths), (function(_this) { @@ -338,7 +338,7 @@ Manhattan_Plot = (function() { })(this)); }; - Manhattan_Plot.prototype.add_chr_labels = function() { + Lod_Chart.prototype.add_chr_labels = function() { var chr_info, chr_names, key; chr_names = []; for (key in this.chromosomes) { @@ -378,7 +378,7 @@ Manhattan_Plot = (function() { })(this)); }; - Manhattan_Plot.prototype.add_plot_points = function() { + Lod_Chart.prototype.add_plot_points = function() { return this.plot_point = this.svg.selectAll("circle").data(this.plot_coordinates).enter().append("circle").attr("cx", (function(_this) { return function(d) { return _this.x_scale(d[0]); @@ -424,7 +424,7 @@ Manhattan_Plot = (function() { })(this)); }; - Manhattan_Plot.prototype.redraw_plot = function(chr_ob) { + Lod_Chart.prototype.redraw_plot = function(chr_ob) { console.log("chr_name is:", chr_ob[0]); console.log("chr_length is:", chr_ob[1]); $('#manhattan_plot').remove(); @@ -432,23 +432,21 @@ Manhattan_Plot = (function() { return root.chr_plot = new Chr_Manhattan_Plot(600, 1200, chr_ob); }; - Manhattan_Plot.prototype.create_zoom_pane = function() { + Lod_Chart.prototype.create_zoom_pane = function() { var zoom; zoom = d3.behavior.zoom().on("zoom", draw); return this.svg.append("rect").attr("class", "pane").attr("width", this.width).attr("height", this.height).call(zoom); }; - Manhattan_Plot.prototype.draw = function() { + Lod_Chart.prototype.draw = function() { this.svg.select("g.x_axis").call(this.xAxis); this.svg.select("g.y_axis").call(this.yAxis); this.svg.select("path.area").attr("d", area); return this.svg.select("path.line").attr("d", line); }; - return Manhattan_Plot; + return Lod_Chart; })(); -root.Manhattan_Plot = Manhattan_Plot; - -new Manhattan_Plot(600, 1200); +new Lod_Chart(600, 1200); diff --git a/wqflask/wqflask/static/new/javascript/search_results.coffee b/wqflask/wqflask/static/new/javascript/search_results.coffee index 84cf7f0a..c4e6b1a2 100755 --- a/wqflask/wqflask/static/new/javascript/search_results.coffee +++ b/wqflask/wqflask/static/new/javascript/search_results.coffee @@ -44,16 +44,16 @@ $ -> for item in buttons console.log(" processing item:", item) text = $(item).html() - if text.indexOf("Records") == -1 - text = text.replace("Record", "Records") - $(item).html(text) + #if text.indexOf("Records") == -1 + # text = text.replace("Record", "Records") + # $(item).html(text) else console.log("in loop") for item in buttons console.log(" processing item:", item) text = $(item).html() - text = text.replace("Records", "Record") - $(item).html(text) + #text = text.replace("Records", "Record") + #$(item).html(text) # remove is only used by collections view diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index e6f55624..6c077c67 100755 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -49,13 +49,7 @@ $(function() { for (_k = 0, _len2 = buttons.length; _k < _len2; _k++) { item = buttons[_k]; console.log(" processing item:", item); - text = $(item).html(); - if (text.indexOf("Records") === -1) { - text = text.replace("Record", "Records"); - _results.push($(item).html(text)); - } else { - _results.push(void 0); - } + _results.push(text = $(item).html()); } return _results; } else { @@ -64,9 +58,7 @@ $(function() { for (_l = 0, _len3 = buttons.length; _l < _len3; _l++) { item = buttons[_l]; console.log(" processing item:", item); - text = $(item).html(); - text = text.replace("Records", "Record"); - _results1.push($(item).html(text)); + _results1.push(text = $(item).html()); } return _results1; } 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 fc687c7a..72d2bbe4 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee @@ -171,11 +171,14 @@ $ -> #return false ) + + $("#rqtl_geno_compute").click(() => $("#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()) + $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val()) $('input[name=control_marker]').val($('input[name=control_rqtl_geno]').val()) form_data = $('#trait_data_form').serialize() console.log("form_data is:", form_data) 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 a8a42ffa..4eaceffe 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -137,6 +137,7 @@ $(function() { url = "/marker_regression"; $('input[name=method]').val("rqtl_geno"); $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); + $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val()); $('input[name=control_marker]').val($('input[name=control_rqtl_geno]').val()); form_data = $('#trait_data_form').serialize(); console.log("form_data is:", form_data); diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 61d17a22..88f6d65a 100755 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -1,6 +1,5 @@ {% extends "base.html" %} {% block css %} - <link rel="stylesheet" type="text/css" href="/static/packages/jqplot/jquery.jqplot.min.css" /> <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" /> diff --git a/wqflask/wqflask/templates/marker_regression.html b/wqflask/wqflask/templates/marker_regression.html index 451b3754..51aab95c 100755 --- a/wqflask/wqflask/templates/marker_regression.html +++ b/wqflask/wqflask/templates/marker_regression.html @@ -88,7 +88,8 @@ <script language="javascript" type="text/javascript" src="/static/new/packages/jsPDF/jspdf.plugin.from_html.js"></script>-->
<script language="javascript" type="text/javascript" src="/static/new/javascript/panelutil.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/javascript/chr_manhattan_plot.js"></script>
- <script language="javascript" type="text/javascript" src="/static/new/javascript/manhattan_plot.js"></script>
+<!-- <script language="javascript" type="text/javascript" src="/static/new/javascript/manhattan_plot.js"></script>-->
+ <script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/javascript/create_manhattan_plot.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script>
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 5bd6534c..0baac2d3 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -1,5 +1,10 @@ {% extends "base.html" %} {% block title %}Search Results{% endblock %} +{% block css %} + <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" /> +{% endblock %} {% block content %} <!-- Start of body --> {{ header("Search Results", @@ -27,7 +32,7 @@ Check records below and click Add button to add to selection.</p> <div class="bs-docs-example"> - <table class="table table-hover" id='trait_table'> + <table class="table table-hover table-striped" id='trait_table'> <thead> <tr> {% for header in header_fields %} @@ -78,7 +83,8 @@ </table> <br /> - + <br /> + <button class="btn" id="select_all"><i class="icon-ok"></i> Select All</button> <button class="btn" id="deselect_all"><i class="icon-remove"></i> Deselect All</button> <button class="btn" id="invert"><i class="icon-resize-vertical"></i> Invert</button> @@ -95,4 +101,24 @@ {% block js %} <script type="text/javascript" src="/static/new/javascript/search_results.js"></script> + + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.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/packages/DT_bootstrap/DT_bootstrap.js"></script> + <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> + <script type="text/javascript" charset="utf-8"> + $(document).ready( function () { + console.time("Creating table"); + $('#trait_table').dataTable( { + //"sDom": "<<'span3'l><'span3'T><'span4'f>'row-fluid'r>t<'row-fluid'<'span6'i><'span6'p>>", + "sDom": "lftipr", + "iDisplayLength": 50, + "bLengthChange": true, + "bDeferRender": true, + "bSortClasses": false + } ); + console.timeEnd("Creating table"); + }); + </script> + {% endblock %} diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index cbb06285..7bbebd72 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -109,7 +109,8 @@ console.time("Creating table"); {% if sample_groups[0].se_exists() %} - $('#samples_primary, #samples_other').find("tr.outlier").css('background-color', 'yellow').dataTable( { + $('#samples_primary, #samples_other').find("tr.outlier").css('background-color', 'yellow') + $('#samples_primary, #samples_other').dataTable( { //"sDom": "<<'span3'l><'span3'T><'span4'f>'row-fluid'r>t<'row-fluid'<'span6'i><'span6'p>>", "aoColumns": [ { "sType": "natural" }, diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index c58b7729..e5d96490 100755 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -135,14 +135,14 @@ <div class="tab-pane" id="pylmm"> <div class="control-group" id="display_all_div"> - <label class="control-label">Display all</label> + <label class="control-label">Manhattan Plot</label> <div class="controls"> <label class="radio inline"> - <input type="radio" name="display_all_pylmm" value="True" checked> + <input type="radio" name="manhattan_plot_pylmm" value=true checked> Yes </label> <label class="radio inline"> - <input type="radio" name="display_all_pylmm" value="False"> + <input type="radio" name="manhattan_plot_pylmm" value=false> No </label> </div> @@ -185,9 +185,27 @@ <div class="control-group"> <label for="control_rqtl_geno" class="control-label">Control Marker</label> <div class="controls"> - <input name="control_rqtl_geno" value="{{ nearest_marker }}" type="text" /> + {% if dataset.type == 'ProbeSet' %} + <input name="control_rqtl_geno" value="{{ nearest_marker1+","+nearest_marker2 }}" type="text" /> + {% else %} + <input name="control_rqtl_geno" value="" type="text" /> + {% endif %} </div> </div> + <div class="control-group mapping_method_fields"> + <label class="control-label">Manhattan Plot</label> + <div class="controls"> + <label class="radio inline"> + <input type="radio" name="manhattan_plot_rqtl" value=true checked> + Yes + </label> + <label class="radio inline"> + <input type="radio" name="manhattan_plot_rqtl" value=false> + No + </label> + </div> + </div> + <div class="control-group"> <div class="controls"> @@ -199,7 +217,7 @@ </button> </div> </div> - + </div> {% if dataset.group.species == 'human' %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 26e690d4..869bd621 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -254,6 +254,7 @@ def marker_regression_page(): 'suggestive', 'num_perm', 'maf', + 'manhattan_plot', 'control_marker', 'control_marker_db' ) @@ -337,7 +338,7 @@ def interval_mapping_page(): 'dataset', 'mapping_method', 'chromosome', - 'num_permutations', + 'num_perm', 'do_bootstraps', 'display_additive', 'default_control_locus', |