about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2016-04-26 11:04:32 +0000
committerPjotr Prins2016-04-26 11:04:32 +0000
commite15ed8d9e240f40b980126c07a54d10af53e2017 (patch)
tree2415c74db78a160016ca7b902ed2e254d32e297d
parentd531829d6184f444cb9257fe2e220ef3b9f462ab (diff)
parente2bdde9488c02603caee5b19644135cac23e9daf (diff)
downloadgenenetwork2-e15ed8d9e240f40b980126c07a54d10af53e2017.tar.gz
Merging with Zach's latest branch
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py5
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py508
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js4
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html130
-rwxr-xr-xwqflask/wqflask/templates/show_trait_mapping_tools.html14
-rwxr-xr-xwqflask/wqflask/templates/show_trait_statistics.html2
6 files changed, 380 insertions, 283 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 97949f93..b56b179b 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -63,7 +63,7 @@ class MarkerRegression(object):
             self.vals.append(value)
  
         self.mapping_method = start_vars['method']
-        if start_vars['manhattan_plot'] == "true":
+        if start_vars['manhattan_plot'] == "True":
             self.manhattan_plot = True
         else:
             self.manhattan_plot = False
@@ -633,6 +633,9 @@ class MarkerRegression(object):
     def gen_reaper_results(self):
         genotype = self.dataset.group.read_genotype_file()
 
+        if self.manhattan_plot != True:
+            genotype = genotype.addinterval()
+        
         samples, values, variances = self.this_trait.export_informative()
 
         trimmed_samples = []
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 245e3f04..11e312b2 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -193,9 +193,9 @@ class MarkerRegression(object):
         #
         #self.species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet)
 
-        if self.dataset.species == "rat":
+        if self.dataset.group.species == "rat":
             self._ucscDb = "rn3"
-        elif self.dataset.species == "mouse":
+        elif self.dataset.group.species == "mouse":
             self._ucscDb = "mm9"
         else:
             self._ucscDb = ""
@@ -285,7 +285,7 @@ class MarkerRegression(object):
         self.dominanceChecked = False
         self.LRS_LOD = start_vars['LRSCheck']
         self.cutoff = start_vars['cutoff']
-        self.intervalAnalystChecked = False
+        self.intervalAnalystChecked = True
         self.draw2X = False
         if 'additiveCheck' in start_vars.keys():
             self.additiveChecked = start_vars['additiveCheck']
@@ -504,34 +504,34 @@ class MarkerRegression(object):
 
         self.geneCol = None
         if self.plotScale == 'physic' and self.selectedChr > -1 and (self.intervalAnalystChecked  or self.geneChecked):
-           chrName = self.selectedChr
-           # Draw the genes for this chromosome / region of this chromosome
-           webqtldatabase = self.dataset.name
+            chrName = self.selectedChr
+            # Draw the genes for this chromosome / region of this chromosome
+            webqtldatabase = self.dataset.name
 
-           if self.dataset.group.species == "mouse":
-               self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "mouse")
-           elif self.dataset.group.species == "rat":
+            if self.dataset.group.species == "mouse":
+                self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "mouse")
+            elif self.dataset.group.species == "rat":
                self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "rat")
 
-        #
-        #    if self.geneCol and self.intervalAnalystChecked:
-        #        #######################################################################
-        #        #Nick use GENEID as RefGene to get Literature Correlation Informations#
-        #        #For Interval Mapping, Literature Correlation isn't useful, so skip it#
-        #        #through set GENEID is None                                           #
-        #        #######################################################################
-        #
-        #        #GENEID = fd.formdata.getvalue('GeneId') or None
-        #        GENEID = None
-        #
-        #        geneTableContainer = HT.Div(Id="sortable") #Div to hold table
-        #        geneTable = self.geneTable(self.geneCol,GENEID)
-        #        geneTableContainer.append(geneTable)
-        #
-        #        mainfmName = webqtlUtil.genRandStr("fm_")
-        #        tableForm = HT.Form(cgi=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name=mainfmName, submit=HT.Input(type='hidden'))
-        #        tableForm.append(HT.Input(name='FormID', value='', type='hidden'))
-        #        tableForm.append(geneTableContainer)
+            if self.geneCol and self.intervalAnalystChecked:
+               #######################################################################
+               #Nick use GENEID as RefGene to get Literature Correlation Informations#
+               #For Interval Mapping, Literature Correlation isn't useful, so skip it#
+               #through set GENEID is None                                           #
+               #######################################################################
+
+               #GENEID = fd.formdata.getvalue('GeneId') or None
+               GENEID = None
+
+               geneTableContainer = HT.Div(Id="sortable") #Div to hold table
+               self.geneTable(self.geneCol, GENEID)
+               #geneTable = self.geneTable(self.geneCol, GENEID)
+               #geneTableContainer.append(geneTable)
+
+               #mainfmName = webqtlUtil.genRandStr("fm_")
+               #tableForm = HT.Form(cgi=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name=mainfmName, submit=HT.Input(type='hidden'))
+               #tableForm.append(HT.Input(name='FormID', value='', type='hidden'))
+               #tableForm.append(geneTableContainer)
 
 
         ################################################################
