about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--misc/find.txt1
-rw-r--r--misc/python_stuff.txt1
-rwxr-xr-xwqflask/base/webqtlCaseData.py69
-rwxr-xr-xwqflask/base/webqtlTrait.py52
-rwxr-xr-xwqflask/utility/webqtlUtil.py7
-rwxr-xr-xwqflask/wqflask/show_trait/DataEditingPage.py276
-rw-r--r--wqflask/wqflask/show_trait/show_trait_page.py27
-rw-r--r--wqflask/wqflask/templates/trait_data_and_analysis.html24
8 files changed, 261 insertions, 196 deletions
diff --git a/misc/find.txt b/misc/find.txt
new file mode 100644
index 00000000..5c792d80
--- /dev/null
+++ b/misc/find.txt
@@ -0,0 +1 @@
+find | grep _____
diff --git a/misc/python_stuff.txt b/misc/python_stuff.txt
new file mode 100644
index 00000000..f36fe338
--- /dev/null
+++ b/misc/python_stuff.txt
@@ -0,0 +1 @@
+Classes should always inherit "object"
\ No newline at end of file
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py
index f68354be..7805df06 100755
--- a/wqflask/base/webqtlCaseData.py
+++ b/wqflask/base/webqtlCaseData.py
@@ -24,28 +24,59 @@
 #
 # Last updated by GeneNetwork Core Team 2010/10/20
 
-class webqtlCaseData:
-    """
-    one case data in one trait
-    """
+print("Mr. Mojo Risin 2")
 
-    val = None              #Trait Value
-    var = None              #Trait Variance
-    N   = None              #Number of individuals
+class webqtlCaseData(object):
+    """one case data in one trait
+    
+    """
 
-    def __init__(self, val=val, var=var, N=N):
-        self.val = val
-        self.var = var
-        self.N = N
+    def __init__(self, name, value=None, variance=None, num_cases=None):
+        self.name = name
+        self.value = value                  # Trait Value
+        self.variance = variance            # Trait Variance
+        self.num_cases = num_cases          # Number of individuals/cases
+        self.this_id = None   # Set a sane default (can't be just "id" cause that's a reserved word)
 
-    def __str__(self):
+    def __repr__(self):
         str = ""
-        if self.val != None:
-            str += "value=%2.3f" % self.val
-        if self.var != None:
-            str += " variance=%2.3f" % self.var
-        if self.N != None:
-            str += " ndata=%d" % self.N
+        if self.value != None:
+            str += "value=%2.3f" % self.value
+        if self.variance != None:
+            str += " variance=%2.3f" % self.variance
+        if self.num_cases != None:
+            str += " ndata=%d" % self.num_cases
         return str
+    
+    @property
+    def display_value(self):
+        if self.value:
+            return "%2.3f" % self.value
+        else:
+            return "x"
+        
+    @property
+    def display_variance(self):
+        if self.variance:
+            return "%2.3f" % self.variance
+        else:
+            return "x"
+        
+        
+              #try:
+                #    traitVar = thisvar
+                #    dispVar = "%2.3f" % thisvar
+                #except:
+                #    traitVar = ''
+                #    dispVar = 'x'
+        
+        #try:
+        #    traitVal = thisval
+        #    dispVal = "%2.3f" % thisval
+        #except:
+        #    traitVal = ''
+        #    dispVal = 'x'
+
 
-    __repr__ = __str__
+    #def this_val_full(self):
+    #    strain_name = 
\ No newline at end of file
diff --git a/wqflask/base/webqtlTrait.py b/wqflask/base/webqtlTrait.py
index 23b98238..337493ef 100755
--- a/wqflask/base/webqtlTrait.py
+++ b/wqflask/base/webqtlTrait.py
@@ -225,7 +225,10 @@ class webqtlTrait:
 
 
 
-    def retrieveData(self, strainlist=[]):
+    def retrieveData(self, strainlist=None):
+        
+        if strainlist == None:
+            strainlist = []
         assert self.db and self.cursor
 
         if self.db.type == 'Temp':
@@ -328,32 +331,33 @@ class webqtlTrait:
         self.cursor.execute(query)
         results = self.cursor.fetchall()
         self.data.clear()
+        
         if results:
             self.mysqlid = results[0][-1]
