From f44a9e0425cf9d364604c62893100c0cdb0a6f8f Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Sun, 3 Jun 2012 04:08:57 -0400 Subject: Added files --- .../basicStatistics/updatedBasicStatisticsPage.py | 150 +++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100755 wqflask/basicStatistics/updatedBasicStatisticsPage.py (limited to 'wqflask/basicStatistics/updatedBasicStatisticsPage.py') diff --git a/wqflask/basicStatistics/updatedBasicStatisticsPage.py b/wqflask/basicStatistics/updatedBasicStatisticsPage.py new file mode 100755 index 00000000..ab7ed07d --- /dev/null +++ b/wqflask/basicStatistics/updatedBasicStatisticsPage.py @@ -0,0 +1,150 @@ +from htmlgen import HTMLgen2 as HT + +from base.templatePage import templatePage +from dbFunction import webqtlDatabaseFunction +import BasicStatisticsFunctions + +#Window generated from the Trait Data and Analysis page (DataEditingPage.py) with updated stats figures; takes the page's values that can bed edited by the user +class updatedBasicStatisticsPage(templatePage): + + plotMinInformative = 4 + + def __init__(self, fd): + + templatePage.__init__(self, fd) + + if not fd.genotype: + fd.readGenotype() + this_strainlist = fd.strainlist + + if fd.allstrainlist: + this_strainlist = fd.allstrainlist + + fd.readData(this_strainlist) + + specialStrains = [] #This appears to be the "other/non-RISet strainlist" without parents/f1 strains; not sure what to name it + setStrains = [] + for item in this_strainlist: + if item not in fd.strainlist and item.find('F1') < 0: + specialStrains.append(item) + else: + continue + + specialStrains.sort() + if specialStrains: + specialStrains = fd.f1list+fd.parlist+specialStrains + + self.dict['title'] = 'Basic Statistics' + TD_LR = HT.TD(valign="top",width="100%",bgcolor="#fafafa") + + stats_row = HT.TR() + stats_cell = HT.TD() + stats_script = HT.Script(language="Javascript") + + #Get strain names, values, and variances + strain_names = fd.formdata.getvalue('strainNames').split(',') + strain_vals = fd.formdata.getvalue('strainVals').split(',') + strain_vars = fd.formdata.getvalue('strainVars').split(',') + + vals = [] + if (len(strain_names) > 0): + if (len(strain_names) > 3): + #Need to create "vals" object + for i in range(len(strain_names)): + try: + this_strain_val = float(strain_vals[i]) + except: + continue + try: + this_strain_var = float(strain_vars[i]) + except: + this_strain_var = None + + thisValFull = [strain_names[i], this_strain_val, this_strain_var] + vals.append(thisValFull) + + stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-2", Class="stats_tab"), + HT.Href(text="Bar Graph (by name)", url="#statstabs-3", Class="stats_tab"), HT.Href(text="Bar Graph (by rank)", url="#statstabs-4", Class="stats_tab"), + HT.Href(text="Box Plot", url="#statstabs-5", Class="stats_tab")] + stats_tabs = HT.List(stats_tab_list) + + stats_container = HT.Div(id="stats_tabs", Class="ui-tabs") + stats_container.append(stats_tabs) + + stats_script_text = """$(function() { $("#stats_tabs").tabs();});""" #Javascript enabling tabs + + table_div = HT.Div(id="statstabs-1", style="height:320px;width:740px;overflow:scroll;") + table_container = HT.Paragraph() + + statsTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + this_trait_type = fd.formdata.getvalue('trait_type', None) + this_cellid = fd.formdata.getvalue('cellid', None) + statsTableCell = BasicStatisticsFunctions.basicStatsTable(vals=vals, trait_type=this_trait_type, cellid=this_cellid) + statsTable.append(HT.TR(HT.TD(statsTableCell))) + + table_container.append(statsTable) + table_div.append(table_container) + stats_container.append(table_div) + + normalplot_div = HT.Div(id="statstabs-2", style="height:540px;width:740px;overflow:scroll;") + normalplot_container = HT.Paragraph() + normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + plotTitle = fd.formdata.getvalue("normalPlotTitle","") + normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, RISet=fd.RISet, title=plotTitle, specialStrains=specialStrains) + normalplot.append(HT.TR(HT.TD(normalplot_img))) + normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \ + normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(), + "More about ", HT.Href(url="http://en.wikipedia.org/wiki/Normal_probability_plot", + target="_blank", text="Normal Probability Plots"), " and more about interpreting these plots from the ", HT.Href(url="/glossary.html#normal_probability", target="_blank", text="glossary")))) + normalplot_container.append(normalplot) + normalplot_div.append(normalplot_container) + stats_container.append(normalplot_div) + + barName_div = HT.Div(id="statstabs-3", style="height:540px;width:740px;overflow:scroll;") + barName_container = HT.Paragraph() + barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="name") + barName.append(HT.TR(HT.TD(barName_img))) + barName_container.append(barName) + barName_div.append(barName_container) + stats_container.append(barName_div) + + barRank_div = HT.Div(id="statstabs-4", style="height:540px;width:740px;overflow:scroll;") + barRank_container = HT.Paragraph() + barRank = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, RISet=fd.RISet, vals=vals, type="rank") + barRank.append(HT.TR(HT.TD(barRank_img))) + barRank_container.append(barRank) + barRank_div.append(barRank_container) + stats_container.append(barRank_div) + + boxplot_div = HT.Div(id="statstabs-5", style="height:540px;width:740px;overflow:scroll;") + boxplot_container = HT.Paragraph() + boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + boxplot_img, boxplot_link = BasicStatisticsFunctions.plotBoxPlot(vals) + boxplot.append(HT.TR(HT.TD(boxplot_img, HT.P(), boxplot_link, align="left"))) + boxplot_container.append(boxplot) + boxplot_div.append(boxplot_container) + stats_container.append(boxplot_div) + + stats_cell.append(stats_container) + stats_script.append(stats_script_text) + + submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") + stats_row.append(stats_cell) + + submitTable.append(stats_row) + submitTable.append(stats_script) + + TD_LR.append(submitTable) + self.dict['body'] = str(TD_LR) + else: + heading = "Basic Statistics" + detail = ['Fewer than %d case data were entered for %s data set. No statitical analysis has been attempted.' % (self.plotMinInformative, fd.RISet)] + self.error(heading=heading,detail=detail) + return + else: + heading = "Basic Statistics" + detail = ['Empty data set, please check your data.'] + self.error(heading=heading,detail=detail) + return \ No newline at end of file -- cgit v1.2.3 From 8ac39ead1014953c634e85d0ce340497ecfe2934 Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Tue, 5 Jun 2012 00:24:44 -0400 Subject: Ran reindent.py recursively on wqflask directory --- .gitignore | 2 + wqflask/base/GeneralObject.py | 77 +- wqflask/base/admin.py | 32 +- wqflask/base/cgiData.py | 60 +- wqflask/base/cookieData.py | 27 +- wqflask/base/header.py | 2 +- wqflask/base/indexBody.py | 414 +-- wqflask/base/myCookie.py | 38 +- wqflask/base/sessionData.py | 27 +- wqflask/base/template.py | 74 +- wqflask/base/templatePage.py | 318 +- wqflask/base/webqtlCaseData.py | 43 +- wqflask/base/webqtlDataset.py | 249 +- wqflask/base/webqtlFormData.py | 516 +-- wqflask/base/webqtlTrait.py | 1152 +++--- .../basicStatistics/BasicStatisticsFunctions.py | 280 +- .../basicStatistics/BasicStatisticsPage_alpha.py | 602 ++-- .../basicStatistics/updatedBasicStatisticsPage.py | 284 +- wqflask/dbFunction/webqtlDatabaseFunction.py | 293 +- wqflask/utility/AJAX_table.py | 224 +- wqflask/utility/Plot.py | 2304 ++++++------ wqflask/utility/TDCell.py | 15 +- wqflask/utility/THCell.py | 16 +- wqflask/utility/svg.py | 133 +- wqflask/utility/webqtlUtil.py | 1459 ++++---- wqflask/wqflask/show_trait/DataEditingPage.py | 3810 ++++++++++---------- wqflask/wqflask/show_trait/show_trait_page.py | 290 +- 27 files changed, 6353 insertions(+), 6388 deletions(-) (limited to 'wqflask/basicStatistics/updatedBasicStatisticsPage.py') diff --git a/.gitignore b/.gitignore index 8bc78454..fc051245 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # gitignore *.pyc *.orig +*.bak *~ + diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py index 311c9e22..53d1357b 100755 --- a/wqflask/base/GeneralObject.py +++ b/wqflask/base/GeneralObject.py @@ -25,47 +25,44 @@ # Last updated by GeneNetwork Core Team 2010/10/20 class GeneralObject: - """ - Base class to define an Object. - a = [Spam(1, 4), Spam(9, 3), Spam(4,6)] - a.sort(lambda x, y: cmp(x.eggs, y.eggs)) - """ + """ + Base class to define an Object. + a = [Spam(1, 4), Spam(9, 3), Spam(4,6)] + a.sort(lambda x, y: cmp(x.eggs, y.eggs)) + """ - def __init__(self, *args, **kw): - self.contents = list(args) - for name, value in kw.items(): - setattr(self, name, value) - - def __setitem__(self, key, value): - setattr(self, key, value) - - def __getitem__(self, key): - return getattr(self, key) - - def __getattr__(self, key): - if key in self.__dict__.keys(): - return self.__dict__[key] - else: - return eval("self.__dict__.%s" % key) - - def __len__(self): - return len(self.__dict__) - 1 - - def __str__(self): - s = '' - for key in self.__dict__.keys(): - if key != 'contents': - s += '%s = %s\n' % (key,self.__dict__[key]) - return s - - def __repr__(self): - s = '' - for key in self.__dict__.keys(): - s += '%s = %s\n' % (key,self.__dict__[key]) - return s - - def __cmp__(self,other): - return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys())) + def __init__(self, *args, **kw): + self.contents = list(args) + for name, value in kw.items(): + setattr(self, name, value) + def __setitem__(self, key, value): + setattr(self, key, value) + def __getitem__(self, key): + return getattr(self, key) + def __getattr__(self, key): + if key in self.__dict__.keys(): + return self.__dict__[key] + else: + return eval("self.__dict__.%s" % key) + + def __len__(self): + return len(self.__dict__) - 1 + + def __str__(self): + s = '' + for key in self.__dict__.keys(): + if key != 'contents': + s += '%s = %s\n' % (key,self.__dict__[key]) + return s + + def __repr__(self): + s = '' + for key in self.__dict__.keys(): + s += '%s = %s\n' % (key,self.__dict__[key]) + return s + + def __cmp__(self,other): + return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys())) diff --git a/wqflask/base/admin.py b/wqflask/base/admin.py index a04df2da..1ba75117 100755 --- a/wqflask/base/admin.py +++ b/wqflask/base/admin.py @@ -35,18 +35,18 @@ ADMIN_search_dbs = { - 'rat': {'PERITONEAL FAT': ['FT_2A_0605_Rz'], + 'rat': {'PERITONEAL FAT': ['FT_2A_0605_Rz'], 'KIDNEY': ['KI_2A_0405_Rz'], 'ADRENAL GLAND': ['HXB_Adrenal_1208'], 'HEART': ['HXB_Heart_1208'] }, - 'mouse': {'CEREBELLUM': ['CB_M_0305_R'], + 'mouse': {'CEREBELLUM': ['CB_M_0305_R'], 'STRIATUM': ['SA_M2_0905_R', 'SA_M2_0405_RC', 'UTHSC_1107_RankInv', 'Striatum_Exon_0209'], - 'HIPPOCAMPUS': ['HC_M2_0606_R', 'UMUTAffyExon_0209_RMA'], - 'WHOLE BRAIN': ['BR_M2_1106_R', 'IBR_M_0106_R', 'BRF2_M_0805_R', 'UCLA_BHF2_BRAIN_0605'], - 'LIVER': ['LV_G_0106_B', 'UCLA_BHF2_LIVER_0605'], - 'EYE': ['Eye_M2_0908_R'], - 'HEMATOPOIETIC STEM CELLS': ['HC_U_0304_R'], + 'HIPPOCAMPUS': ['HC_M2_0606_R', 'UMUTAffyExon_0209_RMA'], + 'WHOLE BRAIN': ['BR_M2_1106_R', 'IBR_M_0106_R', 'BRF2_M_0805_R', 'UCLA_BHF2_BRAIN_0605'], + 'LIVER': ['LV_G_0106_B', 'UCLA_BHF2_LIVER_0605'], + 'EYE': ['Eye_M2_0908_R'], + 'HEMATOPOIETIC STEM CELLS': ['HC_U_0304_R'], 'KIDNEY': ['MA_M2_0806_R'], 'MAMMARY TUMORS': ['MA_M_0704_R', 'NCI_Agil_Mam_Tum_RMA_0409'], 'PREFRONTAL CORTEX': ['VCUSal_1206_R'], @@ -65,14 +65,14 @@ ADMIN_search_dbs = { ###LIST of tissue alias -ADMIN_tissue_alias = {'CEREBELLUM': ['Cb'], - 'STRIATUM': ['Str'], - 'HIPPOCAMPUS': ['Hip'], - 'WHOLE BRAIN': ['Brn'], - 'LIVER': ['Liv'], - 'EYE': ['Eye'], - 'PERITONEAL FAT': ['Fat'], - 'HEMATOPOIETIC STEM CELLS': ['Hsc'], +ADMIN_tissue_alias = {'CEREBELLUM': ['Cb'], + 'STRIATUM': ['Str'], + 'HIPPOCAMPUS': ['Hip'], + 'WHOLE BRAIN': ['Brn'], + 'LIVER': ['Liv'], + 'EYE': ['Eye'], + 'PERITONEAL FAT': ['Fat'], + 'HEMATOPOIETIC STEM CELLS': ['Hsc'], 'KIDNEY': ['Kid'], 'ADRENAL GLAND': ['Adr'], 'HEART': ['Hea'], @@ -84,5 +84,3 @@ ADMIN_tissue_alias = {'CEREBELLUM': ['Cb'], 'ADIPOSE': ['Wfat'], 'RETINA': ['Ret'] } - - diff --git a/wqflask/base/cgiData.py b/wqflask/base/cgiData.py index 57416060..155b3ec3 100755 --- a/wqflask/base/cgiData.py +++ b/wqflask/base/cgiData.py @@ -30,41 +30,37 @@ ######################################### class cgiData(dict): - '''convert Field storage object to Dict object - Filed storage object cannot be properly dumped - ''' + '''convert Field storage object to Dict object + Filed storage object cannot be properly dumped + ''' - def __init__(self, field_storage=None): + def __init__(self, field_storage=None): - if not field_storage: - field_storage={} - - for key in field_storage.keys(): - temp = field_storage.getlist(key) - if len(temp) > 1: - temp = map(self.toValue, temp) - elif len(temp) == 1: - temp = self.toValue(temp[0]) - else: - temp = None - self[key]= temp - - def toValue(self, obj): - '''fieldstorge returns different type of objects, \ - need to convert to string or None''' - try: - return obj.value - except: - return "" - - def getvalue(self, k, default= None): - try: - return self[k] - except: - return default - - getfirst = getvalue + if not field_storage: + field_storage={} + for key in field_storage.keys(): + temp = field_storage.getlist(key) + if len(temp) > 1: + temp = map(self.toValue, temp) + elif len(temp) == 1: + temp = self.toValue(temp[0]) + else: + temp = None + self[key]= temp + def toValue(self, obj): + '''fieldstorge returns different type of objects, \ + need to convert to string or None''' + try: + return obj.value + except: + return "" + def getvalue(self, k, default= None): + try: + return self[k] + except: + return default + getfirst = getvalue diff --git a/wqflask/base/cookieData.py b/wqflask/base/cookieData.py index 4b7c9046..eeb7c0cf 100755 --- a/wqflask/base/cookieData.py +++ b/wqflask/base/cookieData.py @@ -30,23 +30,20 @@ ######################################### class cookieData(dict): - 'convert mod python Cookie object to Dict object' + 'convert mod python Cookie object to Dict object' - def __init__(self, cookies=None): + def __init__(self, cookies=None): - if not cookies: - cookies={} - - for key in cookies.keys(): - self[key.lower()]= cookies[key].value - - def getvalue(self, k, default= None): - try: - return self[k.lower()] - except: - return default - - getfirst = getvalue + if not cookies: + cookies={} + for key in cookies.keys(): + self[key.lower()]= cookies[key].value + def getvalue(self, k, default= None): + try: + return self[k.lower()] + except: + return default + getfirst = getvalue diff --git a/wqflask/base/header.py b/wqflask/base/header.py index b6136b51..ec15e174 100755 --- a/wqflask/base/header.py +++ b/wqflask/base/header.py @@ -3,4 +3,4 @@ import webqtlConfig header_string = open(webqtlConfig.HTMLPATH + 'header.html', 'r').read() header_string = header_string.replace("\\'", "'") header_string = header_string.replace('%"','%%"') -header_string = header_string.replace('', '%s') \ No newline at end of file +header_string = header_string.replace('', '%s') diff --git a/wqflask/base/indexBody.py b/wqflask/base/indexBody.py index aa67dffa..a5bc4c17 100755 --- a/wqflask/base/indexBody.py +++ b/wqflask/base/indexBody.py @@ -1,174 +1,174 @@ index_body_string = """
Select and Search -
+ @@ -185,7 +185,7 @@ Quick HELP Examples and User's Guide - You can also use advanced commands. Copy these simple examples + You can also use advanced commands. Copy these simple examplesWebsites Affiliated with GeneNetwork
--
____________________________ - -
Getting Started
-____________________________ +
Websites Affiliated with GeneNetwork
++
____________________________ + +
Getting Started
+____________________________
How to Use GeneNetwork -
--Take a 20-40 minute GeneNetwork Tour that includes screen shots and typical steps in the analysis.
-
-- -For information about resources and methods, select the buttons.
+++Take a 20-40 minute GeneNetwork Tour that includes screen shots and typical steps in the analysis.
++-For information about resources and methods, select the buttons.
+ + - -Try the Workstation site to explore data and features that are being implemented.
-Review the Conditions and Contacts pages for information on the status of data sets and advice on their use and citation.
+Review the Conditions and Contacts pages for information on the status of data sets and advice on their use and citation.
+ +
Mirror and Development Sites
+Mirror and Development Sites
-History and Archive +
History and Archive -
--GeneNetwork's Time Machine links to earlier versions that correspond to specific publication dates.
+++GeneNetwork's Time Machine links to earlier versions that correspond to specific publication dates.
-
- |
-
+ |
+
- |
-
+ |
+