-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHeatmap.R
More file actions
26 lines (21 loc) · 1.24 KB
/
Heatmap.R
File metadata and controls
26 lines (21 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#load the library with the aheatmap () function
library (NMF)
# aheatmap needs a matrix of values , e.g., a matrix of DE genes with the transformed read counts for each replicate
# sort the results according to the adjusted p- value
DGE.results.sorted <- DGE.results [order(DGE.results$padj),]
# identify genes with the desired adjusted p- value cut -off
DGEgenes <- rownames (subset(DGE.results.sorted, padj<0.05) )
# extract the normalized read counts for DE genes into a matrix
hm.mat_DGEgenes <- log.norm.counts[DGEgenes, ]
# plot the normalized read counts of DE genes sorted by the adjusted p- value
aheatmap (hm.mat_DGEgenes, Rowv=NA , Colv=NA)
# combine the heatmap with hierarchical clustering
aheatmap(hm.mat_DGEgenes,
Rowv=TRUE,Colv=TRUE, # add dendrograms to rows and columns
distfun="euclidean", hclustfun="average")
# scale the read counts per gene to emphasize the sample -type - specific differences
aheatmap (hm.mat_DGEgenes,
Rowv=TRUE, Colv=TRUE,
distfun="euclidean", hclustfun="average",
scale="row") # values are transformed into distances from the center of the row - specific average : ( actual value - mean of the group ) /
#standard deviation