-            if strainlist:
-                for item in results:
-                    if item[0] in strainlist:
-                        val = item[1]
-                        if val != None:
-                            var = item[2]
-                            ndata = None
-                            if self.db.type in ('Publish', 'Temp'):
-                                ndata = item[3]
-                            self.data[item[0]] = webqtlCaseData(val, var, ndata)
+            #if strainlist:
+            for item in results:
+                #name, value, variance, num_cases = item
+                if not strainlist or (strainlist and name in strainlist):
+                    #if value != None:
+                    #    num_cases = None
+                    #    if self.db.type in ('Publish', 'Temp'):
+                    #        ndata = item[3]
+                    name = item[0]
+                    self.data[name] = webqtlCaseData(*item)   #name, value, variance, num_cases)
                 #end for
-            else:
-                for item in results:
-                    val = item[1]
-                    if val != None:
-                        var = item[2]
-                        ndata = None
-                        if self.db.type in ('Publish', 'Temp'):
-                            ndata = item[3]
-                        self.data[item[0]] = webqtlCaseData(val, var, ndata)
-                #end for
-            #end if
-        else:
-            pass
+        #    else:   
+        #        for item in results:
+        #            val = item[1]
+        #            if val != None:
+        #                var = item[2]
+        #                ndata = None
+        #                if self.db.type in ('Publish', 'Temp'):
+        #                    ndata = item[3]
+        #                self.data[item[0]] = webqtlCaseData(val, var, ndata)
+        #        #end for
+        #    #end if
+        #else:
+        #    pass
 
     def keys(self):
         return self.__dict__.keys()
diff --git a/wqflask/utility/webqtlUtil.py b/wqflask/utility/webqtlUtil.py
index 6409e781..99451e33 100755
--- a/wqflask/utility/webqtlUtil.py
+++ b/wqflask/utility/webqtlUtil.py
@@ -252,7 +252,12 @@ def FloatList2String(lst):
         return ""
 
 def ListNotNull(lst):
-    'Determine if the elements in a list are all null'
+    '''Obsolete - Use built in function any (or all or whatever)
+    
+    
+    Determine if the elements in a list are all null
+    
+    '''
     for item in lst:
         if item is not None:
             return 1
diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py
index f9133f27..43f05f14 100755
--- a/wqflask/wqflask/show_trait/DataEditingPage.py
+++ b/wqflask/wqflask/show_trait/DataEditingPage.py
@@ -11,6 +11,7 @@ import yaml
 from htmlgen import HTMLgen2 as HT
 
 from base import webqtlConfig
+from base import webqtlCaseData
 from utility import webqtlUtil, Plot
 from base.webqtlTrait import webqtlTrait
 from dbFunction import webqtlDatabaseFunction
@@ -172,17 +173,17 @@ class DataEditingPage(templatePage):
         if thisTrait == None:
             thisTrait = webqtlTrait(data=fd.allTraitData, db=None)
 
-        # Variance submit page only
-        if fd.enablevariance and not varianceDataPage:
-            pass
-            #title2Body.append("Click the next button to go to the variance submission form.",
-            #        HT.Center(next,reset))
-        else:
-            pass
-            # We'll get this part working later
-            print("Calling dispBasicStatistics")
-            self.dispBasicStatistics(fd, thisTrait)
-            #self.dispMappingTools(fd, title4Body, thisTrait)
+        ## Variance submit page only
+        #if fd.enablevariance and not varianceDataPage:
+        #    pass
+        #    #title2Body.append("Click the next button to go to the variance submission form.",
+        #    #        HT.Center(next,reset))
+        #else:
+        #    pass
+        #    # We'll get this part working later
+        #    print("Calling dispBasicStatistics")
+        #    self.dispBasicStatistics(fd, thisTrait)
+        #    #self.dispMappingTools(fd, title4Body, thisTrait)
 
         #############################
         ##  Trait Value Table
@@ -892,13 +893,13 @@ class DataEditingPage(templatePage):
         for strain in thisTrait.data.keys():
             strainName = strain.replace("_2nd_", "")
             if strain not in strainlist:
-                if (thisTrait.data[strainName].val != None):
+                if thisTrait.data[strainName].value != None:
                     if strain.find('F1') < 0:
                         specialStrains.append(strain)
-                    if (thisTrait.data[strainName].val != None) and (strain not in (fd.f1list + fd.parlist)):
+                    if (thisTrait.data[strainName].value != None) and (strain not in (fd.f1list + fd.parlist)):
                         other_strains.append(strain) #XZ: at current stage, other_strains doesn't include parent strains and F1 strains of primary group
             else:
