[Bioperl-l] Display of gff annotation

Marco Blanchette mblanche at berkeley.edu
Sat Apr 8 12:21:59 EDT 2006


Many Thanks Scott,

Everything works perfectly [although I had to change the
$feature->attributes('note') to $feature->get_tag_values('note')].

My new goal now is to add, under the gene structure, binding sites hits in
the form of a diamond glyph with their color representing the score of the
binding site.

I am trying to use:
 
my ($hits, $min, $max) = hits2feat ($hits_File);

$panel->add_track(  diamond => $hits,
                    -height => 6,
                    ############
                    #-bgcolor => sub{ my $feature = shift;
                    #                 should be able to use
                    #                 value of -score to set
                    #                 the color value
                    #
                    ############    }
                    );



Where the subroutine hits2feat() return a Bio::SeqFeature::Generic object
with the start, end and score of the feature set to the different binding
site hits and score. In addition it returns the smallest and largest score
values of the different hits.

My goal would be to set, probably using a callback, the bgcolor accordingly
to the score value in a green to red gradient where green represent the $min
and red the $max value.

Many thanks.

Marco.


On 4/7/06 7:49 PM, "Scott Cain" <cain at cshl.edu> wrote:

> 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


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







More information about the Bioperl-l mailing list