当前位置: 首页>>代码示例>>Python>>正文


Python SVGdraw.circle方法代码示例

本文整理汇总了Python中CGAT.SVGdraw.circle方法的典型用法代码示例。如果您正苦于以下问题:Python SVGdraw.circle方法的具体用法?Python SVGdraw.circle怎么用?Python SVGdraw.circle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGAT.SVGdraw的用法示例。


在下文中一共展示了SVGdraw.circle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plotOrthologs

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]
    def plotOrthologs(self):
        """plot orthologs orthologwise."""

        # Do the plot
        for ortholog_id in self.mOrthologs1.keys():

            for o1 in self.mOrthologs1[ortholog_id]:

                try:
                    x = self.getCoords1(o1)
                except KeyError:
                    continue

                for o2 in self.mOrthologs2[ortholog_id]:

                    try:
                        y = self.getCoords2(o2)
                    except KeyError:
                        continue

                    e = SVGdraw.circle(x, y,
                                       self.mDotRadius,
                                       fill="rgb(%i,%i,%i)" % BLACK,
                                       stroke="rgb(%i,%i,%i)" % BLACK,
                                       stroke_width=1)

                    self.addElement(e)
开发者ID:CGATOxford,项目名称:Optic,代码行数:29,代码来源:plot_synteny.py

示例2: addSeparator

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]
 def addSeparator(self):
     """add separator on circles."""
     if self.mRadius not in self.mSeparators:
         e = SVGdraw.circle(self.mDataMiddleX, self.mDataMiddleY, self.mRadius, fill="none",
                            stroke="rgb(%i,%i,%i)" % self.mGridColour,
                            stroke_width=self.mGridStrokeWidth)
         self.addWheelElement(e, self.mPlaneGrid)
     self.mSeparators[self.mRadius] = 1
开发者ID:Charlie-George,项目名称:cgat,代码行数:10,代码来源:SVGDuplicationsWheel.py

示例3: getElements

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]
    def getElements(self, node_id, x, y):

        node = self.mTree.node(node_id)
        e = []

        p = node.data.support

        if p == 1.0:
            e.append(SVGdraw.circle(x, y, self.mRadius,
                                    stroke="rgb(%i,%i,%i)" % SVGTree.BLACK,
                                    fill="rgb(%i,%i,%i)" % SVGTree.RED))
        elif p > 0.0:
            e.append(SVGdraw.circle(x, y, self.mRadius,
                                    stroke="rgb(%i,%i,%i)" % SVGTree.BLACK,
                                    fill="rgb(%i,%i,%i)" % SVGTree.WHITE))

            d = SVGdraw.pathdata(x, y)

            d.line(x + self.mRadius, y)

            angle = 360.0 * p
            dx = self.mRadius * math.cos(math.radians(angle)) + x
            dy = self.mRadius * math.sin(math.radians(angle)) + y

            if p <= 0.5:
                d.ellarc(self.mRadius, self.mRadius, 0, 0, 1, dx, dy)
            else:
                d.ellarc(self.mRadius, self.mRadius, 0, 1, 1, dx, dy)

            e.append(SVGdraw.path(d,
                                  stroke="rgb(%i,%i,%i)" % SVGTree.RED,
                                  fill="rgb(%i,%i,%i)" % SVGTree.RED,
                                  stroke_width=self.mStrokeWidth))

        else:
            pass

        return e
开发者ID:CGATOxford,项目名称:Optic,代码行数:40,代码来源:tree2svg.py

示例4: getElements

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]
    def getElements(self, node_id, x, y):

        e = []
        colour = self.getColour(node_id, x, y)

        if self.mPlotSymbol == "circle":
            e.append(SVGdraw.circle(x + self.mFontSize / 2,
                                    y,
                                    self.mFontSize / 2,
                                    stroke="rgb(%i,%i,%i)" % BLACK,
                                    fill="rgb(%i,%i,%i)" % colour))

        elif self.mPlotSymbol == "square":
            e.append(SVGdraw.rect(x, y - self.mFontSize / 2,
                                  self.mFontSize,
                                  self.mFontSize,
                                  stroke="rgb(%i,%i,%i)" % BLACK,
                                  fill="rgb(%i,%i,%i)" % colour))

        return e
开发者ID:Charlie-George,项目名称:cgat,代码行数:22,代码来源:SVGTree.py

示例5: addDuplication

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]

