From d734346335f056955fb2e3b657c45eb2f6ae1f81 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 9 Dec 2015 16:57:05 +0000 Subject: Fixed search result page text to make sense for all working search terms Added a bunch of print statements to GN1 mapping code to locate where code stalls --- wqflask/wqflask/do_search.py | 5 +++- .../marker_regression/marker_regression_gn1.py | 16 +++++++++++-- wqflask/wqflask/templates/search_result_page.html | 27 ++++++++++++++++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 617d7942..a6f9c949 100755 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -861,7 +861,10 @@ class PositionSearch(DoSearch): try: self.chr = int(self.chr) except: - self.chr = int(self.chr.replace('chr', '')) + if 'chr' in self.chr: + self.chr = int(self.chr.replace('chr', '')) + else: + self.chr = int(self.chr.replace('CHR', '')) def run(self): diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index c838b3ec..f2fc12a4 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -344,8 +344,6 @@ class MarkerRegression(object): self.GraphInterval = self.MbGraphInterval #Mb else: self.GraphInterval = self.cMGraphInterval #cM - - ################################################################ # Get Trait Values and Infomation @@ -509,12 +507,16 @@ class MarkerRegression(object): ################################################################ # Plots goes here ################################################################ + print("BEFORE GN1 PLOT") if self.plotScale != 'physic' or self.multipleInterval: showLocusForm = webqtlUtil.genRandStr("fm_") else: showLocusForm = "" + print("BEFORE PIL CANVAS") intCanvas = pid.PILCanvas(size=(self.graphWidth,self.graphHeight)) + print("BEFORE PLOTINTMAPPING") gifmap = self.plotIntMapping(intCanvas, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm) + print("AFTER PLOTINTMAPPING") filename= webqtlUtil.genRandStr("Itvl_") intCanvas.save(os.path.join(webqtlConfig.IMGDIR, filename), format='png') @@ -527,6 +529,8 @@ class MarkerRegression(object): intCanvasX2.save(os.path.join(webqtlConfig.IMGDIR, filename+"X2"), format='png') #DLintImgX2=HT.Href(text='Download',url = '/image/'+filename+'X2.png', Class='smallsize', target='_blank') + print("AFTER GN1 PLOT") + textUrl = self.writeQTL2Text(fd, filename) ################################################################ @@ -739,6 +743,7 @@ class MarkerRegression(object): endPixelX = (xLeftOffset + plotWidth) #Drawing Area Height + print("DRAWING AREA HEIGHT") drawAreaHeight = plotHeight if self.plotScale == 'physic' and self.selectedChr > -1: drawAreaHeight -= self.ENSEMBL_BAND_HEIGHT + self.UCSC_BAND_HEIGHT+ self.WEBQTL_BAND_HEIGHT + 3*self.BAND_SPACING+ 10*zoom @@ -764,6 +769,7 @@ class MarkerRegression(object): newoffset = (xLeftOffset, xRightOffset, yTopOffset, yBottomOffset) # Draw the alternating-color background first and get plotXScale + print("DRAW BACKGROUND") plotXScale = self.drawGraphBackground(canvas, gifmap, offset=newoffset, zoom= zoom, startMb=startMb, endMb = endMb) #draw bootstap @@ -772,6 +778,7 @@ class MarkerRegression(object): # Draw clickable region and gene band if selected if self.plotScale == 'physic' and self.selectedChr > -1: + print("DRAW CLICKABLE REGION") self.drawClickBand(canvas, gifmap, plotXScale, offset=newoffset, zoom = zoom, startMb=startMb, endMb = endMb) if self.geneChecked and self.geneCol: self.drawGeneBand(canvas, gifmap, plotXScale, offset=newoffset, zoom = zoom, startMb=startMb, endMb = endMb) @@ -779,14 +786,18 @@ class MarkerRegression(object): self.drawSNPTrackNew(canvas, offset=newoffset, zoom = 2*zoom, startMb=startMb, endMb = endMb) ## BEGIN HaplotypeAnalyst if self.haplotypeAnalystChecked: + print("DRAW HAPLOTYPE") self.drawHaplotypeBand(canvas, gifmap, plotXScale, offset=newoffset, zoom = zoom, startMb=startMb, endMb = endMb) ## END HaplotypeAnalyst # Draw X axis + print("DRAW X AXIS") self.drawXAxis(canvas, drawAreaHeight, gifmap, plotXScale, showLocusForm, offset=newoffset, zoom = zoom, startMb=startMb, endMb = endMb) # Draw QTL curve + print("DRAW QTL CURVE") self.drawQTL(canvas, drawAreaHeight, gifmap, plotXScale, offset=newoffset, zoom= zoom, startMb=startMb, endMb = endMb) #draw legend + print("DRAW LEGEND") if self.multipleInterval: self.drawMultiTraitName(fd, canvas, gifmap, showLocusForm, offset=newoffset) elif self.legendChecked: @@ -795,6 +806,7 @@ class MarkerRegression(object): pass #draw position, no need to use a separate function + print("DRAW PROBESET POSITION") if self.genotype.Mbmap: self.drawProbeSetPosition(canvas, plotXScale, offset=newoffset, zoom = zoom) diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 7b3df00f..7b7f0037 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -17,9 +17,32 @@
We searched {{ dataset.fullname }} - to find all records that match + to find all records {% for word in search_terms %} - {{word.search_term[0]}} {% if not loop.last %} or {% endif %} + {% if word.key|lower == "rif" %} + with GeneRIF containing {{ word.search_term[0] }}{% if not loop.last %} and {% endif %} + {% elif word.key|lower == "go" %} + with Gene Ontology ID {{ word.search_term[0] }}{% if not loop.last %} and {% endif %} + {% elif word.key|lower == "wiki" %} + with GeneWiki containing {{ word.search_term[0] }}{% if not loop.last %} and {% endif %} + {% elif word.key|lower == "mean" %} + with MEAN between {{ word.search_term[0] }} and {{ word.search_term[1] }}{% if not loop.last %} and {% endif %} + {% elif word.key|lower == "lrs" or word.key|lower == "translrs" or word.key|lower == "cislrs" %} + {% if word.search_term|length == 1 %} + with {% if word.key|lower == "translrs" %}trans{% elif word.key|lower == "cislrs" %}cis{% endif %}LRS {% if word.separator == ">" %} greater than {% elif word.separator == "<" %} less than {% elif word.separator == ">=" %} greater than or equal to {% elif word.separator == "<=" %} less than or equal to {% endif %} {{ word.search_term[0] }}{% if not loop.last %} and {% endif %} + {% elif word.search_term|length == 2 %} + with LRS between {{ word.search_term[0] }} and {{ word.search_term[1] }}{% if not loop.last %} and {% endif %} + {% elif word.search_term|length == 3 %} + with LRS between {{ word.search_term[0] }} and {{ word.search_term[1] }} on chromosome {{ word.search_term[2] }}{% if not loop.last %} and {% endif %} + {% elif word.search_term|length == 5 %} + with LRS between {{ word.search_term[0] }} and {{ word.search_term[1] }} on chromosome {{ word.search_term[2] }} between {{ word.search_term[3] }} and {{ word.search_term[4] }} Mb{% if not loop.last %} and {% endif %} + {% endif %} + {% elif word.key|lower == "position" %} + with target genes on chromosome {% if word.search_term[0].split('chr')|length > 1 %}{{ word.search_term[0].split('chr')[1] }}{% elif word.search_term[0].split('CHR')|length > 1 %}{{ word.search_term[0].split('CHR')[1] }}{% else %}{{ word.search_term[0] }}{% endif %} between {{ word.search_term[1] }} and {{ word.search_term[2] }} Mb{% if not loop.last %} and {% endif %} + {% else %} + with {{ word.key|lower }} matching {{ word.search_term[0] }} + {% endif %} + {% endfor %}.
-- cgit v1.2.3