-                if (thisTrait.data[strainName].val != None) and (strain not in (fd.f1list + fd.parlist)):
+                if (thisTrait.data[strainName].value != None) and (strain not in (fd.f1list + fd.parlist)):
                     primary_strains.append(strain) #XZ: at current stage, the primary_strains is the same as fd.strainlist / ZS: I tried defining primary_strains as fd.strainlist instead, but in some cases it ended up including the parent strains (1436869_at BXD)
 
         if len(other_strains) > 3:
@@ -941,41 +942,58 @@ class DataEditingPage(templatePage):
             vals3 = []
 
             #Using all strains/cases for values
-            for i, strainNameOrig in enumerate(all_strains):
+            #for strain_type in (all_strains, primary_strains, other_strains):
+            for strainNameOrig in all_strains:
                 strainName = strainNameOrig.replace("_2nd_", "")
 
-                try:
-                    thisval = thisTrait.data[strainName].val
-                    thisvar = thisTrait.data[strainName].var
-                    thisValFull = [strainName, thisval, thisvar]
-                except:
-                    continue
+                #try:
+                print("* type of thisTrait:", type(thisTrait))
+                print("  name:", thisTrait.__class__.__name__)
+                print("  thisTrait:", thisTrait)
+                print("  type of thisTrait.data[strainName]:", type(thisTrait.data[strainName]))
+                print("  name:", thisTrait.data[strainName].__class__.__name__)
+                print("  thisTrait.data[strainName]:", thisTrait.data[strainName])
+                thisval = thisTrait.data[strainName].value
+                print("  thisval:", thisval)
+                thisvar = thisTrait.data[strainName].variance
+                print("  thisvar:", thisvar)
+                thisValFull = [strainName, thisval, thisvar]
+                print("  thisValFull:", thisValFull)
+                #except:
+                #    continue
 
                 vals1.append(thisValFull)
+                
+                
+            #vals1 = [[strainNameOrig.replace("_2nd_", ""),
+            #  thisTrait.data[strainName].val,
+            #  thisTrait.data[strainName].var]
+            #    for strainNameOrig in all_strains]]
+            #    
 
             #Using just the RISet strain
-            for i, strainNameOrig in enumerate(primary_strains):
+            for strainNameOrig in primary_strains:
                 strainName = strainNameOrig.replace("_2nd_", "")
 
-                try:
-                    thisval = thisTrait.data[strainName].val
-                    thisvar = thisTrait.data[strainName].var
-                    thisValFull = [strainName,thisval,thisvar]
-                except:
-                    continue
+                #try:
+                thisval = thisTrait.data[strainName].value
+                thisvar = thisTrait.data[strainName].variance
+                thisValFull = [strainName,thisval,thisvar]
+                #except:
+                #    continue
 
                 vals2.append(thisValFull)
 
             #Using all non-RISet strains only
-            for i, strainNameOrig in enumerate(other_strains):
+            for strainNameOrig in other_strains:
                 strainName = strainNameOrig.replace("_2nd_", "")
 
-                try:
-                    thisval = thisTrait.data[strainName].val
-                    thisvar = thisTrait.data[strainName].var
-                    thisValFull = [strainName,thisval,thisvar]
-                except:
-                    continue
+                #try:
+                thisval = thisTrait.data[strainName].value
+                thisvar = thisTrait.data[strainName].variance
+                thisValFull = [strainName,thisval,thisvar]
+                #except:
+                #    continue
 
                 vals3.append(thisValFull)
 
@@ -985,15 +1003,15 @@ class DataEditingPage(templatePage):
             vals = []
 
             #Using all strains/cases for values
-            for i, strainNameOrig in enumerate(all_strains):
+            for strainNameOrig in all_strains:
                 strainName = strainNameOrig.replace("_2nd_", "")
 
-                try:
-                    thisval = thisTrait.data[strainName].val
-                    thisvar = thisTrait.data[strainName].var
-                    thisValFull = [strainName,thisval,thisvar]
-                except:
-                    continue
+                #try:
+                thisval = thisTrait.data[strainName].value
+                thisvar = thisTrait.data[strainName].variance
+                thisValFull = [strainName,thisval,thisvar]
+                #except:
+                #    continue
 
                 vals.append(thisValFull)
 
