get_mby2_ref.r 521 B

12345678910111213141516
  1. library(mclust)
  2. args<- commandArgs(TRUE)
  3. chrf<-args[1]
  4. outf<-args[2]
  5. num<- 7
  6. num<- ifelse(is.na(args[3]),num,args[3])
  7. chr.data<-read.table(file=chrf,sep="\t",row.names=1,header=TRUE,comment.char='')
  8. xydata<-chr.data[,1:3]
  9. samples<-row.names(xydata)
  10. xymod<- Mclust(xydata,num)
  11. pdf(file="MBY2_M_chrXY_class.pdf")
  12. plot(xymod, what = "classification")
  13. dev.off()
  14. nclass<-which.max(table(xymod$classification))
  15. refs<-samples[xymod$classification==nclass]
  16. write.table(file=outf,refs,quote=FALSE,row.names=FALSE,col.names=FALSE)