[Bioperl-l] Bio:Graphics for drawing secondary structure

Matthew Betts betts at embl.de
Thu Aug 7 16:27:28 UTC 2008


Hi Scott,

Thanks for that, was a great help - I didn't realise I could use a code 
ref for anything other than the glyph name.

I'm now doing this:

$panel->add_track(
                  '-bgcolor' => sub {
				     my($feature) = @_;
                                     $feature->display_name eq 'strand' ? 'cyan' : 'magenta';
                                    },
                  '-strand_arrow' => sub {
                                          my($feature) = @_;
                                          $feature->display_name eq 'strand' ? 1 : 0;
                                         },
);

Matthew


On Thu, 7 Aug 2008, Scott Cain wrote:

> Hi Matthew,
> 
> I don't have any code examples, but people have used GBrowse for
> protein secondary structure, which uses Bio::Graphics underneath the
> hood.
> 
> If you want to put more than one glyph and/or more than one color in a
> track, it is fairly easy.  You just need to provide a callback for
> each option when you create the track, like this:
> 
>   $panel->add_track($features_array_ref,
>                     -glyph       => sub { #code to set the glyph
> according the attributes of the feature  },
>                     -bgcolor     => sub { #code to set the color },
>                     -fgcolor     => 'black',
>                  ...etc...
>   );
> 
> For more information, see the biographics howto:
> 
>   http://www.bioperl.org/wiki/HOWTO:Graphics
> 
> Scott
> 
> 
> 
> On Thu, Aug 7, 2008 at 8:42 AM, Matthew Betts <betts at embl.de> wrote:
> >
> > Hi,
> >
> > Has any one tried to draw secondary structure with Bio::Graphics? i.e. two
> > different types of glyph with different colours on the same track.
> >
> > Could use a hash reference to get the different glyph types (would be nice
> > if there was a cylinder glyph and a thick arrow glyph), or heterogeneous
> > segments to get the different colours, but I can't see how to do both at
> > the same time.
> >
> > Any example code or suggestions on how I could implement it would be
> > great.
> >
> > Thanks,
> >
> > Matthew
> >
> > --
> > Matthew Betts PhD, Russell Group (Structural Bioinformatics)
> > EMBL, Meyerhofstrasse 1, D-69117 Heidelberg, Germany
> > phone: +49 (0)6221 387 8305; mailto:betts at embl.de
> > _______________________________________________
> > 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