Scroll to navigation

Bio::Graphics::Glyph::decorated_transcript(3pm) User Contributed Perl Documentation Bio::Graphics::Glyph::decorated_transcript(3pm)


Bio::Graphics::Glyph::decorated_transcript - draws processed transcript with protein decorations


  See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.


This glyph extends the functionality of the Bio::Graphics::Glyph::processed_transcript glyph and allows one to draw protein decorations (e.g., signal peptides, transmembrane domains, protein domains) on top of gene models. Currently, the glyph can draw decorations in form of colored or outlined boxes inside or around CDS segments. Protein decorations are specified at the 'mRNA' transcript level in protein coordinates. Protein coordinates are automatically mapped to nucleotide coordinates by the glyph. Decorations are allowed to span exon-exon junctions, in which case decorations are split between exons. By default, the glyph automatically assigns different colors to different types of protein decorations, whereas decorations of the same type are always assigned the same color.

Protein decorations are provided either with mRNA features inside GFF files (see example below) or dynamically via callback function using the additional_decorations option (see glyph options). The following line is an example of an mRNA feature in a GFF file that contains two protein decorations, one signal peptide predicted by SignalP and one transmembrane domain predicted by TMHMM:

"chr1 my_source mRNA 74796 75599 . + . ID=rna_gene-1;protein_decorations=SignalP40:SP:1:23:0:my_comment,TMHMM:TM:187:209:0"

Each protein decoration consists of six fields separated by a colon:

1. type
Decoration type. For example used to specify decoration source (e.g. 'SignalP40')
2. name
Decoration name. Used as decoration label by default (e.g. 'SP' for signal peptide)
3. start
Start coordinate at the protein-level (1-based coordinate)
4. end
End coordinate at the protein-level
5. score
Optional. Score associated with a decoration (e.g. Pfam E-value). This score can be used to dynamically filter or color decorations via callbacks (see glyph options).
6. description
Optional. User-defined description of decoration. The glyph ignores this description, but it will be made available to callback functions for inspection. Special characters like ':' or ',' that might interfere with the GFF tag parser should be avoided.

If callback functions are used as glyph parameters (see below), the callback is called for each decoration separately. That is, the callback can be called multiple times for a given CDS feature, but each time with a different decoration that overlaps with this CDS. The currently drawn (active) decoration is made available to the callback via the glyph method 'active_decoration'. The active decoration is returned in form of a Bio::Graphics::Feature object, with decoration data fields mapped to corresponding feature attributes in the following way:

  • type --> $glyph->active_decoration->type
  • name --> $glyph->active_decoration->name
  • nucleotide start coordinate --> $glyph->active_decoration->start
  • nucleotide end coordinate --> $glyph->active_decoration->end
  • protein start coordinate --> $glyph->active_decoration->get_tag_values('p_start')
  • protein end coordinate --> $glyph->active_decoration->get_tag_values('p_end')
  • score --> $glyph->active_decoration->score
  • description --> $glyph->active_decoration->description

In addition, the glyph passed to the callback allows access to the parent glyph and parent feature if required (use $glyph->parent or $glyph->parent->feature).


This glyph inherits all options from the Bio::Graphics::Glyph::processed_transcript glyph. In addition, it recognizes the following glyph-specific options:

  Option          Description                                              Default
  ------          -----------                                              -------
                  Specifies whether decorations should be visible          false
                  or not. For selective display of individual 
                  decorations, specify a callback function and 
                  return 1 or 0 after inspecting the active decoration
                  of the glyph. 
                  Decoration background color. If no color is              <auto>
                  specified, colors are assigned automatically by
                  decoration type and name, whereas decorations of 
                  identical type and name are assigned the same color.
                  A special color 'transparent' can be used here in 
                  combination with the option 'decoration_border' to 
                  draw decorations as outlines.
                  Decoration border style. By default, decorations are     0 (none)
                  drawn without border ('none' or 0). Other valid 
                  options here include 'solid' or 'dashed'.
                  Color of decoration border.                              black 
                  Decoration label. If not specified, the second data      true
                  field of the decoration is used as label. Set this       (decoration name)
                  option to 0 to get unlabeled decorations. If the label 
                  text extends beyond the size of the decorated segment, 
                  the label will be clipped. Clipping does not occur 
                  for SVG output.
                  Position of decoration label. Labels can be drawn        inside 
                  'inside' decorations (default) or 'above' and 'below'
                  Decoration label color. If not specified, this color 
                  is complementary to decoration_color (e.g., yellow text 
                  on blue background, white on black, etc.). If the 
                  decoration background color is transparent and no
                  decoration label color is specified, the foreground color 
                  of the underlying transcript glyph is used as default.
                  Additional decorations to those specified in the GFF     undefined 
                  file. Expected is a string in the same format as 
                  described above for GFF files. 
                  This parameter is intended to be used as callback 
                  function, which inspects the currently processed
                  transcript feature (first parameter to callback) 
                  and returns additional protein decorations that 
                  should be drawn.
                  Decoration height. Unless specified otherwise,           CDS height-2
                  the height of the decoration is the height of the 
                  underlying transcript glyph minus 2, such that 
                  the decoration is drawn within transcript boundaries.
                  Currently decorations can only be drawn inside           inside 
                  CDS segments.
                  If set to 1, features on the negative strand will be     false 
                  drawn flipped. This is not particularly useful in 
                  GBrowse, but becomes handy if multiple features should 
                  be drawn within the same panel, left-aligned, and on 
                  top of each other, for example to allow for easy gene 
                  structure comparisons.


Strandedness arrows are decorated incorrectly. Currently, the glyph plots a rectangular box over the arrow instead of properly coloring the arrow.

Overlapping decorations are drawn on top of each other without particular order. The only solution to this problem at this point is to reduce decorations to a non-overlapping set.

For SVG output or if drawn not inside decorations, decoration labels are not clipped. Similar as for overlapping decorations, this can result in labels being drawn on top of each other.

Please report all errors.


Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::decorated_gene, Bio::Graphics::Glyph::processed_transcript


Christian Frech <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.

2019-11-25 perl v5.30.0