@@ -1344,24 +1362,26 @@ class DataEditingPage(templatePage):
         # updated by NL 5-28-2010
         # Interval Mapping
         chrMenu = HT.Select(name='chromosomes1')
-        chrMenu.append(tuple(["All",-1]))
+        chrMenu.append(("All",-1))
         for i in range(len(fd.genotype)):
-            if  len(fd.genotype[i]) > 1:
-                chrMenu.append(tuple([fd.genotype[i].name,i]))
+            if len(fd.genotype[i]) > 1:
+                chrMenu.append((fd.genotype[i].name, i))
 
         #Menu for Composite Interval Mapping
         chrMenu2 = HT.Select(name='chromosomes2')
-        chrMenu2.append(tuple(["All",-1]))
+        chrMenu2.append(("All",-1))
         for i in range(len(fd.genotype)):
-            if  len(fd.genotype[i]) > 1:
-                chrMenu2.append(tuple([fd.genotype[i].name,i]))
+            if len(fd.genotype[i]) > 1:
+                chrMenu2.append((fd.genotype[i].name, i))
 
         if fd.genotype.Mbmap:
             scaleText = HT.Span("Mapping Scale:", Class="ffl fwb fs12")
-            scaleMenu1 = HT.Select(name='scale1', onChange="checkUncheck(window.document.dataInput.scale1.value, window.document.dataInput.permCheck1, window.document.dataInput.bootCheck1)")
+            scaleMenu1 = HT.Select(name='scale1',
+                                   onChange="checkUncheck(window.document.dataInput.scale1.value, window.document.dataInput.permCheck1, window.document.dataInput.bootCheck1)")
             scaleMenu1.append(("Megabase",'physic'))
             scaleMenu1.append(("Centimorgan",'morgan'))
-            scaleMenu2 = HT.Select(name='scale2', onChange="checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)")
+            scaleMenu2 = HT.Select(name='scale2',
+                                   onChange="checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)")
             scaleMenu2.append(("Megabase",'physic'))
             scaleMenu2.append(("Centimorgan",'morgan'))
 
@@ -1521,7 +1541,7 @@ class DataEditingPage(templatePage):
 
         submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%", Class="target2")
 
-        if mappingMethodId != None:
+        if not mappingMethodId:
             if int(mappingMethodId) == 1:
                 submitTable.append(mapping_row)
                 submitTable.append(mapping_script)
@@ -1567,17 +1587,6 @@ class DataEditingPage(templatePage):
         title4Body.append(submitTable)
 
 
-    def natural_sort(strain_list):
-
-        sorted = []
-        for strain in strain_list:
-            try:
-                strain = int(strain)
-                try: sorted[-1] = sorted[-1] * 10 + strain
-                except: sorted.append(strain)
-            except:
-                sorted.append(strain)
-        return sorted
 
     ##########################################
     ##  Function to display trait tables
@@ -1727,8 +1736,9 @@ class DataEditingPage(templatePage):
                                                 attribute_names=attribute_names,
                                                 strains='other')
 
-        if other_strains or (fd.f1list and thisTrait.data.has_key(fd.f1list[0])) \
-                or (fd.f1list and thisTrait.data.has_key(fd.f1list[1])):
+        #TODO: Figure out why this if statement is written this way - Zach
+        if (other_strains or (fd.f1list and thisTrait.data.has_key(fd.f1list[0])) 
+                or (fd.f1list and thisTrait.data.has_key(fd.f1list[1]))):
             print("hjs")
             fd.allstrainlist = allstrainlist_neworder
 
@@ -1738,85 +1748,93 @@ class DataEditingPage(templatePage):
 
 
     def addTrait2Table(self, fd, varianceDataPage, strainlist, mainForm, thisTrait,
-                       other_strainsExist=None, attribute_ids=[],
-                       attribute_names=[], strains='primary'):
+                       other_strainsExist=None, attribute_ids=None,
+                       attribute_names=None, strains='primary'):
+
+        if attribute_ids == None:
+            attribute_ids = []
+            
+        if attribute_names == None:
+            attribute_names = []
+
         #XZ, Aug 23, 2010: I commented the code related to the display of animal case
         #strainInfo = thisTrait.has_key('strainInfo') and thisTrait.strainInfo
         print("in addTrait2Table")
         table_body = []
         vals = []
 
