Skip to content

Commit 687fc31

Browse files
committed
Ready for CRAN
1 parent 1712a9d commit 687fc31

File tree

3 files changed

+79
-73
lines changed

3 files changed

+79
-73
lines changed

vignettes/benchmarking-selectboost-networks.Rmd

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ vignette: >
1616
---
1717

1818
```{r setup, include = FALSE}
19+
LOCAL <- identical(Sys.getenv("LOCAL"), "TRUE")
20+
knitr::opts_chunk$set(purl = LOCAL)
1921
knitr::opts_chunk$set(
2022
collapse = TRUE,
2123
comment = "#>"
@@ -41,22 +43,22 @@ The following allows to reproduce some the figures of the article Aouadi et al.
4143

4244
## Retrieve the results
4345
Some simulation results were stored in the `results_simuls_reverse_engineering_v3` dataset provided with the package.
44-
```{r loadresults, cache= FALSE}
46+
```{r loadresults, cache= FALSE, eval = LOCAL}
4547
library(SelectBoost)
4648
data(results_simuls_reverse_engineering_v3)
4749
colgrey=grey(.05,NULL)
4850
```
4951

5052
## Compute graphs' ranges
51-
```{r ranges, cache= FALSE}
53+
```{r ranges, cache= FALSE, eval = LOCAL}
5254
rangeCPy_S=range(sensitivity_C,sensitivity_PL,sensitivity_PL2,sensitivity_PL2_W,sensitivity_PL2_tW,sensitivity_PSel,sensitivity_PSel_W,sensitivity_PSel.5,sensitivity_PSel.e2,sensitivity_PSel.5.e2,sensitivity_robust,sensitivity_PB,predictive_positive_value_PB_095_075,predictive_positive_value_PB_075_075,sensitivity_PB_W)
5355
rangeCPy_PPV=range(predictive_positive_value_C,predictive_positive_value_PL,predictive_positive_value_PL2,predictive_positive_value_PL2_W,predictive_positive_value_PL2_tW,predictive_positive_value_PSel,predictive_positive_value_PSel_W,predictive_positive_value_PSel.5,predictive_positive_value_PSel.e2,predictive_positive_value_PSel.5.e2,predictive_positive_value_robust,predictive_positive_value_PB,predictive_positive_value_PB_095_075,predictive_positive_value_PB_075_075,predictive_positive_value_PB_W)
5456
rangeCPy_F=range(F_score_C,F_score_PL,F_score_PL2,F_score_PL2_W,F_score_PL2_tW,F_score_PSel,F_score_PSel_W,F_score_PSel.5,F_score_PSel.e2,F_score_PSel.5.e2,F_score_PB,F_score_PB_095_075,F_score_PB_075_075,F_score_PB_W)
5557
rangeCPx=range(test.seq_C,test.seq_PL,test.seq_PL2,test.seq_PL2_W,test.seq_PL2_tW,test.seq_PSel,test.seq_PSel_W,test.seq_PSel.5,test.seq_PSel.e2,test.seq_PSel.5.e2,test.seq_robust,test.seq_PB,test.seq_PB_095_075,test.seq_PB_075_075,test.seq_PB_W)
5658
```
5759

5860
## Sensitivity
59-
```{r artgraphs1, cache= FALSE, fig.width=6}
61+
```{r artgraphs1, cache= FALSE, fig.width=6, eval = LOCAL}
6062
layout(matrix(1:6,nrow=2))
6163
matplot(t(test.seq_PL2),t(sensitivity_PL2),type="l",xlab="cutoff",ylab="Sensitivity",main="Patterns_Lasso2",ylim=rangeCPy_S,col=grey(.05,NULL))
6264
abline(v=nv_PL2,col=grey(.05,NULL),lty=3)
@@ -73,7 +75,7 @@ abline(v=nv_PB_W,col=grey(.05,NULL),lty=3)
7375
```
7476

7577
Run the code to plot the graph.
76-
```{r artgraphs2, cache= FALSE, fig.width=6, fig.keep='none'}
78+
```{r artgraphs2, cache= FALSE, fig.width=6, fig.keep='none', eval = LOCAL}
7779
layout(matrix(1:6,nrow=2))
7880
matplot(t(test.seq_robust),t(sensitivity_robust),type="l",xlab="cutoff",ylab="Sensitivity",main="Patterns_Robust",ylim=rangeCPy_S,col=grey(.05,NULL))
7981
abline(v=nv_robust,col=grey(.05,NULL),lty=3)
@@ -90,7 +92,7 @@ abline(v=nv_PSel,col=grey(.05,NULL),lty=3)
9092
```
9193

9294
## Predictive positive value
93-
```{r artgraphs3, cache= FALSE, fig.width=6}
95+
```{r artgraphs3, cache= FALSE, fig.width=6, eval = LOCAL}
9496
layout(matrix(1:6,nrow=2))
9597
matplot(t(test.seq_PL2),t(predictive_positive_value_PL2),type="l",xlab="cutoff",ylab="Predictive Positive Value",main="Patterns_Lasso2",ylim=rangeCPy_PPV,col=grey(.05,NULL))
9698
abline(v=nv_PL2,col=grey(.05,NULL),lty=3)
@@ -107,7 +109,7 @@ abline(v=nv_PB_W,col=grey(.05,NULL),lty=3)
107109
```
108110

