[Bioperl-l] [Bio::Graphics::Panel] code reference cannot pass to -link, why?

Xianjun Dong Xianjun.Dong at bccs.uib.no
Fri Jul 3 12:22:01 EDT 2009


I have a problem while using the -link in Bio::Graphics (version 1.96):

As the POD of Bio::Graphics described 

link format like:

  -link => 'http://www.google.com/search?q=$description'

works well in my code, but the format like

  -link => sub {
         my ($feature,$panel) = @_;
         my $type = $feature->primary_tag;
         my $name = $feature->display_name;
         if ($primary_tag eq 'clone') {
            return "http://www.google.com/search?q=$name";
         } else {
            return "http://www.yahoo.com/search?p=$name";

does not output image map as expected.

Here I attached a simple code as example for anyone who is willing to 
test for me:

        use strict;
        use Bio::Graphics;
        use Bio::Graphics::Feature;
        my $ftr= 'Bio::Graphics::Feature';
        # processed_transcript
        my $trans1 =
        my $trans2 =
        my $trans3 =
        my $trans4 =
        my @trans = ($trans1,$trans2,$trans3,$trans4);

        my $panel= Bio::Graphics::Panel->new(-start =>0,-length=>1050);

                  -glyph   => 'transcript2',
                          # This works well!
                          #-link =>
                          # while, the following code does not work as
                          -link => sub {
                                      my ($feature,$panel) = @_;
                                      my $type = $feature->primary_tag;
                                      my $name = $feature->display_name;
                                      if ($type eq 'CDS') {
                                      } else {
        my $map = $panel->create_web_map("mapname");
        print $map;

In my test (Bioperl 1.6.0), its output is:

        <map name="mapname" id="mapname">
        <area shape="rect" coords="11,0,58,7"
        href="http://www.yahoo.com/search?p="  />
        <area shape="rect" coords="57,10,115,17"
        href="http://www.yahoo.com/search?p="  />
        <area shape="rect" coords="257,0,401,7"
        href="http://www.yahoo.com/search?p="  />
        <area shape="rect" coords="743,0,801,7"
        href="http://www.yahoo.com/search?p="  />

It seems $feature->primary_tag returns 'track' (I don't know where this 
come from...), but not the type of features.  Anyone has clue for this 


Xianjun Dong
PhD student, Lenhard group
Computational Biology Unit
Bergen Center for Computational Science
University of Bergen
Hoyteknologisenteret, Thormohlensgate 55
N-5008 Bergen, Norway
E-mail: xianjun.dong at bccs.uib.no
Tel.: +47 555 84022
Fax : +47 555 84295

More information about the Bioperl-l mailing list