-
Notifications
You must be signed in to change notification settings - Fork 0
/
robustness_test.R
138 lines (121 loc) · 5.3 KB
/
robustness_test.R
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
source('modified_random_tf.r')
setwd('your_address')
#figure attributes
dpi <- 300
width <- 800*2
height <- 500*2
#SMPDSv1
recon_matrix = read.csv('po19_test_abund.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_po19.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MTCO")
dev.off()
recon_matrix = read.csv('po19_test_comb.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_po19_comb.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MTCO")
dev.off()
out_put_ml <- randomTF_v2(spp = sqrt(sp_m), env = env,
fos = sqrt(cores), n = 999, fun = WAPLS, col = 2)
#png('po19_wapls.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MTCO")
dev.off()
# NIMBIOS
sp_m = read.csv('data/MP20_abund.csv',header = 1)[,c(-1,-2)]
for (i in 1:dim(sp_m)[2])
sp_m [,i] <- as.numeric(sp_m [,i] )
for (i in 1:dim(sp_m)[1]){
sp_m[i,] = sp_m[i,]/sum(sp_m[i,])
}
env = read.csv('data/MP20_env.csv',header = 1)$MAT
env <- (as.numeric(env))
cores = read.csv('data/lla.csv',header = 1)[,-1]
for (i in 1:dim(cores)[2])
cores [,i] <- as.numeric(cores[,i] )
for (i in 1:dim(cores)[1]){
cores[i,] = cores[i,]/sum(cores[i,])
}
recon_matrix = read.csv('lla_test_abund')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_lla.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
recon_matrix = read.csv('lla_test_comb')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_lla_ae.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
out_put_ml <- randomTF_v2(spp = sqrt(sp_m), env = env,
fos = sqrt(cores), n = 999, fun = WAPLS, col = 2)
png('lla_wapls.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
cores = read.csv('data/mos.csv',header = 1)[,-1]
for (i in 1:dim(cores)[2])
cores [,i] <- as.numeric(cores[,i] )
for (i in 1:dim(cores)[1]){
cores[i,] = cores[i,]/sum(cores[i,])
}
recon_matrix = read.csv('lla_test_comb.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_mos.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
recon_matrix = read.csv('mos_test_combt.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = sqrt(sp_m), env = env, #
fos = sqrt(cores),recon_matrix=recon_matrix) #
png('stack_recon_mos_comb.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
out_put_ml <- randomTF_v2(spp = sqrt(sp_m), env = env,
fos = sqrt(cores), n = 999, fun = WAPLS, col = 2)
png('mos_wapls.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "MAT")
dev.off()
# SWAP
data(SWAP)
sp_m = SWAP$spec
env = SWAP$pH
cores = read.csv('data/rlgh3.csv',header = 1)[,-1]/100
recon_matrix = read.csv('rlgh3_test_abund.csv')[,-1] #_2707
out_put_ml <- randomTF_ml(spp = (sp_m), env = env, #
fos = (cores),recon_matrix=recon_matrix) #
png('stack_recon_rlgh3.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()
recon_matrix = read.csv('rlgh3_test_comb.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = (sp_m), env = env, #
fos = (cores),recon_matrix=recon_matrix) #
png('stack_recon_rlgh3_comb.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()
out_put_ml <- randomTF_v2(spp = (sp_m), env = env,
fos = (cores), n = 999, fun = WAPLS, col = 1)
png('rlgh3_wapls.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()
sp_m = SWAP$spec
env = SWAP$pH
cores = read.csv('data/rlgh_spec.csv',header = 1)[,-1]#/100
recon_matrix = read.csv('rlgh_test_abund.csv')[,-1] #2707
out_put_ml <- randomTF_ml(spp = (sp_m), env = env, #
fos = (cores),recon_matrix=recon_matrix) #
png('stack_recon_rlgh.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()
recon_matrix = read.csv('rlgh_test_comb.csv')[,-1] #
out_put_ml <- randomTF_ml(spp = (sp_m), env = env, #
fos = (cores),recon_matrix=recon_matrix) #
png('stack_recon_rlgh_comb.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()
out_put_ml <- randomTF_v2(spp = (sp_m), env = env,
fos = (cores), n = 999, fun = WAPLS, col = 1)
png('rlgh_wapls.png', width = width, height = height, units = "px", res = dpi)
autoplot(out_put_ml, "pH")
dev.off()