From 0f6f0030439acfce43babfed516262bc78354d71 Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Wed, 18 Jul 2012 18:55:43 -0400 Subject: latest changes --- wqflask/wqflask/dataSharing/SharingInfo.py | 46 ++++++++++++++-------- .../new/javascript/trait_data_and_analysis.coffee | 32 +++++++-------- .../new/javascript/trait_data_and_analysis.js | 24 ++++++++--- wqflask/wqflask/templates/base.html | 1 + .../wqflask/templates/trait_data_and_analysis.html | 2 + 5 files changed, 64 insertions(+), 41 deletions(-) diff --git a/wqflask/wqflask/dataSharing/SharingInfo.py b/wqflask/wqflask/dataSharing/SharingInfo.py index 289754d0..befc158a 100755 --- a/wqflask/wqflask/dataSharing/SharingInfo.py +++ b/wqflask/wqflask/dataSharing/SharingInfo.py @@ -29,11 +29,19 @@ from __future__ import print_function, division from pprint import pformat as pf from collections import namedtuple -import httplib +import requests from dbFunction import webqtlDatabaseFunction import SharingBody +import logging +logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO) + +_log = logging.getLogger("search") +_ch = logging.StreamHandler() +_log.addHandler(_ch) + + ######################################### # Sharing Info @@ -62,30 +70,34 @@ class SharingInfo(object): # We can use string interpolation here cause we own the string sql = """select %s from InfoFiles where """ % (field_names) - if(self.GN_AccessionId): + if self.GN_AccessionId: sql += "GN_AccesionId = %s" cursor.execute(sql, self.GN_AccessionId) - elif (self.InfoPageName): + elif self.InfoPageName: sql += "InfoPageName = %s" cursor.execute(sql, self.InfoPageName) else: - raise 'No correct parameter found' + raise Exception('No correct parameter found') info = cursor.fetchone() info = todict(field_names, info) # fetch datasets file list - try: - conn = httplib.HTTPConnection("atlas.uthsc.edu") - conn.request("GET", "/scandatasets.php?GN_AccesionId=%s" % (info[32])) - response = conn.getresponse() - data = response.read() - filelist = data.split() - conn.close() - except Exception: - filelist = [] + filelist = [] + if info["GN_AccesionId"]: + url = "http://atlas.uthsc.edu/scandatasets.php?GN_AccesionId=%s" % ( + info["GN_AccesionId"]) + try: + response = requests.get(url) + except Exception as why: + log.exception("Problem conneting to:", url) + if response: + data = response.text + filelist = data.split() + return info, filelist + def getBody(self, infoupdate=""): info, filelist = self.getInfo() if filelist: @@ -99,16 +111,16 @@ class SharingInfo(object): htmlfilelist += '   ' #r=re.compile(r'(?<=\d)(?=(\d\d\d)+(?!\d))') #htmlfilelist += '[%s B]' % r.sub(r',',filesize) - if 12 mean(the_values) make_table = -> - header = "" + header = " " for column in basic_table['columns'] the_id = process_id("column_" + column) header += """#{ column }""" @@ -73,7 +73,7 @@ $ -> }, { vn: "median" - pretty: "median" + pretty: "Median" }, { vn: "se" @@ -86,30 +86,26 @@ $ -> console.log("length of rows:", rows.length) for row in rows console.log("rowing") - #row_line = key - row_line = """#{ row.pretty }""" + row_line = """""" + row_line += """#{ row.pretty }""" + for column in basic_table['columns'] + console.log("apple:", column) + the_id = process_id(column + "_" + row.vn) + console.log("the_id:", the_id) + row_line += """ """ + row_line += """""" console.log("row line:", row_line) the_rows += row_line the_rows += "" + table = header + the_rows + console.log("table is:", table) + $("#stats_table").append(table) - # - 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 ### + console.log("value:", value) value = value.replace(" ", "_") return value 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 abf98b9b..c288f11f 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js @@ -68,8 +68,8 @@ return mean(the_values); }; make_table = function() { - var column, header, row, row_line, rows, the_id, the_rows, _i, _j, _len, _len1, _ref; - header = ""; + var column, header, row, row_line, rows, table, the_id, the_rows, _i, _j, _k, _len, _len1, _len2, _ref, _ref1; + header = " "; _ref = basic_table['columns']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { column = _ref[_i]; @@ -86,7 +86,7 @@ pretty: "Mean" }, { vn: "median", - pretty: "median" + pretty: "Median" }, { vn: "se", pretty: "Standard Error (SE)" @@ -98,17 +98,29 @@ for (_j = 0, _len1 = rows.length; _j < _len1; _j++) { row = rows[_j]; console.log("rowing"); - row_line = "" + row.pretty + ""; + row_line = ""; + row_line += "" + row.pretty + ""; + _ref1 = basic_table['columns']; + for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { + column = _ref1[_k]; + console.log("apple:", column); + the_id = process_id(column + "_" + row.vn); + console.log("the_id:", the_id); + row_line += " "; + } + row_line += ""; console.log("row line:", row_line); the_rows += row_line; } the_rows += ""; - console.log("header:", header); - return console.log("the_rows:", the_rows); + table = header + the_rows; + console.log("table is:", table); + return $("#stats_table").append(table); }; process_id = function(value) { /* Make an id or a class valid javascript by, for example, eliminating spaces */ + console.log("value:", value); value = value.replace(" ", "_"); return value; }; diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index d7154a5b..4050164d 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -14,6 +14,7 @@ + diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html index 97fee3ea..47d0827b 100644 --- a/wqflask/wqflask/templates/trait_data_and_analysis.html +++ b/wqflask/wqflask/templates/trait_data_and_analysis.html @@ -3014,6 +3014,8 @@

  Review and Edit Data

+ +

-- cgit v1.2.3