[Bioperl-l] two colors on the same track, still not work

Lincoln Stein lstein at cshl.edu
Mon Mar 7 13:02:58 EST 2005


Here's one guess. You have to make sure that the %colors hash is 
visible from the callback under Perl lexical scoping rules.  If you 
use "use strict" and the -w switch then Perl will warn about this 
type of common error.

If this doesn't work please send a complete test case script that 
shows the problem.  Make the script as short as possible and remove 
dependencies on other aspects of your system.  Also send the version 
numbers for Perl and BioPerl.

Lincoln

On Sunday 20 February 2005 07:39 pm, hz5 at njit.edu wrote:
> Hi everybody,
> I am still struggling with two colors on the same track, if anybody
> can help me, I would appreciate it a lot!
>
> I want to have utr blue, coding seq brown, so I have utr
> splitlocations in one feature, and coding seq splitlocations in
> another:
> ######################################################
> 		my $f1 = Bio::SeqFeature::Generic->new(
> 				      -primary_tag => $geneid,
> 				      -seq_id      => $nm,
> 				      -source_tag  => $UTR_str,
> 				      -location    => $splitlocation_utr,
> 		);
> 		my $f = Bio::SeqFeature::Generic->new(
> 				      -primary_tag => $geneid,
> 				      -source_tag  => $coding_str,
> 				      -seq_id      => $nm,
> 				      -location    => $splitlocation,
> 		);
> 		push @allft, $f1;
> 		push @allft, $f;
>
> then I try to render @allft on one track, but color utr and coding
> sequence differently use a subroutine for bgcolor:
> #################################################
> 	my $track_nm = $panel ->add_track(\@allft,
> 			 -glyph   => 'generic',
> 			 -font2color     => 'blue',
> 			 -connector   => 'solid',
> 			 -bump => $bump,
> 			 -description => sub{
> 				my $f_tmp = shift;
> 				if($f_tmp->source_tag eq $dHSP_str){
> 					return '';
> 				}else{
> 					return $f_tmp->seq_id;
> 				}
> 				},
> 			-bgcolor => sub{
> 				my $f_tmp = shift;
> 				print "**".$colors{$f_tmp->source_tag}."\n";
> 				return $colors{$f_tmp->source_tag};
> 				},
> 			);
>
> I have %colors keyed by the source_tag I put in features. But it
> doesn't work.
>
> Anybody knows how to fulfill this kind of functions?
> Thanks!!!!
> haibo
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

-- 
Lincoln D. Stein
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724

NOTE: Please copy Sandra Michelsen <michelse at cshl.edu> on
all emails regarding scheduling and other time-critical topics.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/bioperl-l/attachments/20050307/65dc5bce/attachment-0001.bin


More information about the Bioperl-l mailing list