@@ -1633,7 +1633,7 @@ class MarkerRegression(object):
                 canvas.drawLine(xBrowse1, paddingTop, xBrowse1, (paddingTop + self.WEBQTL_BAND_HEIGHT), color=self.CLICKABLE_WEBQTL_REGION_OUTLINE_COLOR)
 
                 UCSC_COORDS = "%d, %d, %d, %d" %(xBrowse1, ucscPaddingTop, xBrowse2, (ucscPaddingTop+self.UCSC_BAND_HEIGHT))
-                if self.species == "mouse":
+                if self.dataset.group.species == "mouse":
                     UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d&hgt.customText=%s/snp/chr%s" % (self._ucscDb, self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases, webqtlConfig.PORTADDR, self.selectedChr)
                 else:
                     UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d" % (self._ucscDb, self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
@@ -1643,7 +1643,7 @@ class MarkerRegression(object):
                 canvas.drawLine(xBrowse1, ucscPaddingTop, xBrowse1, (ucscPaddingTop+self.UCSC_BAND_HEIGHT), color=self.CLICKABLE_UCSC_REGION_OUTLINE_COLOR)
 
                 ENSEMBL_COORDS = "%d, %d, %d, %d" %(xBrowse1, ensemblPaddingTop, xBrowse2, (ensemblPaddingTop+self.ENSEMBL_BAND_HEIGHT))
-                if self.species == "mouse":
+                if self.dataset.group.species == "mouse":
                     ENSEMBL_HREF = "http://www.ensembl.org/Mus_musculus/contigview?highlight=&chr=%s&vc_start=%d&vc_end=%d&x=35&y=12" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
                 else:
                     ENSEMBL_HREF = "http://www.ensembl.org/Rattus_norvegicus/contigview?chr=%s&start=%d&end=%d" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases)
@@ -2056,63 +2056,62 @@ class MarkerRegression(object):
             if self.plotScale == "physic":
                 this_chr = str(self.ChrList[self.selectedChr][0])
             else:
-                this_chr = str(self.ChrList[self.selectedChr][1]+1)
+                this_chr = str(self.ChrList[self.selectedChr][1]+1)                                                                                                                    
             if self.selectedChr == -1 or str(qtlresult['chr']) == this_chr:
                 #AdditiveCoordXY = []
                 #DominanceCoordXY = []
                 #for k, _locus in enumerate(_chr):
-                if 1 == 1:
-                    Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
-                    #if self.plotScale == 'physic':
-                        #Xc = startPosX + (_locus.Mb-startMb)*plotXScale
-                        #Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
-                    #else:
-                        #Xc = startPosX + (_locus.cM-_chr[0].cM)*plotXScale
-                        #Xc = startPosX + (qtlresult['cM']-qtlresult[0]['cM'])*plotXScale
-
-                    # updated by NL 06-18-2011:
-                    # fix the over limit LRS graph issue since genotype trait may give infinite LRS;
-                    # for any lrs is over than 460(LRS max in this system), it will be reset to 460
-                    if 'lrs_value' in qtlresult:
-                        if self.LRS_LOD == "LOD":
-                            if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
-                                Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/(LRS_LOD_Max*self.LODFACTOR)
-                            else:
-                                Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/(LRS_LOD_Max*self.LODFACTOR)
+                Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
+                #if self.plotScale == 'physic':
+                    #Xc = startPosX + (_locus.Mb-startMb)*plotXScale
+                    #Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
+                #else:
+                    #Xc = startPosX + (_locus.cM-_chr[0].cM)*plotXScale
+                    #Xc = startPosX + (qtlresult['cM']-qtlresult[0]['cM'])*plotXScale
+
+                # updated by NL 06-18-2011:
+                # fix the over limit LRS graph issue since genotype trait may give infinite LRS;
+                # for any lrs is over than 460(LRS max in this system), it will be reset to 460
+                if 'lrs_value' in qtlresult:
+                    if self.LRS_LOD == "LOD":
+                        if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
+                            Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/(LRS_LOD_Max*self.LODFACTOR)
                         else:
-                            if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
-                                Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
-                            else:
-                                Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max
+                            Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/(LRS_LOD_Max*self.LODFACTOR)
                     else:
-                        if qtlresult['lod_score'] > 100 or qtlresult['lod_score']=='inf':
+                        if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
                             Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
                         else:
-                            if self.LRS_LOD == "LRS":
-                                Yc = yZero - qtlresult['lod_score']*self.LODFACTOR*LRSHeightThresh/LRS_LOD_Max
-                            else:
-                                Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRS_LOD_Max
-                    #if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
-                    #if self.qtlresults[j]['lrs_value'] > 460 or self.qtlresults[j]['lrs_value']=='inf':
-                    #    Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
-                    #else:
-                    #    Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max
-
-                    if self.manhattan_plot == True:
-                        canvas.drawEllipse(Xc-1, Yc-1, Xc+1, Yc+1, fillColor=pid.black)
+                            Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max
+                else:
+                    if qtlresult['lod_score'] > 100 or qtlresult['lod_score']=='inf':
+                        Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
                     else:
-                        LRSCoordXY.append((Xc, Yc))
-
-                    if not self.multipleInterval and self.additiveChecked:
-                       if additiveMax == 0.0:
-                           additiveMax = 0.000001
-                       Yc = yZero - qtlresult['additive']*AdditiveHeightThresh/additiveMax
-                       AdditiveCoordXY.append((Xc, Yc))
-                    # if not self.multipleInterval and INTERCROSS and self.additiveChecked:
-                       # Yc = yZero - qtlresult['dominance']*DominanceHeightThresh/dominanceMax
-                       # DominanceCoordXY.append((Xc, Yc))
-                    m += 1
-                    #canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
+                        if self.LRS_LOD == "LRS":
+                            Yc = yZero - qtlresult['lod_score']*self.LODFACTOR*LRSHeightThresh/LRS_LOD_Max
+                        else:
+                            Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRS_LOD_Max
+                #if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
+                #if self.qtlresults[j]['lrs_value'] > 460 or self.qtlresults[j]['lrs_value']=='inf':
+                #    Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
+                #else:
+                #    Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max
+
+                if self.manhattan_plot == True:
+                    canvas.drawEllipse(Xc-1, Yc-1, Xc+1, Yc+1, fillColor=pid.black)
+                else:
+                    LRSCoordXY.append((Xc, Yc))
+
+                if not self.multipleInterval and self.additiveChecked:
+                   if additiveMax == 0.0:
+                       additiveMax = 0.000001
+                   Yc = yZero - qtlresult['additive']*AdditiveHeightThresh/additiveMax
+                   AdditiveCoordXY.append((Xc, Yc))
+                # if not self.multipleInterval and INTERCROSS and self.additiveChecked:
+                   # Yc = yZero - qtlresult['dominance']*DominanceHeightThresh/dominanceMax
+                   # DominanceCoordXY.append((Xc, Yc))
+                m += 1
+                #canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
 
         if self.manhattan_plot != True:
             canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
@@ -2625,113 +2624,141 @@ class MarkerRegression(object):
     def geneTable(self, geneCol, refGene=None):
         #SNPLink = 0 #Not sure what this is used for
 
-        if self.species == 'mouse' or self.species == 'rat':
-
-            gene_tblobj = {}
-            gene_tblobj["header"] = self.getGeneTableHeader(refGene=None)
-            gene_tblobj["body"] = self.getGeneTableBody(geneCol, refGene=None)
+        if self.dataset.group.species == 'mouse' or self.dataset.group.species == 'rat':
+            #gene_tblobj = {}
+            self.gene_table_header = self.getGeneTableHeader(refGene=None)
+            self.gene_table_body = self.getGeneTableBody(geneCol, refGene=None)
+            #gene_tblobj["header"] = self.getGeneTableHeader(refGene=None)
+            #gene_tblobj["body"] = self.getGeneTableBody(geneCol, refGene=None)
 
-            sortby = self.getSortByValue()
+            #sortby = self.getSortByValue()
 
-            filename= webqtlUtil.genRandStr("Mapping_")
+            #filename= webqtlUtil.genRandStr("Mapping_")
 
-            objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb')
-            cPickle.dump(gene_tblobj, objfile)
-            objfile.close()
-
-            gene_table = webqtlUtil.genTableObj(tblobj=gene_tblobj, file=filename, sortby=sortby, tableID="sortable", addIndex="0")
+            #objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb')
+            #cPickle.dump(gene_tblobj, objfile)
+            #objfile.close()
 
+            #gene_table = webqtlUtil.genTableObj(tblobj=gene_tblobj, file=filename, sortby=sortby, tableID="sortable", addIndex="0")
         else:
-            gene_table = ""
-
-        return gene_table
+            self.gene_table_header = None
+            self.gene_table_body = None
+            #gene_table = ""
 
-    def getLiteratureCorrelation(cursor,geneId1=None,geneId2=None):
-        if not geneId1 or not geneId2:
-            return None
-        if geneId1 == geneId2:
-            return 1.0
-        geneId1 = str(geneId1)
-        geneId2 = str(geneId2)
-        lCorr = None
-        try:
-            query = 'SELECT Value FROM LCorrRamin3 WHERE GeneId1 = %s and GeneId2 = %s'
-            for x,y in [(geneId1,geneId2),(geneId2,geneId1)]:
-                cursor.execute(query,(x,y))
-                lCorr =  cursor.fetchone()
-                if lCorr:
-                    lCorr = lCorr[0]
-                    break
-        except: raise #lCorr = None
-        return lCorr
+        #return gene_table    
 
     def getGeneTableHeader(self, refGene=None):
 
         gene_tblobj_header = []
