aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py42
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py46
-rwxr-xr-xwqflask/wqflask/search_results.py4
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py9
-rw-r--r--[-rwxr-xr-x]wqflask/wqflask/static/new/javascript/show_trait.js8
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html11
-rwxr-xr-xwqflask/wqflask/templates/show_trait.html14
-rwxr-xr-xwqflask/wqflask/templates/show_trait_statistics.html1
8 files changed, 105 insertions, 30 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 0bc10b97..af22b5a1 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -308,6 +308,7 @@ class GeneralTrait(object):
if isinstance(trait_info[i], basestring):
holder = unicode(trait_info[i], "utf8", "ignore")
setattr(self, field, holder)
+<<<<<<< HEAD
description_string = unicode(str(self.description).strip(codecs.BOM_UTF8), 'utf-8')
target_string = unicode(str(self.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8')
@@ -345,6 +346,8 @@ class GeneralTrait(object):
self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb))
self.location_value = trait_location_value
+=======
+>>>>>>> e0c5c1aae3aaaa1d81bcec36835a97e169dcc2e2
if self.dataset.type == 'Publish':
self.confidential = 0
@@ -379,8 +382,8 @@ class GeneralTrait(object):
if self.pubmed_id:
self.pubmed_link = webqtlConfig.PUBMEDLINK_URL % self.pubmed_id
+
self.homologeneid = None
-
if self.dataset.type == 'ProbeSet' and self.dataset.group and self.geneid:
#XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number.
#XZ: So I have to test if geneid is number before execute the query.
@@ -408,6 +411,43 @@ class GeneralTrait(object):
if result:
self.homologeneid = result[0]
+
+ description_string = unicode(str(self.description).strip(codecs.BOM_UTF8), 'utf-8')
+ target_string = unicode(str(self.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8')
+
+ if len(description_string) > 1 and description_string != 'None':
+ description_display = description_string
+ else:
+ description_display = self.symbol
+
+ if (len(description_display) > 1 and description_display != 'N/A' and
+ len(target_string) > 1 and target_string != 'None'):
+ description_display = description_display + '; ' + target_string.strip()
+
+ # Save it for the jinja2 template
+ self.description_display = description_display
+
+ #XZ: trait_location_value is used for sorting
+ trait_location_repr = 'N/A'
+ trait_location_value = 1000000
+
+ if self.chr and self.mb:
+ #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y")
+ #This is so we can convert the location to a number used for sorting
+ trait_location_value = convert_location_to_value(self.chr, self.mb)
+ #try:
+ # trait_location_value = int(self.chr)*1000 + self.mb
+ #except ValueError:
+ # if self.chr.upper() == 'X':
+ # trait_location_value = 20*1000 + self.mb
+ # else:
+ # trait_location_value = (ord(str(self.chr).upper()[0])*1000 +
+ # self.mb)
+
+ #ZS: Put this in function currently called "convert_location_to_value"
+ self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb))
+ self.location_value = trait_location_value
+
if get_qtl_info:
#LRS and its location
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 63f62411..01303b0f 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -2007,6 +2007,7 @@ class MarkerRegression(object):
previous_chr = 1
previous_chr_as_int = 0
+ lineWidth = 1
oldStartPosX = 0
startPosX = xLeftOffset
for i, qtlresult in enumerate(self.qtlresults):
@@ -2015,6 +2016,41 @@ class MarkerRegression(object):
thisLRSColor = self.colorCollection[0]
if qtlresult['chr'] != previous_chr and self.selectedChr == -1:
+ if self.manhattan_plot != True:
+ canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+
+ if not self.multipleInterval and self.additiveChecked:
+ plusColor = self.ADDITIVE_COLOR_POSITIVE
+ minusColor = self.ADDITIVE_COLOR_NEGATIVE
+ for k, aPoint in enumerate(AdditiveCoordXY):
+ if k > 0:
+ Xc0, Yc0 = AdditiveCoordXY[k-1]
+ Xc, Yc = aPoint
+ if (Yc0-yZero)*(Yc-yZero) < 0:
+ if Xc == Xc0: #genotype , locus distance is 0
+ Xcm = Xc
+ else:
+ Xcm = (yZero-Yc0)/((Yc-Yc0)/(Xc-Xc0)) +Xc0
+ if Yc0 < yZero:
+ canvas.drawLine(Xc0, Yc0, Xcm, yZero, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ canvas.drawLine(Xcm, yZero, Xc, yZero-(Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ else:
+ canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xcm, yZero, color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ canvas.drawLine(Xcm, yZero, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ elif (Yc0-yZero)*(Yc-yZero) > 0:
+ if Yc < yZero:
+ canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ else:
+ canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ else:
+ minYc = min(Yc-yZero, Yc0-yZero)
+ if minYc < 0:
+ canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+ else:
+ canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+
+ LRSCoordXY = []
+ AdditiveCoordXY = []
previous_chr = qtlresult['chr']
previous_chr_as_int += 1
@@ -2032,7 +2068,6 @@ class MarkerRegression(object):
else:
this_chr = str(self.ChrList[self.selectedChr][1]+1)
if self.selectedChr == -1 or str(qtlresult['chr']) == this_chr:
- #LRSCoordXY = []
#AdditiveCoordXY = []
#DominanceCoordXY = []
#for k, _locus in enumerate(_chr):
@@ -2087,10 +2122,11 @@ class MarkerRegression(object):
# Yc = yZero - qtlresult['dominance']*DominanceHeightThresh/dominanceMax
# DominanceCoordXY.append((Xc, Yc))
m += 1
-
#canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
- lineWidth = 1
+ if self.manhattan_plot != True:
+ canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+
if not self.multipleInterval and self.additiveChecked:
plusColor = self.ADDITIVE_COLOR_POSITIVE
minusColor = self.ADDITIVE_COLOR_NEGATIVE
@@ -2120,6 +2156,7 @@ class MarkerRegression(object):
canvas.drawLine(Xc0, Yc0, Xc, Yc, color=plusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
else:
canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+
if not self.multipleInterval and INTERCROSS and self.dominanceChecked:
plusColor = self.DOMINANCE_COLOR_POSITIVE
minusColor = self.DOMINANCE_COLOR_NEGATIVE
@@ -2151,9 +2188,6 @@ class MarkerRegression(object):
canvas.drawLine(Xc0, yZero - (Yc0-yZero), Xc, yZero - (Yc-yZero), color=minusColor, width=lineWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
- if self.manhattan_plot != True:
- canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
-
###draw additive scale
if not self.multipleInterval and self.additiveChecked:
additiveScaleFont=pid.Font(ttf="verdana",size=16*zoom,bold=0)
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index fb03f027..a57bfffe 100755
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -119,9 +119,9 @@ class SearchResultPage(object):
#### Excel file needs to be generated ####
- print("foo locals are:", locals())
+ #print("foo locals are:", locals())
trait_id = result[0]
- this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True)
+ this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
self.trait_list.append(this_trait)
self.dataset.get_trait_info(self.trait_list, species)
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 3cc6121f..2d4c952a 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -152,10 +152,11 @@ class ShowTrait(object):
self.trait_table_width = get_trait_table_width(self.sample_groups)
- js_data = dict(sample_group_types = self.sample_group_types,
- sample_lists = sample_lists,
- attribute_names = self.sample_groups[0].attributes,
- temp_uuid = self.temp_uuid)
+ js_data = dict(dataset_type = self.dataset.type,
+ sample_group_types = self.sample_group_types,
+ sample_lists = sample_lists,
+ attribute_names = self.sample_groups[0].attributes,
+ temp_uuid = self.temp_uuid)
self.js_data = js_data
def get_mapping_methods(self):
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 8d5982b7..9e249c28 100755..100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -174,7 +174,6 @@
make_table = function() {
var header, key, row, row_line, table, the_id, the_rows, value, _i, _len, _ref, _ref1;
header = "<thead><tr><th>&nbsp;</th>";
- console.log("js_data.sample_group_types:", js_data.sample_group_types);
_ref = js_data.sample_group_types;
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
@@ -186,14 +185,15 @@
the_rows = "<tbody>";
for (_i = 0, _len = Stat_Table_Rows.length; _i < _len; _i++) {
row = Stat_Table_Rows[_i];
- console.log("rowing");
+ if ((row.vn == "range_fold" || row.vn == "range") && js_data.dataset_type == "Publish"){
+ continue;
+ }
row_line = "<tr>";
if (row.url != null) {
row_line += "<td id=\"" + row.vn + "\"><a href=\"" + row.url + "\">" + row.pretty + "</a></td>";
} else {
row_line += "<td id=\"" + row.vn + "\">" + row.pretty + "</td>";
}
- console.log("box - js_data.sample_group_types:", js_data.sample_group_types);
_ref1 = js_data.sample_group_types;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
@@ -202,12 +202,10 @@
row_line += "<td id=\"" + the_id + "\">foo</td>";
}
row_line += "</tr>";
- console.log("row line:", row_line);
the_rows += row_line;
}
the_rows += "</tbody>";
table = header + the_rows;
- console.log("table is:", table);
return $("#stats_table").append(table);
};
process_id = function() {
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index d7950754..f3f33fad 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -87,8 +87,8 @@
</td>
</tr>
</table>
- </div>
- <div class="col-xs-4" style="padding: 0px;">
+ </div>
+ <div class="col-xs-4" style="padding: 0px;">
{% if (mapping_method == "reaper" or mapping_method == "rqtl_geno") and nperm > 0 %}
<input type="checkbox" name="permCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if permChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Permutation Test
<a href="http://genenetwork.org/glossary.html#Permutation" target="_blank">
@@ -121,7 +121,10 @@
{% if plotScale != "morgan" %}
<input type="checkbox" name="haplotypeAnalystCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if haplotypeAnalystChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Haplotype Analyst </span> <span style="color:red;">*</span>
{% endif %}
- </div>
+ </div>
+ <div class="col-xs-12" align="center" style="padding: 5px;">
+ <span style="color:red;">*</span> <span style="font-size: 12px;">only apply to single chromosome physical mapping</span>
+ </div>
</div>
</div>
@@ -162,6 +165,7 @@
</div>
</form>
+ {% if selectedChr == -1 %}
<div style="width:48%;">
<h2>
Results
@@ -219,6 +223,7 @@
</tbody>
</table>
</div>
+ {% endif %}
</div>
<!-- End of body -->
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 62a08d85..7429cd5f 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -257,12 +257,10 @@
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 }
+ "columnDefs": [
+ { "orderable": false, "targets": [0, 1, 2, 3] }
],
+ "order": [],
"sDom": "tr",
"iDisplayLength": -1,
"autoWidth": false,
@@ -274,10 +272,10 @@
}
else {
$('#stats_table').DataTable( {
- "columns": [
- { "bSortable": false },
- { "bSortable": false }
+ "columnDefs": [
+ { "orderable": false, "targets": [0, 1] }
],
+ "order": [],
"sDom": "tr",
"iDisplayLength": -1,
"autoWidth": false,
diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html
index 2183dd30..9c5c94b2 100755
--- a/wqflask/wqflask/templates/show_trait_statistics.html
+++ b/wqflask/wqflask/templates/show_trait_statistics.html
@@ -27,7 +27,6 @@
<div class="tab-pane active" id="stats_tab">
<div style="padding: 20px" class="form-horizontal">
<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">