Skip to content

mavis.illustrate.elements

This is the primary module responsible for generating svg visualizations

HEX_WHITE

HEX_WHITE = '#FFFFFF'

HEX_BLACK

HEX_BLACK = '#000000'

mavis.illustrate.elements.draw_legend()

generates an svg group object representing the legend

def draw_legend(config, canvas, swatches, border=True):

Args

  • config
  • canvas
  • swatches
  • border

mavis.illustrate.elements.draw_ustranscript()

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

def draw_ustranscript(
    config,
    canvas,
    pre_transcript,
    target_width=None,
    breakpoints=[],
    labels=LabelMapping(),
    colors={},
    mapping=None,
    reference_genome=None,
    masks=None,
):

Args

  • config
  • canvas (svgwrite.drawing.Drawing): the main svgwrite object used to create new svg elements
  • pre_transcript (Transcript): the transcript being drawn
  • target_width (int): the target width of the diagram
  • breakpoints (List[Breakpoint]): the breakpoints to overlay
  • labels
  • colors
  • mapping
  • reference_genome
  • masks

mavis.illustrate.elements.draw_genes()

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

def draw_genes(
    config,
    canvas,
    genes,
    target_width,
    breakpoints=None,
    colors=None,
    labels=None,
    plots=None,
    masks=None,
):

Args

  • config
  • canvas (svgwrite.drawing.Drawing): the main svgwrite object used to create new svg elements
  • genes (List[Gene]): the list of genes to draw
  • target_width (int): the target width of the diagram
  • breakpoints (List[Breakpoint]): the breakpoints to overlay
  • colors (Dict[str,Gene]): dictionary of the colors assigned to each Gene as
  • labels
  • plots
  • masks

mavis.illustrate.elements.draw_exon()

generates the svg object representing an exon

def draw_exon(config, canvas, exon, width, height, fill, label='', translation=None):

Args

  • config
  • 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
  • label
  • translation

Todo

add markers for exons with abrogated splice sites

mavis.illustrate.elements.draw_template()

Creates the template/chromosome illustration

Return: svgwrite.container.Group: the group element for the diagram

def draw_template(
    config, canvas, template, target_width, labels=None, colors=None, breakpoints=None
):

Args

  • config
  • canvas
  • template
  • target_width
  • labels
  • colors
  • breakpoints

mavis.illustrate.elements.draw_gene()

generates the svg object representing a gene

def draw_gene(config, canvas, gene, width, height, fill, label='', reference_genome=None):

Args

  • config
  • 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
  • label
  • reference_genome