-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwofactw.R
More file actions
78 lines (54 loc) · 3.46 KB
/
twofactw.R
File metadata and controls
78 lines (54 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
twofact_prep_run_connectedw <- function(samp.data, name.delim, num.prep.batches, num.columns, exp.name, sname.id, stype.id, sbio.id, sfact1.id, sfact2.id, samptype.rand, omics.nm){
alt1 = twofact_prep_run_connected(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, num.columns = num.columns, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact1.id, sfact2.id = sfact2.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
alt2 = twofact_prep_run_connected(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, num.columns = num.columns, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact2.id, sfact2.id = sfact1.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
clac <- function(x){
cnt = 1
temp = matrix(0,nrow(x),(ncol(x))^2)
for(i in 1:ncol(x)){
for(j in 1:ncol(x)){
temp[,cnt] = x[,i] - x[,j]
cnt = cnt + 1
}
}
max(apply(temp, 1, max))
}
a1 = max(clac(alt1$prep.tab1),clac(alt1$prep.tab2))
a2 = max(clac(alt2$prep.tab1),clac(alt2$prep.tab2))
if(a1 <= a2){return(alt1)}else{return(alt2)}
}
twofact_prep_run_notconnectedw <- function(samp.data, name.delim, num.prep.batches, num.run.batches, num.columns, exp.name, sname.id, stype.id, sbio.id, sfact1.id, sfact2.id, samptype.rand, omics.nm){
alt1 = twofact_prep_run_notconnected(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, num.run.batches = num.run.batches, num.columns = num.columns, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact1.id, sfact2.id = sfact2.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
alt2 = twofact_prep_run_notconnected(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, num.run.batches = num.run.batches, num.columns = num.columns, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact2.id, sfact2.id = sfact1.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
clac <- function(x){
cnt = 1
temp = matrix(0,nrow(x),(ncol(x))^2)
for(i in 1:ncol(x)){
for(j in 1:ncol(x)){
temp[,cnt] = x[,i] - x[,j]
cnt = cnt + 1
}
}
max(apply(temp, 1, max))
}
a1 = max(clac(alt1$prep.tab1),clac(alt1$prep.tab2))
a2 = max(clac(alt2$prep.tab1),clac(alt2$prep.tab2))
if(a1 <= a2){return(alt1)}else{return(alt2)}
}
twofact_prepw <- function(samp.data, name.delim, num.prep.batches, exp.name, sname.id, stype.id, sbio.id, sfact1.id, sfact2.id, samptype.rand, omics.nm){
alt1 = twofact_prep(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact1.id, sfact2.id = sfact2.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
alt2 = twofact_prep(samp.data = samp.data, name.delim = name.delim, num.prep.batches = num.prep.batches, exp.name = exp.name, sname.id = sname.id, stype.id = stype.id, sbio.id = sbio.id, sfact1.id = sfact2.id, sfact2.id = sfact1.id, samptype.rand = samptype.rand, omics.nm = omics.nm)
clac <- function(x){
cnt = 1
temp = matrix(0,nrow(x),(ncol(x))^2)
for(i in 1:ncol(x)){
for(j in 1:ncol(x)){
temp[,cnt] = x[,i] - x[,j]
cnt = cnt + 1
}
}
max(apply(temp, 1, max))
}
a1 = max(clac(alt1$prep.tab1),clac(alt1$prep.tab2))
a2 = max(clac(alt2$prep.tab1),clac(alt2$prep.tab2))
if(a1 <= a2){return(alt1)}else{return(alt2)}
}