Skip to content

conditional coloring of image labels

2 messages · Jake Michaelson

#
Hi all,

I am interested in plotting a heatmap of a set of genes.  I would like the 
text labels of these genes to be colored red rather than black if they meet  
certain statistical criteria (using an if statement).  I'm not sure how to 
change individual color labels without changing them all.  Can anyone provide 
some insight on how to do this?

Thanks in advance,

Jake
#
On Friday 11 November 2005 10:37 am, Jake Michaelson wrote:
I'll clarify a little and hopefully this will make more sense (thanks for the 
friendly encouragement):

Let's say I have 6 samples and am looking at 3 genes, with intensities in a 
matrix as follows:
ABC1 ABC2 ABC3
[1,]    3    4    8
[2,]    4    3    7
[3,]    4    4    8
[4,]    5    7    6
[5,]    6    7    3
[6,]    3    8    2

###plot the image
"", col=cm.colors(256))
 
###label the axes
0)
0)

Now let's say (I'm just making these numbers and the scenario up here -- for 
simplicity's sake) that I had run a statistical analysis previously and 
wanted to label the genes that showed a significance of p< 0.05.  Let's say 
that ABC1 and ABC3 had p<0.05 (assume that these values would be in a 
two-column matrix with the gene name and its p-value).
name   pvalue 
[1,] "ABC1" "0.005"
[2,] "ABC2" "0.1"  
[3,] "ABC3" "0.001"

 I now want these (the names of the significant genes) to be labeled in red 
rather than black on the plot.  I would eventually write a script that would 
generate a large number of these images, each with a different set of genes. 
I would like to insert some sort of conditional formatting so that if that 
gene meets the significance threshold, the name is automatically plotted in 
red on the plot.

I hope this is more clear and effective in explaining what I'm looking for.


Thanks,

--Jake