5
|
1 args<-commandArgs(TRUE)
|
|
2
|
|
3 input=args[1]
|
|
4 response=args[2]
|
|
5 tmp_dir=args[3]
|
|
6 nbFolds=as.numeric(args[4])
|
|
7 loss=args[5]
|
|
8 output=args[6]
|
|
9
|
|
10 library(MPAgenomics)
|
|
11 workdir=file.path(tmp_dir, "mpagenomics")
|
|
12 setwd(workdir)
|
|
13
|
|
14 CN=read.table(input,header=TRUE,check.names=FALSE)
|
|
15 drops=c("chromosome","position","probeName")
|
|
16 CNsignal=CN[,!(names(CN)%in% drops)]
|
|
17 samples=names(CNsignal)
|
|
18 CNsignalMatrix=t(data.matrix(CNsignal))
|
|
19 resp=read.table(response,header=TRUE,sep=",")
|
|
20 listOfFile=resp[[1]]
|
|
21 responseValue=resp[[2]]
|
|
22 index = match(listOfFile,rownames(CNsignalMatrix))
|
|
23 responseValueOrder=responseValue[index]
|
|
24
|
|
25 result=variableSelection(CNsignalMatrix,responseValueOrder,nbFolds=nbFolds,loss=loss,plot=TRUE)
|
|
26
|
|
27 CNsignalResult=CN[result$markers.index,(names(CN)%in% drops)]
|
|
28
|
|
29 CNsignalResult["coefficient"]=result$coefficient
|
|
30 CNsignalResult["index"]=result$markers.index
|
|
31
|
|
32 sink(output)
|
|
33 print(format(CNsignalResult),row.names=FALSE)
|
|
34 sink()
|
|
35 #write.table(CNsignalResult,output,row.names = FALSE, quote=FALSE, sep = "\t")
|