-        for i, strainNameOrig in enumerate(strainlist):
-            strainName = strainNameOrig.replace("_2nd_", "")
-
-            try:
-                thisval = thisTrait.data[strainName].val
-                thisvar = thisTrait.data[strainName].var
-                thisValFull = [strainName,thisval,thisvar]
-            except:
-                continue
-
-            vals.append(thisValFull)
 
-        upperBound, lowerBound = Plot.findOutliers(vals) # ZS: Values greater than upperBound or less than lowerBound are considered outliers.
+        #################### Only used to find upperBound and lowerBound
+        #for strainNameOrig in strainlist:
+        #    strainName = strainNameOrig.replace("_2nd_", "")
+        #    print("pen: %s - %s" % (strainNameOrig, strainName))
+        #    thisval = thisTrait.data[strainName].value
+        #    thisvar = thisTrait.data[strainName].variance
+        #    thisValFull = [strainName, thisval, thisvar]
+        #
+        #    vals.append(thisValFull)
+        #
+        #upperBound, lowerBound = Plot.findOutliers(vals) # ZS: Values greater than upperBound or less than lowerBound are considered outliers.
 
         the_strains = []
 
-        for i, strainNameOrig in enumerate(strainlist):
-            strain = {}
-            print("zyt - strainNameOrig:", strainNameOrig)
-            trId = strainNameOrig
-            #selectCheck = HT.Input(type="checkbox", name="selectCheck", value=trId, Class="checkbox", onClick="highlight(this)")
-
+        for counter, strainNameOrig in enumerate(strainlist, 1):
             strainName = strainNameOrig.replace("_2nd_", "")
             strainNameAdd = ''
             if fd.RISet == 'AXBXA' and strainName in ('AXB18/19/20','AXB13/14','BXA8/17'):
                 strainNameAdd = HT.Href(url='/mouseCross.html#AXB/BXA', text=HT.Sup('#'), Class='fs12', target="_blank")
-
+    
             try:
-                thisval, thisvar, thisNP = thisTrait.data[strainName].val, thisTrait.data[strainName].var, thisTrait.data[strainName].N
-                if thisNP:
-                    mainForm.append(HT.Input(name='N'+strainName, value=thisNP, type='hidden'))
-                else:
-                    pass
-            except:
-                thisval = thisvar = 'x'
-
-            try:
-                traitVal = thisval
-                dispVal = "%2.3f" % thisval
-            except:
-                traitVal = ''
-                dispVal = 'x'
+                strain = thisTrait.data[strainName]
+            except KeyError:
+                print("No strain %s, let's create it now" % strainName)
+                strain = webqtlCaseData.webqtlCaseData(strainName)
+            print("zyt - strainNameOrig:", strainNameOrig)
+            #trId = strainNameOrig
+            #selectCheck = HT.Input(type="checkbox", name="selectCheck", value=trId, Class="checkbox", onClick="highlight(this)")
 
-            strain['strain_name'] = strainName
-            strainNameDisp = HT.Span(strainName, Class='fs14 fwn ffl')
+            
+            #try:
+            #    thisval, thisvar, thisNP = thisTrait.data[strainName].value, thisTrait.data[strainName].var, thisTrait.data[strainName].N
+            #    if thisNP:
+            #        mainForm.append(HT.Input(name='N'+strainName, value=thisNP, type='hidden'))
+            #    else:
+            #        pass
+            #except:
+            #    thisval = thisvar = 'x'
 
-            if varianceDataPage:
-                try:
-                    traitVar = thisvar
-                    dispVar = "%2.3f" % thisvar
-                except:
-                    traitVar = ''
-                    dispVar = 'x'
+            #thisval = thisTrait.data[strainName].value
+            #thisvar = thisTrait.data[strainName].variance
+            #thisTrait.data[strainName].num_cases
 
-            if thisval == 'x':
-                traitVar = '' #ZS: Used to be 0, but it doesn't seem like a good idea for values of 0 to *always* be at the bottom when you sort; it makes more sense to put "nothing"
+            #strain['strain_name'] = strainName
+            #strainNameDisp = HT.Span(strainName, Class='fs14 fwn ffl')
 
-                #className = 'fs13 b1 c222 '
-                #valueClassName = 'fs13 b1 c222 valueField '
-                #rowClassName = 'novalue '
-            else:
-                if (thisval >= upperBound) or (thisval <= lowerBound):
-                    strain['outlier'] = "outlier"  # We're going to use this as a class, so we want it to be a word
-                    #className = 'fs13 b1 c222 outlier '
-                    #valueClassName = 'fs13 b1 c222 valueField '
-                    #rowClassName = 'outlier'
-                else:
-                    strain['outlier'] = "not_outlier"
-                    #className = 'fs13 b1 c222 '
-                    #valueClassName = 'fs13 b1 c222 valueField '
-                    #rowClassName = ' '
+            #if varianceDataPage:
+                #try:
+                #    traitVar = thisvar
+                #    dispVar = "%2.3f" % thisvar
+                #except:
+                #    traitVar = ''
+                #    dispVar = 'x'
+
+            #if thisval == 'x':
+            #    traitVar = '' #ZS: Used to be 0, but it doesn't seem like a good idea for values of 0 to *always* be at the bottom when you sort; it makes more sense to put "nothing"
+            #
+            #    #className = 'fs13 b1 c222 '
+            #    #valueClassName = 'fs13 b1 c222 valueField '
+            #    #rowClassName = 'novalue '
+            #else:
+            #    if (thisval >= upperBound) or (thisval <= lowerBound):
+            #        strain['outlier'] = "outlier"  # We're going to use this as a class, so we want it to be a word
+            #        #className = 'fs13 b1 c222 outlier '
+            #        #valueClassName = 'fs13 b1 c222 valueField '
+            #        #rowClassName = 'outlier'
+            #    else:
+            #        strain['outlier'] = "not_outlier"
+            #        #className = 'fs13 b1 c222 '
+            #        #valueClassName = 'fs13 b1 c222 valueField '
+            #        #rowClassName = ' '
             #
             #if varianceDataPage:
             #    varClassName = valueClassName + str(traitVar)
@@ -1851,15 +1869,15 @@ class DataEditingPage(templatePage):
             #        #        onChange= "javascript:this.form['V%s'].value=this.form['V%s'].value;" % (strainNameOrig.replace("/", ""), strainNameOrig.replace("/", "")), Class=varClassName)
 
             if strains == 'primary':
-                strain['the_id'] = "Primary_" + str(i+1)
+                strain.this_id = "Primary_" + str(counter)
                 #table_row = HT.TR(Id="Primary_"+str(i+1), Class=rowClassName)
             else:
-                strain['the_id'] = "Other_" + str(i+1)
+                strain.this_id = "Other_" + str(counter)
                 #table_row = HT.TR(Id="Other_"+str(i+1), Class=rowClassName)
 
-            strain['value'] = traitVal
-
-            strain['se'] = dispVar
+            #strain['value'] = traitVal
+            #
+            #strain['se'] = dispVar
             #if varianceDataPage:
                 #table_row.append(HT.TD(str(i+1), selectCheck, width=45, align='right', Class=className))
                 #table_row.append(HT.TD(strainNameDisp, strainNameAdd, align='right', width=100, Class=className))
diff --git a/wqflask/wqflask/show_trait/show_trait_page.py b/wqflask/wqflask/show_trait/show_trait_page.py
index b1f71e55..b42f5e8e 100644
--- a/wqflask/wqflask/show_trait/show_trait_page.py
+++ b/wqflask/wqflask/show_trait/show_trait_page.py
@@ -161,24 +161,25 @@ class ShowTraitPage(DataEditingPage):
             thisTrait.returnURL = '%s&CellID=%s' % (thisTrait.returnURL, CellID)
 
         #retrieve trait information
-        try:
-            thisTrait.retrieveInfo()
-            thisTrait.retrieveData()
-            self.updMysql()
-            self.cursor.execute("insert into AccessLog(accesstime,ip_address) values(Now(),%s)", user_ip)
-            self.openMysql()
-        except Exception as why:
-            print("Got an exception:", why)
-            heading = "Retrieve Data"
-            detail = ["The information you requested is not avaiable at this time."]
-            self.error(heading=heading, detail=detail)
-            return
+        #try:
+        thisTrait.retrieveInfo()
+        thisTrait.retrieveData()
+        self.updMysql()
+        self.cursor.execute("insert into AccessLog(accesstime,ip_address) values(Now(),%s)", user_ip)
+        self.openMysql()
+        #except Exception as why:
+        #    print("Got an exception:", why)
+        #    heading = "Retrieve Data"
+        #    detail = ["The information you requested is not avaiable at this time."]
+        #    self.error(heading=heading, detail=detail)
+        #    return
 
         ##read genotype file
         fd.RISet = thisTrait.riset
         fd.readGenotype()
 
