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

hz5 at njit.edu hz5 at njit.edu
Sun Feb 20 19:39:36 EST 2005


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



More information about the Bioperl-l mailing list