aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorDannyArends2015-09-27 09:12:19 +0200
committerDannyArends2015-09-27 09:12:19 +0200
commit531a018e3f394b3da6b42198bcf119a8abb4917b (patch)
treec9b624363cde29099e35985e35a638d3d436dd60 /wqflask
parent8a5dbce3273ba296a342054e2b2c23866006b5b4 (diff)
parent9f15eac5a1f6301f93e3dfc276924baca8f91d41 (diff)
downloadgenenetwork2-531a018e3f394b3da6b42198bcf119a8abb4917b.tar.gz
Merge branch 'master' of github.com:genenetwork/genenetwork2 into WGCNAintegration
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/correlation/show_corr_results.py39
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py9
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait.js5
-rwxr-xr-xwqflask/wqflask/templates/show_trait.html47
-rwxr-xr-xwqflask/wqflask/templates/show_trait_calculate_correlations.html14
-rwxr-xr-xwqflask/wqflask/templates/show_trait_statistics_new.html6
6 files changed, 101 insertions, 19 deletions
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 6a120325..63a7a555 100755
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -110,6 +110,17 @@ class CorrelationResults(object):
self.min_expr = float(start_vars['min_expr'])
self.p_range_lower = float(start_vars['p_range_lower'])
self.p_range_upper = float(start_vars['p_range_upper'])
+ self.min_location_chr = start_vars['min_loc_chr']
+ self.max_location_chr = start_vars['max_loc_chr']
+ if start_vars['min_loc_mb'].isdigit():
+ self.min_location_mb = start_vars['min_loc_mb']
+ else:
+ self.min_location_mb = 0
+ if start_vars['max_loc_mb'].isdigit():
+ self.max_location_mb = start_vars['max_loc_mb']
+ else:
+ self.max_location_mb = 1000
+ self.max_location = [start_vars['max_loc_chr'], start_vars['max_loc_mb']]
self.get_formatted_corr_type()
self.return_number = int(start_vars['corr_return_results'])
@@ -167,15 +178,35 @@ class CorrelationResults(object):
key=lambda t: -abs(t[1][0])))
+ #ZS: Convert min/max chromosome to an int for the location range option
+ min_chr_as_int = 1
+ max_chr_as_int = 30 #Just to make sure all are included if user inputs nothing
+ for order_id, chr_info in self.dataset.species.chromosomes.chromosomes.iteritems():
+ if chr_info.name == self.min_location_chr:
+ min_chr_as_int = order_id
+ if chr_info.name == self.max_location_chr:
+ max_chr_as_int = order_id
+
for _trait_counter, trait in enumerate(self.correlation_data.keys()[:self.return_number]):
print("trait name:", trait)
trait_object = GeneralTrait(dataset=self.target_dataset, name=trait, get_qtl_info=True)
- print("trait_object.mean:", trait_object.mean)
- print("self.min_expr:", self.min_expr)
- print("self.p_range_upper:", self.p_range_upper)
+
+ #ZS: Convert trait chromosome to an int for the location range option
+ chr_as_int = 0
+ for order_id, chr_info in self.dataset.species.chromosomes.chromosomes.iteritems():
+ if chr_info.name == trait_object.chr:
+ chr_as_int = order_id
+
if (float(trait_object.mean) > self.min_expr and
float(self.correlation_data[trait][0]) > self.p_range_lower and
- float(self.correlation_data[trait][0]) < self.p_range_upper):
+ float(self.correlation_data[trait][0]) < self.p_range_upper and
+ chr_as_int >= min_chr_as_int and
+ chr_as_int <= max_chr_as_int):
+
+ if (chr_as_int == min_chr_as_int and float(trait_object.mb) < float(self.min_location_mb)):
+ continue
+ elif (chr_as_int == max_chr_as_int and float(trait_object.mb) > float(self.max_location_mb)):
+ continue
(trait_object.sample_r,
trait_object.sample_p,
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index e83437ab..850c99a7 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -139,9 +139,12 @@ class ShowTrait(object):
self.temp_uuid = uuid.uuid4()
self.sample_group_types = OrderedDict()
- self.sample_group_types['samples_primary'] = self.dataset.group.name + " Only"
- self.sample_group_types['samples_other'] = "Non-" + self.dataset.group.name
- self.sample_group_types['samples_all'] = "All Cases"
+ if len(self.sample_groups) > 1:
+ self.sample_group_types['samples_primary'] = self.dataset.group.name + " Only"
+ self.sample_group_types['samples_other'] = "Non-" + self.dataset.group.name
+ self.sample_group_types['samples_all'] = "All Cases"
+ else:
+ self.sample_group_types['samples_primary'] = self.dataset.group.name
sample_lists = [group.sample_list for group in self.sample_groups]
print("sample_lists is:", pf(sample_lists))
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 302d5ec4..1dd54e3a 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -179,13 +179,10 @@
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
value = _ref[key];
- console.log("aa key:", key);
- console.log("aa value:", value);
the_id = process_id("column", key);
header += "<th id=\"" + the_id + "\">" + value + "</th>";
}
header += "</thead>";
- console.log("windex header is:", header);
the_rows = "<tbody>";
for (_i = 0, _len = Stat_Table_Rows.length; _i < _len; _i++) {
row = Stat_Table_Rows[_i];
@@ -201,9 +198,7 @@
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
- console.log("apple key:", key);
the_id = process_id(key, row.vn);
- console.log("the_id:", the_id);
row_line += "<td id=\"" + the_id + "\">foo</td>";
}
row_line += "</tr>";
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index c5921ccf..a86a149d 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -212,7 +212,7 @@
"buttons": [
'csv'
],
- "sDom": "RZBtir",
+ "sDom": "RZBtr",
"iDisplayLength": -1,
"autoWidth": false,
"bLengthChange": true,
@@ -240,7 +240,7 @@
"buttons": [
'csv'
],
- "sDom": "RZBtir",
+ "sDom": "RZBtr",
"iDisplayLength": -1,
"autoWidth": false,
"bLengthChange": true,
@@ -254,7 +254,48 @@
"paging": false
} );
{% endif %}
-
+
+ console.log("SAMPLE GROUP TYPES:", js_data.sample_group_types)
+ if (Object.keys(js_data.sample_group_types).length > 1) {
+ $('#stats_table').DataTable( {
+ "columns": [
+ { "bSortable": false },
+ { "bSortable": false },
+ { "bSortable": false },
+ { "bSortable": false }
+ ],
+ "sDom": "RZtr",
+ "iDisplayLength": -1,
+ "autoWidth": false,
+ "bLengthChange": true,
+ "bDeferRender": true,
+ "bSortClasses": false,
+ "colResize": {
+ "tableWidthFixed": false
+ },
+ "paging": false
+ } );
+ }
+ else {
+ $('#stats_table').DataTable( {
+ "columns": [
+ { "bSortable": false },
+ { "bSortable": false }
+ ],
+ "sDom": "RZtr",
+ "iDisplayLength": -1,
+ "autoWidth": false,
+ "bLengthChange": true,
+ "bDeferRender": true,
+ "bSortClasses": false,
+ "colResize": {
+ "tableWidthFixed": false
+ },
+ "paging": false
+ } );
+
+ }
+
var slider = document.getElementById('p_range_slider');
noUiSlider.create(slider, {
start: [-1.0, 1.0],
diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
index cefe9763..65b9d08e 100755
--- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html
+++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
@@ -80,6 +80,20 @@
</div>
</div>
<div class="form-group">
+ <label class="col-xs-1 control-label">Location</label>
+ <div class="col-xs-4 controls">
+ <span style="margin:10px;">
+ Min Chr: <input name="min_loc_chr" value="" type="text" class="form-control" style="width: 50px; display: inline;">
+ Mb: <input name="min_loc_mb" value="" type="text" class="form-control" style="width: 50px; display: inline;">
+ </span>
+ <br>
+ <span style="margin:10px;">
+ Max Chr: <input name="max_loc_chr" value="" type="text" class="form-control" style="width: 50px; display: inline;">
+ Mb: <input name="max_loc_mb" value="" type="text" class="form-control" style="width: 50px; display: inline;">
+ </span>
+ </div>
+ </div>
+ <div class="form-group">
<label class="col-xs-1 control-label">Range</label>
<div class="col-xs-3 controls">
<input name="p_range_lower" value="" type="hidden">
diff --git a/wqflask/wqflask/templates/show_trait_statistics_new.html b/wqflask/wqflask/templates/show_trait_statistics_new.html
index b7323ba3..1932d968 100755
--- a/wqflask/wqflask/templates/show_trait_statistics_new.html
+++ b/wqflask/wqflask/templates/show_trait_statistics_new.html
@@ -24,10 +24,8 @@
<div class="tab-content">
<div class="tab-pane active" id="stats_tab">
<div style="padding: 20px" class="form-horizontal">
- <div class="well">
- <h3>Stats</h3>
- <table id="stats_table" class="table table-hover"></table>
- </div>
+ <table id="stats_table" style="width: 300px; float: left;" class="table table-hover table-striped"></table>
+
</div>
</div>
<div class="tab-pane" id="histogram_tab">