Skip to content

Commit a5d64f2

Browse files
committed
Fix for incompatibility with PLNmodels latest release
1 parent 0358eb8 commit a5d64f2

16 files changed

+105
-35
lines changed

.Rprofile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
options(repos=structure(c(CRAN="http://cran.us.r-project.org")))
1+
options(repos=structure(c(CRAN="https://cloud.r-project.org/")))

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.Ruserdata
55
inst/doc
66
docs
7+
dev_history.R

DESCRIPTION

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,45 @@ Type: Package
22
Package: EMtree
33
Title: Infers Direct Species Association Networks using Tree Averaging
44
Version: 1.1.0
5-
Author: Raphaelle Momal <[email protected]>
6-
Maintainer: Raphaelle Momal <[email protected]>
7-
Description: Uses averages over spanning trees within an Expectation Maximization algorithm to infer conditional dependence networks. Involves plotting functionalities.
5+
Authors@R: c(
6+
person("Raphaëlle", "Momal", role = c("aut", "cre","cph"), email = "[email protected]",
7+
comment = c(ORCID = "0000-0002-1550-4530")))
8+
Description: The spanning tree averaging within an Expectation-Maximization algorithm
9+
(Momal, Robin and Ambroise, 2020 <doi:10.1111/2041-210X.13380>) leverages the
10+
Matrix Tree Theorem to infer conditional dependence networks, such as direct species association
11+
networks.
812
License: GPL-3
913
Imports:
1014
dplyr,
1115
ggplot2,
1216
ggraph,
1317
huge,
14-
influenceR,
1518
magrittr,
1619
Matrix,
1720
mvtnorm,
1821
parallel,
1922
PLNmodels,
20-
purrr,
2123
tibble,
2224
tidygraph,
23-
tidyr,
2425
vegan,
26+
gridExtra,
27+
pillar,
2528
ade4,
26-
gridExtra
29+
viridis,
30+
gmp
2731
Suggests:
2832
testthat (>= 2.1.0),
2933
knitr,
3034
rmarkdown,
3135
networkD3,
36+
pROC,
37+
tidyr,
3238
RColorBrewer
3339
Encoding: UTF-8
34-
LazyData: false
35-
RoxygenNote: 7.1.1
40+
LazyData: true
41+
RoxygenNote: 7.3.2
42+
Depends: R (>= 3.5)
3643
VignetteBuilder: knitr
3744
URL: https://rmomal.github.io/EMtree/
3845
BugReports: https://github.com/Rmomal/EMtree/issues
46+
Language: en-US

