Skip to content

Instantly share code, notes, and snippets.

@gireeshkbogu
Last active October 23, 2018 23:43
Show Gist options
  • Save gireeshkbogu/a3fa4b7075033b519976 to your computer and use it in GitHub Desktop.
Save gireeshkbogu/a3fa4b7075033b519976 to your computer and use it in GitHub Desktop.
library(pheatmap)
a <-read.table("expression", head=T)
head(a)
GTEX.ZP4G.0526.SM.4YCED GTEX.ZYFD.2126.SM.5E43D
a1 3.469363 2.903798
a2 2.551825 -1.003092
a3 2.841332 2.903798
a6 4.936489 5.225726
a7 6.300763 6.574336
a8 7.306713 7.982749
age <-read.table("phenotype", head=T)
head(age)
Age
GTEX.111YS.0526.SM.5GZXJ 62
GTEX.1122O.1126.SM.5NQ8X 64
GTEX.117XS.0426.SM.5GZZN 64
GTEX.117YW.0226.SM.5N9CM 58
GTEX.11DXX.0426.SM.5EQ5F 66
GTEX.11DXZ.0426.SM.5987Y 56
ann_colors = list(Age = c("grey", "black"))
pheatmap(a, scale="row", annotation=age, fontsize_row =0.5, fontsize_col = 3, clustering_distance_rows = "euclidean",clustering_distance_cols = "correlation", clustering_method = "average", annotation_colors = ann_colors)
pheatmap(a, scale="row", annotation=age, fontsize_row =0.5, fontsize_col = 3, color = colorRampPalette(c("green", "black", "red"))(50), clustering_distance_rows = "euclidean",clustering_distance_cols = "correlation", clustering_method = "average", annotation_colors = ann_colors)
pheatmap(a, scale="row", annotation=age, fontsize_row =0.5, fontsize_col = 3, color = colorRampPalette(c("green", "white", "red"))(50), clustering_distance_rows = "euclidean",clustering_distance_cols = "correlation", clustering_method = "average", annotation_colors = ann_colors)
pheatmap(a, scale="row", annotation=age, fontsize_row =0.5, fontsize_col = 3, color = colorRampPalette(c("green", "black", "gold"))(50), clustering_distance_rows = "euclidean",clustering_distance_cols = "correlation", clustering_method = "average", annotation_colors = ann_colors)
link:http://www.inside-r.org/packages/cran/pheatmap/docs/pheatmap
@gireeshkbogu
Copy link
Author

Play with your own colors

ggplot2-colour-names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment