14
|
1 #!/usr/bin/R
|
|
2
|
|
3 library("optparse")
|
|
4 library(heatmaply)
|
|
5
|
|
6 option_list = list(
|
|
7 make_option(c("-f", "--file"), type="character", default=NULL,
|
|
8 help="dataset file name", metavar="character"),
|
|
9 make_option(c("-o", "--out"), type="character", default="out.txt",
|
|
10 help="output file name [default= %default]", metavar="character")
|
|
11 );
|
|
12 opt_parser = OptionParser(option_list=option_list);
|
|
13 opt = parse_args(opt_parser);
|
|
14
|
|
15 if (is.null(opt$file)){
|
|
16 print_help(opt_parser)
|
|
17 stop("At least one argument must be supplied (input file).\n", call.=FALSE)
|
|
18 }
|
|
19
|
|
20 if (is.null(opt$out)){
|
|
21 print_help(opt_parser)
|
|
22 stop("At least one argument must be supplied (out file).\n", call.=FALSE)
|
|
23 }
|
|
24
|
|
25 mydata <- read.table(opt$file,sep="\t",fill=TRUE,header=TRUE, row.names = 1)
|
|
26 heatmaply(mydata,file = "heatmaply.html",plot_method="plotly",scale_fill_gradient_fun = ggplot2::scale_fill_gradient2( low = "white" , high = "blue", limits = c(0, 100)))
|