From 8bd404246b83f46f34c9b162c39c2dfc6ab39049 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Fri, 28 Sep 2012 16:56:42 -0500 Subject: Removed show_trait_page.py and moved relevant code over to DataEditingPage.py (though the user security stuff still needs to be moved over) --- wqflask/base/webqtlFormData.py | 1 + wqflask/wqflask/show_trait/DataEditingPage.py | 44 +++++++++++++++++++++++++-- wqflask/wqflask/views.py | 6 ++-- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/wqflask/base/webqtlFormData.py b/wqflask/base/webqtlFormData.py index 63263895..710c9f53 100755 --- a/wqflask/base/webqtlFormData.py +++ b/wqflask/base/webqtlFormData.py @@ -43,6 +43,7 @@ from utility import webqtlUtil + class webqtlFormData: 'Represents data from a WebQTL form page, needed to generate the next page' diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py index 92d0feaf..12e816f8 100755 --- a/wqflask/wqflask/show_trait/DataEditingPage.py +++ b/wqflask/wqflask/show_trait/DataEditingPage.py @@ -20,13 +20,29 @@ from basicStatistics import BasicStatisticsFunctions from pprint import pformat as pf +############################################### +# +# Todo: Put in security to ensure that user has permission to access confidential data sets +# And add i.p.limiting as necessary +# +############################################## + + + class DataEditingPage(templatePage): - def __init__(self, fd, this_trait=None): + def __init__(self, fd): + self.fd = fd templatePage.__init__(self, fd) assert self.openMysql(), "No datbase!" + this_trait = self.get_this_trait() + + ##read genotype file + fd.RISet = this_trait.riset + fd.readGenotype() + if not fd.genotype: fd.readData(incf1=1) @@ -43,7 +59,6 @@ class DataEditingPage(templatePage): else: fmID='dataEditing' - # Some fields, like method, are defaulted to None; otherwise in IE the field can't be changed using jquery hddn = OrderedDict( FormID = fmID, @@ -149,6 +164,31 @@ class DataEditingPage(templatePage): self.js_data = dict(sample_groups = self.sample_group_types) + def get_this_trait(self): + # When is traitInfos used? + #if traitInfos: + # database, ProbeSetID, CellID = traitInfos + #else: + database = self.fd['database'] + probe_set_id = self.fd['ProbeSetID'] + cell_id = self.fd.get('CellID') + + this_trait = webqtlTrait(db=database, name=probe_set_id, cellid=cell_id, cursor=self.cursor) + + ##identification, etc. + self.fd.identification = '%s : %s' % (this_trait.db.shortname, probe_set_id) + this_trait.returnURL = webqtlConfig.CGIDIR + webqtlConfig.SCRIPTFILE + '?FormID=showDatabase&database=%s\ + &ProbeSetID=%s&RISet=%s&parentsf1=on' %(database, probe_set_id, self.fd['RISet']) + + if cell_id: + self.fd.identification = '%s/%s'%(self.fd.identification, cell_id) + this_trait.returnURL = '%s&CellID=%s' % (this_trait.returnURL, cell_id) + + this_trait.retrieveInfo() + this_trait.retrieveData() + return this_trait + + def dispTraitInformation(self, fd, title1Body, hddn, this_trait): _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 0befb74a..bc80a1e6 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -10,7 +10,7 @@ from wqflask import app from flask import render_template, request from wqflask import search_results -from wqflask.show_trait import show_trait_page +from wqflask.show_trait import DataEditingPage from wqflask.correlation import CorrelationPage from wqflask.dataSharing import SharingInfo, SharingInfoPage @@ -75,8 +75,8 @@ def whats_new(): def show_trait(): # Here it's currently too complicated not to use an fd that is a webqtlFormData fd = webqtlFormData.webqtlFormData(request.args) - template_vars = show_trait_page.ShowTraitPage(fd) - + #template_vars = show_trait_page.ShowTraitPage(fd) + template_vars = DataEditingPage.DataEditingPage(fd) template_vars.js_data = json.dumps(template_vars.js_data) print("show_trait template_vars:", pf(template_vars.__dict__)) -- cgit v1.2.3