|
0
|
1 #!/usr/bin/env Rscript
|
|
|
2 args = commandArgs(trailingOnly=TRUE)
|
|
|
3 if (length(args)!=3) {
|
|
|
4 st_sentence=paste("This script requires exactly 3 arguments",length(args),"supplied\n")
|
|
|
5 stop(sentence, call.=FALSE)
|
|
|
6 }
|
|
|
7
|
|
|
8 bubbleplot<-function(MatData,VirData,palette,magn,main,space)
|
|
|
9 {
|
|
|
10 COL=ncol(MatData)
|
|
|
11 ROW=nrow(MatData)
|
|
|
12 Mcopy=rep(1:COL,ROW)
|
|
|
13 Mfactor=rep(1:ROW,rep( COL,ROW ))
|
|
|
14
|
|
|
15 COLOR=rep(palette,rep(COL,ROW))
|
|
|
16 CEX=(log10(t((MatData*100)+1)))*magn
|
|
|
17
|
|
|
18
|
|
|
19 par(mar=c(8,4,4,0),fig=c(0,0.8,0,1))
|
|
|
20 plot(Mcopy,Mfactor,cex=0.1,pch=20,xaxt="n",yaxt="n",xlab="",ylab="",main=main,yaxs="r");
|
|
|
21 #grid(COL*ROW)
|
|
|
22 abline(h=1:ROW)
|
|
|
23 abline(v=1:COL)
|
|
|
24 lines(Mcopy,Mfactor,cex=CEX,col=COLOR,pch=20,type="p")
|
|
|
25
|
|
|
26 axis(1,at=1:COL,labels=colnames(MatData),las=2)
|
|
|
27 axis(2,at=(1:ROW),labels=rownames(MatData),las=2)
|
|
|
28
|
|
|
29 par(fig=c(0.8,1,0,1),new=TRUE,mar=c(8,0,4,1))
|
|
|
30 barplot(log10(VirData+1),horiz=T,las=2,space=space,yaxs="i",main="Log(N genomes)")
|
|
|
31 }
|
|
|
32 MatData=read.table("MatData.csv",header=T,row.names=1,check.names=F);
|
|
|
33 VirData=read.table("VirData.csv",header=T,row.names=1);
|
|
|
34 VirData=as.vector(VirData[,1])
|
|
|
35 add_data=read.table(args[1],header=T,row.names=1,check.names=F);
|
|
|
36 VirData=c(VirData,rep(1,nrow(add_data) ))
|
|
|
37 MatData=rbind(MatData,add_data);
|
|
|
38 pdf(args[2],width=1200,height=1600)
|
|
|
39 bubbleplot(MatData,VirData,c(colors()[c(90,60,150,120,30)],topo.colors(nrow(add_data))),3,main="",space=1)
|
|
|
40 dev.off()
|
|
|
41 pdf(args[3],width=1600,height=1600)
|
|
|
42 heatmap(cor(t(MatData)),col=blues9);
|
|
|
43 dev.off()
|