-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathheatmap.R
executable file
·43 lines (37 loc) · 1.24 KB
/
heatmap.R
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env Rscript
############################
# Usage : ./ggplots.R file1 file2 ...
############################
# arguments in command line
library("pheatmap")
options<-commandArgs(trailingOnly = T)
plot_heigh<-4
plot_width<-2
png_name<-unlist(strsplit(options[1],'.',fixed=T))[1]
png(file=paste(png_name,'png',sep='.'),height = plot_heigh, width = plot_width, res=600, units = "in", family="Arial")
dat<-read.table(file=options[1],header=T)
dat[,2:3]->values
logvalues<-log(values+0.1)
rownames(logvalues)<-dat$Gene
# column annotation
#labels = c('a','b', rep('x',100))
#anno = data.frame(labels)
#rownames(anno) = colnames(dat)
pheatmap(logvalues,
cluster_rows = F,
clustering_distance_rows = "euclidean",
cluster_cols = F,
clustering_distance_cols = "euclidean",
clustering_method = "complete",
# ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC), "centroid" (= UPGMC).
scale = "column",
#annotation_col = anno,
#annotation_names_col = F,
#breaks = seq(-2,2, length.out=100),
labels_col = c("Ctrl","OE"))->hm
hm
dev.off()
################ END ################
# Created by Aone #
# quanyi.zhao@stanford.edu #
#####################################