diff mpagenomics_normalize-7dc6ce39fb89/markersSelection.R @ 0:84b13b0e2b85

Uploaded
author sblanck
date Thu, 07 May 2015 08:22:36 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpagenomics_normalize-7dc6ce39fb89/markersSelection.R	Thu May 07 08:22:36 2015 -0400
@@ -0,0 +1,35 @@
+args<-commandArgs(TRUE)
+
+input=args[1]
+response=args[2]
+tmp_dir=args[3]
+nbFolds=as.numeric(args[4])
+loss=args[5]
+output=args[6]
+
+library(MPAgenomics)
+workdir=file.path(tmp_dir, "mpagenomics")
+setwd(workdir)
+
+CN=read.table(input,header=TRUE,check.names=FALSE)
+drops=c("chromosome","position","probeName")
+CNsignal=CN[,!(names(CN)%in% drops)]
+samples=names(CNsignal)
+CNsignalMatrix=t(data.matrix(CNsignal))
+resp=read.table(response,header=TRUE,sep=",")
+listOfFile=resp[[1]]
+responseValue=resp[[2]]
+index = match(listOfFile,rownames(CNsignalMatrix))
+responseValueOrder=responseValue[index]
+
+result=variableSelection(CNsignalMatrix,responseValueOrder,nbFolds=nbFolds,loss=loss,plot=TRUE)
+
+CNsignalResult=CN[result$markers.index,(names(CN)%in% drops)]
+
+CNsignalResult["coefficient"]=result$coefficient
+CNsignalResult["index"]=result$markers.index
+
+sink(output)
+print(format(CNsignalResult),row.names=FALSE)
+sink()
+#write.table(CNsignalResult,output,row.names = FALSE, quote=FALSE, sep = "\t")