[Bioperl-l] colorize features
Marc Logghe
Marc.Logghe at DEVGEN.com
Tue May 9 14:13:24 UTC 2006
> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org
> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of
> Peter Menzel
> Sent: Tuesday, May 09, 2006 2:44 PM
> To: bioperl-l at lists.open-bio.org
> Subject: [Bioperl-l] colorize features
>
> Hi all,
> I am using the Bio::Graphics module to draw sequences and
> their features with Bio::SeqFeature::Generic.
> The features I want to highlight are occurrences of
> transcription binding factors. Therefore I want to give every
> factor its own color, but i didn't see how to manage it. I
> only can colorize complete tracks.
> Is there a known workaround?
Yes, instead of giving a hardcoded color value you can pass a subroutine
to the option.
-bgcolor => sub {
my $feat = shift;
# get your attribute on which you want to base your color
my ($attr) = $feat->get_tag_values('my_attribute');
return $attr > 10 ? 'red' : 'green'
}
Not sure about the method calls I am making here (could as well be
get_attributes()) but you get the idea.
Cheers,
Marc
More information about the Bioperl-l
mailing list