Rendering shapes and text¶
Drawing shapes and text¶
Each of the functions below takes as arguments information about the screen coordinates, and yields a series of SVG tags specifying lines, shapes and text to be drawn. Each function also accepts optional kwdargs
which can include additional SVG attributes such as fill
and stroke
colors.
-
class
genomeview.svg.
Renderer
(backend, x, y, width, height)[source]¶ -
text
(self, x, y, text, size=10, anchor="middle", family="Helvetica", **kwdargs)[source]¶ Draws text. Anchor specifies the horizontal positioning of the text with respect to the point (x,y) and must be one of
{start, middle, end}
. Fontsize
andfamily
can also be specified.
-
text_with_background
(self, x, y, text, size=10, anchor="middle", family="Helvetica", text_color="black", bg="white", bg_opacity=0.8, **kwdargs)[source]¶ Draws text on an opaque background.
bg
specifies the background color, andbg_opacity
ranges from 0 (completely transparent) to 1 (completely opaque).
-
Converting genomic coordinates to screen coordinates¶
-
class
genomeview.
Scale
(chrom, start, end, strand, source)[source]¶ Maintains information about a projection of a specific genomic interval into screen coordinates.
That is, we’re interested in visualizing an interval (chrom:start-end) on a canvas of a specified pixel width. The scale enables converting genomic coordinates into the display coordinates.
-
get_seq
(start=None, end=None, strand='+')[source]¶ Gets the nucleotide sequence of an interval. By default, returns the sequence for the current genomic interval.
-