fix memory leaks on EMGLLF, test OK for EMGrank
[valse.git] / src / test / generate_test_data / generateRunSaveTest_selectiontotale.R
CommitLineData
c3bc4705
BA
1generateRunSaveTest_selectiontotale= function(n=200, p=15, m=10, k=3, mini=5, maxi=10, gamma=1.0,
2 glambda=list(0.0,0.01,0.02,0.03,0.05,0.1,0.2,0.3,0.5,0.7,0.85,0.99))
3{
f1b906da
BG
4 testFolder = "data/"
5 dir.create(testFolder, showWarnings=FALSE, mode="0755")
9ade3f1b 6
c3bc4705 7 require(valse)
9ade3f1b 8 params = valse:::basic_Init_Parameters(n, p, m, k)
c3bc4705
BA
9 io = valse:::generateIOdefault(n, p, m, k)
10
f1b906da 11 #save inputs
c3bc4705
BA
12 write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""),
13 row.names=F, col.names=F)
14 write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""),
15 row.names=F, col.names=F)
16 write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""),
17 row.names=F, col.names=F)
18 write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""),
19 row.names=F, col.names=F)
20 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
21 row.names=F, col.names=F)
22 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
23 row.names=F, col.names=F)
24 write.table(as.double(gamma), paste(testFolder,"gamma",sep=""),
25 row.names=F, col.names=F)
26 write.table(as.double(glambda), paste(testFolder,"lambda",sep=""),
27 row.names=F, col.names=F)
28 write.table(as.double(io$X), paste(testFolder,"X",sep=""),
29 row.names=F, col.names=F)
30 write.table(as.double(io$Y), paste(testFolder,"Y",sep=""),
31 row.names=F, col.names=F)
32 write.table(as.double(tau), paste(testFolder,"tau",sep=""),
33 row.names=F, col.names=F)
34 write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensions",sep=""),
35 row.names=F, col.names=F)
36
37 res = selectiontotale(params$phiInit,params$rhoInit,params$piInit,params$gamInit,
38 mini,maxi,gamma,glambda,io$X,io$Y,seuil, tau)
39
f1b906da 40 #save output
c3bc4705
BA
41 write.table(as.double(res$A1), paste(testFolder,"A1",sep=""), row.names=F, col.names=F)
42 write.table(as.double(res$A2), paste(testFolder,"A2",sep=""), row.names=F, col.names=F)
43 write.table(as.double(res$rho), paste(testFolder,"rho",sep=""), row.names=F, col.names=F)
44 write.table(as.double(res$pi), paste(testFolder,"pi",sep=""), row.names=F, col.names=F)
f1b906da 45}