elements module

This is the primary module responsible for generating svg visualizations

mavis.illustrate.elements.draw_breakpoint(config, canvas, breakpoint, width, height, label='')[source]
Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • breakpoint (Breakpoint) – the breakpoint to draw
  • width (int) – the pixel width
  • height (int) – the pixel height
Returns:

the group element for the diagram

Return type:

svgwrite.container.Group

mavis.illustrate.elements.draw_exon(config, canvas, exon, width, height, fill, label='', translation=None)[source]

generates the svg object representing an exon

Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • exon (Exon) – the exon to draw
  • width (int) – the pixel width
  • height (int) – the pixel height
  • fill (str) – the fill color to use for the exon
Returns:

the group element for the diagram

Return type:

svgwrite.container.Group

Todo

add markers for exons with abrogated splice sites

mavis.illustrate.elements.draw_exon_track(config, canvas, transcript, mapping, colors=None, x_start=None, x_end=None, translation=None)[source]
mavis.illustrate.elements.draw_gene(config, canvas, gene, width, height, fill, label='', reference_genome=None)[source]

generates the svg object representing a gene

Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • gene (Gene) – the gene to draw
  • width (int) – the pixel width
  • height (int) – the pixel height
  • fill (str) – the fill color to use for the gene
Returns:

the group element for the diagram

Return type:

svgwrite.container.Group

mavis.illustrate.elements.draw_genes(config, canvas, genes, target_width, breakpoints=None, colors=None, labels=None, plots=None, masks=None)[source]

draws the genes given in order of their start position trying to minimize the number of tracks required to avoid overlap

Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • target_width (int) – the target width of the diagram
  • genes (list of Gene) – the list of genes to draw
  • breakpoints (list of Breakpoint) – the breakpoints to overlay
  • colors (dict of Gene and str) – dictionary of the colors assigned to each Gene as fill
Returns:

the group element for the diagram.

Has the added parameters of labels, height, and mapping

Return type:

svgwrite.container.Group

mavis.illustrate.elements.draw_legend(config, canvas, swatches, border=True)[source]

generates an svg group object representing the legend

mavis.illustrate.elements.draw_template(config, canvas, template, target_width, labels=None, colors=None, breakpoints=None)[source]

Creates the template/chromosome illustration

Returns:the group element for the diagram
Return type:svgwrite.container.Group
mavis.illustrate.elements.draw_transcript_with_translation(config, canvas, translation, labels, colors, mapping, reference_genome=None, x_start=None, x_end=None)[source]
mavis.illustrate.elements.draw_ustranscript(config, canvas, pre_transcript, target_width=None, breakpoints=[], labels=<mavis.illustrate.util.LabelMapping object>, colors={}, mapping=None, reference_genome=None, masks=None)[source]

builds an svg group representing the transcript. Exons are drawn in a track with the splicing information and domains are drawn in separate tracks below

if there are multiple splicing variants then multiple exon tracks are drawn

Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • target_width (int) – the target width of the diagram
  • pre_transcript (Transcript) – the transcript being drawn
  • exon_color (str) – the color being used for the fill of the exons
  • utr_color (str) – the color for the fill of the UTR regions
  • abrogated_splice_sites (list of int) – list of positions to ignore as splice sites
  • breakpoints (list of Breakpoint) – the breakpoints to overlay
Returns:

the group element for the transcript diagram

Has the added parameters of labels, height, and mapping

Return type:

svgwrite.container.Group

mavis.illustrate.elements.draw_vmarker(config, canvas, marker, width, height, label='', color=None)[source]
Parameters:
  • canvas (svgwrite.drawing.Drawing) – the main svgwrite object used to create new svg elements
  • breakpoint (Breakpoint) – the breakpoint to draw
  • width (int) – the pixel width
  • height (int) – the pixel height
Returns:

the group element for the diagram

Return type:

svgwrite.container.Group