aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/search_results.py72
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.coffee58
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js53
-rw-r--r--wqflask/wqflask/templates/show_trait.html22
4 files changed, 149 insertions, 56 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index d393d0c1..a9972349 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -771,37 +771,40 @@ class SearchResultPage(templatePage):
DescriptionText = self.ORDescriptionText
itemCmd = item[0]
- lowerLimit = float(item[1])
- upperLimit = float(item[2])
+ lower_limit = float(item[1])
+ upper_limit = float(item[2])
if itemCmd.upper() in ("TRANSLRS", "CISLRS"):
if item[3]:
mthresh = float(item[3])
clauseItem = " %sXRef.LRS > %2.7f and %sXRef.LRS < %2.7f " % \
- (self.dbType, min(lowerLimit, upperLimit), self.dbType, max(lowerLimit, upperLimit))
+ (self.dbType, min(lower_limit, upper_limit), self.dbType, max(lower_limit, upper_limit))
if itemCmd.upper() == "CISLRS":
clauseItem += """ and %sXRef.Locus = Geno.name and Geno.SpeciesId = %s and %s.Chr = Geno.Chr and ABS(%s.Mb-Geno.Mb) < %2.7f """ % (self.dbType, self.speciesId, self.dbType, self.dbType, mthresh)
- DescriptionText.append(HT.Span(' with a ', HT.U('cis-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit), mthresh)))
+ DescriptionText.append(HT.Span(' with a ', HT.U('cis-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lower_limit, upper_limit), max(lower_limit, upper_limit), mthresh)))
else:
clauseItem += """ and %sXRef.Locus = Geno.name and Geno.SpeciesId = %s and (%s.Chr != Geno.Chr or (%s.Chr != Geno.Chr and ABS(%s.Mb-Geno.Mb) > %2.7f)) """ % (self.dbType, self.speciesId, self.dbType, self.dbType, self.dbType, mthresh)
- DescriptionText.append(HT.Span(' with a ', HT.U('trans-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit), mthresh)))
+ DescriptionText.append(HT.Span(' with a ', HT.U('trans-QTL'), ' having an LRS between %g and %g using a %g Mb exclusion buffer' % (min(lower_limit, upper_limit), max(lower_limit, upper_limit), mthresh)))
query.append(" (%s) " % clauseItem)
self.orderByDefalut = "LRS"
else:
pass
elif itemCmd.upper() in ("RANGE"):
#XZ, 03/05/2009: Xiaodong changed Data to ProbeSetData
- clauseItem = " (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) > %2.7f and (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) < %2.7f " % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))
+ clauseItem = " (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) > %2.7f and (select Pow(2, max(value) -min(value)) from ProbeSetData where Id = ProbeSetXRef.dataId) < %2.7f " % (min(lower_limit, upper_limit), max(lower_limit, upper_limit))
query.append(" (%s) " % clauseItem)
- DescriptionText.append(HT.Span(' with a range of expression that varied between %g and %g' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit)), " (fold difference)"))
+ DescriptionText.append(HT.Span(' with a range of expression that varied between %g and %g' % (min(lower_limit, upper_limit), max(lower_limit, upper_limit)), " (fold difference)"))
else:
clauseItem = " %sXRef.%s > %2.7f and %sXRef.%s < %2.7f " % \
- (self.dbType, itemCmd, min(lowerLimit, upperLimit), self.dbType, itemCmd, max(lowerLimit, upperLimit))
+ (self.dbType, itemCmd, min(lower_limit, upper_limit), self.dbType, itemCmd, max(lower_limit, upper_limit))
query.append(" (%s) " % clauseItem)
self.orderByDefalut = itemCmd
- DescriptionText.append(HT.Span(' with ', HT.U(itemCmd), ' between %g and %g' % (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))))
+ DescriptionText.append(HT.Span(' with ', HT.U(itemCmd), ' between %g and %g' % (min(lower_limit, upper_limit), max(lower_limit, upper_limit))))
for k, item in enumerate(m3_OR+m3_AND):
+ print("enumerating m3_OR+m3_AND with k: %s - item %s" % (k, item))
+ if self.dbType not in ("ProbeSet", "Geno"):
+ continue
if k >=len(m3_OR):
query = self.ANDQuery
DescriptionText = self.ANDDescriptionText
@@ -809,23 +812,32 @@ class SearchResultPage(templatePage):
query = self.ORQuery
DescriptionText = self.ORDescriptionText
itemCmd = item[0]
- chrsch = item[1]
- lowerLimit = float(item[2])
- upperLimit = float(item[3])
- fname = 'target genes'
+
+
+ chr_number = item[1] # chromosome number
+ lower_limit = float(item[2])
+ upper_limit = float(item[3])
+
if self.dbType == "ProbeSet":
- clauseItem = " %s.Chr = '%s' and %s.Mb > %2.7f and %s.Mb < %2.7f " % \
- (self.dbType, chrsch, self.dbType, min(lowerLimit, upperLimit), self.dbType, max(lowerLimit, upperLimit))
+ fname = 'target genes'
elif self.dbType == "Geno":
fname = 'loci'
- clauseItem = " %s.Chr = '%s' and %s.Mb > %2.7f and %s.Mb < %2.7f " % \
- (self.dbType, chrsch, self.dbType, min(lowerLimit, upperLimit), self.dbType, max(lowerLimit, upperLimit))
- else:
- continue
+
+ if lower_limit > upper_limit:
+ lower_limit, upper_limit = upper_limit, lower_limit
+
+
+
+ clauseItem = " %s.Chr = '%s' and %s.Mb > %2.7f and %s.Mb < %2.7f " % (
+ self.dbType, chr_number, self.dbType, lower_limit, self.dbType, upper_limit)
+
+
query.append(" (%s) " % clauseItem)
self.orderByDefalut = itemCmd
- DescriptionText.append(HT.Span(' with ', HT.U('target genes'), ' on chromosome %s between %g and %g Mb' % \
- (chrsch, min(lowerLimit, upperLimit), max(lowerLimit, upperLimit))))
+
+ self.results_desc = dict()
+ #DescriptionText.append(HT.Span(' with ', HT.U('target genes'), ' on chromosome %s between %g and %g Mb' % \
+ # (chr_number, min(lower_limit, upper_limit), max(lower_limit, upper_limit))))
for k, item in enumerate(m5_OR+m5_AND):
if k >=len(m5_OR):
@@ -835,22 +847,22 @@ class SearchResultPage(templatePage):
query = self.ORQuery
DescriptionText = self.ORDescriptionText
itemCmd = item[0]
- lowerLimit = float(item[1])
- upperLimit = float(item[2])
- chrsch = item[3]
- MblowerLimit = float(item[4])
- MbupperLimit = float(item[5])
+ lower_limit = float(item[1])
+ upper_limit = float(item[2])
+ chr_number = item[3]
+ mb_lower_limit = float(item[4])
+ mb_upper_limit = float(item[5])
if self.dbType == "ProbeSet" or self.dbType == "Publish":
clauseItem = " %sXRef.LRS > %2.7f and %sXRef.LRS < %2.7f " % \
- (self.dbType, min(lowerLimit, upperLimit), self.dbType, max(lowerLimit, upperLimit))
+ (self.dbType, min(lower_limit, upper_limit), self.dbType, max(lower_limit, upper_limit))
clauseItem += " and %sXRef.Locus = Geno.name and Geno.SpeciesId = %s and Geno.Chr = '%s' and Geno.Mb > %2.7f and Geno.Mb < %2.7f" \
- % (self.dbType, self.speciesId, chrsch, min(MblowerLimit, MbupperLimit), max(MblowerLimit, MbupperLimit))
+ % (self.dbType, self.speciesId, chr_number, min(mb_lower_limit, mb_upper_limit), max(mb_lower_limit, mb_upper_limit))
query.append(" (%s) " % clauseItem)
self.orderByDefalut = "MB"
DescriptionText.append(HT.Span(' with ', HT.U('LRS'), ' between %g and %g' % \
- (min(lowerLimit, upperLimit), max(lowerLimit, upperLimit)), \
+ (min(lower_limit, upper_limit), max(lower_limit, upper_limit)), \
' on chromosome %s between %g and %g Mb' % \
- (chrsch, min(MblowerLimit, MbupperLimit), max(MblowerLimit, MbupperLimit))))
+ (chr_number, min(mb_lower_limit, mb_upper_limit), max(mb_lower_limit, mb_upper_limit))))
pass
return 1
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee
index 29489fb9..b89e15ce 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.coffee
+++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee
@@ -196,28 +196,56 @@ $ ->
exclude_by_value = $('#attribute_values').val()
cell_class = ".column_name-#{attribute_name}"
- $(cell_class).each (index, element)=>
+ $(cell_class).each (index, element) =>
if $.trim($(element).text()) == exclude_by_value
row = $(element).parent('tr')
$(row).find(".trait_value_input").val("x")
-
- #sample_lists = js_data['sample_lists']
- #console.log("sample_lists is:", sample_lists)
- #for sample_list in sample_lists
- # for sample in sample_list
- # console.log("sample is:", sample)
- # if sample.extra_attributes[attribute_name] == exclude_by_value
- # console.log("is exclude_by_value")
- # console.log("sample.name is:", sample.name)
- # attr_cell = $('td:contains('+sample.name+')').parent().find('td.column_name-'+ attribute_name)
- # console.log("attr_cell is:", attr_cell)
- # value_cell = attr_cell.parent().find('td.column_name-Value')
- # value_cell.children('input').val("x")
-
$('#exclude_group').click(block_by_attribute_value)
##End Block Samples By Attribute Value Code
+
+ ##Block Samples By Index Code
+ block_by_index = ->
+ index_string = $('#remove_samples_field').val()
+ console.log("index_string is:", index_string)
+ index_list = []
+ for index_set in index_string.split(",")
+ if index_set.indexOf('-') != -1
+ try
+ start_index = parseInt(index_set.split("-")[0])
+ console.log("start_index:", start_index)
+ end_index = parseInt(index_set.split("-")[1])
+ console.log("end_index:", end_index)
+ index_list.push(index) for index in [start_index..end_index]
+ catch error
+ alert("Syntax error")
+ else
+ #try
+ index = parseInt(index_set)
+ console.log("index:", index)
+ index_list.push(index)
+ #catch(erro)
+ # alert("Syntax error")
+ console.log("index_list:", index_list)
+ for index in index_list
+ if $('#block_group').val() == "primary"
+ console.log("block_group:", $('#block_group').val())
+ console.log("row:", $('#Primary_'+index.toString()))
+ $('#Primary_'+index.toString()).find('.trait_value_input').val("x")
+ else if $('#block_group').val() == "other"
+ $('#Other_'+index.toString()).find('.trait_value_input').val("x")
+
+ $('#remove_samples_field').validate(
+ rules:
+ field:
+ required: true
+ number: true
+ )
+
+ $('#block_by_index').click(block_by_index)
+
+ ##End Block Samples By Index Code
console.log("before registering show_hide_outliers")
$('#show_hide_outliers').click(show_hide_outliers)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index a5582519..6d3dee13 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -11,7 +11,7 @@
};
$(function() {
- var block_by_attribute_value, change_stats_value, create_value_dropdown, edit_data_change, hide_tabs, make_table, on_corr_method_change, populate_sample_attributes_values_dropdown, process_id, show_hide_outliers, stats_mdp_change, update_stat_values;
+ var block_by_attribute_value, block_by_index, change_stats_value, create_value_dropdown, edit_data_change, hide_tabs, make_table, on_corr_method_change, populate_sample_attributes_values_dropdown, process_id, show_hide_outliers, stats_mdp_change, update_stat_values;
hide_tabs = function(start) {
var x, _i, _results;
_results = [];
@@ -238,6 +238,57 @@
});
};
$('#exclude_group').click(block_by_attribute_value);
+ block_by_index = function() {
+ var end_index, index, index_list, index_set, index_string, start_index, _i, _j, _k, _len, _len1, _ref, _results;
+ index_string = $('#remove_samples_field').val();
+ console.log("index_string is:", index_string);
+ index_list = [];
+ _ref = index_string.split(",");
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ index_set = _ref[_i];
+ if (index_set.indexOf('-') !== -1) {
+ try {
+ start_index = parseInt(index_set.split("-")[0]);
+ console.log("start_index:", start_index);
+ end_index = parseInt(index_set.split("-")[1]);
+ console.log("end_index:", end_index);
+ for (index = _j = start_index; start_index <= end_index ? _j <= end_index : _j >= end_index; index = start_index <= end_index ? ++_j : --_j) {
+ index_list.push(index);
+ }
+ } catch (error) {
+ alert("Syntax error");
+ }
+ } else {
+ index = parseInt(index_set);
+ console.log("index:", index);
+ index_list.push(index);
+ }
+ }
+ console.log("index_list:", index_list);
+ _results = [];
+ for (_k = 0, _len1 = index_list.length; _k < _len1; _k++) {
+ index = index_list[_k];
+ if ($('#block_group').val() === "primary") {
+ console.log("block_group:", $('#block_group').val());
+ console.log("row:", $('#Primary_' + index.toString()));
+ _results.push($('#Primary_' + index.toString()).find('.trait_value_input').val("x"));
+ } else if ($('#block_group').val() === "other") {
+ _results.push($('#Other_' + index.toString()).find('.trait_value_input').val("x"));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+ $('#remove_samples_field').validate({
+ rules: {
+ field: {
+ required: true,
+ number: true
+ }
+ }
+ });
+ $('#block_by_index').click(block_by_index);
console.log("before registering show_hide_outliers");
$('#show_hide_outliers').click(show_hide_outliers);
console.log("after registering show_hide_outliers");
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index f85cf98e..5a364f8b 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -1214,18 +1214,19 @@
<div style=
"border: 3px solid #EEEEEE; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 625px; padding: 5px 5px 10px 8px; font-size: 12px; background: #DDDDDD;">
<span id="showHideOptions" style="line-height:225%;"><strong>&nbsp;&nbsp;Block samples by index:&nbsp;&nbsp;&nbsp;&nbsp;</strong>
- <input type="text" name="removeField" style=
- "background-color:white;border: 1px solid black;font-size: 14px;">&nbsp;&nbsp;&nbsp;<span id="blockMenuSpan"><select name=
- "block_method" size="1">
- <option value="1">
- BXD Only
+ <input type="text" id="remove_samples_field" style=
+ "background-color:white;border: 1px solid black;font-size: 14px;">&nbsp;&nbsp;&nbsp;
+ <span id="blockMenuSpan">
+ <select id="block_group" size="1">
+ <option value="primary">
+ {{ sample_group_types['primary_only'] }}
</option>
-
- <option value="0">
- Non-BXD Only
+ <option value="other">
+ {{ sample_group_types['other_only'] }}
</option>
- </select></span> &nbsp;&nbsp;&nbsp;
- <input type="button" name="blockSamples" class="button" value=" Block ">
+ </select>
+ </span> &nbsp;&nbsp;&nbsp;
+ <input type="button" id="block_by_index" class="button" value=" Block ">
<br>
{% if sample_groups[0].attributes %}
@@ -1362,6 +1363,7 @@
<script type="text/javascript" src="/static/new/js_external/underscore-min.js"></script>-->
<script type="text/javascript" src="/static/new/js_external/underscore.string.min.js"></script>
+ <script type="text/javascript" src="/static/new/packages/ValidationPlugin/dist/jquery.validate.min.js"></script>
<script type="text/javascript" src="/static/new/javascript/stats.js"></script>
<script type="text/javascript" src="/static/new/javascript/show_trait.js"></script>