#.........这里部分代码省略.........
        ########################################################
        ########################################################
        ########################################################
        # draw points
        ########################################################
        link_colour = master_colour
        link_rad_width = self.mLinkRadStrokeWidth
        link_arc_width = self.mLinkArcStrokeWidth
        new_points = {}
        for pos1, pos2, gene, quality, chr in points:

            angle = self.getAngle((pos1 + pos2) / 2)

            x, y = self.getPosOnArc(angle, self.mRadius)

            try:
                symbol = quality2symbol[quality]
            except KeyError:
                symbol = "rect"

            if quality in quality2mask:
                colour = self.mLinkColourSymbolMasked
                link_colour = self.mLinkColourMasked
                link_rad_width = self.mLinkStrokeWidthMasked
                link_arc_width = self.mLinkStrokeWidthMasked
            else:
                colour = master_colour

            if gene in self.mPreviousPoints:
                continue

            new_points[gene] = (x, y, angle, quality, chr)

            if symbol == "circle":
                ee = SVGdraw.circle(x, y, self.mLinkSymbolSize,
                                    fill="rgb(%i,%i,%i)" % colour,
                                    stroke="black",
                                    stroke_width=self.mLinkStrokeWidthSymbol)
            elif symbol == "rect":
                ee = SVGdraw.rect(x - self.mLinkSymbolSize / 2, y - self.mLinkSymbolSize / 2,
                                  self.mLinkSymbolSize, self.mLinkSymbolSize,
                                  fill="rgb(%i,%i,%i)" % colour,
                                  stroke="black",
                                  stroke_width=self.mLinkStrokeWidthSymbol)

            if url:
                e = SVGdraw.link(url % gene)
                e.addElement(ee)
            else:
                e = ee

            self.addWheelElement(e)

        ########################################################
        ########################################################
        ########################################################
        # write all arcs in between old points and new points
        # cis:   circular arc
        # trans: radial arc
        ########################################################

        angles = []

        for x1, y1, angle1, quality1, chr1 in new_points.values():

            # reduce clutter by not writing arc to the same angle
开发者ID:Charlie-George,项目名称:cgat,代码行数:70,代码来源:SVGDuplicationsWheel.py

示例6: plotGene

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]
    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
开发者ID:CGATOxford,项目名称:Optic,代码行数:80,代码来源:plot_multiple_synteny.py

示例7: addDuplication

# 需要导入模块: from CGAT import SVGdraw [as 别名]
# 或者: from CGAT.SVGdraw import circle [as 别名]

#.........这里部分代码省略.........
                # get points of center
                old_x1, old_y1 = self.getPosOnArcForRadius( (self.mPreviousMax + self.mPreviousMin) / 2, r1 )
                new_x1, new_y1 = self.getPosOnArcForRadius( (ma + mi) / 2, r2 )

                # lines for interleaved spans: skip
                if not ((self.mPreviousMin < mi and self.mPreviousMax > ma) or \
                        (self.mPreviousMin > mi and self.mPreviousMax < ma)) :
##                     d = SVGdraw.pathdata( old_x2, old_y2 )
##                     d.line( new_x2, new_y2 )
##                     d.move( new_x1, new_y1 )
##                     d.line( old_x1, old_y1 )
##                     d.move( old_x2, old_y2 )
##                     e = SVGdraw.path( d,
##                                       fill = "none",
##                                       stroke = "rgb(%i,%i,%i)" % BLACK,
##                                       stroke_width = self.mMarkerWidth / 2 )

                    e = SVGdraw.line( old_x1, old_y1,
                                      new_x1, new_y1,
                                      fill = "none",
                                      stroke = "rgb(%i,%i,%i)" % GREY,
                                      stroke_width = self.mMarkerWidth / 2 )
                else:
                    # lines for covering spans, as these overlaps
                    e = None
##                     e = SVGdraw.line( old_x1, old_y1,
##                                       new_x1, new_y1,
##                                       fill = "none",
##                                       stroke = "rgb(%i,%i,%i)" % GREY,
##                                       stroke_width = self.mMarkerWidth / 2 )

            if e:
                self.addElement( e, self.mPlaneJoins )
                    

        self.mPreviousMin = mi
        self.mPreviousMax = ma
        self.mPreviousCis = cis
        
        self.mRadiusMax = max(self.mRadius, self.mRadiusMax)
        
        ## draw points
        link_colour = master_colour
        link_width = 10
        for pos1, pos2, gene, quality in points:
            
            angle = self.getAngle( (pos1 + pos2) / 2 )
            
            x,y = self.getPosOnArc( angle, self.mRadius )

            try:
                symbol = quality2symbol[quality]
            except KeyError:
                symbol = "rect"

            if quality in quality2mask:
                colour = GREY
                link_colour = GREY
                link_width = 1
            else:
                colour = master_colour

            if symbol == "circle":
                ee = SVGdraw.circle( x, y, self.mMarkerWidth,
                                     fill = "rgb(%i,%i,%i)" % colour,
                                     stroke="black",
                                     stroke_width= 1)
            elif symbol == "rect":
                ee =  SVGdraw.rect( x-self.mMarkerWidth/2, y-self.mMarkerWidth/2,
                                    self.mMarkerWidth, self.mMarkerWidth,
                                    fill = "rgb(%i,%i,%i)" % colour,
                                    stroke="black",
                                    stroke_width= 1)

            if url:
                e = SVGdraw.link( url % gene )
                e.addElement( ee )
            else:
                e = ee
            self.addElement( e )                


        angle1 = self.getAngle( mi ) 
        angle2 = self.getAngle( ma )

        x1,y1 = self.getPosOnArc( angle1, self.mRadius )
        x2,y2 = self.getPosOnArc( angle2, self.mRadius )

        d = SVGdraw.pathdata( x1, y1 )
        if cis:
            d.ellarc( self.mRadius, self.mRadius, 0, 0, 1, x2, y2 )            
        else:
            d.ellarc( self.mRadius * 2, self.mRadius * 2, 0, 0, 0, x2, y2 )

        e = SVGdraw.path( d,
                          fill = "none",
                          stroke = "rgb(%i,%i,%i)" % link_colour,
                          stroke_width = link_width )

        self.addElement(e)
开发者ID:siping,项目名称:cgat,代码行数:104,代码来源:plot_duplications.py


注:本文中的CGAT.SVGdraw.circle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。