[Bioperl-l] How to create contrasting colors in every singe track - Bio::Graphics
Chris Fields
cjfields at uiuc.edu
Thu Aug 16 14:11:22 UTC 2007
On Aug 15, 2007, at 11:18 PM, Edward Wijaya 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,
> );
>
> foreach my $seqid ( sort {$a <=> $b }keys %nlist ) {
> my $track = $panel->add_track(
> -glyph => 'graded_segments',
> -key => "SEQ " . $seqid,
> -connector => "dashed",
> -label => 1,
> -fontcolor => 'red',
> -bgcolor => 'blue',
> -bump => +1,
> -height => 8,
> -min_score => 0,
> -max_score => 500000
> );
> # rest of the script
> __END__
>
> Regards,
> Edward
I think you have two options:
1) Split the seqfeatures into different tracks based on the source
(AlignACE, MP, etc), then give each it's own graded segment color. I
like this personally as it doesn't glob various results together onto
one track and (at least to me) is easier to maintain. It also allows
one more flexibility in using varying scoring schemes.
2) Use a callback for bgcolor which changes the color explicitly
based on the source/score.
The GenBank/EMBL section of the Bio::Graphics HOWTO reveals how to
add different tracks, and there are several scattered examples on how
to use callbacks.
http://www.bioperl.org/wiki/HOWTO:Graphics
chris
More information about the Bioperl-l
mailing list