def plotGene(self, x, y, gene=None, group_id=None): """plot a gene at x,y.""" if gene: group_id = gene.mOrthologId colour, format = self.mMapGroup2Colour[group_id] filled, shape = format.split("-") if filled == "filled": fill = "rgb(%i,%i,%i)" % colour stroke = "rgb(%i,%i,%i)" % BLACK stroke_width = 1 elif filled == "open": fill = "rgb(%i,%i,%i)" % WHITE stroke = "rgb(%i,%i,%i)" % colour stroke_width = self.mBlockSize / 2 if shape == "circle": ee = SVGdraw.circle(x, y, self.mBlockSize, fill=fill, stroke=stroke, stroke_width=stroke_width) elif shape == "box": ee = SVGdraw.rect( x - self.mBlockSize, y - self.mBlockSize, 2 * self.mBlockSize, 2 * self.mBlockSize, fill=fill, stroke=stroke, stroke_width=stroke_width, ) elif shape == "lefttriangle": ee = SVGdraw.polygon( ( (x - self.mBlockSize, y), (x + self.mBlockSize, y - self.mBlockSize), (x + self.mBlockSize, y + self.mBlockSize), ), fill=fill, stroke=stroke, stroke_width=stroke_width, ) elif shape == "righttriangle": ee = SVGdraw.polygon( ( (x - self.mBlockSize, y - self.mBlockSize), (x + self.mBlockSize, y), (x - self.mBlockSize, y + self.mBlockSize), ), fill=fill, stroke=stroke, stroke_width=stroke_width, ) elif shape == "uptriangle": ee = SVGdraw.polygon( ( (x, y - self.mBlockSize), (x + self.mBlockSize, y + self.mBlockSize), (x - self.mBlockSize, y + self.mBlockSize), ), fill="rgb(%i,%i,%i)" % WHITE, stroke="rgb(%i,%i,%i)" % colour, stroke_width=self.mBlockSize / 2, ) elif shape == "downtriangle": ee = SVGdraw.polygon( ( (x, y + self.mBlockSize), (x + self.mBlockSize, y - self.mBlockSize), (x - self.mBlockSize, y - self.mBlockSize), ), fill="rgb(%i,%i,%i)" % WHITE, stroke="rgb(%i,%i,%i)" % colour, stroke_width=self.mBlockSize / 2, ) return ee
def plotGene(self, x, y, gene=None, group_id=None): """plot a gene at x,y.""" if gene: group_id = gene.mOrthologId colour, format = self.mMapGroup2Colour[group_id] filled, shape = format.split("-") if filled == "filled": fill = "rgb(%i,%i,%i)" % colour stroke = "rgb(%i,%i,%i)" % BLACK stroke_width = 1 elif filled == "open": fill = "rgb(%i,%i,%i)" % WHITE stroke = "rgb(%i,%i,%i)" % colour stroke_width = self.mBlockSize / 2 if shape == "circle": ee = SVGdraw.circle(x, y, self.mBlockSize, fill=fill, stroke=stroke, stroke_width=stroke_width) elif shape == "box": ee = SVGdraw.rect(x - self.mBlockSize, y - self.mBlockSize, 2 * self.mBlockSize, 2 * self.mBlockSize, fill=fill, stroke=stroke, stroke_width=stroke_width) elif shape == "lefttriangle": ee = SVGdraw.polygon(((x - self.mBlockSize, y), (x + self.mBlockSize, y - self.mBlockSize), (x + self.mBlockSize, y + self.mBlockSize)), fill=fill, stroke=stroke, stroke_width=stroke_width) elif shape == "righttriangle": ee = SVGdraw.polygon(((x - self.mBlockSize, y - self.mBlockSize), (x + self.mBlockSize, y), (x - self.mBlockSize, y + self.mBlockSize)), fill=fill, stroke=stroke, stroke_width=stroke_width) elif shape == "uptriangle": ee = SVGdraw.polygon(((x, y - self.mBlockSize), (x + self.mBlockSize, y + self.mBlockSize), (x - self.mBlockSize, y + self.mBlockSize)), fill="rgb(%i,%i,%i)" % WHITE, stroke="rgb(%i,%i,%i)" % colour, stroke_width=self.mBlockSize / 2) elif shape == "downtriangle": ee = SVGdraw.polygon(((x, y + self.mBlockSize), (x + self.mBlockSize, y - self.mBlockSize), (x - self.mBlockSize, y - self.mBlockSize)), fill="rgb(%i,%i,%i)" % WHITE, stroke="rgb(%i,%i,%i)" % colour, stroke_width=self.mBlockSize / 2) return ee