diff --git a/.zenodo.json b/.zenodo.json deleted file mode 100644 index 67221f93..00000000 --- a/.zenodo.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "creators":[ - { - "orcid":"0000-0003-2142-7612", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Etienne, Rampal S." - }, - { - "orcid":"0000-0003-4247-8785", - "affiliation":"Naturalis Biodiversity Center", - "name":"Valente, Luis" - }, - { - "orcid":"0000-0002-6553-1553", - "affiliation":"Institute of Evolutionary Biology, University of Edinburgh", - "name":"Phillimore, Albert B." - }, - { - "orcid":"0000-0003-2325-4727", - "affiliation":"Station d’Ecologie Théorique et Expérimentale, CNRS", - "name":"Haegeman, Bart" - }, - { - "orcid":"0000-0001-5218-3046", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Lambert, Joshua W." - }, - { - "orcid":"0000-0003-2561-4677", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Santos Neves, Pedro" - }, - { - "orcid":"0000-0001-9594-946X", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Xie, Shu" - }, - { - "orcid":"0000-0003-1107-7049", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Bilderbeek, Rich\u00e8l J.C." - }, - { - "orcid":"0000-0002-6784-1037", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Hildenbrandt, Hanno" - } - ], - "contributors":[ - { - "orcid":"0000-0001-5711-9457", - "affiliation":"Justus Liebig University", - "name":"Hauffe, Torsten", - "type":"Other" - }, - { - "orcid":"0000-0002-2952-3345", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Laudanno, Giovanni", - "type":"Other" - }, - { - "orcid":"0000-0002-9720-4581", - "affiliation":"National University of Singapore", - "name":"Kristensen, Nadiah", - "type":"Other" - }, - { - "orcid":"0000-0002-1447-7630", - "affiliation":"Groningen Institute for Evolutionary Life Sciences, University of Groningen", - "name":"Scherrer, Raphael", - "type":"Other" - } - ], - "license":"GPL-3.0-only", - "title":"DAISIE: Dynamical Assembly of Islands by Speciation, Immigration and Extinction", - "description":"Simulates and computes the (maximum) likelihood of a dynamical model of island biota assembly through speciation, immigration and extinction.", - "access_right":"open", - "keywords":[ - "island biogeography", - "birth-death process", - "maximum-likelihood estimation", - "R package" - ], - "related_identifiers":[ - { - "scheme":"url", - "identifier":"https://github.com/rsetienne/DAISIE", - "relation":"isSupplementTo", - "resource_type":"software" - }, - { - "scheme":"url", - "identifier":"https://cran.r-project.org/package=DAISIE", - "relation":"isSupplementTo", - "resource_type":"software" - }, - { - "scheme":"doi", - "identifier":"10.5281/zenodo.4054058", - "relation":"isVersionOf" - } - ] -} \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 28aab8fa..5a83f474 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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, diff --git a/NEWS.md b/NEWS.md index 3edb86f7..629655bd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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). diff --git a/R/DAISIE-package.R b/R/DAISIE-package.R index 95c1c772..8d03135e 100644 --- a/R/DAISIE-package.R +++ b/R/DAISIE-package.R @@ -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 diff --git a/R/DAISIE_loglik_CS.R b/R/DAISIE_loglik_CS.R index d1c22a13..f290b764 100644 --- a/R/DAISIE_loglik_CS.R +++ b/R/DAISIE_loglik_CS.R @@ -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)) @@ -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)) @@ -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)) diff --git a/README.md b/README.md index e4347b4c..67b5f693 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/man/DAISIE-package.Rd b/man/DAISIE-package.Rd index 464c1708..92fc8d31 100644 --- a/man/DAISIE-package.Rd +++ b/man/DAISIE-package.Rd @@ -23,9 +23,10 @@ Cladogenesis and immigration rates can be dependent on diversity. \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 } } \seealso{ diff --git a/src/DAISIE_CS.cpp b/src/DAISIE_CS.cpp index 455d2574..933f3f0f 100644 --- a/src/DAISIE_CS.cpp +++ b/src/DAISIE_CS.cpp @@ -1,4 +1,4 @@ -// [[Rcpp::plugins(cpp14)]] +// [[Rcpp::plugins(cpp17)]] // [[Rcpp::depends(BH)]] diff --git a/src/DAISIE_IW.cpp b/src/DAISIE_IW.cpp index 27d39945..6075b35b 100644 --- a/src/DAISIE_IW.cpp +++ b/src/DAISIE_IW.cpp @@ -1,5 +1,6 @@ //' @export daisie_odeint_iw +// [[Rcpp::plugins(cpp17)]] // [[Rcpp::plugins(openmp)]] // [[Rcpp::depends(RcppEigen)]] diff --git a/tests/testthat/test-DAISIE_ML1.R b/tests/testthat/test-DAISIE_ML1.R index 2a11295f..4aa7def5 100644 --- a/tests/testthat/test-DAISIE_ML1.R +++ b/tests/testthat/test-DAISIE_ML1.R @@ -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) @@ -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) diff --git a/tests/testthat/test-DAISIE_ML2.R b/tests/testthat/test-DAISIE_ML2.R index 3d33840a..0d64954e 100644 --- a/tests/testthat/test-DAISIE_ML2.R +++ b/tests/testthat/test-DAISIE_ML2.R @@ -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( @@ -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( diff --git a/tests/testthat/test-DAISIE_ML4.R b/tests/testthat/test-DAISIE_ML4.R index 9449ba2a..435ec184 100644 --- a/tests/testthat/test-DAISIE_ML4.R +++ b/tests/testthat/test-DAISIE_ML4.R @@ -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( diff --git a/tests/testthat/test-DAISIE_MW_ML.R b/tests/testthat/test-DAISIE_MW_ML.R index 875dfc93..23b55798 100644 --- a/tests/testthat/test-DAISIE_MW_ML.R +++ b/tests/testthat/test-DAISIE_MW_ML.R @@ -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) diff --git a/tests/testthat/test-DAISIE_loglik_CS.R b/tests/testthat/test-DAISIE_loglik_CS.R index 1de5544d..bb55aba9 100644 --- a/tests/testthat/test-DAISIE_loglik_CS.R +++ b/tests/testthat/test-DAISIE_loglik_CS.R @@ -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) @@ -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) @@ -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, @@ -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( @@ -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), @@ -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) { @@ -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) diff --git a/tests/testthat/test-DAISIE_loglik_IW_solver.R b/tests/testthat/test-DAISIE_loglik_IW_solver.R index 30c68384..c7013f37 100644 --- a/tests/testthat/test-DAISIE_loglik_IW_solver.R +++ b/tests/testthat/test-DAISIE_loglik_IW_solver.R @@ -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) @@ -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) diff --git a/tests/testthat/test-integration_DAISIE.R b/tests/testthat/test-integration_DAISIE.R index c6b1e5c7..c6923be8 100644 --- a/tests/testthat/test-integration_DAISIE.R +++ b/tests/testthat/test-integration_DAISIE.R @@ -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) @@ -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, @@ -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, @@ -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,