aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/marker_regression/marker_regression.py6
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py5
-rwxr-xr-xwqflask/wqflask/static/new/css/bar_chart.css4
-rwxr-xr-xwqflask/wqflask/static/new/javascript/histogram.coffee38
-rwxr-xr-xwqflask/wqflask/static/new/javascript/histogram.js16
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait.coffee1
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee35
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js36
-rwxr-xr-xwqflask/wqflask/templates/show_trait.html126
-rwxr-xr-xwqflask/wqflask/templates/show_trait_mapping_tools.html65
10 files changed, 270 insertions, 62 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 54cc9006..c220d2c9 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -58,6 +58,8 @@ class MarkerRegression(object):
if self.mapping_method == "gemma":
qtl_results = self.run_gemma()
+ elif self.mapping_method == "plink":
+ qtl_results = self.run_plink()
elif self.mapping_method == "pylmm":
#self.qtl_results = self.gen_data(tempdata)
qtl_results = self.gen_data(str(temp_uuid))
@@ -151,6 +153,10 @@ class MarkerRegression(object):
#
#
+ def run_plink(self):
+
+ os.chdir("/home/zas1024/plink")
+
#def gen_data(self, tempdata):
def gen_data(self, temp_uuid):
"""Generates p-values for each marker"""
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index db8d4f1a..6f0ff44b 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -98,7 +98,10 @@ class ShowTrait(object):
hddn['trait_id'] = self.trait_id
hddn['dataset'] = self.dataset.name
hddn['method'] = "pylmm"
-
+ hddn['mapping_display_all'] = True
+ hddn['suggestive'] = 0
+ hddn['maf'] = 0.01
+
# We'll need access to this_trait and hddn in the Jinja2 Template, so we put it inside self
self.hddn = hddn
diff --git a/wqflask/wqflask/static/new/css/bar_chart.css b/wqflask/wqflask/static/new/css/bar_chart.css
index c8e081f9..3e6e7bd6 100755
--- a/wqflask/wqflask/static/new/css/bar_chart.css
+++ b/wqflask/wqflask/static/new/css/bar_chart.css
@@ -9,7 +9,7 @@
fill: steelblue;
shape-rendering: crispEdges;
}
-
+/*
.x.axis path {
display: none;
-} \ No newline at end of file
+}*/ \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/histogram.coffee b/wqflask/wqflask/static/new/javascript/histogram.coffee
index 6c1e65e9..98f89ac6 100755
--- a/wqflask/wqflask/static/new/javascript/histogram.coffee
+++ b/wqflask/wqflask/static/new/javascript/histogram.coffee
@@ -41,13 +41,15 @@ class Histogram
create_x_scale: () ->
console.log("min/max:", d3.min(@sample_vals) + "," + d3.max(@sample_vals))
- if (d3.min(@sample_vals) < 0)
- min_domain = d3.min(@sample_vals)
- else
- min_domain = 0
+ x0 = Math.max(-d3.min(@sample_vals), d3.max(@sample_vals))
+ #if (d3.min(@sample_vals) < 0)
+ # min_domain = d3.min(@sample_vals)
+ #else
+ # min_domain = 0
@x_scale = d3.scale.linear()
- .domain([min_domain, parseFloat(d3.max(@sample_vals))])
- .range([0, @plot_width])
+ .domain([d3.min(@sample_vals), d3.max(@sample_vals)])
+ .range([0, @plot_width])
+ .nice()
get_histogram_data: () ->
console.log("sample_vals:", @sample_vals)
@@ -62,6 +64,7 @@ class Histogram
create_graph: () ->
@add_x_axis()
+ @add_y_axis()
@add_bars()
add_x_axis: () ->
@@ -74,11 +77,32 @@ class Histogram
.attr("transform", "translate(0," + @plot_height + ")")
.call(x_axis)
+ #add_y_axis: () ->
+ # y_axis = d3.svg.axis()
+ # .scale(@y_scale)
+ # .orient("left")
+ # .ticks(5)
+ #
+ # @svg.append("g")
+ # .attr("class", "y axis")
+ # #.attr("transform", "translate(0," + @plot_width + ")")
+ # .call(y_axis)
+
+
add_y_axis: () ->
- y_axis = d3.svg.axis()
+ yAxis = d3.svg.axis()
.scale(@y_scale)
.orient("left")
.ticks(5)
+
+ @svg.append("g")
+ .attr("class", "y axis")
+ .call(yAxis)
+ .append("text")
+ .attr("transform", "rotate(-90)")
+ .attr("y", 6)
+ .attr("dy", ".71em")
+ .style("text-anchor", "end")
add_bars: () ->
console.log("bar_width:", @x_scale(@histogram_data[0].dx))
diff --git a/wqflask/wqflask/static/new/javascript/histogram.js b/wqflask/wqflask/static/new/javascript/histogram.js
index 1603cb77..d8067ced 100755
--- a/wqflask/wqflask/static/new/javascript/histogram.js
+++ b/wqflask/wqflask/static/new/javascript/histogram.js
@@ -55,14 +55,10 @@
};
Histogram.prototype.create_x_scale = function() {
- var min_domain;
+ var x0;
console.log("min/max:", d3.min(this.sample_vals) + "," + d3.max(this.sample_vals));
- if (d3.min(this.sample_vals) < 0) {
- min_domain = d3.min(this.sample_vals);
- } else {
- min_domain = 0;
- }
- return this.x_scale = d3.scale.linear().domain([min_domain, parseFloat(d3.max(this.sample_vals))]).range([0, this.plot_width]);
+ x0 = Math.max(-d3.min(this.sample_vals), d3.max(this.sample_vals));
+ return this.x_scale = d3.scale.linear().domain([d3.min(this.sample_vals), d3.max(this.sample_vals)]).range([0, this.plot_width]).nice();
};
Histogram.prototype.get_histogram_data = function() {
@@ -82,6 +78,7 @@
Histogram.prototype.create_graph = function() {
this.add_x_axis();
+ this.add_y_axis();
return this.add_bars();
};
@@ -92,8 +89,9 @@
};
Histogram.prototype.add_y_axis = function() {
- var y_axis;
- return y_axis = d3.svg.axis().scale(this.y_scale).orient("left").ticks(5);
+ var yAxis;
+ yAxis = d3.svg.axis().scale(this.y_scale).orient("left").ticks(5);
+ return this.svg.append("g").attr("class", "y axis").call(yAxis).append("text").attr("transform", "rotate(-90)").attr("y", 6).attr("dy", ".71em").style("text-anchor", "end");
};
Histogram.prototype.add_bars = function() {
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee
index 84e465e8..a410baf3 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait.coffee
+++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee
@@ -204,6 +204,7 @@ $ ->
name = $.trim(name)
real_value = $(row).find('.edit_sample_value').val()
console.log("real_value:", real_value)
+
checkbox = $(row).find(".edit_sample_checkbox")
checked = $(checkbox).attr('checked')
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 f1024cd1..1d375686 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee
@@ -56,6 +56,9 @@ $ ->
console.log("In interval mapping")
$("#progress_bar_container").modal()
url = "/interval_mapping"
+ $('input[name=method]').val("reaper")
+ $('input[name=mapping_display_all]').val($('input[name=display_all_reaper]'))
+ $('input[name=suggestive]').val($('input[name=suggestive_reaper]'))
form_data = $('#trait_data_form').serialize()
console.log("form_data is:", form_data)
$.ajax(
@@ -116,9 +119,41 @@ $ ->
return false
)
+ $("#plink_compute").click(() =>
+ url = "/marker_regression"
+ $('input[name=method]').val("plink")
+ $('input[name=mapping_display_all]').val($('input[name=display_all_plink]'))
+ $('input[name=suggestive]').val($('input[name=suggestive_plink]'))
+ $('input[name=maf]').val($('input[name=maf_plink]'))
+ form_data = $('#trait_data_form').serialize()
+ console.log("form_data is:", form_data)
+ $.ajax(
+ type: "POST"
+ url: url
+ data: form_data
+ error: (xhr, ajaxOptions, thrownError) =>
+ alert("Sorry, an error occurred")
+ console.log(xhr)
+ clearInterval(this.my_timer)
+ $('#progress_bar_container').modal('hide')
+ $("body").html("We got an error.")
+ success: (data) =>
+ clearInterval(this.my_timer)
+ $('#progress_bar_container').modal('hide')
+ $("body").html(data)
+ )
+ console.log("settingInterval")
+
+ this.my_timer = setInterval(get_progress, 1000)
+ return false
+ )
+
$("#gemma_compute").click(() =>
url = "/marker_regression"
$('input[name=method]').val("gemma")
+ $('input[name=mapping_display_all]').val($('input[name=display_all_gemma]'))
+ $('input[name=suggestive]').val($('input[name=suggestive_gemma]'))
+ $('input[name=maf]').val($('input[name=maf_gemma]'))
form_data = $('#trait_data_form').serialize()
console.log("form_data is:", form_data)
$.ajax(
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 a5a49ace..dbc26e3b 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
@@ -67,6 +67,9 @@
console.log("In interval mapping");
$("#progress_bar_container").modal();
url = "/interval_mapping";
+ $('input[name=method]').val("reaper");
+ $('input[name=mapping_display_all]').val($('input[name=display_all_reaper]'));
+ $('input[name=suggestive]').val($('input[name=suggestive_reaper]'));
form_data = $('#trait_data_form').serialize();
console.log("form_data is:", form_data);
$.ajax({
@@ -127,10 +130,43 @@
_this.my_timer = setInterval(get_progress, 1000);
return false;
});
+ $("#plink_compute").click(function() {
+ var form_data, url;
+ url = "/marker_regression";
+ $('input[name=method]').val("plink");
+ $('input[name=mapping_display_all]').val($('input[name=display_all_plink]'));
+ $('input[name=suggestive]').val($('input[name=suggestive_plink]'));
+ $('input[name=maf]').val($('input[name=maf_plink]'));
+ form_data = $('#trait_data_form').serialize();
+ console.log("form_data is:", form_data);
+ $.ajax({
+ type: "POST",
+ url: url,
+ data: form_data,
+ error: function(xhr, ajaxOptions, thrownError) {
+ alert("Sorry, an error occurred");
+ console.log(xhr);
+ clearInterval(_this.my_timer);
+ $('#progress_bar_container').modal('hide');
+ return $("body").html("We got an error.");
+ },
+ success: function(data) {
+ clearInterval(_this.my_timer);
+ $('#progress_bar_container').modal('hide');
+ return $("body").html(data);
+ }
+ });
+ console.log("settingInterval");
+ _this.my_timer = setInterval(get_progress, 1000);
+ return false;
+ });
$("#gemma_compute").click(function() {
var form_data, url;
url = "/marker_regression";
$('input[name=method]').val("gemma");
+ $('input[name=mapping_display_all]').val($('input[name=display_all_gemma]'));
+ $('input[name=suggestive]').val($('input[name=suggestive_gemma]'));
+ $('input[name=maf]').val($('input[name=maf_gemma]'));
form_data = $('#trait_data_form').serialize();
console.log("form_data is:", form_data);
$.ajax({
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index e15d043b..ff05e859 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -69,38 +69,98 @@
<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">
+
+ function getValue(x) {
+ if (x.indexOf('input') >= 0) {
+ if ($(x).val() == 'x') {
+ return 0
+ }
+ else {
+ return parseFloat($(x).val());
+ }
+ }
+ return parseFloat(x);
+ }
+
+ jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) {
+ var x = getValue(a);
+ var y = getValue(b);
+ 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));
+ };
+
+ $(document).ready( function () {
+ console.time("Creating table");
+
+ {% if sample_groups[0].se_exists() %}
+ $('#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" },
+ null,
+ { "sType": "cust-txt" },
+ { "bSortable": false },
+ { "sType": "cust-txt" }
+ ],
+ "sDom": "ftr",
+ "oTableTools": {
+ "aButtons": [
+ "copy",
+ "print",
+ {
+ "sExtends": "collection",
+ "sButtonText": 'Save <span class="caret" />',
+ "aButtons": [ "csv", "xls", "pdf" ]
+ }
+ ],
+ "sSwfPath": "/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf"
+ },
+ "bPaginate": false,
+ "bLengthChange": true,
+ "bDeferRender": true,
+ "bSortClasses": false
+ } );
+ console.timeEnd("Creating table");
+
+ {% else %}
+
+
+ console.time("Creating table");
+
+ $('#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" },
+ null,
+ { "sType": "cust-txt" }
+ ],
+ "sDom": "ftr",
+ "oTableTools": {
+ "aButtons": [
+ "copy",
+ "print",
+ {
+ "sExtends": "collection",
+ "sButtonText": 'Save <span class="caret" />',
+ "aButtons": [ "csv", "xls", "pdf" ]
+ }
+ ],
+ "sSwfPath": "/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf"
+ },
+ "bPaginate": false,
+ "bLengthChange": true,
+ "bDeferRender": true,
+ "bSortClasses": false
+ } );
+ console.timeEnd("Creating table");
+ {% endif %}
+ });
+ </script>
- <script type="text/javascript" charset="utf-8">
- $(document).ready( function () {
- console.time("Creating table");
- $('#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" },
- null,
- null,
- { "bSortable": false },
- null
- ],
- "sDom": "ftr",
- "oTableTools": {
- "aButtons": [
- "copy",
- "print",
- {
- "sExtends": "collection",
- "sButtonText": 'Save <span class="caret" />',
- "aButtons": [ "csv", "xls", "pdf" ]
- }
- ],
- "sSwfPath": "/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf"
- },
- "bPaginate": false,
- "bLengthChange": true,
- "bDeferRender": true,
- "bSortClasses": false
- } );
- console.timeEnd("Creating table");
- });
- </script>
{% endblock %}
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index cc995f2f..f380988e 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -10,6 +10,9 @@
<a href="#marker_regression" data-toggle="tab">Marker Regression</a>
</li>
<li>
+ <a href="#plink" data-toggle="tab">PLINK</a>
+ </li>
+ <li>
<a href="#gemma" data-toggle="tab">GEMMA</a>
</li>
<!--<li>
@@ -114,20 +117,20 @@
<label class="control-label">Display all</label>
<div class="controls">
<label class="radio inline">
- <input type="radio" name="display_all" value="True" checked>
+ <input type="radio" name="display_all_reaper" value="True" checked>
Yes
</label>
<label class="radio inline">
- <input type="radio" name="display_all" value="False">
+ <input type="radio" name="display_all_reaper" value="False">
No
</label>
</div>
</div>
<div class="control-group" id="suggestive" >
- <label for="suggestive" class="control-label"
+ <label for="suggestive_reaper" class="control-label"
title="Control Locus">LOD score greater than: </label>
<div class="controls">
- <input name="suggestive" type="text" value="0"/>
+ <input name="suggestive_reaper" type="text" value="0"/>
</div>
</div>
@@ -151,32 +154,74 @@
</div>
+ <div class="tab-pane" id="plink">
+ <div class="control-group" id="display_all_div">
+ <label class="control-label">Display all</label>
+ <div class="controls">
+ <label class="radio inline">
+ <input type="radio" name="display_all_plink" value="True" checked>
+ Yes
+ </label>
+ <label class="radio inline">
+ <input type="radio" name="display_all_plink" value="False">
+ No
+ </label>
+ </div>
+ </div>
+ <div class="control-group" id="suggestive" >
+ <label for="suggestive_plink" class="control-label"
+ title="Control Locus">LOD score greater than: </label>
+ <div class="controls">
+ <input name="suggestive_plink" type="text" value="0"/>
+ </div>
+ </div>
+ <div class="control-group" id="suggestive" >
+ <label for="maf_plink" class="control-label"
+ title="Control Locus">Minor allele threshold: </label>
+ <div class="controls">
+ <input name="maf_plink" type="text" value="0.01"/>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <div class="controls">
+ <button id="plink_compute"
+ class="btn btn-inverse submit_special"
+ data-url="/marker_regression"
+ title="Compute using PLINK">
+ <i class="icon-ok-circle icon-white"></i> Compute
+ </button>
+ </div>
+ </div>
+
+ </div>
+
<div class="tab-pane" id="gemma">
<div class="control-group" id="display_all_div">
<label class="control-label">Display all</label>
<div class="controls">
<label class="radio inline">
- <input type="radio" name="display_all" value="True" checked>
+ <input type="radio" name="display_all_gemma" value="True" checked>
Yes
</label>
<label class="radio inline">
- <input type="radio" name="display_all" value="False">
+ <input type="radio" name="display_all_gemma" value="False">
No
</label>
</div>
</div>
<div class="control-group" id="suggestive" >
- <label for="suggestive" class="control-label"
+ <label for="suggestive_gemma" class="control-label"
title="Control Locus">LOD score greater than: </label>
<div class="controls">
- <input name="suggestive" type="text" value="0"/>
+ <input name="suggestive_gemma" type="text" value="0"/>
</div>
</div>
<div class="control-group" id="suggestive" >
- <label for="maf" class="control-label"
+ <label for="maf_gemma" class="control-label"
title="Control Locus">Minor allele threshold: </label>
<div class="controls">
- <input name="maf" type="text" value="0.01"/>
+ <input name="maf_gemma" type="text" value="0.01"/>
</div>
</div>