109111
Run the code to plot the graph.
110-
```{r artgraphs4, cache= FALSE, fig.width=6, fig.keep='none'}
112+
```{r artgraphs4, cache= FALSE, fig.width=6, fig.keep='none', eval = LOCAL}
111113
layout(matrix(1:6,nrow=2))
112114
matplot(t(test.seq_robust),t(predictive_positive_value_robust),type="l",xlab="cutoff",ylab="Predictive Positive Value",main="Patterns_Robust",ylim=rangeCPy_PPV,col=grey(.05,NULL))
113115
abline(v=nv_robust,col=grey(.05,NULL),lty=3)
@@ -124,7 +126,7 @@ abline(v=nv_PSel,col=grey(.05,NULL),lty=3)
124126
```
125127

126128
## F-score
127-
```{r artgraphs5, cache= FALSE, fig.width=6}
129+
```{r artgraphs5, cache= FALSE, fig.width=6, eval = LOCAL}
128130
layout(matrix(1:6,nrow=2))
129131
matplot(t(test.seq_PL2),t(F_score_PL2),type="l",xlab="cutoff",ylab="Fscore",main="Patterns_Lasso2",ylim=rangeCPy_F,col=grey(.05,NULL))
130132
abline(v=nv_PL2,col=grey(.05,NULL),lty=3)
@@ -141,7 +143,7 @@ abline(v=nv_PB_W,col=grey(.05,NULL),lty=3)
141143
```
142144

143145
Run the code to plot the graph.
144-
```{r artgraphs6, cache= FALSE, fig.width=6, fig.keep='none'}
146+
```{r artgraphs6, cache= FALSE, fig.width=6, fig.keep='none', eval = LOCAL}
145147
layout(matrix(1:6,nrow=2))
146148
matplot(t(test.seq_robust),t(F_score_robust),type="l",xlab="cutoff",ylab="Fscore",main="Patterns_Robust",ylim=rangeCPy_F,col=grey(.05,NULL))
147149
abline(v=nv_robust,col=grey(.05,NULL),lty=3)

vignettes/confidence-indices-Cascade-networks.Rmd

+27-25
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ vignette: >
1616
---
1717

1818
```{r setup, include = FALSE}
19+
LOCAL <- identical(Sys.getenv("LOCAL"), "TRUE")
20+
knitr::opts_chunk$set(purl = LOCAL)
1921
knitr::opts_chunk$set(
2022
collapse = TRUE,
2123
comment = "#>"
@@ -42,12 +44,12 @@ devtools::install_github("fbertran/SelectBoost", ref = "doMC")
4244
Code to reproduce the datasets saved with the package and some the figures of the article Aouadi et al. (2018), <arXiv:1810.01670>
4345

4446
## Data simulation
45-
```{r Cascade, cache= FALSE}
47+
```{r Cascade, cache= FALSE, eval = LOCAL}
4648
library(Cascade)
4749
```
4850

4951
We define the F array for the simulations.
50-
```{r, cache= TRUE}
52+
```{r, cache= TRUE, eval = LOCAL}
5153
T<-4
5254
F<-array(0,c(T-1,T-1,T*(T-1)/2))
5355
@@ -61,7 +63,7 @@ F[,,5]<-F[,,2]
6163
```
6264

6365
We set the seed to make the results reproducible
64-
```{r, cache= TRUE}
66+
```{r, cache= TRUE, eval = LOCAL}
6567
set.seed(1)
6668
Net<-Cascade::network_random(
6769
nb=100,
@@ -77,7 +79,7 @@ Net@F<-F
7779
```
7880

7981
We simulate gene expression according to the network Net
80-
```{r message=FALSE, cache=TRUE}
82+
```{r message=FALSE, cache=TRUE, eval = LOCAL}
8183
M <- Cascade::gene_expr_simulation(
8284
network=Net,
8385
time_label=rep(1:4,each=25),
@@ -87,100 +89,100 @@ M <- Cascade::gene_expr_simulation(
8789

8890
## Network inference
8991
We infer the new network.
90-
```{r, cache= TRUE, fig.keep='none'}
92+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
9193
Net_inf_C <- Cascade::inference(M,cv.subjects=TRUE)
9294
```
9395

9496
Heatmap of the coefficients of the Omega matrix of the network. Run the code to get the graph.
95-
```{r, cache= TRUE, fig.keep='none'}
97+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
9698
stats::heatmap(Net_inf_C@network, Rowv = NA, Colv = NA, scale="none", revC=TRUE)
9799
```
98100

99-
```{r, cache= TRUE}
101+
```{r, cache= TRUE, eval = LOCAL}
100102
Fab_inf_C <- Net_inf_C@F
101103
```
102104

103105
## Compute the confidence indices for the inference
104-
```{r, cache= TRUE}
106+
```{r, cache= TRUE, eval = LOCAL}
105107
library(SelectBoost)
106108
set.seed(1)
107109
```
108110

109111
By default the crossvalidation is made subjectwise according to a leave one out scheme and the resampling analysis is made at the .95 `c0` level. To pass CRAN tests, `use.parallel = FALSE` is required. Set `use.parallel = TRUE` and select the number of cores using `ncores = 4`.
110-
```{r, cache= TRUE}
112+
```{r, cache= TRUE, eval = LOCAL}
111113
net_pct_selected <- selectboost(M, Fab_inf_C, use.parallel = FALSE)
112114
```
113-
```{r, cache= TRUE}
115+
```{r, cache= TRUE, eval = LOCAL}
114116
net_pct_selected_.5 <- selectboost(M, Fab_inf_C, c0value = .5, use.parallel = FALSE)
115117
```
116-
```{r, cache= TRUE}
118+
```{r, cache= TRUE, eval = LOCAL}
117119
net_pct_selected_thr <- selectboost(M, Fab_inf_C, group = group_func_1, use.parallel = FALSE)
118120
```
119121

120122
Use `cv.subject=FALSE` to use default crossvalidation
121-
```{r, cache= TRUE}
123+
```{r, cache= TRUE, eval = LOCAL}
122124
net_pct_selected_cv <- selectboost(M, Fab_inf_C, cv.subject=FALSE, use.parallel = FALSE)
123125
```
124126

125127
## Analysis of the confidence indices
126128
Use plot to display the result of the confidence analysis.
127-
```{r, cache= TRUE}
129+
```{r, cache= TRUE, eval = LOCAL}
128130
plot(net_pct_selected)
129131
```
130132

131133
Run the code to plot the other results.
132-
```{r, cache= TRUE, fig.keep='none'}
134+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
133135
plot(net_pct_selected_.5)
134136
```
135137

136-
```{r, cache= TRUE, fig.keep='none'}
138+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
137139
plot(net_pct_selected_thr)
138140
```
139141

140-
```{r, cache= TRUE, fig.keep='none'}
142+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
141143
plot(net_pct_selected_cv)
142144
```
143145

144146
Run the code to plot the remaning graphs.
145147

146148
Distribution of non-zero (absolute value > 1e-5) coefficients
147-
```{r, cache= FALSE, fig.keep="none"}
149+
```{r, cache= FALSE, fig.keep="none", eval = LOCAL}
148150
hist(Net_inf_C@network[abs(Net_inf_C@network)>1e-5])
149151
```
150152

151153
Plot of confidence at .95 resampling level versus coefficient value for non-zero (absolute value > 1e-5) coefficients
152-
```{r, cache= FALSE, fig.keep="none"}
154+
```{r, cache= FALSE, fig.keep="none", eval = LOCAL}
153155
plot(Net_inf_C@network[abs(Net_inf_C@network)>1e-5],[email protected][abs(Net_inf_C@network)>1e-5])
154156
```
155157

156-
```{r, cache= TRUE, fig.keep='none'}
158+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
157159
hist([email protected][abs(Net_inf_C@network)>1e-5])
158160
```
159161

160162
Plot of confidence at .5 resampling level versus coefficient value for non-zero (absolute value > 1e-5) coefficients
161-
```{r, cache= TRUE, fig.keep='none'}
163+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
162164
plot(Net_inf_C@network[abs(Net_inf_C@network)>1e-5],[email protected][abs(Net_inf_C@network)>1e-5])
163165
```
164166

165-
```{r, cache= TRUE, fig.keep='none'}
167+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
166168
hist([email protected][abs(Net_inf_C@network)>1e-5])
167169
```
168170

169171
Plot of confidence at .95 resamling level with groups created by thresholding the correlation matrix versus coefficient value for non-zero (absolute value > 1e-5) coefficients.
170-
```{r, cache= TRUE, fig.keep='none'}
172+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
171173
plot(Net_inf_C@network[abs(Net_inf_C@network)>1e-5],[email protected][abs(Net_inf_C@network)>1e-5])
172174
```
173175

174-
```{r, cache= TRUE, fig.keep='none'}
176+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
175177
hist([email protected][abs(Net_inf_C@network)>1e-5])
176178
```
177179

178180
Plot of confidence at .95 resampling level versus coefficient value for non-zero (absolute value > 1e-5) coefficients using standard cross-validation.
179-
```{r, cache= TRUE, fig.keep='none'}
181+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
180182
plot(Net_inf_C@network[abs(Net_inf_C@network)>1e-5],[email protected][abs(Net_inf_C@network)>1e-5])
181183
```
182184

183-
```{r, cache= TRUE, fig.keep='none'}
185+
```{r, cache= TRUE, fig.keep='none', eval = LOCAL}
184186
hist([email protected][abs(Net_inf_C@network)>1e-5])
185187
```
186188

0 commit comments

Comments
 (0)