开发者

multiple scatter plots in single Pdf in R

I have a function which takes a tab delimited file as an input and creates scatter plot for the values(one scatter plot per file) in the tab delimited file.I need a function which can print scatter plots in one pdf file(ie one scatter plot per page).Here is my function which prints one scatterplot per file.

scatter.plot=function(file)
  {
  raw.Data=read.delim(file="D:/output/illumina.txt",row.names = 1, dec = ".")
  raw.expression <- raw.Data[,seq(1,dim(raw.Data)[2],2)]
  dim(raw.expression)   
  raw.calls <- raw.Data[,seq(2,dim(raw.Data)[2],2)]
  dim(raw.calls)
  IDs <- colnames(raw.expression)
  for (i in 1:(dim(raw.expression)[2]-1))
  {
  for( j in i:(dim(raw.expression)[2]) )
  {
  if (i != j)
  {          
  pdf(file=paste(directory,"/",IDs[i],"_gegen_",IDs[j],".pdf",sep=""))
  correlation <- round(cor(raw.expression[,i],raw.expression[,j]),2)
  maximum <- max(log2(raw.expression[,i]))
  minimum <- min(log2(raw.expression[,i]))      plot(log2(raw.expression[,i]),log2(raw.expression[,j]),xlab=IDs[i],ylab=IDs[j],pch='.',text(maximum-2,minimum+0.5,labels=paste("R = ",correlation,sep=""),pos=4,offset=0))
  dev.off()
  }         
  }
  }      
  }

The above function takes the illumina text file as a input and prints each scatter plots in single pdf.I want all them in one pdf..

As the illumina text file is large..I ve given a minimal information code for input data is below

input.file=list(ProbeID=c(870131,5310368,1070445,6770328,610373,450431,1050114,770300,3290546),X1692272066AAVGSignal=c(46.1234,48.73746,50.15939,51.36239,53.75028,55.18534,49.32711,49.49868,50.40989),X1692272066ADetectionPval=c(0.5924308,0.4665211,0.3595342,0.213246,0.1390102,0.5443959,0.5291121,0.4461426,0.6914119),X1692272066BAVGSignal=c(49.38838,50.76025,50.41117,50.52384,58.56867,55.49637,48.71999,57.0689,45.99026),X1692272066BDetectionPval=c(0.5851529,0.4开发者_JAVA技巧556041,0.4905386,0.4818049,0.05604076,0.1441048,0.6375546,0.08515284,0.8377001),X1692272066CAVGSignal=c(52.47962,51.48042,51.93637,50.08885,56.68196,54.18305,52.03677,57.8032,52.71201),X1692272066CDetectionPval=c(0.4708879,0.5553129,0.5145561,0.661572,0.1783115,0.338428,0.5080058,0.1106259,0.4490539))'

Please do help me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