[Bioperl-l] How to create contrasting colors in every singe track - Bio::Graphics

Razi Khaja razi.khaja at gmail.com
Thu Aug 16 13:37:09 UTC 2007


You would probably want to consider a "Graph-Coloring" algorithm in
order to optimally pick contrasting colors for the features being
displayed.  This might be overkill for what your trying to accomplish
and may not be possible (depending on how many features you have in
your dataset ... ie. how big your graph is).

In anycase, some resources are:
http://en.wikipedia.org/wiki/Graph_coloring
http://web.cs.ualberta.ca/~joe/Coloring/

If your problem is simpler, see the modifications to your program Ive
made below:

Razi Khaja

On 8/16/07, Edward Wijaya <ewijaya at gmail.com> wrote:
> Dear experts,
>
> I am trying to draw a figures that shows binding sites hits for various
> program (see attached) for example.
>
> Now, I have a problem in creating contrasting colour for each of
> the Programs (MEME, AlignACE, etc).  I want to avoid "graded segments",
> so that I can have more contrasting color, e.g: red, blue, yellow, etc.
>
> Can anybody suggest how can we achieve that?
>
> My full source code can be found here: http://dpaste.com/16985/
> The portion of the script is this:
>
> __BEGIN__
>     my %prog_color = (
>         "Actual"   => 800000,
>         "ALIGNACE" => 230000,
>         "BP"       => 80000,
>         "MDSCAN"   => 5000,
>         "MITRA"    => 10000,
>         "MTSAMP"   => 200000,
>         "SPACE"    => 40000,
>         "NONE"     => 0,
>     );
>
       my %color = ( 'MEME' => 'red', 'ALIGNACE => 'blue');

>     foreach my $seqid ( sort {$a <=> $b }keys %nlist ) {
           my( @feild ) = split( /\s+/, $nlist{$seqid} );
           my $prog_name = $feild[3];

>         my $track = $panel->add_track(
>             -glyph     => 'graded_segments',
>             -key       => "SEQ " . $seqid,
>             -connector => "dashed",
>             -label     => 1,
>             -fontcolor => 'red',
               -bgcolor   => $color{ $prog_name },
>             -bump      => +1,
>             -height    => 8,
>             -min_score => 0,
>             -max_score => 500000
>         );
> # rest of the script
> __END__
>
> Regards,
> Edward
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>



More information about the Bioperl-l mailing list