MetagenomeSeq: Sorting by sample type in plotMRheatmap
1
0
Entering edit mode
Rachael • 0
@rachael-12136
Last seen 7.9 years ago

Hello,

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.

Cheers,

Rachael

metagenomeSeq plotMRheatmap • 1.7k views
ADD COMMENT
0
Entering edit mode
@joseph-nathaniel-paulson-6442
Last seen 7.7 years ago
United States

Hi Rachael,

All the options available to heatmap.2 from the gplots package can be passed forward (?heatmap.2). So for example to keep the ordering and not reorder per the dendrogram (and remove dendrogram) see the bold parameters below:

data(mouseData)
trials = pData(mouseData)$mouseID
heatmapColColors=brewer.pal(12,"Set3")[as.integer(factor(trials))];
heatmapCols = colorRampPalette(brewer.pal(9, "RdBu"))(50)
plotMRheatmap(obj=mouseData,n=200,cexRow = 0.4,cexCol = 0.4,trace="none",
 col = heatmapCols,ColSideColors = heatmapColColors,Colv=FALSE,dendrogram="row")
ADD COMMENT
0
Entering edit mode

Fantastic, thank you!

ADD REPLY

Login before adding your answer.

Traffic: 869 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