Skip to content

Commit

Permalink
Merge pull request #29 from rsetienne/develop
Browse files Browse the repository at this point in the history
v3.0.0
  • Loading branch information
rsetienne authored Jul 27, 2023
2 parents 7a64725 + 2b8dfc9 commit d651227
Show file tree
Hide file tree
Showing 118 changed files with 6,125 additions and 9,764 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
^README\.md
^\.github$
^LICENSE\.md$
^pics$
^doc$
^Meta$
^\.vscode$
^\.zenodo\.json$
^_pkgdown\.yml$
^docs$
^pkgdown$
^vignettes/secsse_performance\.Rmd$
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ test.R
test2.R
/doc/
/Meta/
docs
39 changes: 35 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "(gbd) devtools::test()",
"type": "cppdbg",
Expand Down Expand Up @@ -68,15 +69,15 @@
"preLaunchTask": "genenv"
},
{
"name": "(gbd) test_hanno.R",
"name": "(gbd) acc",
"type": "cppdbg",
"request": "launch",
// The binary, not the script
"program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R",
"args": [
"--vanilla",
"-e",
"devtools::load_all(); source('${workspaceFolder}/test_hanno.R')"
"devtools::load_all(); source('${workspaceFolder}/secsse_acc.R')"
],
"stopAtEntry": false,
// needs to be generated, see below
Expand All @@ -98,15 +99,45 @@
"preLaunchTask": "genenv"
},
{
"name": "(gbd) secsse_acc.R",
"name": "(gbd) cla",
"type": "cppdbg",
"request": "launch",
// The binary, not the script
"program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R",
"args": [
"--vanilla",
"-e",
"devtools::load_all(); source('${workspaceFolder}/secsse_acc.R')"
"devtools::load_all(); source('${workspaceFolder}/secsse_cla.R')"
],
"stopAtEntry": false,
// needs to be generated, see below
"envFile": "${workspaceFolder}/.vscode/.env",
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
//"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
// 'R' is a script that sets a ton of environment variables
// required by the R binary. This task emulates that part of
// the R script:
"preLaunchTask": "genenv"
},
{
"name": "(gbd) store",
"type": "cppdbg",
"request": "launch",
// The binary, not the script
"program": "${env:HOME}/opt/bin/Rroot/lib/R/bin/exec/R",
"args": [
"--vanilla",
"-e",
"devtools::load_all(); source('${workspaceFolder}/secsse_store.R')"
],
"stopAtEntry": false,
// needs to be generated, see below
Expand Down
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
"__verbose_abort": "cpp",
"ios": "cpp",
"locale": "cpp",
"version": "cpp"
"version": "cpp",
"__tree": "cpp",
"queue": "cpp",
"span": "cpp",
"charconv": "cpp",
"__errc": "cpp",
"__mutex_base": "cpp"
}
}
55 changes: 55 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"title": "secsse: Several Examined and Concealed States-Dependent Speciation and Extinction",
"license": "GPL-3.0",
"upload_type": "software",
"description": "<p>SecSSE is an R package designed for multistate data sets under a concealed state and speciation (hisse) framework. In this sense, it is parallel to the 'MuSSE' functionality implemented in diversitree, but it accounts for finding possible spurious relationships between traits and diversification rates ('false positives', Rabosky & Goldberg 2015) by testing against a 'hidden trait' (Beaulieu et al. 2013), which is responsible for more variation in diversification rates than the trait being investigated. <\/p>",
"keywords": [
"Evolving traits",
"macroevolution",
"phylogenetic tools",
"speciation rates",
"model",
"maximum-likelihood",
"parameter estimation"
],
"access_right": "open",
"language": "eng",
"contributors": [
{
"name": "Janzen, Thijs",
"affiliation": "University of Groningen",
"orcid": "0000-0002-4162-1140",
"type": "ProjectMember"
},
{
"name": "Hildenbrandt, Hanno",
"affiliation": "University of Groningen",
"orcid": "0000-0002-6784-1037",
"type": "ProjectMember"
},
{
"name": "Santos Neves, Pedro",
"affiliation": "University of Groningen",
"orcid": "0000-0003-2561-4677",
"type": "ProjectMember"
}
],
"creators": [
{
"name": "Herrera Alsina, Leonel",
"affiliation": "University of Aberdeen",
"orcid": "0000-0003-0474-3592",
},
{
"name": "van Els, Paul",
"affiliation": "Sovon Dutch Centre for Field Ornithology",
"orcid": "0000-0002-9499-8873",
},
{
"name": "Etienne, Rampal S.",
"affiliation": "University of Groningen",
"orcid": "0000-0003-2142-7612",
},
],
"notes": "Compiled code (*.cpp and *.h files) is licensed under the BSL-1.0. See file COPYRIGHTS and LICENSE.note for mode details",
}
13 changes: 6 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Package: secsse
Type: Package
Title: Several Examined and Concealed States-Dependent Speciation and
Extinction
Version: 2.6.0
Date: 2023-06-27
Version: 3.0.0
Date: 2023-07-27
License: GPL (>= 3) | file LICENSE
Authors@R: c(
person(given = "Leonel",
Expand Down Expand Up @@ -50,13 +50,11 @@ Imports:
RcppParallel,
ggplot2,
tibble,
rlang,
stringr
rlang
Suggests:
diversitree,
phytools,
testthat,
testit,
knitr,
rmarkdown
LinkingTo:
Expand All @@ -67,8 +65,9 @@ NeedsCompilation: yes
SystemRequirements: C++17
Encoding: UTF-8
LazyData: true
URL: https://github.com/rsetienne/secsse,
https://rsetienne.github.io/secsse/
URL: https://rsetienne.github.io/secsse/,
https://github.com/rsetienne/secsse
BugReports: https://github.com/rsetienne/secsse/issues
VignetteBuilder: knitr
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
14 changes: 4 additions & 10 deletions LICENSE.note
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
The secsse package as a whole is distributed under >= GPL-3, the license of which can be found in the distributed file LICENSE. The secsse package includes code written by one of the package contributors that is distributed under BSL-1.0:

* src/config.h
* src/rhs.h
* src/odeint.h
* src/secsse_sim.h
* src/threaded_ll.h
* src/util.h
* src/secsse_rhs.h
* src/secsse_eval.h
* src/secsse_sim.cpp
* src/util.cpp
* src/secsse_sim.h
* src/secsse_loglik.cpp
* src/cla_loglik.cpp
* src/cla_loglik_threaded.cpp
* src/cla_secsse_store.cpp
* src/secsse_loglik_store.cpp
* src/secsse_loglik_threaded.cpp
* src/secsse_loglik.h

Full copies of the BSL-1.0 license used by these files is included in `inst/LICENSE_1_0.txt`, as is a license and copyright notice on said files, while details are also in `inst/COPYRIGHTS`.
13 changes: 6 additions & 7 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Generated by roxygen2: do not edit by hand

export(cla_id_paramPos)
export(cla_secsse_eval)
export(cla_secsse_loglik)
export(cla_secsse_ml)
export(cla_secsse_ml_func_def_pars)
export(create_default_lambda_list)
export(create_default_q_list)
export(create_lambda_matrices)
export(create_mus)
export(create_transition_matrix)
export(create_default_lambda_transition_matrix)
export(create_default_shift_matrix)
export(create_lambda_list)
export(create_mu_vector)
export(create_q_matrix)
export(default_params_doc)
export(event_times)
export(expand_q_matrix)
export(extract_par_vals)
export(fill_in)
export(id_paramPos)
export(plot_state_exact)
export(plot_state_exact_cla)
export(prepare_full_lambdas)
export(q_doubletrans)
export(secsse_loglik)
Expand Down
92 changes: 92 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# secsse 3.0.0

Version 3.0.0 extends the C++ code base used for the standard likelihood to the "cla_"
likelihood, harnessing the same computation improvement.

## Breaking changes
* Function name changes:
* `create_lambda_matrices()` is now called `create_lambda_list()`
* `create_transition_matrix()` is now called `create_q_matrix()`
* `create_mus()` is now called `create_mu_vector()`
* `create_default_q_list()` is now called `create_default_shift_matrix()`
* `create_default_lambda_list ()` is now called `create_default_lambda_transition_matrix()`
* `create_default_q_list()` is now called `create_default_shift_matrix()`
* Package data files renamed:
* `phylo_Vign` is now called `phylo_vignette`
* `traitinfo` is now called `traits`
* `phy` is now called `example_phy_GeoSSE`
* `plot_state_exact()` argument `steps` renamed to `num_steps` and argument
`focal_tree` renamed to `phy` for consistency with other functions.

## Major changes

* Vastly improve the computational speed of "cla_" likelihood calculation.
* Optimization of parallelization resulting in better scaling with more threads
and faster run time for standard secsse and cla_secsse likelihood calculations.

## Minor changes
* Added a `NEWS.md` file to track changes to the package.
* Documentation reworked into `default_params_doc()`.
* Several documentation formatting improvements and linking. Documentation now
follows and allows for roxygen2 markdown.
* A new vignette:
* _Using secsse with complete phylogenies (with extinction)_ `vignette("complete_tree", package = "secsse")`
* A new [pkgdown website](https://rsetienne.github.io/secsse/index.html)!
* It contains all the documentation and vignettes of the package, along with
additional interesting information like the _Secsse versions_ article with
details on performance and the development history of secsse.
* Revise, combine and simplify the _Using SecSSE ML search_ and _Setting up a
secsse analysis_ into the _Starting secsse_ vignette
`vignette("starting_secsse", package = "secsse")`.
* `secsse_sim()` argument `conditioning` now defaults to `"obs_states"` from
`"none"`.
* No longer Import package 'stringr' and Suggest package 'testit'.
* New organisation of code in .R, .cpp and .h files. (Developer side).
* Start archiving in Zenodo, with new .zenodo.json metadata file.

## Bug fixes
* `secsse_sim()` fix bug causing error when simulating trees with extinct
species.

# 2.6.0

## Major changes
* C++ code base for the standard likelihood, making smarter use of
parallelization, this marks another 10-fold increase in speed.

## Minor changes
* Add a number of helper functions: `fill_in()`, `create_default_q_list()`,
`create_default_transition_list()`, `create_mus()`
* Implemented necessary changes to comply with CRAN clang16 build and solve
issue with the boost odeint library uninitialized variable
(see https://github.com/boostorg/odeint/issues/59 and more details at
https://github.com/rsetienne/DAISIE/pull/158)
* Updated Copyright license to the Boost Software License, Version 1.0 for
included C++ code (R code remains GPL>=3).

## Bug fixes
* Fix memory leaks

# 2.5.0
Version 2.5.0 appeared in 2021 on GitHub and was published in May 2023 on CRAN.
Version 2.5.0 marks the first version using C++ to perform the integration,
and it used tbb (from the RcppParallel package) to perform multithreading. This
marks a ten fold increase in speed over previous versions.
Secondly, 2.5.0 introduces the function `secsse_sim()` to simulate a
diversification process using the (cla) secsse framework.
Lastly, in version 2.5.0 functions were added to allow visualisation of
inferred rates of speciation across the tree (e.g. `plot_state_exact()` and
`secsse_loglik_eval()`).

# 2.0.0
Version 2.0.0 appeared in June of 2019 on CRAN and extended the package with the
cla framework, e.g. including state shifts during speciation / asymmetric
inheritance during speciation.

# 1.0.0
The first version of secsse appeared in January of 2019 on CRAN. It used the
package deSolve to solve all integrations, and could switch between either using
a fully R based evaluation, or use FORTRAN to speed up calculations.
Furthermore, using the foreach package, within-R parallelization was
implemented. However, parallelization only situationally improved computation
times, and generally, computation was relatively slow.
32 changes: 8 additions & 24 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

ct_condition_cla <- function(y, t, ll, mm, Q, method, atol, rtol) {
.Call(`_secsse_ct_condition_cla`, y, t, ll, mm, Q, method, atol, rtol)
eval_cpp <- function(rhs, ances, states, forTime, lambdas, mus, Q, method, atol, rtol, is_complete_tree, num_steps) {
.Call(`_secsse_eval_cpp`, rhs, ances, states, forTime, lambdas, mus, Q, method, atol, rtol, is_complete_tree, num_steps)
}

cla_calThruNodes_cpp <- function(ances, states_R, forTime_R, lambdas, mus, Q, method, atol, rtol, is_complete_tree) {
.Call(`_secsse_cla_calThruNodes_cpp`, ances, states_R, forTime_R, lambdas, mus, Q, method, atol, rtol, is_complete_tree)
calc_ll_cpp <- function(rhs, ances, states, forTime, lambdas, mus, Q, method, atol, rtol, is_complete_tree, see_states) {
.Call(`_secsse_calc_ll_cpp`, rhs, ances, states, forTime, lambdas, mus, Q, method, atol, rtol, is_complete_tree, see_states)
}

calc_cla_ll_threaded <- function(ances, states_R, forTime_R, lambdas_R, mus_R, Q, num_threads = 1L, method = "odeint::bulirsch_stoer", is_complete_tree = FALSE) {
.Call(`_secsse_calc_cla_ll_threaded`, ances, states_R, forTime_R, lambdas_R, mus_R, Q, num_threads, method, is_complete_tree)
ct_condition_cpp <- function(rhs, state, t, lambdas, mus, Q, method, atol, rtol) {
.Call(`_secsse_ct_condition_cpp`, rhs, state, t, lambdas, mus, Q, method, atol, rtol)
}

cla_calThruNodes_store_cpp <- function(ances, states_R, forTime_R, lambdas, mus, Q, method, atol, rtol, is_complete_tree, num_steps, verbose) {
.Call(`_secsse_cla_calThruNodes_store_cpp`, ances, states_R, forTime_R, lambdas, mus, Q, method, atol, rtol, is_complete_tree, num_steps, verbose)
}

calThruNodes_cpp <- function(ances, states_R, forTime_R, lambdas, mus, Q, num_threads, abstol, reltol, method, is_complete_tree) {
.Call(`_secsse_calThruNodes_cpp`, ances, states_R, forTime_R, lambdas, mus, Q, num_threads, abstol, reltol, method, is_complete_tree)
}

ct_condition <- function(y, t, ll, mm, Q, method, atol, rtol) {
.Call(`_secsse_ct_condition`, y, t, ll, mm, Q, method, atol, rtol)
}

calThruNodes_store_cpp <- function(ances, states_R, forTime_R, lambdas, mus, Q, num_threads, abstol, reltol, method, is_complete_tree, num_steps, verbose) {
.Call(`_secsse_calThruNodes_store_cpp`, ances, states_R, forTime_R, lambdas, mus, Q, num_threads, abstol, reltol, method, is_complete_tree, num_steps, verbose)
}

secsse_sim_cpp <- function(m_R, lambdas_R, q_R, max_time, max_species, init_states, condition, num_concealed_states, non_extinction, verbose, max_tries, seed) {
.Call(`_secsse_secsse_sim_cpp`, m_R, lambdas_R, q_R, max_time, max_species, init_states, condition, num_concealed_states, non_extinction, verbose, max_tries, seed)
secsse_sim_cpp <- function(m_R, lambdas_R, q_R, max_time, max_species, min_species, init_states, condition, num_concealed_states, non_extinction, verbose, max_tries, seed, conditioning_vec) {
.Call(`_secsse_secsse_sim_cpp`, m_R, lambdas_R, q_R, max_time, max_species, min_species, init_states, condition, num_concealed_states, non_extinction, verbose, max_tries, seed, conditioning_vec)
}

Loading

0 comments on commit d651227

Please sign in to comment.