-        if webqtlUtil.ListNotNull(map(lambda x:x.var, thisTrait.data.values())):
+        #if webqtlUtil.ListNotNull(map(lambda x:x.var, thisTrait.data.values())):
+        if any([x.variance for x in thisTrait.data.values()]):
             fd.displayVariance = 1
             fd.varianceDispName = 'SE'
             fd.formID = 'varianceChoice'
diff --git a/wqflask/wqflask/templates/trait_data_and_analysis.html b/wqflask/wqflask/templates/trait_data_and_analysis.html
index 4bf06d45..94ba0aad 100644
--- a/wqflask/wqflask/templates/trait_data_and_analysis.html
+++ b/wqflask/wqflask/templates/trait_data_and_analysis.html
@@ -8,7 +8,7 @@
         <table width="100%" cellspacing="0" cellpadding="5">
           <tr>
             <td valign="top" width="100%" bgcolor="#FAFAFA">
-              <form method="post" action="/webqtl/main.py" name="dataInput">
+              <form method="post" action="/webqtl/main.py" name="dataInput"></form>
             {#    <input type="hidden" name="isSE" value="yes">
 				<input type="hidden" name="permCheck">
 				<input type="hidden" name="otherStrainVals" value="_">
@@ -3059,7 +3059,7 @@
                         </div><br>
 
 						{% for strain_type in (primary_strains, other_strains) %}
-                        <div id="{{ strain_type[0]['the_id'].lower().partition('_')[0] }}">  {# Slightly tortuous, but best way to get the id we need #}
+                        <div id="{{ strain_type[0]['this_id'].lower().partition('_')[0] }}">  {# Slightly tortuous, but best way to get the id we need #}
                           <table class="not_tablesorter"  {# Todo: Turn tablesorter back on #}
 								 id="{{ 'sortable%i' % (loop.index) }}"
 								 cellpadding="0" cellspacing="0">
@@ -3076,20 +3076,20 @@
                             </tr>
 
 							{% for strain in strain_type %}
-                            <tr class="{{ strain.outlier }} value_se" id="{{ strain.the_id }}">
+                            <tr class="{{ strain.outlier }} value_se" id="{{ strain.this_id }}">
                               <td class="fs13 b1 c222" align="right" width="45">
 								{{ loop.index }}
-								<input type="checkbox" name="selectCheck" class="checkbox edit_strain_checkbox" value="{{ strain.strain_name }}" checked="checked">
+								<input type="checkbox" name="selectCheck" class="checkbox edit_strain_checkbox" value="{{ strain.name }}" checked="checked">
 							  </td>
 
                               <td class="fs13 b1 c222" align="right" width="100">
-								<span class="fs14 fwn ffl edit_strain_strain_name">{{ strain.strain_name }}</span>
+								<span class="fs14 fwn ffl edit_strain_strain_name">{{ strain.name }}</span>
 							  </td>
 
 							  {# Todo: Add IDs #}
                               <td class="fs13 b1 c222"  align="right" width="70">
-								<input type="text" name="{{ strain.strain_name }}" class="fs13 b1 c222 edit_strain_value valueField"
-									   value="{{ strain.value }}" size="8" maxlength="8"
+								<input type="text" name="{{ strain.name }}" class="fs13 b1 c222 edit_strain_value valueField"
+									   value="{{ strain.display_value }}" size="8" maxlength="8"
 									   style="text-align:right; background-color:#FFFFFF;">
 							  </td>
 
@@ -3099,8 +3099,8 @@
 
 							  {# Todo: Add IDs #}
                               <td class="fs13 b1 c222" align="right" width="80">
-								<input type="text" name=""{{ 'V' + strain.strain_name}}" class="fs13 b1 c222 valueField edit_strain_se"
-									   value="{{ strain.se }}"
+								<input type="text" name=""{{ 'V' + strain.name}}" class="fs13 b1 c222 valueField edit_strain_se"
+									   value="{{ strain.display_variance }}"
 									   size="8" maxlength="8" style="text-align:right"></td>
                             </tr>
 							{% endfor %}
@@ -3133,4 +3133,8 @@
 
 
 	<!-- End of body -->
-	{% endblock %}
+	
+    
+    
+    
+    {% endblock %}