R/F_inference.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ ResampleEMtree <- function(counts,covar_matrix=NULL, unlinked=NULL,
410410
#- parallel computation of S fits of new_EMtree
411411
if(is.null(user_covariance_estimation)){
412412
suppressWarnings(
413-
PLNfit <- PLNmodels::PLN(counts ~ -1 + offset(log(O)) + .,
414-
data=data.frame(X),control=list("trace"=0))
413+
PLNfit <- PLNmodels::PLN(formula=counts ~ -1 + offset(log(O)) + .,
414+
data=data.frame(X),control=PLN_param(trace=0))
415415
)}
416416
obj<-parallel::mclapply(1:S,function(b){
417417
if(init){

README.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ By default, it uses the Poisson log-Normal Model ([PLNmodels](https://github.com
2828
### CRAN dependencies
2929

3030
```{r,eval=FALSE}
31-
required_CRAN <- c("Matrix", "purrr","parallel", "mvtnorm", "vegan","huge",
32-
"ggplot2", "magrittr", "dplyr","tidyr", "tibble",
33-
"PLNmodels","ggraph", "tidygraph", "ade4")
31+
required_CRAN <- c("Matrix", "parallel", "mvtnorm", "vegan",
32+
"ggplot2", "magrittr", "dplyr", "tibble",
33+
"PLNmodels","ggraph", "tidygraph","huge")
3434
not_installed_CRAN <- setdiff(required_CRAN, rownames(installed.packages()))
3535
if (length(not_installed_CRAN) > 0) install.packages(not_installed_CRAN)
3636
```

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ copulas, or Gaussian data transformations.
3131
### CRAN dependencies
3232

3333
``` r
34-
required_CRAN <- c("Matrix", "purrr","parallel", "mvtnorm", "vegan","huge",
35-
"ggplot2", "magrittr", "dplyr","tidyr", "tibble",
36-
"PLNmodels","ggraph", "tidygraph", "ade4")
34+
required_CRAN <- c("Matrix", "parallel", "mvtnorm", "vegan",
35+
"ggplot2", "magrittr", "dplyr", "tibble",
36+
"PLNmodels","ggraph", "tidygraph","huge")
3737
not_installed_CRAN <- setdiff(required_CRAN, rownames(installed.packages()))
3838
if (length(not_installed_CRAN) > 0) install.packages(not_installed_CRAN)
3939
```

cran-comments.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
## Test environments
2-
* local R installation, R 4.0.2
3-
* ubuntu 16.04 (on travis-ci), R 4.0.2
4-
* win-builder (devel)
2+
- R-hub fedora-clang-devel (r-devel)
3+
- R-hub windows-x86_64-devel (r-devel)
4+
- R-hub macos-highsierra-release (r-release)
55

66
## R CMD check results
7+
> On fedora-clang-devel (r-devel), windows-x86_64-devel (r-devel)
8+
checking CRAN incoming feasibility ... NOTE
9+
Maintainer: ‘Raphaelle Momal <[email protected]>
10+
11+
New submission
712

8-
0 errors | 0 warnings | 1 note
9-
10-
* This is a new release.
13+
0 errors ✓ | 0 warnings ✓ | 1 note x

dev_history.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ attachment::att_to_description()
1313
use_build_ignore("dev_history.R")
1414

1515
usethis::use_vignette("Fatala_Net","Fatala fishes")
16+
usethis::use_vignette("Partial_correlations","Partial correlations")
1617
pkgdown::build_site()
1718

1819
# workflow
@@ -44,14 +45,14 @@ covr::report()
4445
results <- rhub::check_for_cran(platforms=c("fedora-clang-devel",
4546
"windows-x86_64-devel",
4647
"macos-highsierra-release"))
47-
48+
results2 <- rhub::check_for_cran()
4849
# Get the summary of your results
49-
results$cran_summary()
50+
results2$cran_summary()
5051
# Generate your cran-comments.md, then you copy-paste the output from the function above
5152
usethis::use_cran_comments()
5253

5354
devtools::check_win_devel()
5455
usethis::use_news_md(open = rlang::is_interactive())
5556

56-
57+
devtools::release()
5758

docs/.DS_Store

0 Bytes
Binary file not shown.

tests/.DS_Store

0 Bytes
Binary file not shown.

tests/testthat/test-F_Graphs.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ library(PLNmodels)
44
library(parallel)
55
library(tidygraph)
66
library(ggraph)
7-
library(purrr)
87
library(dplyr)
9-
library(tidyr)
108
library(gridExtra)
119
##########################
1210
n<-30

tests/testthat/test-F_inference.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ library(dplyr)
66
library(vegan)
77
library(Matrix)
88
library(mvtnorm)
9-
library(tidyr)
10-
library(EMtree)
119
##########################
1210
n<-30
1311
p<-10

tests/testthat/test-test_gener_data.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ library(dplyr)
66
library(vegan)
77
library(Matrix)
88
library(mvtnorm)
9-
library(tidyr)
109
library(EMtree)
1110
##########################
1211
n<-100

vignettes/.DS_Store

6 KB
Binary file not shown.

vignettes/Fatala_Net.Rmd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,3 @@ forceNetwork(Links = graph_d3$links, Nodes =graph_d3$nodes,
208208
Source = 'source', Target = 'target',
209209
NodeID = 'name', Group = 'group',opacity = 1,fontSize = 15, legend=TRUE)
210210
```
211-
212-
213-

vignettes/Partial_correlations.Rmd

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: "Partial correlations"
3+
output: rmarkdown::html_vignette
4+
vignette: >
5+
%\VignetteIndexEntry{Partial correlations}
6+
%\VignetteEngine{knitr::rmarkdown}
7+
%\VignetteEncoding{UTF-8}
8+
---
9+
10+
```{r, include = FALSE}
11+
knitr::opts_chunk$set(
12+
collapse = TRUE,
13+
comment = "#>",
14+
cache=TRUE
15+
)
16+
library(ggplot2)
17+
library(dplyr)
18+
library(tidyr)
19+
library(magrittr)
20+
```
21+
22+
```{r setup}
23+
library(EMtree)
24+
```
25+
26+
# Partial correlations simulation
27+
28+
```{r}
29+
set.seed(1)
30+
p=300
31+
n=400
32+
simulation<-data_from_scratch(type="erdos",p=p,n=n,signed=TRUE, dens=3/p)
33+
G=1*(simulation$omega!=0) ; diag(G) = 0
34+
draw_network(G, remove_isolated = TRUE, pal_edges = "gray70",pal_nodes = "steelblue",btw_rank = 1)$G
35+
```
36+
simulated partial correlation matrix :
37+
```{r}
38+
ParCor <- - cov2cor(simulation$omega)
39+
```
40+
41+
```{r}
42+
ParCor %>% ToVec() %>% as_tibble() %>% filter(value!=0) %>%
43+
ggplot(aes(value))+geom_histogram(alpha=0.8)+
44+
theme_light()+labs(title="Repartition of non-nul partial correlations",
45+
x="Partial correlation values")
46+
47+
```
48+
49+
50+
# Inference
51+
52+
```{r}
53+
EMtreefit<-ResampleEMtree(simulation$data,S = 30,cores = 3)
54+
stab_selection=StATS(EMtreefit$Pmat, nlambda=50, stab.thresh=0.8,plot=TRUE)
55+
```
56+
57+
```{r}
58+
net90=ToSym(1*(stab_selection$freqs_opt>0.95))
59+
table(net90, G)
60+
library(PRROC)
61+
pr<-pr.curve(scores.class0 = stab_selection$freqs_opt,
62+
scores.class1 = ToVec(G))
63+
pr
64+
```
65+

0 commit comments

Comments
 (0)