From 5a19179f0b93a80a4c6cc22eb81c0395e1879026 Mon Sep 17 00:00:00 2001 From: Muriithi Frederick Muriuki Date: Sat, 9 Mar 2019 08:34:13 +0300 Subject: 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. --- .../marker_regression/display_mapping_results.py | 48 ++++++++++++++-------- 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'wqflask') 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 -- cgit v1.2.3