annotate tool_barp_score.R @ 0:f5f3f1c07cf1 draft default tip

Uploaded
author elixir-it
date Thu, 17 Sep 2020 09:34:57 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
1 #!/usr/bin/env Rscript
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
2 args <- commandArgs(trailingOnly = TRUE)
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
3 file1=args[1]
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
4 scores=as.numeric(args[2])
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
5 ofile=args[3]
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
6 bdata=read.table(file1,header=T)
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
7 bdata[,1:12]=bdata[,1:12]/rowSums(bdata[,1:12])
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
8 rownames(bdata)=paste("#rank",c(1:nrow(bdata)))
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
9 col=c("#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928")
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
10 png(ofile,width=1800,height=800)
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
11 par(mar=c(10,4,4,25))
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
12 X=barplot(t(bdata[1:scores,1:12]),horiz=F,col=col,legend.text=colnames(bdata)[1:12],args.legend = list(x = "right", bty="n", inset=c(-0.20,0), xpd = TRUE,cex=1.8),space=0.2,cex.axis=1.5,cex.names=2.5,las=2)
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
13 dev.off()
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
14
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
15
f5f3f1c07cf1 Uploaded
elixir-it
parents:
diff changeset
16