aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Ockman2012-07-15 21:17:49 -0400
committerSam Ockman2012-07-15 21:17:49 -0400
commit9d22fe88365c96a092febeab9cef7775dcb5a773 (patch)
tree217ab52b93a775cc25b105a117bca99a2fcc6433
parentf93de74671feafbabeed50c80226d57388210d01 (diff)
downloadgenenetwork2-9d22fe88365c96a092febeab9cef7775dcb5a773.tar.gz
Continuing trait data table in js
-rwxr-xr-xwqflask/wqflask/dataSharing/SharingInfo.py19
-rwxr-xr-xwqflask/wqflask/show_trait/DataEditingPage.py24
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee60
-rw-r--r--wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js52
-rw-r--r--wqflask/wqflask/templates/trait_data_and_analysis.html6
5 files changed, 129 insertions, 32 deletions
diff --git a/wqflask/wqflask/dataSharing/SharingInfo.py b/wqflask/wqflask/dataSharing/SharingInfo.py
index 4845b5c8..289754d0 100755
--- a/wqflask/wqflask/dataSharing/SharingInfo.py
+++ b/wqflask/wqflask/dataSharing/SharingInfo.py
@@ -60,8 +60,6 @@ class SharingInfo(object):
About_Array_Platform, About_Data_Values_Processing,
Data_Source_Acknowledge, Progreso """
- #InfoRecord = namedtuple('InfoRecord', field_names)
-
# We can use string interpolation here cause we own the string
sql = """select %s from InfoFiles where """ % (field_names)
if(self.GN_AccessionId):
@@ -73,20 +71,8 @@ class SharingInfo(object):
else:
raise 'No correct parameter found'
info = cursor.fetchone()
- print("432 info:", info)
- print("type(info):", type(info))
- #info = InfoRecord._make(info)
- info = todict(field_names, info)
- # We need to edit info so we convert it to a dict...
- #info = info._asdict()
- print("q888 info.Title:", info['Title'])
-
- print("info type is:", type(info))
- #new_about_cases = unicode(info.About_Cases, "utf-8")
- #print("new_about_cases is:", new_about_cases)
-
- #info['About_Cases'] = unicode(info['About_Cases'], "utf-8")
+ info = todict(field_names, info)
# fetch datasets file list
try:
@@ -130,8 +116,7 @@ class SharingInfo(object):
htmlfilelist += "</ul>"
else:
htmlfilelist = "Data sets are not available or are not public yet."
- print("333 info is:", pf(info))
- print("333 keys:", pf(info))
+
return info, htmlfilelist
#return SharingBody.sharinginfo_body_string % (info[31], info[32], infoupdate, info[32], info[1], info[3], info[30], info[4], info[27], info[33], info[2], info[23], info[26], info[11], info[15], info[16], info[18], info[19], info[20], info[21], info[22], info[13], info[12], info[14], info[14], htmlfilelist, info[6], info[35], info[36], info[37], info[38], info[39], info[40], info[5], info[7], info[8], info[9], info[10], info[17], info[24])
diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py
index 81bb3a92..610124ae 100755
--- a/wqflask/wqflask/show_trait/DataEditingPage.py
+++ b/wqflask/wqflask/show_trait/DataEditingPage.py
@@ -213,18 +213,18 @@ class DataEditingPage(templatePage):
self.hddn = hddn
self.basic_table = {}
- self.basic_table['rows'] = yaml.load("""
- - N of Samples
- - Mean
- - Median
- - Standard Error (SE)
- - Standard Deviation (SD)
- - Minimum
- - Maximum
- - Range (log2)
- - Range (fold)
- - Interquartile Range
- """)
+ #self.basic_table['rows'] = yaml.load("""
+ # - N of Samples
+ # - Mean
+ # - Median
+ # - Standard Error (SE)
+ # - Standard Deviation (SD)
+ # - Minimum
+ # - Maximum
+ # - Range (log2)
+ # - Range (fold)
+ # - Interquartile Range
+ # """)
self.basic_table['columns'] = yaml.load("""
- All Cases
diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
index 380d0a5a..d3817f99 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
+++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee
@@ -55,6 +55,66 @@ $ ->
the_values.push(parseFloat(real_value))
mean(the_values)
+ make_table = ->
+ header = "<thead><tr>"
+ for column in basic_table['columns']
+ the_id = process_id("column_" + column)
+ header += """<th id="#{ the_id }">#{ column }</th>"""
+ header += "</thead>"
+
+ rows = [
+ {
+ vn: "n_of_samples"
+ pretty: "N of Samples"
+ },
+ {
+ vn: "mean"
+ pretty: "Mean"
+ },
+ {
+ vn: "median"
+ pretty: "median"
+ },
+ {
+ vn: "se"
+ pretty: "Standard Error (SE)"
+ }
+ ]
+
+ console.log("rows are:", rows)
+ the_rows = "<tbody>"
+ console.log("length of rows:", rows.length)
+ for row in rows
+ console.log("rowing")
+ #row_line = key
+ row_line = """<tr><td id="#{ row.vn }">#{ row.pretty }</td></tr>"""
+ console.log("row line:", row_line)
+ the_rows += row_line
+ the_rows += "</tbody>"
+
+
+ # - N of Samples
+ # - Mean
+ # - Median
+ # - Standard Error (SE)
+ # - Standard Deviation (SD)
+ # - Minimum
+ # - Maximum
+ # - Range (log2)
+ # - Range (fold)
+ # - Interquartile Range
+ # """)
+
+ console.log("header:", header)
+ console.log("the_rows:", the_rows)
+
+ process_id = (value) ->
+ ### Make an id or a class valid javascript by, for example, eliminating spaces ###
+ value = value.replace(" ", "_")
+ return value
$('#primary').change(edit_data_change)
console.log("loaded")
+ console.log("basic_table is:", basic_table)
+ make_table()
+ console.log("end")
diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
index 1ea224b4..abf98b9b 100644
--- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
+++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js
@@ -9,7 +9,7 @@
};
$(function() {
- var edit_data_change, hide_tabs, mean, stats_mdp_change;
+ var edit_data_change, hide_tabs, make_table, mean, process_id, stats_mdp_change;
hide_tabs = function(start) {
var x, _i, _results;
_results = [];
@@ -67,8 +67,56 @@
}
return mean(the_values);
};
+ make_table = function() {
+ var column, header, row, row_line, rows, the_id, the_rows, _i, _j, _len, _len1, _ref;
+ header = "<thead><tr>";
+ _ref = basic_table['columns'];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ column = _ref[_i];
+ the_id = process_id("column_" + column);
+ header += "<th id=\"" + the_id + "\">" + column + "</th>";
+ }
+ header += "</thead>";
+ rows = [
+ {
+ vn: "n_of_samples",
+ pretty: "N of Samples"
+ }, {
+ vn: "mean",
+ pretty: "Mean"
+ }, {
+ vn: "median",
+ pretty: "median"
+ }, {
+ vn: "se",
+ pretty: "Standard Error (SE)"
+ }
+ ];
+ console.log("rows are:", rows);
+ the_rows = "<tbody>";
+ console.log("length of rows:", rows.length);
+ for (_j = 0, _len1 = rows.length; _j < _len1; _j++) {
+ row = rows[_j];
+ console.log("rowing");
+ row_line = "<tr><td id=\"" + row.vn + "\">" + row.pretty + "</td></tr>";
+ console.log("row line:", row_line);
+ the_rows += row_line;
+ }
+ the_rows += "</tbody>";
+ console.log("header:", header);
+ return console.log("the_rows:", the_rows);
+ };
+ process_id = function(value) {
+ /* Make an id or a class valid javascript by, for example, eliminating spaces
+ */
+ value = value.replace(" ", "_");
+ return value;
+ };
$('#primary').change(edit_data_change);
- return console.log("loaded");
+ console.log("loaded");
+ console.log("basic_table is:", basic_table);
+ make_table();
+ return console.log("end");
});
}).call(this);
diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html
index 0304aa03..97fee3ea 100644
--- a/wqflask/wqflask/templates/trait_data_and_analysis.html
+++ b/wqflask/wqflask/templates/trait_data_and_analysis.html
@@ -3112,7 +3112,11 @@
</td>
</tr>
- <script type="text/javascript" src="/static/new/packages/DataTables/js/trait_data_and_analysis.js"></script>
+ <script>
+ basic_table = {{ basic_table | safe }}
+ </script>
+
+ <script type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/new/javascript/trait_data_and_analysis.js"></script>