![]() |
![]()
| ![]() |
![]()
NAMEBio::Das::Stylesheet - Access to DAS stylesheetsSYNOPSISuse Bio::Das; # contact the DAS server at wormbase.org (0.18 version API) my $das = Bio::Das->new('http://www.wormbase.org/db/das'=>'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); } DESCRIPTIONThe 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. OBJECT CREATIONBio::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.METHODS
HOW GLYPH() RESOLVES FEATURESWhen 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::PanelThe 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('http://www.wormbase.org/db/das'=>'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]); $panel->add_track($features=>$glyph,@attributes); } 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: $panel->add_track($features=>$glyph, @attributes, -connectgroups => 1, -key => 1, -labelcolor => 'chartreuse' ); AUTHORLincoln Stein <lstein@cshl.org>.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. SEE ALSOBio::Das, Bio::Graphics::Panel, Bio::Graphics::TrackPOD ERRORSHey! The above document had some coding errors, which are explained below:
|