aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2022-08-12 14:51:38 +0000
committerzsloan2022-12-21 13:04:07 -0600
commit52bbe8b56c0d8d2cda2b084e1ad936d80c40e431 (patch)
tree618ff4e72933be8112cbad4ccf2bd496abab957b
parent881376674aadd8c68f9c5ca519ce28feb84f89e8 (diff)
downloadgenenetwork2-52bbe8b56c0d8d2cda2b084e1ad936d80c40e431.tar.gz
Make homology track display directional arrows based on query strand
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py93
1 files changed, 43 insertions, 50 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 9425e1f3..af63713f 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -1398,61 +1398,54 @@ class DisplayMappingResults:
geneYLocation += 3 * self.BAND_HEIGHT + 3 * self.BAND_SPACING
# draw the detail view
- if self.endMb - self.startMb <= self.DRAW_DETAIL_MB and geneEndPix - geneStartPix > self.EACH_GENE_ARROW_SPACING * 3:
- utrColor = ImageColor.getrgb("rgb(66%, 66%, 66%)")
- arrowColor = ImageColor.getrgb("rgb(70%, 70%, 70%)")
+ utrColor = ImageColor.getrgb("rgb(66%, 66%, 66%)")
+ arrowColor = ImageColor.getrgb("rgb(70%, 70%, 70%)")
- # draw the line that runs the entire length of the gene
- im_drawer.line(
- xy=(
- (geneStartPix, geneYLocation + \
- self.EACH_GENE_HEIGHT / 2 * zoom),
- (geneEndPix, geneYLocation + self.EACH_GENE_HEIGHT / 2 * zoom)),
- fill=outlineColor, width=1)
-
- # draw the arrows
- if geneEndPix - geneStartPix < 1:
- genePixRange = 1
- else:
- genePixRange = int(geneEndPix - geneStartPix)
- for xCoord in range(0, genePixRange):
-
- if (xCoord % self.EACH_GENE_ARROW_SPACING == 0 and xCoord + self.EACH_GENE_ARROW_SPACING < geneEndPix - geneStartPix) or xCoord == 0:
- if query_strand == "+":
- im_drawer.line(
- xy=((geneStartPix + xCoord, geneYLocation),
- (geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
- geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
- fill=arrowColor, width=1)
- im_drawer.line(
- xy=((geneStartPix + xCoord,
- geneYLocation + self.EACH_GENE_HEIGHT * zoom),
- (geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
- geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
- fill=arrowColor, width=1)
- else:
- im_drawer.line(
- xy=((geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
- geneYLocation),
- (geneStartPix + xCoord,
- geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
- fill=arrowColor, width=1)
- im_drawer.line(
- xy=((geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
- geneYLocation + self.EACH_GENE_HEIGHT * zoom),
- (geneStartPix + xCoord,
- geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
- fill=arrowColor, width=1)
- # draw the genes as rectangles
+ # draw the line that runs the entire length of the gene
+ im_drawer.line(
+ xy=(
+ (geneStartPix, geneYLocation + \
+ self.EACH_GENE_HEIGHT / 2 * zoom),
+ (geneEndPix, geneYLocation + self.EACH_GENE_HEIGHT / 2 * zoom)),
+ fill=outlineColor, width=1)
+
+ # draw the arrows
+ if geneEndPix - geneStartPix < 1:
+ genePixRange = 1
else:
- im_drawer.rectangle(
- xy=((geneStartPix, geneYLocation),
- (geneEndPix, (geneYLocation + self.EACH_GENE_HEIGHT * zoom))),
- outline=outlineColor, fill=fillColor)
+ genePixRange = int(geneEndPix - geneStartPix)
+ for xCoord in range(0, genePixRange):
+
+ if (xCoord % self.EACH_GENE_ARROW_SPACING == 0 and xCoord + self.EACH_GENE_ARROW_SPACING < geneEndPix - geneStartPix) or xCoord == 0:
+ if query_strand == "+":
+ im_drawer.line(
+ xy=((geneStartPix + xCoord, geneYLocation),
+ (geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
+ geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
+ fill=arrowColor, width=1)
+ im_drawer.line(
+ xy=((geneStartPix + xCoord,
+ geneYLocation + self.EACH_GENE_HEIGHT * zoom),
+ (geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
+ geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
+ fill=arrowColor, width=1)
+ else:
+ im_drawer.line(
+ xy=((geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
+ geneYLocation),
+ (geneStartPix + xCoord,
+ geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
+ fill=arrowColor, width=1)
+ im_drawer.line(
+ xy=((geneStartPix + xCoord + self.EACH_GENE_ARROW_WIDTH,
+ geneYLocation + self.EACH_GENE_HEIGHT * zoom),
+ (geneStartPix + xCoord,
+ geneYLocation + (self.EACH_GENE_HEIGHT / 2) * zoom)),
+ fill=arrowColor, width=1)
COORDS = "%d, %d, %d, %d" % (
geneStartPix, geneYLocation, geneEndPix, (geneYLocation + self.EACH_GENE_HEIGHT))
- # NL: 06-02-2011 Rob required to display NCBI info in a new window
+
gifmap.append(
HtmlGenWrapper.create_area_tag(
shape='rect',