aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2019-03-09 08:34:13 +0300
committerBonfaceKilz2020-08-08 03:26:09 +0300
commit5a19179f0b93a80a4c6cc22eb81c0395e1879026 (patch)
treeaaf2b71c7d5c612bafe4caa550b44fd35a9c3a37
parente3c0745fdc3bf33cb10256643f3b1469ee6614c4 (diff)
downloadgenenetwork2-5a19179f0b93a80a4c6cc22eb81c0395e1879026.tar.gz
Use new `draw_open_polygon()` utility
* wqflask/wqflask/marker_regression/display_mapping_results.py: Use the new `draw_open_polygon()` utility to draw open polygons.
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py48
1 files changed, 30 insertions, 18 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 9a96cd52..b754662f 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -45,7 +45,7 @@ from utility import Plot
from utility.benchmark import Bench
from wqflask.interval_analyst import GeneUtil
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR, GENERATED_IMAGE_DIR
-from utility.pillow_utils import draw_rotated_text
+from utility.pillow_utils import draw_rotated_text, draw_open_polygon
import utility.logger
logger = utility.logger.getLogger(__name__ )
@@ -841,10 +841,8 @@ class DisplayMappingResults(object):
break
if locPixel >= 0 and self.plotScale == 'physic':
traitPixel = ((locPixel, yZero), (locPixel-7, yZero+14), (locPixel+7, yZero+14))
- im_drawer.polygon(
- xy=traitPixel, outline=BLACK,
- fill=self.TRANSCRIPT_LOCATION_COLOR#, closed=1
- )
+ draw_open_polygon(canvas, xy=traitPixel, outline=BLACK,
+ fill=self.TRANSCRIPT_LOCATION_COLOR)
if self.legendChecked:
startPosY = 15
@@ -854,8 +852,18 @@ class DisplayMappingResults(object):
leftOffset = xLeftOffset
else:
leftOffset = xLeftOffset+(nCol-1)*200*fontZoom
- canvas.drawPolygon(((leftOffset+7, startPosY-7), (leftOffset, startPosY+7), (leftOffset+14, startPosY+7)), edgeColor=BLACK, fillColor=self.TRANSCRIPT_LOCATION_COLOR, closed=1)
- canvas.drawString("Sequence Site", (leftOffset+15), (startPosY+5), smallLabelFont, self.TOP_RIGHT_INFO_COLOR)
+ draw_open_polygon(
+ canvas,
+ xy=(
+ (leftOffset+7, startPosY-7),
+ (leftOffset, startPosY+7),
+ (leftOffset+14, startPosY+7)),
+ outline=BLACK, fill=self.TRANSCRIPT_LOCATION_COLOR
+ )
+ im_drawer.text(
+ text="Sequence Site",
+ xy=(leftOffset+15,startPosY+5), font=smallLabelFont,
+ fill=self.TOP_RIGHT_INFO_COLOR)
def drawSNPTrackNew(self, canvas, offset= (40, 120, 80, 10), zoom = 1, startMb = None, endMb = None):
im_drawer = ImageDraw.Draw(canvas)
@@ -2143,12 +2151,14 @@ class DisplayMappingResults(object):
thisLRSColor = self.colorCollection[0]
if qtlresult['chr'] != previous_chr and self.selectedChr == -1:
if self.manhattan_plot != True:
- im_drawer.polygon(
- xy=LRSCoordXY,
- outline=thisLRSColor
- # , closed=0, edgeWidth=lrsEdgeWidth,
- # clipX=(xLeftOffset, xLeftOffset + plotWidth)
- )
+ # im_drawer.polygon(
+ # xy=LRSCoordXY,
+ # outline=thisLRSColor
+ # # , closed=0, edgeWidth=lrsEdgeWidth,
+ # # clipX=(xLeftOffset, xLeftOffset + plotWidth)
+ # )
+ draw_open_polygon(canvas, xy=LRSCoordXY,
+ outline=thisLRSColor, width=lrsEdgeWidth)
if not self.multipleInterval and self.additiveChecked:
plusColor = self.ADDITIVE_COLOR_POSITIVE
@@ -2301,11 +2311,13 @@ class DisplayMappingResults(object):
m += 1
if self.manhattan_plot != True:
- im_drawer.polygon(
- xy=LRSCoordXY,
- outline=thisLRSColor
- #, closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)
- )
+ # im_drawer.polygon(
+ # xy=LRSCoordXY,
+ # outline=thisLRSColor
+ # #, closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)
+ # )
+ draw_open_polygon(canvas, xy=LRSCoordXY, outline=thisLRSColor,
+ width=lrsEdgeWidth)
if not self.multipleInterval and self.additiveChecked:
plusColor = self.ADDITIVE_COLOR_POSITIVE