aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2015-06-05 22:14:38 +0000
committerzsloan2015-06-05 22:14:38 +0000
commit29b51444acbc6fa7c839bb588d7985c79364dc3d (patch)
tree98f2f28dfc2c8ae861e443e413c7f868ce6f4136 /wqflask
parent204f56b654e4498a3e83fb382e3dad888f976394 (diff)
downloadgenenetwork2-29b51444acbc6fa7c839bb588d7985c79364dc3d.tar.gz
Added back in some of the options on the trait page; Add, Find, and Verify now work. I'll get the other 4 working next.
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py21
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait.coffee8
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait.js163
-rwxr-xr-xwqflask/wqflask/templates/show_trait.html1
-rwxr-xr-xwqflask/wqflask/templates/show_trait_details.html24
-rwxr-xr-xwqflask/wqflask/templates/show_trait_edit_data.html8
6 files changed, 123 insertions, 102 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 7ad824fa..adb12b7b 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -362,34 +362,35 @@ class ShowTrait(object):
#--------Hongqiang add this part in order to not only blat ProbeSet, but also blat Probe
blatsequence = '%3E'+this_trait.name+'%0A'+blatsequence+'%0A'
#XZ, 06/03/2009: ProbeSet name is not unique among platforms. We should use ProbeSet Id instead.
- self.cursor.execute("""SELECT Probe.Sequence, Probe.Name
+ query = """SELECT Probe.Sequence, Probe.Name
FROM Probe, ProbeSet, ProbeSetFreeze, ProbeSetXRef
WHERE ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND
ProbeSetXRef.ProbeSetId = ProbeSet.Id AND
- ProbeSetFreeze.Name = '%s' AND
- ProbeSet.Name = '%s' AND
- Probe.ProbeSetId = ProbeSet.Id order by Probe.SerialOrder""" % (this_trait.dataset.name, this_trait.name) )
+ ProbeSetFreeze.Name = '{}' AND
+ ProbeSet.Name = '{}' AND
+ Probe.ProbeSetId = ProbeSet.Id order by Probe.SerialOrder""".format(this_trait.dataset.name, this_trait.name)
+
+ seqs = g.db.execute(query).fetchall()
- seqs = self.cursor.fetchall()
for seqt in seqs:
if int(seqt[1][-1]) %2 == 1:
blatsequence += '%3EProbe_'+string.strip(seqt[1])+'%0A'+string.strip(seqt[0])+'%0A'
#XZ: Pay attention to the parameter of version (rn, mm, hg). They need to be changed if necessary.
if _Species == "rat":
- UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence)
+ self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence)
UTHSC_BLAT_URL = ""
elif _Species == "mouse":
- UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', blatsequence)
+ self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', blatsequence)
UTHSC_BLAT_URL = webqtlConfig.UTHSC_BLAT % ('mouse', 'mm9', blatsequence)
elif _Species == "human":
- UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('human', 'hg19', blatsequence)
+ self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('human', 'hg19', blatsequence)
UTHSC_BLAT_URL = ""
else:
- UCSC_BLAT_URL = ""
+ self.UCSC_BLAT_URL = ""
UTHSC_BLAT_URL = ""
- if UCSC_BLAT_URL:
+ if self.UCSC_BLAT_URL != "":
verifyButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % UCSC_BLAT_URL)
verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="verify", alt=" Check probe locations at UCSC ",
title=" Check probe locations at UCSC ", style="border:none;")
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee
index 3dedd7d5..91aa15ba 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait.coffee
+++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee
@@ -61,6 +61,14 @@ Stat_Table_Rows = [
]
$ ->
+
+ add = ->
+ trait = $("input[name=trait_hmac]").val()
+ console.log("trait is:", trait)
+ $.colorbox({href:"/collections/add?traits=#{trait}"})
+
+ $('#add_to_collection').click(add)
+
sample_lists = js_data.sample_lists
sample_group_types = js_data.sample_group_types
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 7311d0a8..302d5ec4 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -1,8 +1,8 @@
-// Generated by CoffeeScript 1.9.2
+// Generated by CoffeeScript 1.8.0
(function() {
var Stat_Table_Rows, is_number,
- hasProp = {}.hasOwnProperty,
- slice = [].slice;
+ __hasProp = {}.hasOwnProperty,
+ __slice = [].slice;
console.log("start_b");
@@ -56,7 +56,16 @@
];
$(function() {
- var block_by_attribute_value, block_by_index, block_outliers, change_stats_value, create_value_dropdown, edit_data_change, export_sample_table_data, get_sample_table_data, hide_no_value, hide_tabs, make_table, on_corr_method_change, open_trait_selection, populate_sample_attributes_values_dropdown, process_id, redraw_bar_chart, redraw_histogram, redraw_prob_plot, reset_samples_table, sample_group_types, sample_lists, show_hide_outliers, stats_mdp_change, update_stat_values;
+ var add, block_by_attribute_value, block_by_index, block_outliers, change_stats_value, create_value_dropdown, edit_data_change, export_sample_table_data, get_sample_table_data, hide_no_value, hide_tabs, make_table, on_corr_method_change, open_trait_selection, populate_sample_attributes_values_dropdown, process_id, redraw_bar_chart, redraw_histogram, redraw_prob_plot, reset_samples_table, sample_group_types, sample_lists, show_hide_outliers, stats_mdp_change, update_stat_values;
+ add = function() {
+ var trait;
+ trait = $("input[name=trait_hmac]").val();
+ console.log("trait is:", trait);
+ return $.colorbox({
+ href: "/collections/add?traits=" + trait
+ });
+ };
+ $('#add_to_collection').click(add);
sample_lists = js_data.sample_lists;
sample_group_types = js_data.sample_group_types;
d3.select("#select_compare_trait").on("click", (function(_this) {
@@ -82,12 +91,12 @@
})(this));
};
hide_tabs = function(start) {
- var i, ref, results, x;
- results = [];
- for (x = i = ref = start; ref <= 10 ? i <= 10 : i >= 10; x = ref <= 10 ? ++i : --i) {
- results.push($("#stats_tabs" + x).hide());
+ var x, _i, _results;
+ _results = [];
+ for (x = _i = start; start <= 10 ? _i <= 10 : _i >= 10; x = start <= 10 ? ++_i : --_i) {
+ _results.push($("#stats_tabs" + x).hide());
}
- return results;
+ return _results;
};
stats_mdp_change = function() {
var selected;
@@ -124,36 +133,36 @@
}
};
update_stat_values = function(sample_sets) {
- var category, i, len, ref, results, row, show_effects;
+ var category, row, show_effects, _i, _len, _ref, _results;
show_effects = $(".tab-pane.active").attr("id") === "stats_tab";
- ref = ['samples_primary', 'samples_other', 'samples_all'];
- results = [];
- for (i = 0, len = ref.length; i < len; i++) {
- category = ref[i];
- results.push((function() {
- var j, len1, results1;
- results1 = [];
- for (j = 0, len1 = Stat_Table_Rows.length; j < len1; j++) {
- row = Stat_Table_Rows[j];
+ _ref = ['samples_primary', 'samples_other', 'samples_all'];
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ category = _ref[_i];
+ _results.push((function() {
+ var _j, _len1, _results1;
+ _results1 = [];
+ for (_j = 0, _len1 = Stat_Table_Rows.length; _j < _len1; _j++) {
+ row = Stat_Table_Rows[_j];
console.log("Calling change_stats_value");
- results1.push(change_stats_value(sample_sets, category, row.vn, row.digits, show_effects));
+ _results1.push(change_stats_value(sample_sets, category, row.vn, row.digits, show_effects));
}
- return results1;
+ return _results1;
})());
}
- return results;
+ return _results;
};
redraw_histogram = function() {
var x;
return root.histogram.redraw((function() {
- var i, len, ref, results;
- ref = _.values(root.selected_samples[root.histogram_group]);
- results = [];
- for (i = 0, len = ref.length; i < len; i++) {
- x = ref[i];
- results.push(x.value);
+ var _i, _len, _ref, _results;
+ _ref = _.values(root.selected_samples[root.histogram_group]);
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ x = _ref[_i];
+ _results.push(x.value);
}
- return results;
+ return _results;
})());
};
redraw_bar_chart = function() {
@@ -163,13 +172,13 @@
return root.redraw_prob_plot_impl(root.selected_samples, root.prob_plot_group);
};
make_table = function() {
- var header, i, key, len, ref, ref1, row, row_line, table, the_id, the_rows, value;
+ 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;
- value = ref[key];
+ _ref = js_data.sample_group_types;
+ 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);
@@ -178,8 +187,8 @@
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];
+ for (_i = 0, _len = Stat_Table_Rows.length; _i < _len; _i++) {
+ row = Stat_Table_Rows[_i];
console.log("rowing");
row_line = "<tr>";
if (row.url != null) {
@@ -188,10 +197,10 @@
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;
- value = ref1[key];
+ _ref1 = js_data.sample_group_types;
+ 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);
@@ -207,13 +216,13 @@
return $("#stats_table").append(table);
};
process_id = function() {
- var i, len, processed, value, values;
- values = 1 <= arguments.length ? slice.call(arguments, 0) : [];
+ var processed, value, values, _i, _len;
+ values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
/* Make an id or a class valid javascript by, for example, eliminating spaces */
processed = "";
- for (i = 0, len = values.length; i < len; i++) {
- value = values[i];
+ for (_i = 0, _len = values.length; _i < _len; _i++) {
+ value = values[_i];
console.log("value:", value);
value = value.replace(" ", "_");
if (processed.length) {
@@ -224,7 +233,7 @@
return processed;
};
edit_data_change = function() {
- var already_seen, checkbox, checked, i, j, len, len1, name, real_dict, real_value, real_variance, row, rows, sample_sets, table, tables;
+ var already_seen, checkbox, checked, name, real_dict, real_value, real_variance, row, rows, sample_sets, table, tables, _i, _j, _len, _len1;
already_seen = {};
sample_sets = {
samples_primary: new Stats([]),
@@ -238,11 +247,11 @@
};
console.log("at beginning:", sample_sets);
tables = ['samples_primary', 'samples_other'];
- for (i = 0, len = tables.length; i < len; i++) {
- table = tables[i];
+ for (_i = 0, _len = tables.length; _i < _len; _i++) {
+ table = tables[_i];
rows = $("#" + table).find('tr');
- for (j = 0, len1 = rows.length; j < len1; j++) {
- row = rows[j];
+ for (_j = 0, _len1 = rows.length; _j < _len1; _j++) {
+ row = rows[_j];
name = $(row).find('.edit_sample_sample_name').html();
name = $.trim(name);
real_value = $(row).find('.edit_sample_value').val();
@@ -310,26 +319,26 @@
return "<option val=" + value + ">" + value + "</option>";
};
populate_sample_attributes_values_dropdown = function() {
- var attribute_info, i, key, len, ref, ref1, results, sample_attributes, selected_attribute, value;
+ var attribute_info, key, sample_attributes, selected_attribute, value, _i, _len, _ref, _ref1, _results;
console.log("in beginning of psavd");
$('#attribute_values').empty();
sample_attributes = {};
- ref = js_data.attribute_names;
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- attribute_info = ref[key];
+ _ref = js_data.attribute_names;
+ for (key in _ref) {
+ if (!__hasProp.call(_ref, key)) continue;
+ attribute_info = _ref[key];
sample_attributes[attribute_info.name] = attribute_info.distinct_values;
}
console.log("[visa] attributes is:", sample_attributes);
selected_attribute = $('#exclude_menu').val().replace("_", " ");
console.log("selected_attribute is:", selected_attribute);
- ref1 = sample_attributes[selected_attribute];
- results = [];
- for (i = 0, len = ref1.length; i < len; i++) {
- value = ref1[i];
- results.push($(create_value_dropdown(value)).appendTo($('#attribute_values')));
+ _ref1 = sample_attributes[selected_attribute];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ value = _ref1[_i];
+ _results.push($(create_value_dropdown(value)).appendTo($('#attribute_values')));
}
- return results;
+ return _results;
};
if (js_data.attribute_names.length > 0) {
populate_sample_attributes_values_dropdown();
@@ -352,17 +361,17 @@
};
$('#exclude_group').click(block_by_attribute_value);
block_by_index = function() {
- var end_index, error, i, index, index_list, index_set, index_string, j, k, len, len1, ref, ref1, ref2, results, start_index;
+ var end_index, error, index, index_list, index_set, index_string, start_index, _i, _j, _k, _len, _len1, _ref, _results;
index_string = $('#remove_samples_field').val();
index_list = [];
- ref = index_string.split(",");
- for (i = 0, len = ref.length; i < len; i++) {
- index_set = ref[i];
+ _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]);
end_index = parseInt(index_set.split("-")[1]);
- for (index = j = ref1 = start_index, ref2 = end_index; ref1 <= ref2 ? j <= ref2 : j >= ref2; index = ref1 <= ref2 ? ++j : --j) {
+ 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) {
@@ -376,22 +385,22 @@
}
}
console.log("index_list:", index_list);
- results = [];
- for (k = 0, len1 = index_list.length; k < len1; k++) {
- index = index_list[k];
+ _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"));
+ _results.push($('#Primary_' + index.toString()).find('.trait_value_input').val("x"));
} else if ($('#block_group').val() === "other") {
console.log("block_group:", $('#block_group').val());
console.log("row:", $('#Other_' + index.toString()));
- results.push($('#Other_' + index.toString()).find('.trait_value_input').val("x"));
+ _results.push($('#Other_' + index.toString()).find('.trait_value_input').val("x"));
} else {
- results.push(void 0);
+ _results.push(void 0);
}
}
- return results;
+ return _results;
};
$('#block_by_index').click(block_by_index);
hide_no_value = function() {
@@ -428,17 +437,17 @@
samples = [];
$('#' + table_name).find('.value_se').each((function(_this) {
return function(_index, element) {
- var attribute_info, key, ref, row_data;
+ var attribute_info, key, row_data, _ref;
row_data = {};
row_data.name = $.trim($(element).find('.column_name-Sample').text());
row_data.value = $(element).find('.edit_sample_value').val();
if ($(element).find('.edit_sample_se').length !== -1) {
row_data.se = $(element).find('.edit_sample_se').val();
}
- ref = js_data.attribute_names;
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- attribute_info = ref[key];
+ _ref = js_data.attribute_names;
+ for (key in _ref) {
+ if (!__hasProp.call(_ref, key)) continue;
+ attribute_info = _ref[key];
row_data[attribute_info.name] = $.trim($(element).find('.column_name-' + attribute_info.name.replace(" ", "_")).text());
}
console.log("row_data is:", row_data);
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 559650f3..c0a404d9 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -26,6 +26,7 @@
<form method="post" action="/corr_compute" name="trait_page" id="trait_data_form"
class="form-horizontal">
<div id="hidden_inputs">
+ <input type="hidden" name="trait_hmac" value="{{ data_hmac('{}:{}'.format(this_trait.name, dataset.name)) }}">
{% for key in hddn %}
<input type="hidden" name="{{ key }}" value="{{ hddn[key] }}">
{% endfor %}
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index ffedbd5f..c938c683 100755
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -60,38 +60,40 @@
-<!--<div class="btn-toolbar">
+<div style="margin-bottom:15px;" class="btn-toolbar">
<div class="btn-group">
- <button class="btn btn-primary" title="Add to collection">
+ <button type="button" id="add_to_collection" class="btn btn-primary" title="Add to collection">
<i class="icon-plus-sign icon-white"></i> Add
</button>
-
- <button class="btn" title="Find similar expression data">
+ <a href="#redirect" onclick="window.open('http://www.genenetwork.org/webqtl/main.py?cmd=sch&amp;gene=Shh&amp;alias=1&amp;species=mouse')">
+ <button type="button" class="btn btn-default" title="Find similar expression data">
<i class="icon-search"></i> Find
</button>
-
- <button class="btn" title="Check probe locations at UCSC">
+ </a>
+ <a href="#redirect" onclick="window.open('{{ UCSC_BLAT_URL }}')">
+ <button type="button" class="btn btn-default" title="Check probe locations at UCSC">
<i class="icon-ok"></i> Verify
</button>
+ </a>
</div>
<div class="btn-group">
- <button class="btn" title="Write or review comments about this gene">
+ <button type="button" class="btn btn-default" title="Write or review comments about this gene">
<i class="icon-edit"></i> GeneWiki
</button>
- <button class="btn" title="View SNPs and Indels">
+ <button type="button" class="btn btn-default" title="View SNPs and Indels">
<i class="icon-road"></i> SNPs
</button>
- <button class="btn" title="View probes, SNPs, and RNA-seq at UTHSC">
+ <button type="button" class="btn btn-default" title="View probes, SNPs, and RNA-seq at UTHSC">
<i class="icon-eye-close"></i> RNA-seq
</button>
- <button class="btn" title="Check sequence of probes">
+ <button type="button" class="btn btn-default" title="Check sequence of probes">
<i class="icon-list"></i> Probes
</button>
</div>
-</div>-->
+</div>
diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html
index 585165bb..a02dc409 100755
--- a/wqflask/wqflask/templates/show_trait_edit_data.html
+++ b/wqflask/wqflask/templates/show_trait_edit_data.html
@@ -44,11 +44,11 @@
{% endif %}
<br>
<div>
- <input type="button" id="hide_no_value" class="btn" value="Hide No Value">
- <input type="button" id="block_outliers" class="btn" value="Block Outliers">
- <input type="button" id="reset" class="btn btn-inverse" value="Reset">
+ <input type="button" id="hide_no_value" class="btn btn-default" value="Hide No Value">
+ <input type="button" id="block_outliers" class="btn btn-default" value="Block Outliers">
+ <input type="button" id="reset" class="btn btn-primary" value="Reset">
<span class="input-append">
- <input type="button" id="export" class="btn" value="Export">
+ <input type="button" id="export" class="btn btn-default" value="Export">
<select id="export_format" class="select optional span2">
<option value="excel">Excel</option>
<option value="csv">CSV</option>