In metagenomeSeq, I am trying to produce a heatmap with my own data which resembles the one in the vignette (https://bioconductor.org/packages/release/bioc/vignettes/metagenomeSeq/inst/doc/metagenomeSeq.pdf, Figure 4 left on page 27)
My samples are in two groups; cases and controls. Using the following code (where the group variable is either case or control):
group <- pData(npsdata.trim)$group
heatmapColColors <- brewer.pal(12, "Set3")[as.integer(factor(group))]
heatmapCols <- colorRampPalette(brewer.pal(9, "RdBu"))(50)
plotMRheatmap(npsdata.trim, n = 30, trace = "none", col = heatmapCols, ColSideColors = heatmapColColors)
I can produce a heatmap, but the samples are not sorted by case/control. I have checked npsdata.trim$group and they are ordered with all controls first, then all cases; but the heatmap seems to jumble them up.
How can I create this heatmap with the samples neatly sorted into cases and controls, as in the vignette?
Any help would be appreciated.