[Bioperl-l] FW: How to specify color for each feature in a track?

Zhenguo Zhang zuz17 at psu.edu
Thu Mar 31 18:18:59 EDT 2011


Dear Dr. Stein,

Sorry for interruption. I found the problems, I used
$f->get_tag_values('color'); to return the tag value, it is not correct. The
list context should be provided. It is my mistake. Thanks.

Best wishes!

Zhenguo

---------------- Forwarded Message ----------------
From: "Zhenguo Zhang" <zuz17 at psu.edu>
Date: Thu, Mar 31, 2011 04:54 PM
Subject: How to specify color for each feature in a track?
To: lstein at cshl.edu, bioperl-l at lists.open-bio.org

Dear Dr. Stein,

I am using your excellent module Bio::Graphics for
programming to show protein domains. I want to put all the domains for a
sequence into one track, and give each domain (one feature here) one designated
color. The following is the cold to add_track:


 75        
$panel->add_track($seq,
 78                 -glyph    =>  'segments',
 81                 -bgcolor  => sub {
 82                     my $f = shift;
 87                     return $f->get_tag_values('color');
 88                 },
 89                 -fgcolor  => 'black',
 90                 -font2color => 'red',
 91                 -key      => "$seq",
 92                 -label    => 1,
 93                 -bump     => +1,
 94                 -height   => 8,
 95                 -description => 1,
 96 #               -part_label_merge => 1
 97                 );

Here $seq is an array reference, each element being one domain feature. I
specify the -bgcolor based on the tag 'color'  defined when domain feature was
constructed. However, it does not work. All the domains in all sequences show
the same color. Based on the document, the -glyph can be changed by calling
back the anonymous functions (I have not tried this). The color might be
changed in a similar way. Thank you in advance!

Best regards!

Zhenguo

**************************************************************
Zhenguo Zhang
Postdoctoral Scholar
Institute of Molecular Evolutionary Genetics
Penn State University
312 Mueller Lab
University Park, PA 16802
Tel: 814-865-2796
Homepage: <http://www.personal.psu.edu/zuz17/>
Lab page:  <http://homes.bio.psu.edu/people/Faculty/Nei/>




**************************************************************
Zhenguo Zhang
Postdoctoral Scholar
Institute of Molecular Evolutionary Genetics
Penn State University
312 Mueller Lab
University Park, PA 16802
Tel: 814-865-2796
Homepage: <http://www.personal.psu.edu/zuz17/>
Lab page:  <http://homes.bio.psu.edu/people/Faculty/Nei/>





More information about the Bioperl-l mailing list