[Bioperl-l] Bio::GRaphics query

Richard Adams Richard.Adams@ed.ac.uk
Mon, 30 Sep 2002 12:24:48 +0100


    Hello,
First of all I'd just like to say congratulations to the Bio::Graphics
developers, it is an excellent tool
and I anticipate using it a great deal from now on. For creating custom
displays of  features, I think it's very powerful
in conjunction with the Seq::Feature methods. Furthermore I think it
will tip the balance to convince some of my BioPerl-sceptical
colleagues to start using BioPerl generally.

    However, I am experiencing a glitch when I want the 'height' value
of  a glyph component to vary proportionally to the
score of a feature e.g.,

$panel->add_track(ellipse  => \@NetPhos_prediction,  #custom feature
added to Genbank file using Bio::SeqFeature::Generic
                     -bgcolor    =>  'blue',
                     -fgcolor    =>  'black',
                     -key        => 'NetPhos_p',
                     -bump       =>  1,
                     -height     =>  \&getsize,
                     -label      => \&cds_label,  #this and callback on
next line are from synopsis code
                     -description=> \&cds_description,
                   ) ;

sub getsize {
  my $feature = shift;
 my @size;
 if ($feature->has_tag('score')) {
           @size = $feature->each_tag_value('score');
             my $size  = int ($size[0] *25);
            return $size;
    }
   else {####need this else error
            print STDERR "default\n";
            return 10;
        }
}

If I don't put in the default "else {..}I get the following error for
all glyph types I've tried.

Use of uninitialized value in addition (+) at
/packages/perl/lib/site_perl/5.6.0/Bio/Graphics/Glyph.pm line 382,
<DATA> line 141.

I've examined my Genbank-style  file  and all  my 16 'Netphos' features
have 'score' tags, and all values of $size are integers between 5 and
20.
Yet the 'default' code is executed twice, despite the fact that all the
features in the final .png file appear to have been scaled correctly.

I was just wondering if this is a bug or is supposed to happen, and why
the else{.} is executed at all if it is supposed to..

Many thanks

Richard Adams
Dept. of Molecular Medicine
University of Edinburgh
UK