Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add -color_cycle option to control automatic background color selection

  • Loading branch information...
commit fac85898a40dd6e1947c4106d6d12f61c19d7de6 1 parent ee4968a
@lstein lstein authored
View
2  Changes
@@ -3,6 +3,8 @@ Revision history for Perl extension Bio::Graphics.
2.26
- Support for normalizing quantitative plots across entire track.
- Support for transparency within tracks, allowing features to overlap.
+ - Support for -color_series and -color_cycle options (see Bio::Graphics::Panel)
+ which cycle dynamically among a fixed series of background colors.
2.25
- Deprecate xyplot "histogram" subtype and default to "boxes".
View
3  lib/Bio/Graphics/FeatureFile.pm
@@ -440,7 +440,8 @@ END
} else {
mkpath(dirname($cachefile));
my $parsed = $self->_new(@_);
- lock_store($parsed,$cachefile);
+ eval {lock_store($parsed,$cachefile)};
+ warn $@ if $@;
return $parsed;
}
View
7 lib/Bio/Graphics/Glyph/track.pm
@@ -35,9 +35,10 @@ sub draw {
$self->normalize_track(@parts);
# dynamic assignment of colors
- if ($self->option('color_series')) {
- my @color_series =
- qw(red blue green yellow orange brown aqua black fuchsia green lime maroon navy olive purple silver teal magenta);
+ if ($self->option('color_series') || $self->option('color_cycle')) {
+ my $series = $self->option('color_cycle');
+ $series ||= 'red blue green yellow orange brown aqua black fuchsia green lime maroon navy olive purple silver teal magenta';
+ my @color_series = ref($series) eq 'ARRAY' ? @$series : split /\s+/,$series;
my $index = 0;
my %color_cache;
my $closure = sub {
View
12 lib/Bio/Graphics/Panel.pm
@@ -1961,10 +1961,14 @@ object to the panel. This stylesheet will be called to determine both
the glyph and the glyph options. If both a stylesheet and direct
options are provided, the latter take precedence.
-The B<-color_series> argument, if true, causes the track to ignore
-the -bgcolor setting and instead to assign glyphs a series of
-contrasting colors. This is usually used in combination with
--bump=>'overlap' in order to create overlapping features.
+The B<-color_series> argument causes the track to ignore the -bgcolor
+setting and instead to assign glyphs a series of contrasting
+colors. This is usually used in combination with -bump=>'overlap' in
+order to create overlapping features. A true value activates the color
+series. You may adjust the default color series using the
+B<-color_cycle> option, which is either a reference to an array of
+Bio::Graphics color values, or a space-delimited string of color
+names/value.
If successful, add_track() returns an Bio::Graphics::Glyph object.
You can use this object to add additional features or to control the
Please sign in to comment.
Something went wrong with that request. Please try again.