comparison PCA.R @ 0:0011da72f65a draft

Uploaded
author elixir-it
date Tue, 09 Jun 2020 16:11:33 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0011da72f65a
1 args <- commandArgs(trailingOnly = TRUE)
2 fileIn=args[1]
3 nhealth=args[2]
4 ndis=args[3]
5 fileO=args[4]
6 Final_D=read.table(fileIn,header=T,row.names=1)
7 PCA=prcomp(t(Final_D))
8 M=PCA$x
9 png(fileO,width=1800,height=1800,res=160)
10 plot(M[,1],M[,2],col=rep(c("orange","purple"),c(nhealth,ndis)),main="PCA of gene scores",xlab="PC1",ylab="PC2",cex.main=2,cex.lab=2,pch=20,cex.axis=1.5,cex=1.5)
11 legend(min(M[,1]),min(M[,2])*0.8,fill=c("orange","purple"),legend=c("affected","unaffected"),cex=1.5)
12 dev.off()