colors in plotCtCategory heatmap
0
0
Entering edit mode
Heidi Dvinge ★ 2.0k
@heidi-dvinge-2195
Last seen 10.3 years ago
Dear Manuela, > Dear Heidi, > > I am trying your nice package for the analysis of Fluidigm array data. > > I think I found a problem in the heatmap coloring within plotCtCategory. > In especially, if in a sample there are not all the three categories "OK", > "Undetermined" and "Unreliable" but only let's say "OK" and "Unreliable", > the (default) colors for this sample show up in the heatmap as green and > red instead of green and yellow. The problem seems related to the > conversion of the categories to factor levels - in the absence of one > category there will always just be levels 1 and 2 and not e.g. 1 and 3. > thanks for the feedback, and for the nice, self-contained example. You're absolutely right that the colours in plotCtCategory can be confusing (and potentially misleading!) in the example you provide, since the default colours listed in the documentation are wrong. I must admit that this is something I never put much thought into; since the user can in principle have completely different different categories than OK/Undetermined/Unrealiable I din't want to make the colour scheme to "rigid". As such, the colours can always be set using the col parameter, e.g. plotCtCategory(q, by.feature=T, col=c("red", "yellow")) This isn't optimal though. I'll change the documentation and default behaviour of plotCtCategory to reflect this. If you would like a fix for this rather than specifying your colours with "col=", then please let me know so I can port it to the release version of HTqPCR. Otherwise it'll go into the devel version. Thanks \Heidi > It's easier with an example: > >> test.cat <- data.frame(matrix(rep(c("OK","Undetermined","Unreliable"), >> each=2), ncol=2)) >> q <- new("qPCRset", featureCategory=test.cat, featureNames=letters[1:3], >> sampleNames=c("s1","s2")) > >> featureCategory(q) > s1 s2 > a OK Undetermined > b OK Unreliable > c Undetermined Unreliable > > > With this, you would expect a heatmap where the first column is > green-green-red and the second red-yellow-yellow (potentially changed in > order due to the clustering). Instead we get a heatmap of only green and > yellow: > >> plotCtCategory(q, by.feature=T) > > > When in plotCtCategory categories are converted to factors and then to > numeric numbers for each sample separately, we get only values 1 and 2: > >> data <- featureCategory(q) >> apply(data, 2, function(x) as.numeric(as.factor(x))) > s1 s2 > [1,] 1 1 > [2,] 1 2 > [3,] 2 2 > > > Instead, you could force to have always the three levels, e.g. by: > >> apply(data, 2, function(x) as.numeric(factor(x, >> levels=c("OK","Undetermined","Unreliable")))) > s1 s2 > [1,] 1 2 > [2,] 1 3 > [3,] 2 3 > > > I hope this makes sense. > > Thank you and best regards > Manuela > > > > Manuela Hummel > Core Facilities - Microarrays Unit > Center for Genomic Regulation (CRG) > Dr. Aiguader 88, 4th floor, Office 439.01 > 08003 Barcelona > Phone: +34 93 316 0373 > e-mail: manuela.hummel at crg.es > ? > > >
Category HTqPCR Category HTqPCR • 799 views
ADD COMMENT

Login before adding your answer.

Traffic: 715 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6