Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  BIO::DAS::STYLESHEET (3)

.ds Aq ’


Bio::Das::Stylesheet - Access to DAS stylesheets



  use Bio::Das;

  # contact the DAS server at (0.18 version API)
  my $das      = Bio::Das->new(>elegans);

  # get the stylesheet
  my $style    = $das->stylesheet;

  # get features
  my @features = $das->segment(-ref=>Locus:unc-9)->features;

  # for each feature, ask the stylesheet what glyph to use
  for my $f (@features) {
    my ($glyph_name,@attributes) = $style->glyph($f);


The Bio::Das::Stylesheet class contains information about a remote DAS server’s preferred visualization style for sequence features. Each server has zero or one stylesheets for each of the data sources it is responsible for. Stylesheets can provide stylistic guidelines for broad feature categories (such as transcription), or strict guidelines for particular feature types (such as Prosite motif).

The glyph names and attributes are broadly compatible with the Bio::Graphics library.


Bio::Das::Stylesheets are created by the Bio::Das object in response to a call to the stylesheet() method. The Bio::Das object must previously have been associated with a data source.


($glyph,@attributes) = $stylesheet->glyph($feature) The glyph() method takes a Bio::Das::Segment::Feature object and returns the name of a suggested glyph to use, plus zero or more attributes to apply to the glyph. Glyphs names are described in the DAS specification, and include terms like box and arrow.

Attributes are name/value pairs, for instance:

   (-width => 10, -outlinecolor => black)

The initial - is added to the attribute names to be consistent with the Perl name/value calling style. The attribute list can be passed directly to the Ace::Panel->add_track() method.

In a scalar context, glyph() will return just the name of the glyph without the attribute list.

@categories = $stylesheet->categories Return a list of all the categories known to the stylesheet.
$source = $stylesheet->source Return the Bio::Das object associated with the stylesheet.


When a feature is passed to glyph(), the method checks the feature’s type ID and category against the stylesheet. If an exact match is found, then the method returns the corresponding glyph name and attributes. Otherwise, glyph() looks for a default style for the category and returns the glyph and attributes for that. If no category default is found, then glyph() returns its global default.

    USING Bio::Das::Stylesheet WITH Bio::Graphics::Panel

The stylesheet class was designed to work hand-in-glove with Bio::Graphics::Panel. You can rely entirely on the stylesheet to provide the glyph name and attributes, or provide your own default attributes to fill in those missing from the stylesheet.

It is important to bear in mind that Bio::Graphics::Panel only allows a single glyph type to occupy a horizontal track. This means that you must sort the different features by type, determine the suggested glyph for each type, and then create the tracks.

The following code fragment illustrates the idiom. After sorting the features by type, we pass the first instance of each type to glyph() in order to recover a glyph name and attributes applicable to the entire track.

  use Bio::Das;
  use Bio::Graphics::Panel;

  my $das        = Bio::Das->new(>elegans);
  my $stylesheet = $das->stylesheet;
  my $segment    = $das->segment(-ref=>Locus:unc-9);
  @features      = $segment->features;

  my %sort;
  for my $f (@features) {
     my $type = $f->type;
     # sort features by their type, and push them onto anonymous
     # arrays in the %sort hash.
     push @{$sort{$type}},$f;  
  my $panel = Bio::Graphics::Panel->new( -segment => $segment,
                                         -width   => 800 );
  for my $type (keys %sort) {
      my $features = $sort{$type};
      my ($glyph,@attributes) = $stylesheet->glyph($features->[0]);

To provide your own default attributes to be used in place of those omitted by the stylesheet, just change the last line so that your own attributes follow those provided by the stylesheet:

                        -connectgroups => 1,
                        -key           => 1,
                        -labelcolor    => chartreuse


Lincoln Stein <>.

Copyright (c) 2001 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.


Bio::Das, Bio::Graphics::Panel, Bio::Graphics::Track


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 227: You forgot a ’=back’ before ’=head2’
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 DAS::STYLESHEET (3) 2010-06-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.