Skip to content

Commit

Permalink
Merge pull request #153 from rsetienne/develop
Browse files Browse the repository at this point in the history
v4.3.1
  • Loading branch information
rsetienne authored Feb 12, 2023
2 parents d0ed3df + 4e9323c commit 7d62c63
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 125 deletions.
104 changes: 0 additions & 104 deletions .zenodo.json

This file was deleted.

8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Package: DAISIE
Type: Package
Title: Dynamical Assembly of Islands by Speciation, Immigration and Extinction
Version: 4.3.0
Date: 2023-12-26
Depends: R (>= 3.5.0)
Version: 4.3.1
Date: 2023-02-10
Depends: R (>= 4.1.0)
biocViews:
SystemRequirements: C++14
SystemRequirements: C++17
Imports:
deSolve,
graphics,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# DAISIE 4.3.1

* Fix issue that prevented 'covr' from running correctly.
* Depend on R >= 4.1.0, C++17.
* Tests of `DAISIE_ML_*()` and integration tests don't run on CRAN due to too long runtime.

# DAISIE 4.3.0

* Due to recent changes in CRAN policy that result in warnings due to the use of Rcpp related packages that link to libraries that use `sprintf` ('Rcpp' and 'BH'), 'DAISIE' now requires Rcpp v(>= 1.0.10) and BH v(>= 1.81.0-1). See https://github.com/RcppCore/Rcpp/pull/1236 and https://github.com/eddelbuettel/bh/pull/90 respectively. Also require package 'DDD' v(>= 5.0.0).
Expand Down
3 changes: 2 additions & 1 deletion R/DAISIE-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#' \item Valente, L., Phillimore, A. B., Melo, M., Warren, B. H., Clegg, S. M., Havenstein, K., & Etienne, R. S. (2020). A simple dynamic model explains the diversity of island birds worldwide. Nature 579: 92-96. \doi{10.1038/s41586-020-2022-5}.\cr
#' \item Hauffe, T., Delicado, D., Etienne, R.S., & Valente, L. (2020). Lake expansion elevates equilibrium diversity via increasing colonization. Journal of Biogeography 47: 1849–1860. \doi{10.1111/jbi.13914}.\cr
#' \item Valente, L., Kristensen, N., Phillimore, A. B., & Etienne, R. S. (2021). Report of programming bugs in the DAISIE R package: consequences and correction. EcoEvoRxiv. \doi{10.32942/osf.io/w5ntf}.\cr
#' \item Santos Neves, P., Lambert, J. W., Valente, L., & Etienne, R. S. (2022). The robustness of a simple dynamic model of island biodiversity to geological and sea-level change. Journal of Biogeography. \doi{10.1111/jbi.14519}.\cr
#' \item Santos Neves, P., Lambert, J. W., Valente, L., & Etienne, R. S. (2022). The robustness of a simple dynamic model of island biodiversity to geological and sea-level change. Journal of Biogeography 49: 2091-2104. \doi{10.1111/jbi.14519}.\cr
#' \item Lambert, J. W., Santos Neves, P., Bilderbeek, R. L. C., Valente, L., Etienne, R. S. (2022). The effect of mainland dynamics on data and parameter estimates in island biogeography. bioRxiv. \doi{10.1101/2022.01.13.476210}.\cr
#' \item Xie, S., Valente, L., Etienne, R. S. (2023). Can we ignore trait-dependent colonization and diversification in island biogeography? Evolution. \doi{10.1093/evolut/qpad006}.\cr
#' \item Michielsen, N. M., Goodman, S. M., Soarimalala, V., van der Geer, A. A. E., Dávalos, L. M., Saville, G. I., Upham, N., Valente, L. (2023). The macroevolutionary impact of recent and imminent mammal extinctions on Madagascar. Nature Communications 14 (14).\doi{10.1038/s41467-022-35215-3}.\cr
#' }
#' @keywords internal
#' @import Rcpp
Expand Down
10 changes: 7 additions & 3 deletions R/DAISIE_loglik_CS.R
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,11 @@ DAISIE_integrate_const <- function(initprobs,tvec,rhs_func,pars,rtol,atol,method
# Use a regular expression to extract if the part that we are interested
# in is present
function_as_text <- as.character(body(rhs_func)[2])
if (function_as_text == 'rhs <- 0')
do_fun_1 <- grepl(pattern = "rhs <- 0", x = function_as_text)
do_fun_2 <- grepl(pattern = "rhs <- 1", x = function_as_text)
do_fun_3 <- grepl(pattern = "rhs <- 2", x = function_as_text)

if (do_fun_1)
{
lx <- (length(initprobs) - 1)/2
parsvec <- c(DAISIE_loglik_rhs_precomp(pars,lx))
Expand All @@ -1252,7 +1256,7 @@ DAISIE_integrate_const <- function(initprobs,tvec,rhs_func,pars,rtol,atol,method
# atol = atol,
# method = method
# )[2, -1]
} else if (function_as_text == 'rhs <- 1')
} else if (do_fun_2)
{
lx <- (length(initprobs))/4
parsvec <- c(DAISIE_loglik_rhs_precomp(pars,lx))
Expand All @@ -1264,7 +1268,7 @@ DAISIE_integrate_const <- function(initprobs,tvec,rhs_func,pars,rtol,atol,method
method,
runmod = "daisie_runmod1")

} else if (function_as_text == 'rhs <- 2')
} else if (do_fun_3)
{
lx <- (length(initprobs))/3
parsvec <- c(DAISIE_loglik_rhs_precomp(pars,lx))
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ Remotes:

For feature requests or bug-reports or other matters, please submit an [issue](https://github.com/rsetienne/DAISIE/issues/new).

## `git` branching workflow
## Feature branches

* `master`: build should always pass. [@rsetienne](https://github.com/rsetienne) has control over `develop` to `master` merges.
* `develop`: merge of topic branches, merge with `master` by [@rsetienne](https://github.com/rsetienne) iff build passes.
* `develop`: merge of feature branches, merge with `master` by [@rsetienne](https://github.com/rsetienne) iff build passes.

## Contributors

Expand Down Expand Up @@ -106,8 +106,10 @@ For feature requests or bug-reports or other matters, please submit an [issue](h

* Valente, L., Kristensen, N., Phillimore, A. B., & Etienne, R. S. (2021). Report of programming bugs in the DAISIE R package: consequences and correction. https://doi.org/10.32942/osf.io/w5ntf

* Santos Neves, P.\*, Lambert, J. W.\*, Valente, L., & Etienne, R. S. (2022). The robustness of a simple dynamic model of island biodiversity to geological and sea-level change. Journal of Biogeography. https://doi.org/10.1111/jbi.14519
* Santos Neves, P.\*, Lambert, J. W.\*, Valente, L., & Etienne, R. S. (2022). The robustness of a simple dynamic model of island biodiversity to geological and sea-level change. Journal of Biogeography 49: 2091-2104. https://doi.org/10.1111/jbi.14519

* Lambert, J. W., Santos Neves, P., Bilderbeek, R. L. C., Valente, L., Etienne, R. S. (2022). The effect of mainland dynamics on data and parameter estimates in island biogeography. bioRxiv. https://doi.org/10.1101/2022.01.13.476210

* Xie, S., Valente, L., Etienne, R. S. (2023). Can we ignore trait-dependent colonization and diversification in island biogeography? Evolution. https://doi.org/10.1093/evolut/qpad006.
* Xie, S., Valente, L., Etienne, R. S. (2023). Can we ignore trait-dependent colonization and diversification in island biogeography? Evolution. https://doi.org/10.1093/evolut/qpad006

* Michielsen, N. M., Goodman, S. M., Soarimalala, V., van der Geer, A. A. E., Dávalos, L. M., Saville, G. I., Upham, N., Valente, L. (2023). The macroevolutionary impact of recent and imminent mammal extinctions on Madagascar. Nature Communications 14 (14). https://doi.org/10.1038/s41467-022-35215-3
3 changes: 2 additions & 1 deletion man/DAISIE-package.Rd

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

2 changes: 1 addition & 1 deletion src/DAISIE_CS.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// [[Rcpp::plugins(cpp14)]]
// [[Rcpp::plugins(cpp17)]]
// [[Rcpp::depends(BH)]]


Expand Down
1 change: 1 addition & 0 deletions src/DAISIE_IW.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//' @export daisie_odeint_iw

// [[Rcpp::plugins(cpp17)]]
// [[Rcpp::plugins(openmp)]]
// [[Rcpp::depends(RcppEigen)]]

Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-DAISIE_ML1.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("DAISIE_ML1")

test_that("use", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
data(Galapagos_datalist)
datalist <- Galapagos_datalist
initparsopt <- c(2.5, 2.7, 20, 0.009, 1.01)
Expand Down Expand Up @@ -39,6 +39,7 @@ test_that("use", {

test_that("abuse", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
utils::data(Galapagos_datalist)
datalist <- Galapagos_datalist
initparsopt <- c(2.5, 2.7, 20, 0.009, 1.01)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-DAISIE_ML2.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("use", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Macaronesia_datalist, package = "DAISIE")
invisible(capture.output(
tested_MLE <- DAISIE_ML2(
Expand Down Expand Up @@ -59,6 +59,7 @@ test_that("use", {

test_that("abuse", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
expect_error(tested_MLE <- DAISIE:::DAISIE_ML2(
datalist = "nonsense",
initparsopt = c(
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-DAISIE_ML4.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_that("DAISIE_ML4 is silent and produces correct output", {
test_that("DAISIE_loglik_all_choosepar4 is silent and produces correct output", {
utils::data(Galapagos_datalist)
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
# Throws warnings and DLSODES output
invisible(capture.output(suppressWarnings(
output <- DAISIE_loglik_all_choosepar4(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-DAISIE_MW_ML.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("DAISIE_MW_ML produces correct output", {

skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()


utils::data(archipelagos41)
Expand Down
9 changes: 7 additions & 2 deletions tests/testthat/test-DAISIE_loglik_CS.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("DAISIE_loglik_CS_choice produces correct output for CS_version 1", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand All @@ -21,6 +22,7 @@ test_that("DAISIE_loglik_CS_choice produces correct output for CS_version 1", {
test_that("DAISIE_loglik_CS_choice produces correct output for relaxed-rate
model (CS_version = 2)", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand All @@ -46,7 +48,7 @@ test_that("DAISIE_loglik_CS_choice produces correct output for relaxed-rate

test_that("DAISIE_loglik_CS_choice produces same output for CS_version = 0
(with M = 1) and CS_version = 1 ", {

skip_on_cran()
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(100, 11, 0, 0, NA, 0.0e+00, 1.0e-04,
Expand Down Expand Up @@ -77,6 +79,7 @@ test_that("DAISIE_loglik_CS_choice produces same output for CS_version = 0

test_that("DAISIE_loglik_all produces correct output for relaxed-rate model", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
utils::data(Galapagos_datalist)
invisible(capture.output(suppressWarnings(
loglik <- DAISIE::DAISIE_loglik_all(
Expand All @@ -98,6 +101,7 @@ test_that("DAISIE_loglik_all produces correct output for relaxed-rate model", {

test_that("DAISIE_loglik produces correct output", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
output <- DAISIE_loglik(pars1 = c(2.061154e-09, 2.683455e+00, 1.000000e+01,
9.332070e-03, 1.010073e+00),
pars2 = c(100, 0, 0, 0, NA),
Expand All @@ -115,7 +119,7 @@ test_that("DAISIE_loglik produces correct output", {
test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with
and without conditioning", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Galapagos_datalist)
Galapagos_datalist2 <- Galapagos_datalist
for(i in 2:9) {
Expand Down Expand Up @@ -162,6 +166,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with
test_that("DAISIE_loglik_CS_choice produces equivalent output for ODEINT RKCK54
and deSolve lsodes", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-DAISIE_loglik_IW_solver.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("IW and CS loglik is same when K = Inf", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Galapagos_datalist, package = "DAISIE")
pars1 <- c(0.35, 0.3, Inf, 0.001, 0.3)
pars2 <- c(120, 11, 0, 1)
Expand Down Expand Up @@ -51,7 +51,7 @@ test_that("loglik IW various solver options give similar results", {
# Test is not included in coverage due to issue with running loglik_IW
# code from covr::package_coverage()
testthat::skip_on_covr()

skip_on_cran()
utils::data(frogs_datalist, package = "DAISIE")
pars1 <- c(0.2, 0.1, 1000.1, 0.001, 0.3)
pars2 <- c(40, 11, 0, 0)
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-integration_DAISIE.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ test_that("clade specific rate-shift loglik works", {
test_that("IW and CS loglik is same when K = Inf", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
data(Galapagos_datalist, package = "DAISIE")
pars1 <- c(0.35, 0.3, Inf, 0.001, 0.3)
pars2 <- c(80, 11, 1, 0)
Expand Down Expand Up @@ -103,6 +104,7 @@ test_that("IW and CS loglik is same when K = Inf", {
test_that("DAISIE_ML simple case works", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
expected_mle <- data.frame(
lambda_c = 2.583731356303842,
mu = 2.708828027514834,
Expand Down Expand Up @@ -131,6 +133,7 @@ test_that("DAISIE_ML simple case works", {
test_that("DAISIE_ML simple case works with zero probability of initial presence", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
expected_mle <- data.frame(
lambda_c = 2.583731356303842,
mu = 2.708828027514834,
Expand Down Expand Up @@ -190,6 +193,7 @@ test_that("DAISIE_ML simple case works with estimating probability of initial
presence", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()

expected_mle <- data.frame(
lambda_c = 2.54079308283855,
Expand Down

0 comments on commit 7d62c63

Please sign in to comment.