[Bioperl-l] Display of gff annotation

Scott Cain cain at cshl.edu
Sat Apr 8 02:49:42 UTC 2006


Hi Marco,

In answer to your questions: 

1. You might find it easier to use Bio::DB::GFF with you gff file; you
can use the 'memory' adaptor to have it use a file instead of a 'real'
database.  It will give you Bio::DB::GFF::Feature objects which you can
use in the same was as your Bio::SeqFeature::Generic objects.

2. To color your exons differently, you can use a callback in the
bgcolor attribute:

$panel->add_track($full_length,
          -glyph   => 'arrow',
          -tick    => 2,
          -fgcolor => 'black',
          -double  => 1,
          -bgcolor => sub {
                 my $feature = shift;
                 my ($note)  = $feature->attributes('note');
                 if ($note =~ /\./) {
                      return 'red';
                 }
                 else {
                      return 'blue';
                 }
            }
       );

My only comment is that your GFF is a little funny looking: the "(   -"
in the source column might result in some strange behavior.

Scott


On Fri, 2006-04-07 at 18:54 -0700, Marco Blanchette wrote:
> Dear all--
> 
> I have a gff annotation in the form of:
> 
> ##gff-version 2
> # seqname    source    feature    start    end    score    strand    frame
> attributes
> AF260530 (    -    exon    262    693    .    +    .    note "1"
> AF260530 (    -    exon    4450    4630    .    +    .    note "2"
> AF260530 (    -    exon    13432    13776    .    +    .    note "3"
> AF260530 (    -    exon    15198    15359    .    +    .    note "4.1"
> AF260530 (    -    exon    15537    15698    .    +    .    note "4.2"
> AF260530 (    -    exon    16060    16221    .    +    .    note "4.3"
> AF260530 (    -    exon    16682    16852    .    +    .    note "4.4"
> AF260530 (    -    exon    16985    17146    .    +    .    note "4.5"
> AF260530 (    -    exon    16985    17146    .    +    .    note "5"
> 
> 
> Where the value of the tag 'note' is the exon name. all exons with a decimal
> annotation are alternatively spliced exon. My goal would be to display the
> alternative exons in a different color (let say red) than the constitutive
> exons (let say blue).
> 
> I have this script:
> #!/usr/bin/perl
> 
> use strict;
> use Bio::Tools::GFF;
> use Bio::Graphics;
> use Bio::SeqFeature::Generic;
> 
> 
> my $gffio = Bio::Tools::GFF->new(-file => $ARGV[0],
>                                  -gff_version => 2,
>                                 );
> 
> my $feat_o = Bio::SeqFeature::Generic->new(-name => 'aGene');
> 
> while (my $feature = $gffio->next_feature) {
>         $feat_o->add_SeqFeature($feature,'EXPAND');
> }
> 
> my $panel = Bio::Graphics::Panel->new(
>                   -length => $feat_o->end,
>                   -width  => 1500,
>                   -pad_left => 10,
>                   -pad_right => 10,
>                  );
> 
> my $full_length = Bio::SeqFeature::Generic->new(-start=>1,
>                                                 -end=>$feat_o->end);
> 
> $panel->add_track($full_length,
>           -glyph   => 'arrow',
>           -tick    => 2,
>           -fgcolor => 'black',
>           -double  => 1,
>                         );
> 
> $panel->add_track($feat_o,
>                     -glyph=> 'segments');
> print $panel->png
> 
> 
> That does almost what I need. My questions are:
> 1) is there a better way to transform the GFF file into a SeqFeature object
> than the while loop that I am using
> 
> 2) How could I tell the Bio::Graphics::Panel object to color the exon with a
> '.' in red and the others in blue.
> 
> Many thanks all
> 
> Marco
> 
> 
> 
> Marco Blanchette, Ph.D.
> 
> mblanche at berkeley.edu
> 
> Donald C. Rio's lab
> Department of Molecular and Cell Biology
> 16 Barker Hall
> University of California
> Berkeley, CA 94720-3204
> 
> Tel: (510) 642-1084
> Cell: (510) 847-0996
> Fax: (510) 642-6062
> 
> 
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain at cshl.edu
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory




More information about the Bioperl-l mailing list