about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorzsloan2018-08-14 17:19:46 +0000
committerzsloan2018-08-14 17:19:46 +0000
commit18ef3e74e7e898cbec200b7ed18b83db26741b62 (patch)
tree30d14a092f7e34e0e00087dedf81fe53d12869d6 /wqflask/base
parentb964a8b732c1066978ce88073c009803f36a9173 (diff)
downloadgenenetwork2-18ef3e74e7e898cbec200b7ed18b83db26741b62.tar.gz
Added cofactors to correlation scatterplot and changed it to use Plotly
Added Phenogen track to mapping results

Added comparison bar chart figure

Simplified global search to not build trait/dataset objects, which speeds thing up considerably

Fixed correlation matrix to correctly deal with 0 values

Fixed issue where anonymous collections couldn't be created if none already existed
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/trait.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index b71dacf6..3daf9ea9 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -18,7 +18,7 @@ import simplejson as json
 from MySQLdb import escape_string as escape
 from pprint import pformat as pf
 
-from flask import Flask, g, request
+from flask import Flask, g, request, url_for
 
 from utility.logger import getLogger
 logger = getLogger(__name__ )
@@ -176,13 +176,23 @@ def get_sample_data():
 
     trait_ob = GeneralTrait(name=trait, dataset_name=dataset)
 
-    return json.dumps([trait, {key: value.value for key, value in trait_ob.data.iteritems() }])
-
-    #jsonable_sample_data = {}
-    #for sample in trait_ob.data.iteritems():
-    #    jsonable_sample_data[sample] = trait_ob.data[sample].value
-    #
-    #return jsonable_sample_data
+    trait_dict = {}
+    trait_dict['name'] = trait
+    trait_dict['db'] = dataset
+    trait_dict['type'] = trait_ob.dataset.type
+    trait_dict['group'] = trait_ob.dataset.group.name
+    trait_dict['tissue'] = trait_ob.dataset.tissue
+    trait_dict['species'] = trait_ob.dataset.group.species
+    trait_dict['url'] = url_for('show_trait_page', trait_id = trait, dataset = dataset)
+    trait_dict['description'] = trait_ob.description_display
+    if trait_ob.dataset.type == "ProbeSet":
+        trait_dict['symbol'] = trait_ob.symbol
+        trait_dict['location'] = trait_ob.location_repr
+    elif trait_ob.dataset.type == "Publish":
+        trait_dict['pubmed_link'] = trait_ob.pubmed_link
+        trait_dict['pubmed_text'] = trait_ob.pubmed_text
+
+    return json.dumps([trait_dict, {key: value.value for key, value in trait_ob.data.iteritems() }])
     
 def jsonable(trait):
     """Return a dict suitable for using as json