-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for incompatibility with PLNmodels latest release
- Loading branch information
Showing
16 changed files
with
105 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
options(repos=structure(c(CRAN="http://cran.us.r-project.org"))) | ||
options(repos=structure(c(CRAN="https://cloud.r-project.org/"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.Ruserdata | ||
inst/doc | ||
docs | ||
dev_history.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,37 +2,45 @@ Type: Package | |
Package: EMtree | ||
Title: Infers Direct Species Association Networks using Tree Averaging | ||
Version: 1.1.0 | ||
Author: Raphaelle Momal <[email protected]> | ||
Maintainer: Raphaelle Momal <[email protected]> | ||
Description: Uses averages over spanning trees within an Expectation Maximization algorithm to infer conditional dependence networks. Involves plotting functionalities. | ||
Authors@R: c( | ||
person("Raphaëlle", "Momal", role = c("aut", "cre","cph"), email = "[email protected]", | ||
comment = c(ORCID = "0000-0002-1550-4530"))) | ||
Description: The spanning tree averaging within an Expectation-Maximization algorithm | ||
(Momal, Robin and Ambroise, 2020 <doi:10.1111/2041-210X.13380>) leverages the | ||
Matrix Tree Theorem to infer conditional dependence networks, such as direct species association | ||
networks. | ||
License: GPL-3 | ||
Imports: | ||
dplyr, | ||
ggplot2, | ||
ggraph, | ||
huge, | ||
influenceR, | ||
magrittr, | ||
Matrix, | ||
mvtnorm, | ||
parallel, | ||
PLNmodels, | ||
purrr, | ||
tibble, | ||
tidygraph, | ||
tidyr, | ||
vegan, | ||
gridExtra, | ||
pillar, | ||
ade4, | ||
gridExtra | ||
viridis, | ||
gmp | ||
Suggests: | ||
testthat (>= 2.1.0), | ||
knitr, | ||
rmarkdown, | ||
networkD3, | ||
pROC, | ||
tidyr, | ||
RColorBrewer | ||
Encoding: UTF-8 | ||
LazyData: false | ||
RoxygenNote: 7.1.1 | ||
LazyData: true | ||
RoxygenNote: 7.3.2 | ||
Depends: R (>= 3.5) | ||
VignetteBuilder: knitr | ||
URL: https://rmomal.github.io/EMtree/ | ||
BugReports: https://github.com/Rmomal/EMtree/issues | ||
Language: en-US |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
## Test environments | ||
* local R installation, R 4.0.2 | ||
* ubuntu 16.04 (on travis-ci), R 4.0.2 | ||
* win-builder (devel) | ||
- R-hub fedora-clang-devel (r-devel) | ||
- R-hub windows-x86_64-devel (r-devel) | ||
- R-hub macos-highsierra-release (r-release) | ||
|
||
## R CMD check results | ||
> On fedora-clang-devel (r-devel), windows-x86_64-devel (r-devel) | ||
checking CRAN incoming feasibility ... NOTE | ||
Maintainer: ‘Raphaelle Momal <[email protected]>’ | ||
|
||
New submission | ||
|
||
0 errors | 0 warnings | 1 note | ||
|
||
* This is a new release. | ||
0 errors ✓ | 0 warnings ✓ | 1 note x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: "Partial correlations" | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{Partial correlations} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
cache=TRUE | ||
) | ||
library(ggplot2) | ||
library(dplyr) | ||
library(tidyr) | ||
library(magrittr) | ||
``` | ||
|
||
```{r setup} | ||
library(EMtree) | ||
``` | ||
|
||
# Partial correlations simulation | ||
|
||
```{r} | ||
set.seed(1) | ||
p=300 | ||
n=400 | ||
simulation<-data_from_scratch(type="erdos",p=p,n=n,signed=TRUE, dens=3/p) | ||
G=1*(simulation$omega!=0) ; diag(G) = 0 | ||
draw_network(G, remove_isolated = TRUE, pal_edges = "gray70",pal_nodes = "steelblue",btw_rank = 1)$G | ||
``` | ||
simulated partial correlation matrix : | ||
```{r} | ||
ParCor <- - cov2cor(simulation$omega) | ||
``` | ||
|
||
```{r} | ||
ParCor %>% ToVec() %>% as_tibble() %>% filter(value!=0) %>% | ||
ggplot(aes(value))+geom_histogram(alpha=0.8)+ | ||
theme_light()+labs(title="Repartition of non-nul partial correlations", | ||
x="Partial correlation values") | ||
``` | ||
|
||
|
||
# Inference | ||
|
||
```{r} | ||
EMtreefit<-ResampleEMtree(simulation$data,S = 30,cores = 3) | ||
stab_selection=StATS(EMtreefit$Pmat, nlambda=50, stab.thresh=0.8,plot=TRUE) | ||
``` | ||
|
||
```{r} | ||
net90=ToSym(1*(stab_selection$freqs_opt>0.95)) | ||
table(net90, G) | ||
library(PRROC) | ||
pr<-pr.curve(scores.class0 = stab_selection$freqs_opt, | ||
scores.class1 = ToVec(G)) | ||
pr | ||
``` | ||
|