Scroll to navigation

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


Bio::Graphics::Glyph::merged_alignment - The "merged_alignment" glyph


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


This glyph acts like graded_segments but the bgcolor of segments (sub-feature) is controlled by binned scores. It also supports semantic zooming to optimize glyph drawing for larger sequence displays.


The following options are standard among all Glyphs. See Bio::Graphics::Glyph for a full explanation.

  Option      Description                      Default
  ------      -----------                      -------
  -fgcolor      Foreground color               black
  -outlinecolor Synonym for -fgcolor
  -bgcolor      Background color               turquoise
  -fillcolor    Synonym for -bgcolor
  -linewidth    Line width                     1
  -height       Height of glyph                10
  -font         Glyph font                     gdSmallFont
  -connector    Connector type                 0 (false)
                Connector color                black
  -label        Whether to draw a label        0 (false)
  -description  Whether to draw a description  0 (false)
  -hilite       Highlight color                undef (no color)

In addition, the merged-alignment glyph recognizes the following glyph-specific options:

  Option      Description                  Default
  ------      -----------                  -------
  -max_score  Maximum value of the         Calculated
              feature's "score" attribute
  -min_score  Minimum value of the         Calculated
              feature's "score" attribute
  -bincolors  Colors assigned to bins      lightgrey powderblue cornflowerblue blue
              (in order)
  -bins       Bins to which scores are     Calculated
  -merge_parts                             0 (false)
              Whether to simplify the 
              alignment at low magnification
  -max_gap    Do not merge across gaps     Calculated
              that exceed this threshold

If max_score and min_score are not specified, then the glyph will calculate the local maximum and minimum scores at run time.

If the bins are not specified, they will be calculated based on the number of colors assigned and the local (or user-specified) minimum and maximum scores. Calculated bins are equal in size.

User-specified bins are expressed as ranges,

  bins  = 0-50 50-70 70-90 90-100

where each range means greater than the lower number and less than or equal to the higher number.

Simplifying the display of alignment features for large segments

The "merge_parts" option is used for semantic zooming. Specifically, if features are small and dense, they will not be displayed very well for large segments and the color-coding will be lost. If merge-parts is set to a true value, adjacent alignment parts will be merged until a gap exceeding a calculated or user-specified value is encountered. Unless specified, the maximum gap allowed for merging adjacent features is calculated as (L/10000)*(L/500), where L = the length of the sequence displayed in the browser. The exponentially increasing gap threshold allows more aggressive merging of alignment features as the size of the displayed sequence grows larger.

The score of the merged feature is calculated as a weighted average. For example, consider two adjacent HSPs that are each 400 bp in length and have scores of 60% and 70%. If the merge_parts option is set to a true value, the two HSPs would be merged in the display to a single 800 bp alignment block with an average score of 65%.

The merge_parts option is turned off by default.


Sample gbrowse configuration stanzas for an alignment feature using this glyph. The scores are assumed to be expressed as percent identity (0-100).

 # base configuration
 feature      = blastz_alignment
 glyph        = merged_alignment
 bincolors    = #A0A0A0 powderblue cornflowerblue blue
 bins         = 60-70 70-80 80-90 90-100
 category     = Sequence Similarity Tracks
 height       = 6
 bump         = 1
 label        = 1
 fgcolor      = black
 key          = BLASTZ

Semantic zooming with defined maximum gap between merged features for different zoom levels

 # if the displayed segment is >= 20000 in length,
 # use the merge_parts option to simplify the alignment
 # display
 feature      = blastz_alignment
 merge_parts  = 1
 max_gap      = 50 # do not merge across gaps > 50 bp
 # if the displayed segment is >= 50000 in length
 feature      = blastz_alignment
 merge_parts  = 1
 max_gap      = 500 # do not merge across gaps > 500 bp


Semantic zooming with dynamically calculated maximum gap

 # if the displayed segment is >= 20000 in length,
 feature      = blastz_alignment
 merge_parts  = 1


Please report them.


Bio::Graphics::Panel, Bio::Graphics::Glyph Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD


Sheldon McKay <>

Copyright (c) 2005 Cold Spring Harbor Laboratory

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