diff options
author | Zachary Sloan | 2013-11-27 23:21:51 +0000 |
---|---|---|
committer | Zachary Sloan | 2013-11-27 23:21:51 +0000 |
commit | 467502356717c50b6cb3311facca501217092a6f (patch) | |
tree | 1fcac62c4960e76ad116a13140221792f8205283 /wqflask/base/trait.py | |
parent | d70ee84e84ee01a45ea9a36c4a88e9f5f8cae202 (diff) | |
download | genenetwork2-467502356717c50b6cb3311facca501217092a6f.tar.gz |
Clicking a trait in "color by trait" now gets all of its sample values
that will be used to color the bar graph
Diffstat (limited to 'wqflask/base/trait.py')
-rwxr-xr-x | wqflask/base/trait.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 9e4f0944..712d9af5 100755 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -12,10 +12,13 @@ from base.data_set import create_dataset from dbFunction import webqtlDatabaseFunction from utility import webqtlUtil +from wqflask import app + +import simplejson as json from MySQLdb import escape_string as escape from pprint import pformat as pf -from flask import Flask, g +from flask import Flask, g, request def print_mem(stage=""): mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss @@ -70,6 +73,7 @@ class GeneralTrait(object): Actual turning into json doesn't happen here though""" return dict(name=self.name, + dataset=self.dataset.name, description=self.description_display, mean=self.mean) @@ -626,3 +630,22 @@ class GeneralTrait(object): ZValue = 0.5*log((1.0+self.correlation)/(1.0-self.correlation)) ZValue = ZValue*sqrt(self.overlap-3) self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue))) + + + +@app.route("/trait/get_sample_data") +def get_sample_data(): + params = request.args + trait = params['trait'] + dataset = params['dataset'] + + trait_ob = GeneralTrait(name=trait, dataset_name=dataset) + + return json.dumps({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 +
\ No newline at end of file |