I have derived a list of deferentially expressed genes and would want to plot a heatmap of the expression values and see whether there the normal and tumor samples cluster out. Below is the code:
genes <- table$index design <- model.matrix(~ 0+factor(c(data1$Class))) colnames(design) <- c("S", "NS") contrast.matrix <- makeContrasts(diff=NS-S, levels=design) fit <- lmFit(tableSub, design = design) # What should the design be? fit2 <- contrasts.fit(fit, contrast.matrix) options(digits=3) fit3 <- eBayes(fit2) writefile = topTable(fit3, number=250, genelist=genes, adjust.method = "fdr", sort.by="B") idx = rownames(writefile) heatmap.2(exprs(gset)[idx,],trace='none',scale='row')
Now the columns I am getting are that of my samples. The samples can be grouped into "Normal" and "Tumour". How can I display this in the heatmap?