args <- commandArgs(TRUE) if(length(args)!=3){ stop('usage:Rscript $0 ') } sample<-args[1] png(paste0(sample,".png"),width=1024,height=768) layout(matrix(c(1,1,2,3),2,2,byrow=T)) insert<-read.table(args[2]) depth<-read.table(args[3]) par(cex=1.5) plot(insert[,1],insert[,3],type="h",xlim=c(0,1000),col="red",main="Insert size distribution",xlab="Insert size",ylab="Read percent",xaxt="n") axis(1,seq(0,1000,100)) a<-ceiling(weighted.mean(depth[,1],depth[,2])*3/100)*100 plot(depth[,1],depth[,5],xlim=c(0,a),type="l",col="red",xlab="Base depth",ylab="Cumulative base",main="Base depth cumulative distribution") plot(depth[,1],depth[,3],xlim=c(0,a),type="h",col="red",xlab="Base depth",ylab="Base percent",main="Base depth distribution") dev.off()