[Bioperl-l] FW: Bio::Graphics::Panel question
Lincoln Stein
lincoln.stein at gmail.com
Mon Nov 16 20:08:20 UTC 2009
Hi,
I think you should modify your color selection code as follows:
if($color_array[$index] == 1 ){
$color = 'red';
}
elsif($color_array[$index]== 2){
$color = 'orange';
}
elsif($color_array[$index]== 3){
$color = 'green';
}
elsif($color_array[$index]== 4){
$color = 'blue';
}
elsif($color_array[$index]== 5){
$color = 'black';
}
else { die "unexpected color array
value $color_array[$index]" }
Lincoln
On Mon, Nov 16, 2009 at 1:22 PM, Kevin Brown <Kevin.M.Brown at asu.edu> wrote:
> Please keep your responses on the list for more timely help.
>
>
> Kevin Brown
> Center for Innovations in Medicine
> Biodesign Institute
> Arizona State University
>
>
>
> ________________________________
>
> From: Xiaoyu Liang [mailto:veronica.xiaoyu at gmail.com]
> Sent: Monday, November 16, 2009 9:34 AM
> To: Kevin Brown
> Subject: Re: [Bioperl-l] Bio::Graphics::Panel question
>
>
> Hi Kevin,
>
> Thank you for ur quick response. I attached the BLAST .out file here.
> And the follow is my code part. I have an array keeping the color for
> each hit, and I printed it out the array, there is no missing.
>
> my $track = $panel->add_track(
> -glyph => 'graded_segments',
> -label => 1,
> -connector => 'dashed',
> -font2color => 'red',
> -sort_order => 'high_score',
> -description => sub {
> $feature = shift;
> #print "--".$feature."\n";
> return unless
> $feature->has_tag('description');
> my ($description) =
> $feature->each_tag_value('description');
> my ($id) = $feature->display_name;
> my @records= split(/\|/,$description);
> my $score = $feature->score;
> #print $id.":".$score."\n";
> if($score >=200){
> push (@color_array,1);
> }elsif($score >=80){
> push (@color_array,2);
> }elsif($score >=50){
> push (@color_array,3);
> }elsif($score >= 40){
> push (@color_array,4);
> }else{
> push (@color_array,5);
> }
>
> if($type == 1){
> "Species:Arabidopsis TF
> Family:$records[1] Score=$score";
> }elsif($type == 2){
> if(scalar(@records)==5){
> "Species:$records[1] TF
> Family:$records[2] Accepted Name:$records[3] Score=$score";
> }else{
> "Species:$records[1] TF
> Family:$records[2] Score=$score";
> }
> }else{
> "";
> }
> },
> -bgcolor => sub{
> return unless
> $feature->has_tag('description');
> if($color_array[$index] == 1 ){
> $color = 'red';
> }
> if($color_array[$index]== 2){
> $color = 'orange';
> }
> if($color_array[$index]== 3){
> $color = 'green';
> }
> if($color_array[$index]== 4){
> $color = 'blue';
> }
> if($color_array[$index]== 5){
> $color = 'black';
> }
> #if ($index == 20){
> # $color = 'black';
> #}
> #print
> $index."--".$color_array[$index]."\n";
> $index++;
>
> #print $feature."\n";
> #print
> $feature->display_name."\n";
> return $color;
> },
> );
>
>
> Best regrads,
> Xiaoyu
>
>
> On Mon, Nov 16, 2009 at 10:49 AM, Kevin Brown <Kevin.M.Brown at asu.edu>
> wrote:
>
>
> To really be able to tell if this was a bug, I (and probably the
> real
> devs) would need to see that part of your code and the Blast
> file that
> is having this issue as it could be your callback for color
> choice vs
> the blast object (e.g. your color picker is missing an option
> that the
> data comes in with and so returns with a blank value).
>
>
> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org
> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of
> Xiaoyu Liang
> Sent: Friday, November 13, 2009 1:36 PM
> To: Bioperl-l at lists.open-bio.org
> Subject: [Bioperl-l] Bio::Graphics::Panel question
>
> Hi,
>
> I'm using Bio::Graphics to parse the blast result and generate
> images.
> But, sometimes, in the middle of the output image, the hit's
> color is
> white, eventhough I set it to other colors. I attached the
> picture here
> for an example. This doesn't occur all the time, usually, it
> works well.
> I'm wondering if I did something wrong? or depends on the blast
> result?
>
> Thank you,
> Xiaoyu
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
--
Lincoln D. Stein
Director, Informatics and Biocomputing Platform
Ontario Institute for Cancer Research
101 College St., Suite 800
Toronto, ON, Canada M5G0A3
416 673-8514
Assistant: Renata Musa <Renata.Musa at oicr.on.ca>
More information about the Bioperl-l
mailing list