Hello,
I did a differential analysis between 160 tumor and 90 normal samples. I'm using edgeR
package. I used the following code to make a differential analysis heatmap. I selected differential expressed genes based on FC > 2 and FDR < 0.05. This gave me 614 DEGs.
logCPM <- cpm(y, prior.count=2, log=TRUE)
o <- order(tr$table$PValue)
logCPM <- logCPM[o[1:614],]
logCPM <- t(scale(t(logCPM)))
dim(logCPM)
library(matrixStats)
library(gplots)
library(ComplexHeatmap)
library(circlize)
library(RColorBrewer)
#Set annotation
ann <- data.frame(TvsN$Type)
colnames(ann) <- c("Type")
colours <- list("Type"=c("Tumor"="black","Normal"="brown"))
colAnn <- HeatmapAnnotation(df=ann, which="col", col=colours, annotation_width=unit(c(1, 4), "cm"), gap=unit(1, "mm"))
myCol <- colorRampPalette(c("navyblue", "white", "red"))(100)
myBreaks <- seq(-2,2, length.out=100)
hmap <- Heatmap(logCPM, name = "Z-Score", col = colorRamp2(myBreaks, myCol),
show_row_names = FALSE, show_column_names = FALSE, cluster_rows = TRUE,
cluster_columns = TRUE, show_column_dend = FALSE, show_row_dend = TRUE,
row_dend_reorder = TRUE, column_dend_reorder = TRUE, clustering_method_rows = "ward.D2",
clustering_method_columns = "ward.D2", width = unit(100, "mm"),
top_annotation=colAnn)
draw(hmap, heatmap_legend_side="left", annotation_legend_side="right")
The heatmap was made using complex heatmap like above. I see that DEGs showing samples are clustered.
![heatmap][1]
I wanted to select 614 DEGs and sort the samples acc to their Type
without using hclust like above. May I know how to do this?
thanq
In your case it would be
cluster_rows
which needs to be set to FALSE as by default it is TRUE and then uses Complete linkeage to cluster the rows. As Jean-Karim Heriche says, please read the manual, it is outstandingly comprehensive with an example plot for like every possible option.