#! /path/to/Rscript
library(pheatmap)
library(getopt)
spec = matrix(c(
'name', 'n', 1,"character","output name:eg.Demo",
'seur','s',1,"character",'seuratdata:eg:pbmc.rds'), byrow=TRUE,ncol=5)
opt = getopt(spec)
if (!is.null(opt$outdir)||is.null(opt$seur)) {
cat(paste(getopt(spec, usage = T), "\n"))
q(status=1)
}
bk <- c(seq(-1,-0.01,by=0.01),seq(0,1,by=0.01))
mycolor <- c(colorRampPalette(colors=c("navy","white"))(length(bk)/2),colorRampPalette(color=c("white","firebrick3"))(length(bk)/2))
r <- read.table(opt$seur,sep="\t",row.names=1,header=T)
rdata <- as.data.frame(r)
rdata <- rdata[apply(r, 1, function(x) sd(x)!=0),]
dpi=500
png(opt$name,w=12*dpi,h=10*dpi,units = "px",res = dpi,type='cairo')
pheatmap(rdata,scale = "row", cellwidth = 20, cellheight = 2,cluster_cols = F,cluster_rows = T,treeheight_row=0, treeheight_col=0,show_rownames=T, color=mycolor,fontsize = 2,fontsize_col=12, breaks=bk,legend=T)
dev.off()
保持初心。
网友评论