+        
+        gene_table_header_list = []
 
         col_class = "fs14 fwb ffl b1 cw cbrb"
 
-        if self.species == "mouse":
+        if self.dataset.group.species == "mouse":
 
             if refGene:
-                gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
-                        THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
-                        THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
-                        THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
-                        THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
-                        THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
-                        THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
-                        THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
-                        THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
-                        THCell(HT.TD('Literature',HT.BR(),'Correlation', align='left', width=100, Class=col_class), text="lit_corr", idx=9),
-                        THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=10),
-                        THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
-                                        align='left', width=100, Class=col_class), sort=0, idx=11),
-                        THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
-                                        align='left', width=110, Class=col_class), sort=0, idx=12),
-                                        ]]
+                gene_table_header_list = ["Index", 
+                                               "Symbol", 
+                                               "Mb Start", 
+                                               "Length (Kb)", 
+                                               "SNP Count", 
+                                               "SNP Density", 
+                                               "Avg Expr", 
+                                               "Human Chr", 
+                                               "Mb Start (hg19)", 
+                                               "Literature Correlation",
+                                               "Gene Description", 
+                                               "PolymiRTS Database" + HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank").__str__(), 
+                                               "Gene Weaver Info Content" + HT.Href(url='http://geneweaver.org/', text='>>', target="_blank").__str__()]
+            
+                # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
+                        # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
+                        # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
+                        # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
+                        # THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
+                        # THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
+                        # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
+                        # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
+                        # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
+                        # THCell(HT.TD('Literature',HT.BR(),'Correlation', align='left', width=100, Class=col_class), text="lit_corr", idx=9),
+                        # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=10),
+                        # THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
+                                        # align='left', width=100, Class=col_class), sort=0, idx=11),
+                        # THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
+                                        # align='left', width=110, Class=col_class), sort=0, idx=12),
+                                        # ]]
             else:
-                gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
-                        THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
-                        THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
-                        THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
-                        THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
-                        THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
-                        THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
-                        THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
-                        THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
-                        THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=9),
-                        THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
-                                        align='left', width=100, Class=col_class), sort=0, idx=10),
-                        THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
-                                        align='left', width=110, Class=col_class), sort=0, idx=11),
-                                        ]]
-
-        elif self.species == "rat":
-
-            gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
-                    THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
-                    THCell(HT.TD('Mb Start',HT.BR(),'(rn3)', align='left', width=100, Class=col_class), text="mb_start_rn3", idx=2),
-                    THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
-                    THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=4),
-                    THCell(HT.TD('Mouse',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="mouse_chr", idx=5),
-                    THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=6),
-                    THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
-                    THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
-                    THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', Class=col_class), text="description", idx=9)]]
+                gene_table_header_list = ["",
+                                          "Index", 
+                                          "Symbol", 
+                                          "Mb Start", 
+                                          "Length (Kb)", 
+                                          "SNP Count", 
+                                          "SNP Density", 
+                                          "Avg Expr", 
+                                          "Human Chr", 
+                                          "Mb Start (hg19)", 
+                                          "Gene Description", 
+                                          "PolymiRTS Database" + HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank").__str__(), 
+                                          "Gene Weaver Info Content" + HT.Href(url='http://geneweaver.org/', text='>>', target="_blank").__str__()]
+
+                # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
+                        # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
+                        # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
+                        # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
+                        # THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
+                        # THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
+                        # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
+                        # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
+                        # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
+                        # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=9),
+                        # THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
+                                        # align='left', width=100, Class=col_class), sort=0, idx=10),
+                        # THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
+                                        # align='left', width=110, Class=col_class), sort=0, idx=11),
+                                        # ]]
+
+        elif self.dataset.group.species == "rat":
+
+            gene_table_header_list = ["",
+                                      "Index", 
+                                      "Symbol", 
+                                      "Mb Start", 
+                                      "Length (Kb)", 
+                                      "Avg Expr", 
+                                      "Mouse Chr", 
+                                      "Mb Start (mm9)", 
+                                      "Human Chr", 
+                                      "Mb Start (hg19)", 
+                                      "Gene Description"]
+        
+            # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
+                    # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
+                    # THCell(HT.TD('Mb Start',HT.BR(),'(rn3)', align='left', width=100, Class=col_class), text="mb_start_rn3", idx=2),
+                    # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
+                    # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=4),
+                    # THCell(HT.TD('Mouse',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="mouse_chr", idx=5),
+                    # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=6),
+                    # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
+                    # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
+                    # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', Class=col_class), text="description", idx=9)]]
 
         else:
             pass
 
-        return gene_tblobj_header
+        return gene_table_header_list
+        #return gene_tblobj_header
 
     def getGeneTableBody(self, geneCol, refGene=None):
 
         tblobj_body = [] #contains table rows
         className = "fs13 b1 c222"
+        
+        gene_table_body = []
 
         tableIterationsCnt = 0
-        if self.species == "mouse":
+        if self.dataset.group.species == "mouse":
 
             # polymiRTS
             # http://lily.uthsc.edu:8080/20090422_UTHSC_cuiyan/PolymiRTS_CLS?chrom=2&chrom_from=115&chrom_to=125
@@ -2770,8 +2797,8 @@ class MarkerRegression(object):
 
                     allProbeString = '%s?cmd=sch&gene=%s&alias=1' % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), theGO["GeneSymbol"])
                     if theGO["snpCount"]:
-                        snpString = HT.Href(url="%s&chr=%s&start=%s&end=%s&geneName=%s&s1=%d&s2=%d" % (os.path.join(webqtlConfig.CGIDIR, 'main.py?FormID=snpBrowser'),
-                                theGO["Chromosome"], theGO["TxStart"], theGO["TxEnd"], theGO["GeneSymbol"], self.diffCol[0], self.diffCol[1]),
+                        snpString = HT.Href(url="http://genenetwork.org/webqtl/main.py?FormID=snpBrowser&chr=%s&start=%s&end=%s&geneName=%s&s1=%d&s2=%d" % (theGO["Chromosome"],
+                                theGO["TxStart"], theGO["TxEnd"], theGO["GeneSymbol"], self.diffCol[0], self.diffCol[1]),
                                 text=theGO["snpCount"], target="_blank", Class="normalsize")
                     else:
                         snpString = 0
@@ -2808,7 +2835,7 @@ class MarkerRegression(object):
                     geneDescription = theGO["GeneDescription"]
                     if len(geneDescription) > 26:
                         geneDescription = geneDescription[:26]+"..."
-                    probeSetSearch = HT.Href(allProbeString, HT.Image("/images/webqtl_search.gif", border=0), target="_blank")
+                    probeSetSearch = HT.Href(allProbeString, ">>", target="_blank")
 
                     if theGO["snpDensity"] < 0.000001:
                         snpDensityStr = "0"
@@ -2835,37 +2862,69 @@ class MarkerRegression(object):
 
                         literatureCorrelationString = str(self.getLiteratureCorrelation(self.cursor,refGene,theGO['GeneID']) or "N/A")
 
-                        this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
-                        this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
-                        this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
-                        this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
-                        this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
-                        this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
-                        this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
-                        this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
-                        this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
-                        this_row.append(TDCell(HT.TD(literatureCorrelationString, align='right', Class=className), literatureCorrelationString, literatureCorrelation))
-                        this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
-                        this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
-                        this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
+                        this_row = [selectCheck.__str__(),
+                                    str(tableIterationsCnt),
+                                    HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank").__str__() +  "&nbsp;" + probeSetSearch.__str__(),
+                                    HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank").__str__(),
+                                    HT.Href("javascript:rangeView('%s', %f, %f)" % (str(int(theGO["Chromosome"])-1), txStart-tenPercentLength, txEnd+tenPercentLength), "%0.3f" % geneLength).__str__(),
+                                    snpString,
+                                    snpDensityStr,
+                                    avgExpr,
+                                    humanChr,
+                                    HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(),
+                                    literatureCorrelationString,
+                                    geneDescription,
+                                    polymiRTS,
+                                    ""]
+                                    
+                        # this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
+                        # this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
+                        # this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
+                        # this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
+                        # this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
+                        # this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
+                        # this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
+                        # this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
+                        # this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
+                        # this_row.append(TDCell(HT.TD(literatureCorrelationString, align='right', Class=className), literatureCorrelationString, literatureCorrelation))
+                        # this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
+                        # this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
+                        # this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
 
                     else:
-                        this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
-                        this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
-                        this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
-                        this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
-                        this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
-                        this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
-                        this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
-                        this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
-                        this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
-                        this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
-                        this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
-                        this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
-
-                tblobj_body.append(this_row)
-
-        elif self.species == 'rat':
+                    
+                        this_row = [selectCheck.__str__(),
+                                    str(tableIterationsCnt),
+                                    HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank").__str__() +  "&nbsp;" + probeSetSearch.__str__(),
+                                    HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank").__str__(),
+                                    HT.Href("javascript:rangeView('%s', %f, %f)" % (str(int(theGO["Chromosome"])-1), txStart-tenPercentLength, txEnd+tenPercentLength), "%0.3f" % geneLength).__str__(),
+                                    snpString,
+                                    snpDensityStr,
+                                    avgExpr,
+                                    humanChr,
+                                    HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(),
+                                    geneDescription,
+                                    polymiRTS,
+                                    ""]
+                    
+                    
+                        # this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
+                        # this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
+                        # this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
+                        # this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
+                        # this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
+                        # this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
+                        # this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
+                        # this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
+                        # this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
+                        # this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
+                        # this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
+                        # this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
+
+                gene_table_body.append(this_row)        
+                #tblobj_body.append(this_row)
+
+        elif self.dataset.group.species == 'rat':
 
             for gIndex, theGO in enumerate(geneCol):
 
@@ -2913,32 +2972,57 @@ class MarkerRegression(object):
                 if geneDesc == "---":
                     geneDesc = ""
 
-                """
-                if len(geneDesc) > 40:
-                        geneDesc = gene0So apparently Angola prison (which used to be a slave plantation) has a rodeo that they invite the general public to.
-The prisoners are not trained before hand
-But its cool because its completely voluntary.
-And by voluntary, according to HFG when I talked to him, they have a choice between doing it or door number two and "door number 2 is... rather worse than volunteering"Desc[:37] + "..."
-                """
-
-                this_row.append(TDCell(HT.TD(gIndex + 1, selectCheck, align='left', Class=className), str(gIndex+1), gIndex+1))
-                this_row.append(TDCell(HT.TD(webqtlSearch, geneSymbolNCBI, align='left', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
-                this_row.append(TDCell(HT.TD(theGO["TxStart"], align='left', Class=className), theGO["TxStart"], theGO["TxStart"]))
-                this_row.append(TDCell(HT.TD(HT.Href(geneLengthURL, "%0.3f" % (geneLength*1000.0)), align='left', Class=className), "%0.3f" % (geneLength*1000.0), (geneLength*1000.0)))
-                this_row.append(TDCell(HT.TD(avgExprVal, align='left', Class=className), "", ""))
-                this_row.append(TDCell(HT.TD(mouseChr, align='left', Class=className), mouseChr, mouseChr))
-                this_row.append(TDCell(HT.TD(mouseTxStart, align='left', Class=className), mouseTxStart, mouseTxStart))
-                this_row.append(TDCell(HT.TD(humanChr, align='left', Class=className), humanChr, humanChrSort))
-                this_row.append(TDCell(HT.TD(humanTxStart, align='left', Class=className), humanTxStart, humanTxStart))
-                this_row.append(TDCell(HT.TD(geneDesc, align='left', Class=className), geneDesc, geneDesc))
-
-                tblobj_body.append(this_row)
+                this_row = [selectCheck.__str__(),
+                            str(gIndex+1),
+                            webqtlSearch.__str__() + geneSymbolNCBI,
+                            theGO["TxStart"],
+                            HT.Href(geneLengthURL, "%0.3f" % (geneLength*1000.0)).__str__(),
+                            avgExprVal,
+                            mouseChr,
+                            mouseTxStart,
+                            humanChr,
+                            humanTxStart,
+                            geneDesc]
+                    
+                    
+                #this_row.append(TDCell(HT.TD(gIndex + 1, selectCheck, align='left', Class=className), str(gIndex+1), gIndex+1))
+                #this_row.append(TDCell(HT.TD(webqtlSearch, geneSymbolNCBI, align='left', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
+                #this_row.append(TDCell(HT.TD(theGO["TxStart"], align='left', Class=className), theGO["TxStart"], theGO["TxStart"]))
+                #this_row.append(TDCell(HT.TD(HT.Href(geneLengthURL, "%0.3f" % (geneLength*1000.0)), align='left', Class=className), "%0.3f" % (geneLength*1000.0), (geneLength*1000.0)))
+                #this_row.append(TDCell(HT.TD(avgExprVal, align='left', Class=className), "", ""))
+                #this_row.append(TDCell(HT.TD(mouseChr, align='left', Class=className), mouseChr, mouseChr))
+                #this_row.append(TDCell(HT.TD(mouseTxStart, align='left', Class=className), mouseTxStart, mouseTxStart))
+                #this_row.append(TDCell(HT.TD(humanChr, align='left', Class=className), humanChr, humanChrSort))
+                #this_row.append(TDCell(HT.TD(humanTxStart, align='left', Class=className), humanTxStart, humanTxStart))
+                #this_row.append(TDCell(HT.TD(geneDesc, align='left', Class=className), geneDesc, geneDesc))
+
+                gene_table_body.append(this_row)
+                #tblobj_body.append(this_row)
 
         else:
             pass
 
-        return tblobj_body
-
+        return gene_table_body
+        #return tblobj_body        
+        
+    def getLiteratureCorrelation(cursor,geneId1=None,geneId2=None):
+        if not geneId1 or not geneId2:
+            return None
+        if geneId1 == geneId2:
+            return 1.0
+        geneId1 = str(geneId1)
+        geneId2 = str(geneId2)
+        lCorr = None
+        try:
+            query = 'SELECT Value FROM LCorrRamin3 WHERE GeneId1 = %s and GeneId2 = %s'
+            for x,y in [(geneId1,geneId2),(geneId2,geneId1)]:
+                cursor.execute(query,(x,y))
+                lCorr =  cursor.fetchone()
+                if lCorr:
+                    lCorr = lCorr[0]
+                    break
+        except: raise #lCorr = None
+        return lCorr
 
     def getSortByValue(self):
 
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 9e249c28..9d418e9b 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -190,9 +190,9 @@
         }
         row_line = "<tr>";
         if (row.url != null) {
-          row_line += "<td id=\"" + row.vn + "\"><a href=\"" + row.url + "\">" + row.pretty + "</a></td>";
+          row_line += "<td id=\"" + row.vn + "\" style=\"border-right: 1px solid #000000;\"><a href=\"" + row.url + "\">" + row.pretty + "</a></td>";
         } else {
-          row_line += "<td id=\"" + row.vn + "\">" + row.pretty + "</td>";
+          row_line += "<td id=\"" + row.vn + "\" style=\"border-right: 1px solid #000000;\">" + row.pretty + "</td>";
         }
         _ref1 = js_data.sample_group_types;
         for (key in _ref1) {
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 311429f8..07f764ca 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -20,7 +20,7 @@
         {% endfor %}
         <input type="hidden" name="maf">
         <input type="hidden" name="selected_chr" value="{{ selectedChr }}">
-        <input type="hidden" name="manhattan_plot">
+        <input type="hidden" name="manhattan_plot" value="{{ manhattan_plot }}">
         <input type="hidden" name="num_perm" value="{{ nperm }}">
         <input type="hidden" name="num_bootstrap" value="{{ nboot }}">
         <input type="hidden" name="do_control" value="{{ doControl }}">
@@ -117,10 +117,10 @@
                     <span style="color:red;">*</span>
                   <br>
                   <input type="checkbox" name="showGenes" class="checkbox" style="display: inline; margin-top: 0px;" {% if geneChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Gene Track </span> <span style="color:red;">*</span><br>
-                  <input type="checkbox" name="viewLegend" class="checkbox" style="display: inline; margin-top: 0px;" {% if legendChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Legend </span><br>
                   {% if plotScale != "morgan" %}
-                  <input type="checkbox" name="haplotypeAnalystCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if haplotypeAnalystChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Haplotype Analyst </span> <span style="color:red;">*</span>
+                  <input type="checkbox" name="haplotypeAnalystCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if haplotypeAnalystChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Haplotype Analyst </span> <span style="color:red;">*</span><br>
                   {% endif %}
+                  <input type="checkbox" name="viewLegend" class="checkbox" style="display: inline; margin-top: 0px;" {% if legendChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Legend </span>
             </div>
             <div class="col-xs-12" align="center" style="padding: 5px;">
               <span style="color:red;">*</span> <span style="font-size: 12px;">only apply to single chromosome physical mapping</span>
@@ -165,65 +165,75 @@
         </div>
 
         </form>
-        {% if selectedChr == -1 %}
         <div style="width:48%;">
-            <h2>
-                Results
-            </h2>
-            <table id="qtl_results" class="table table-hover table-striped">
-                <thead>
-                    <tr>
-                        <th></th>
-                        <th>Index</th>
-                        <th>{{ LRS_LOD }}</th>
-                        <th>Chr</th>
-                        {% if plotScale == "centimorgan" %}
-                        <th>cM</th>
-                        {% else %}
-                        <th>Mb</th>
-                        {% endif %}
-                        <th>Locus</th>
-                   </tr>
-                </thead>
-                <tbody>
-                    {% for marker in trimmed_markers %}
-                        <tr>
-                            <td>
-                                <input type="checkbox" name="selectCheck"
-                                       class="checkbox edit_sample_checkbox"
-                                       value="{{ marker.name }}" checked="checked">
-                            </td>
-                            <td align="right">{{ loop.index }}</td>
-                            {% if LRS_LOD == "LOD" %}
-                            {% if 'lod_score' in marker %}
-                            <td>{{ '%0.2f' | format(marker.lod_score|float) }}</td>
-                            {% else %}
-                            <td>{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}</td>
-                            {% endif %}
-                            {% else %}
-                            {% if 'lod_score' in marker %}
-                            <td>{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}</td>
-                            {% else %}
-                            <td>{{ '%0.2f' | format(marker.lrs_value|float) }}</td>
-                            {% endif %}
-                            {% endif %}
-                            <td>{{marker.chr}}</td>
-                            <td>{{ '%0.6f' | format(marker.Mb|float) }}</td>
-                            <td>
-                                {{ marker.name }}
-                                <!--<a href="{{ url_for('show_trait_page',
-                                        trait_id = marker.name,
-                                        dataset = dataset.name
-                                        )}}">
-                                    {{ marker.name }}
-                                </a>-->
-                            </td>
-                        </tr>
-                    {% endfor %}
-                </tbody>
-            </table>
+          {% if selectedChr == -1 %}
+          <h2>Results</h2>
+          <table id="qtl_results" class="table table-hover table-striped">
+            <thead>
+              <tr>
+                <th></th>
+                <th>Index</th>
+                <th>{{ LRS_LOD }}</th>
+                <th>Chr</th>
+                {% if plotScale == "centimorgan" %}
+                <th>cM</th>
+                {% else %}
+                <th>Mb</th>
+                {% endif %}
+                <th>Locus</th>
+              </tr>
+            </thead>
+            <tbody>
+              {% for marker in trimmed_markers %}
+              <tr>
+                <td>
+                  <input type="checkbox" name="selectCheck"
+                         class="checkbox edit_sample_checkbox"
+                         value="{{ marker.name }}" checked="checked">
+                </td>
+                <td align="right">{{ loop.index }}</td>
+                {% if LRS_LOD == "LOD" %}
+                {% if 'lod_score' in marker %}
+                <td>{{ '%0.2f' | format(marker.lod_score|float) }}</td>
+                {% else %}
+                <td>{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}</td>
+                {% endif %}
+                {% else %}
+                {% if 'lod_score' in marker %}
+                <td>{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}</td>
+                {% else %}
+                <td>{{ '%0.2f' | format(marker.lrs_value|float) }}</td>
+                {% endif %}
+                {% endif %}
+                <td>{{marker.chr}}</td>
+                <td>{{ '%0.6f' | format(marker.Mb|float) }}</td>
+                <td>{{ marker.name }}</td>
+              </tr>
+              {% endfor %}
+            </tbody>
+          </table>
+          {% elif selectedChr > -1 %}
+          <h2>Interval Analyst</h2>
+          <table id="interval_analyst" class="table table-hover table-striped">
+            <thead>
+              <tr>
+                {% for header in gene_table_header %}
+                <th>{{ header|safe }}</th>
+                {% endfor %}
+              </tr>
+            </thead>
+            <tbody>
+              {% for row in gene_table_body %}
+              <tr>
+                {% for n in range(row|length) %}
+                <td>{{ row[n]|safe }}</td>
+                {% endfor %}
+              </tr>
+              {% endfor %}
+            </tbody>
+          </table>
+          {% endif %}
         </div>
-        {% endif %}
     </div>
 
     <!-- End of body -->
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 620a4631..067dfc67 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -66,11 +66,11 @@
                             <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label>
                             <div class="col-xs-12 controls">                      
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_pylmm" value="true">
+                                    <input type="radio" name="manhattan_plot_pylmm" value="True">
                                     Yes
                                 </label>
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_pylmm" value="false" checked="">
+                                    <input type="radio" name="manhattan_plot_pylmm" value="False" checked="">
                                     No
                                </label>
                             </div>
@@ -160,11 +160,11 @@
                             <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label>
                             <div class="col-xs-12 controls">                      
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_rqtl" value="true">
+                                    <input type="radio" name="manhattan_plot_rqtl" value="True">
                                     Yes
                                 </label>
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_rqtl" value="false" checked="">
+                                    <input type="radio" name="manhattan_plot_rqtl" value="False" checked="">
                                     No
                                </label>
                             </div>
@@ -239,14 +239,14 @@
 
 
                         <div class="mapping_method_fields form-group">
-                            <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label>
+                            <label style="text-align:left;" class="col-xs-12 control-label">Marker Regr.</label>
                             <div class="col-xs-12 controls">                      
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_reaper" value="true">
+                                    <input type="radio" name="manhattan_plot_reaper" value="True">
                                     Yes
                                 </label>
                                 <label class="radio-inline">
-                                    <input type="radio" name="manhattan_plot_reaper" value="false" checked="">
+                                    <input type="radio" name="manhattan_plot_reaper" value="False" checked="">
                                     No
                                </label>
                             </div>
diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html
index 9c5c94b2..9a57b285 100755
--- a/wqflask/wqflask/templates/show_trait_statistics.html
+++ b/wqflask/wqflask/templates/show_trait_statistics.html
@@ -26,7 +26,7 @@
             <div class="tab-content">
                 <div class="tab-pane active" id="stats_tab">
                     <div style="padding: 20px" class="form-horizontal">
-                            <table id="stats_table" style="width: 300px; float: left;" class="table table-hover table-striped"></table>
+                            <table id="stats_table" style="width: 300px; float: left;" class="table table-hover table-striped cell-border"></table>
                     </div>
                 </div>   
                 <div class="tab-pane" id="histogram_tab">