[Bioperl-l] colorize features

Marc Logghe Marc.Logghe at DEVGEN.com
Tue May 9 14:47:06 UTC 2006


Hi Peter,
Actually it is explained much better in this howto:
http://bioperl.org/wiki/HOWTO:Graphics

The examples show the principle I mentioned in my previous post (e.g.
Example 4), but then for the -label or -description options.
But as said, you can apply this as well for (most of ?) the other
options as well.
Regards,
ML 



> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org 
> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Marc Logghe
> Sent: Tuesday, May 09, 2006 4:13 PM
> To: Peter Menzel; bioperl-l at lists.open-bio.org
> Subject: Re: [Bioperl-l] colorize features
> 
> 
> > -----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
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 




More information about the Bioperl-l mailing list