Skip to content

Commit

Permalink
merging with master
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveViss committed Feb 17, 2017
2 parents 8a9ae03 + d4e1bf7 commit a9f3ca5
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 126 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: alienR
Package: alien
Type: Package
Title: Comparative analysis of interaction inference methods
Version: 0.0.1
Expand Down Expand Up @@ -31,7 +31,7 @@ Imports:
SystemRequirements: none, one or more of JAGS (>= 4.0.0; (http://mcmc-jags.sourceforge.net))
NeedsCompilation: no
License: MIT
BugReports: https://github.com/TheoreticalEcosystemEcology/alienR/issues
BugReports: https://github.com/TheoreticalEcosystemEcology/alien/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 5.0.1
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
rfun := $(wildcard R/*.R)
rman := $(wildcard man/)
rtes := $(wildcard tests/testthat/*.R)
rdm = README.Rmd
md = README.md
chk = record_updates.txt
rscr = pkg2date.R


all: $(md) $(chk)

$(md): $(rdm)
Rscript --no-site-file --no-init-file $(rscr) 0
all: $(chk)

$(chk): $(rfun) $(rtes) $(rman)
Rscript --no-site-file --no-init-file $(rscr) 1

clean:
rm -rf man/* NAMESPACES
rm -rf man/* NAMESPACE
4 changes: 2 additions & 2 deletions R/predNicheProb.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' The next elements are as many predicted interaction as replicates.
#'
#' @note
#' See more here: https://github.com/ibartomeus/trait_match
#' See more here: \url{https://github.com/ibartomeus/trait_match}
#'
#' @author
#' Dominique Gravel and Ignasi Bartomeus
Expand All @@ -35,5 +35,5 @@ predNicheProb <- function(pars, Tlevel1, Tlevel2, replicates = 100) {
for (i in 1:replicates + 1) {
out[[i]] <- rbinom(length(Tlevel1), size = 1, prob = pLM)
}
out
return(out)
}
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Status

**Early development** **Version**: 0.0.1

[![Travis](https://travis-ci.org/TheoreticalEcosystemEcology/alienR.svg?branch=master)](https://travis-ci.org/TheoreticalEcosystemEcology/alienR) [![Build status](https://ci.appveyor.com/api/projects/status/sk3sbvusvcyy0at0?svg=true)](https://ci.appveyor.com/project/TheoreticalEcosystemEcology/alienR/build/1.0.7) [![codecov](https://codecov.io/gh/TheoreticalEcosystemEcology/alienR/branch/master/graphs/badge.svg)](https://codecov.io/gh/KevCaz/recruitR)
[![Travis](https://travis-ci.org/TheoreticalEcosystemEcology/alienR.svg?branch=master)](https://travis-ci.org/TheoreticalEcosystemEcology/alienR) [![Build status](https://ci.appveyor.com/api/projects/status/sk3sbvusvcyy0at0?svg=true)](https://ci.appveyor.com/project/TheoreticalEcosystemEcology/alienR/build/1.0.7) [![codecov](https://codecov.io/gh/TheoreticalEcosystemEcology/alien/branch/master/graph/badge.svg)](https://codecov.io/gh/TheoreticalEcosystemEcology/alien)

ALIEN: The aim of the package is to predict All Links In Ecological Networks
----------------------------------------------------------------------------
Expand All @@ -17,7 +17,7 @@ Incoming content
- binomial
- poisson
- RF
- Indirect matching centrality (latent \~ traits) (DG)
- Indirect matching centrality (latent ~ traits) (DG)
- Niche binary (DG)
- Niche probabilistic (DG)
- iEat recommend (DB)
Expand All @@ -28,6 +28,9 @@ Incoming content
- 4th corner (GB)
- Ben's magic (BW)
- Ives' phylo (GB)
- Permutation methods (GB)
- C-scores
- V-ratio

**Deadline:** Package ready by Christmas

Expand Down Expand Up @@ -75,7 +78,7 @@ devtools::test()
All of the previous steps can be done with:

``` bash
cd path/to/alienR
cd path/to/alien
make
```

Expand All @@ -89,7 +92,7 @@ Contribute to this package
- `git fetch` / `git pull` before you do anything else
- new branches must be made from `master` -- if not, you are responsible for rebasing
- good commit messages are 72 chars on the first line and explain what has been done in the imperative tone. A good rule of thumb is that if you say "If merged, this commit will" before the commit message, it should be a sentence. A good commit message is: `add informations about development practices`. A bad commit message is `CONTRIBUTING changes`
- if the branching complexity of your function is \> 3 (number of nested for / if / while), rewrite
- if the branching complexity of your function is &gt; 3 (number of nested for / if / while), rewrite

### Styleguide

Expand All @@ -100,9 +103,9 @@ Contribute to this package
- all `roxygen2` flags (e.g. @param etc.) are to be set up.
- R extension file has to be written in capital letter (e.g `fitBayesReg.R`)

Have a look at [<http://adv-r.had.co.nz/Style.html>](http://adv-r.had.co.nz/Style.html)
Have a look at <http://adv-r.had.co.nz/Style.html>

For further details on namespaces: [<http://r-pkgs.had.co.nz/namespace.html>](http://r-pkgs.had.co.nz/namespace.html)
For further details on namespaces: <http://r-pkgs.had.co.nz/namespace.html>

License
-------
Expand Down
101 changes: 0 additions & 101 deletions Readme.Rmd

This file was deleted.

2 changes: 1 addition & 1 deletion man/predNicheProb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Testthat.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
library(testthat)
test_check("alienR")
test_check("alien")
10 changes: 10 additions & 0 deletions tests/testthat/test-models.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
context("Models")

## 2B improved
test_that("integrated model works", {
out <- integratedModel(pars = c(1,1,1,1),
Tlevel1 = rnorm(10),
Expand All @@ -20,6 +21,7 @@ test_that("integrated model works", {
# expect_equal(TRUE, TRUE)#is.numeric(out))
# })

## 2B improved
test_that("neutral model works", {
out <- neutralModel(pars = NULL,
Tlevel1 = rnorm(10),
Expand All @@ -28,3 +30,11 @@ test_that("neutral model works", {
sd_Tlevel1 = 1)
expect_equal(TRUE, is.numeric(out))
})


test_that("residuals computation for the niche model works", {
out <- residualsNicheProb(pars = c(1,1,1,1),
Tlevel1 = rnorm(10),
Tlevel2 = rnorm(10))
expect_equal(TRUE, is.numeric(out))
})
12 changes: 6 additions & 6 deletions vignettes/BayesTutorial.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ output: html_document
---

#Aim
A short tutorial explaining the different options for fitting hierarchical bayesian models for species interactions using the package alienR
A short tutorial explaining the different options for fitting hierarchical bayesian models for species interactions using the package alien

```{r}
library(alienR)
library(alien)
library(ggplot2)
library(knitr)
opts_chunk$set(warning=F,message=F)
#source scripts because I can't seem to understand how roxygen generates functions to the package! To delete once we understand how paths are handled in package creation
s<-sapply(list.files("C:/Users/Ben/Documents/alienR/R",pattern=".R",full.names = T),source)
s<-sapply(list.files("C:/Users/Ben/Documents/alien/R",pattern=".R",full.names = T),source)
```

# Simulate data
Expand Down Expand Up @@ -68,7 +68,7 @@ ggplot(sumframe,aes(x=as.factor(I),y=J,fill=lower)) + geom_tile() + scale_fill_c
If we want the distributions, instead of a summary we can plot the posterior predictions directly. For the sake of plotting, lets look at just one node.

```{r}
justB<-predframe %>% filter(I=="b")
justB<-predframe %>% filter(I=="b")
ggplot(data=justB,aes(x=J,y=value)) + geom_boxplot(fill="black") + labs(y="Probability of interaction") + ggtitle("For Species B in the higher level") + theme_bw()
```

Expand Down Expand Up @@ -107,7 +107,7 @@ ggplot(sumframe,aes(x=as.factor(I),y=J,fill=lower)) + geom_tile() + scale_fill_c
Create the same boxplot as in the intercept model

```{r}
justB<-predframe2 %>% filter(I=="b")
justB<-predframe2 %>% filter(I=="b")
ggplot(data=justB,aes(x=J,y=value)) + geom_boxplot(fill="black") + labs(y="Probability of interaction") + ggtitle("For Species B in the higher level") + theme_bw()
```

Expand Down Expand Up @@ -135,4 +135,4 @@ allstats<-rbind_all(list(intercept_stats,binomial_stats))
ggplot(allstats,aes(x=nstat)) + geom_density(alpha=0.6,aes(fill=Model)) + facet_wrap(~Metric,scales='free',nrow=1) + theme_bw() + labs(x="value")
```

Same data, different model, different network statistics! Models matter.
Same data, different model, different network statistics! Models matter.

0 comments on commit a9f3ca5

Please sign in to comment.