Hi Anna,
I recommend package "gplot" - heatmap.2 function.
library(gplots)
y is your expression matrix ### y <- exprs(eset) or subset
hr <- hclust(as.dist(1-cor(t(y), method="pearson")), method="average");
hc <- hclust(as.dist(1-cor(y, method="kendall")), method="average")
mycl <- cutree(hr, h=max(hr$height)/1.3);
mycolhc <- rainbow(length(unique(mycl)), start=0.1, end=0.9);
mycolhc <- mycolhc[as.vector(mycl)]
myheatcol <- greenred(75)
heatmap.2(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), col=myheatcol, scale="row", density.info="none", trace="none", key = FALSE, cexRow = 0.7, cexCol = 0.8, srtRow = NULL, srtCol= 20, labRow = TRUE, main = " whatever you want", RowSideColors=mycolhc, labCol= TRUE )
Please check this website http://www.inside-r.org/packages/cran/gplots/docs/heatmap.2 for explanation!
You can change the "method" according to your preference and of course all the other arguments.
I hope it helps.
Anita
So just to visualize it: it doesnt look like this
https://www.google.hu/search?q=microarray+heat+map&espv=2&biw=911&bih=445&source=lnms&tbm=isch&sa=X&ei=8fhVVbrOE4z3ULCfgcAN&ved=0CAYQ_AUoAQ&dpr=1.5#imgrc=HxVCfnstHrw5-M%253A%3BHqHbNVHOeD3tZM%3Bhttp%253A%252F%252Fmanuals.bioinformatics.ucr.edu%252F_%252Frsrc%252F1353284419908%252Fhome%252FR_BioCondManual%252Fr-bioc-temp%252Fintersect.png%253Fheight%253D400%2526width%253D400%3Bhttp%253A%252F%252Fmanuals.bioinformatics.ucr.edu%252Fhome%252FR_BioCondManual%3B400%3B400
You will have to be much more descriptive, and tell us exactly what you are trying to do, and what you have done so far. The heatmap you link to is from here, which may or may not be what you are trying to accomplish (I sort of doubt it is what you want to do).
Most heatmaps that people create are not symmetric like this; in general this sort of heatmap is intended to show that replicate samples are similar in some sense, and if you want to do that sort of thing, then a PCA plot is probably a more reasonable thing to do.
Anyway, if you tell us what you are trying to accomplish and what you have done so far (show code!), then perhaps we can help.
Hi,
I have 2 samples, 3-3 biological repeat and i want to do QC: histogram, boxplot, MA plot, heatmap etc. The heatmap has to show the replicates similarity after normalization, and somehow its not simetric as on the link which ive pasted before and i dont know why. I want to know why does this happen (this is the first time that it had happend)
I pasted in the begining of the code and i did hashmarks for QC steps which ive done next to heatmap( for dose the code is not important)
celdir<- 'c:\\....\\outplotdir'
filename2sample<- 'c:\\.....\\filename2sample.txt'
gzipped <-TRUE
outplotdir<- 'c:\\....\\outplotdir'
affyutils <- 'c:\\.....\\AffyUtils.R'
# read in home-made utility functions
source(affyutils)
# libraries
# libraries
library(EBImage);
library(affy);
library(simpleaffy);
library(affyPLM);
library(arrayQualityMetrics);
# change into directory with cel files
setwd(celdir) #set working directory
# create sampleNames from the list of celFiles - substitute file names with sample names
celFiles <- list.celfiles()
fn2sp <- read.table(filename2sample, header=T)
sNames <- unlist(lapply(celFiles, convertFilename2Sample, tabledict=fn2sp)) # convertFilename2Sample: from AffyUtils #samplenames
# Read in the CEL files in the directory
raw <- ReadAffy(filenames=celFiles, sampleNames = sNames)
# DNA degradation plot(sample quality)
# Affy control expression (hybridization and overall sample quality)
# actin & GAPDH
# perform a robust multi-chip probe-level fit
norm <- rma(raw); expr <- exprs(norm);
Pda <- fitPLM(raw, model = PM ~ -1 + probes + samples)
# NUSE, RLE (probe set homogeneity)
#Boxplot raw
# density histogram (signal comparability)
#PM histogram
# MA plot (intensity dependent bias)
# MvA plot of normalized data:
# 2D image of chip (spatial bias)
# dist - returns distance matrix between rows
distmx <- dist(t(expr), method = "euclidean", diag = TRUE, upper = TRUE)
# plot heatmap
my.hclust <- function(d) hclust(d, method="complete")
heatmap(as.matrix(distmx), cexCol=0.5, cexRow=0.5, hclustfun=my.hclust)
-----------------------------------------------------------