diff options
Diffstat (limited to 'wqflask')
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<len(filesize): + if 12 < len(filesize): filesize=filesize[0:-12] filesize += ' T' - elif 9<len(filesize): + elif 9 < len(filesize): filesize=filesize[0:-9] filesize += ' G' - elif 6<len(filesize): + elif 6 < len(filesize): filesize=filesize[0:-6] filesize += ' M' - elif 3<len(filesize): + elif 3 < len(filesize): filesize=filesize[0:-3] filesize += ' K' htmlfilelist += '[%sB]' % filesize 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 d3817f99..2c912f05 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee @@ -56,7 +56,7 @@ $ -> mean(the_values) make_table = -> - header = "<thead><tr>" + header = "<thead><tr><th> </th>" for column in basic_table['columns'] the_id = process_id("column_" + column) header += """<th id="#{ the_id }">#{ column }</th>""" @@ -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 = """<tr><td id="#{ row.vn }">#{ row.pretty }</td></tr>""" + row_line = """<tr>""" + row_line += """<td id="#{ row.vn }">#{ row.pretty }</td>""" + 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 += """<td id="#{ the_id }"> </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) + $("#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 = "<thead><tr>"; + var column, header, row, row_line, rows, table, the_id, the_rows, _i, _j, _k, _len, _len1, _len2, _ref, _ref1; + header = "<thead><tr><th> </th>"; _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 = "<tr><td id=\"" + row.vn + "\">" + row.pretty + "</td></tr>"; + row_line = "<tr>"; + row_line += "<td id=\"" + row.vn + "\">" + row.pretty + "</td>"; + _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 += "<td id=\"" + the_id + "\"> </td>"; + } + row_line += "</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); + 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 @@ <LINK REL="stylesheet" TYPE="text/css" HREF='/css/general_flask.css'> <LINK REL="stylesheet" TYPE="text/css" HREF='/css/menu.css'> <link rel="stylesheet" media="all" type="text/css" href="/css/tabbed_pages.css" /> + <link rel="stylesheet" media="all" type="text/css" href="/static/new/css/table.css" /> <LINK REL="apple-touch-icon" href="/images/ipad_icon3.png" /> <link type="text/css" href='/css/custom-theme/jquery-ui-1.8.12.custom.css' rel='Stylesheet' /> <link type="text/css" href='/css/tab_style.css' rel='Stylesheet' /> 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 @@ <p class="sectionheader" id="title5" style="border-radius: 5px;"> Review and Edit Data</p> + <table id="stats_table" class="one-column-emphasis" /> + <p id="sectionbody5"></p> <table class="target5" cellpadding="0" cellspacing="0" width="100%"> |