Question: MetagenomeSeq: Sorting by sample type in plotMRheatmap
0
gravatar for Rachael
2.7 years ago by
Rachael0
Rachael0 wrote:

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

ADD COMMENTlink modified 2.7 years ago by Joseph Nathaniel Paulson270 • written 2.7 years ago by Rachael0
Answer: MetagenomeSeq: Sorting by sample type in plotMRheatmap
0
gravatar for Joseph Nathaniel Paulson
2.7 years ago by
United States
Joseph Nathaniel Paulson270 wrote:

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 COMMENTlink modified 2.7 years ago • written 2.7 years ago by Joseph Nathaniel Paulson270

Fantastic, thank you!

ADD REPLYlink written 2.7 years ago by Rachael0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 290 users visited in the last hour