Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbastide committed Oct 3, 2019
2 parents 5fd0696 + 1a7e332 commit 03b371a
Show file tree
Hide file tree
Showing 26 changed files with 298 additions and 342 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ env:
- NOT_CRAN=true
r_packages:
- covr
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y libmagick++-dev
after_success:
- Rscript -e 'library(covr); codecov(quiet = FALSE)'
23 changes: 11 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: PhylogeneticEM
Title: Automatic Shift Detection using a Phylogenetic EM
Version: 1.2.1
Version: 1.3.0
Authors@R: c(
person("Paul", "Bastide", email = "[email protected]", role = c("aut", "cre")),
person("Mahendra", "Mariadassou", role = "ctb"))
Expand All @@ -11,29 +11,28 @@ Description:
available. See Bastide et al. (2017) <doi:10.1111/rssb.12206> and
Bastide et al. (2018) <doi:10.1093/sysbio/syy005>.
Depends:
ape (>= 3.5),
ape (>= 5.3),
Matrix (>= 1.2.3),
R (>= 3.2.1),
R (>= 3.6.0),
Imports:
capushe (>= 1.1.1),
foreach (>= 1.4.3),
gglasso (>= 1.4),
glmnet (>= 2.0.5),
graphics (>= 3.2.1),
grDevices (>= 3.2.1),
LINselect (>= 0.0.2),
graphics (>= 3.6.0),
grDevices (>= 3.6.0),
LINselect (>= 1.1.1),
MASS (>= 7.3.45),
methods (>= 3.2.1),
methods (>= 3.6.0),
plyr (>= 1.8.4),
Rcpp (>= 0.12.6),
Rcpp (>= 1.0.2),
robustbase (>= 0.92.6),
stats (>= 3.2.1),
utils (>= 3.2.1)
stats (>= 3.6.0),
utils (>= 3.6.0)
Suggests:
combinat (>= 0.0.8),
doParallel (>= 1.0.10),
phytools (>= 0.5.38),
Rphylopars (>= 0.2.9),
testthat (>= 1.0.2),
TreeSim (>= 2.2),
knitr,
Expand All @@ -44,7 +43,7 @@ LinkingTo:
License: GPL (>= 2) | file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.0
RoxygenNote: 6.1.1
URL: https://github.com/pbastide/PhylogeneticEM
BugReports: https://github.com/pbastide/PhylogeneticEM/issues
VignetteBuilder: knitr
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# PhylogeneticEM 1.3.0
* Bug fix:
* Bug fix in plot function for univariate result.
* Tree does not need to be ultrametric for a BM
* Change `tol` to `tol_EM` in `estimateEM` for actual binding
* Bug fixes in plot function for displying traits.
* New Option:
* Add option "name_trait" to plot function for ancestral state reconstruction.
* API Change
* For a univariate trait, the BM re-scaling is now applied by default.
* Deprecation Fix:
* Update `ape`, and replace `is.binary.tree` by `is.binary`.
* Remove dependency to Rphylopars (no longer on CRAN).

# PhylogeneticEM 1.2.1
* CRAN maintenance
* Added references in Description
Expand Down
143 changes: 71 additions & 72 deletions R/estimateEM.R

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions R/generic_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ test.root.state.BM <- function(root.state, ...) {
warning("The BM does not have a stationary state. root.state$stationary.root is set to NULL")
root.state$stationary.root <- NULL
}
if (root.state$random && !is.na(root.state$value.root)) {
if (root.state$random && !anyNA(root.state$value.root)) {
warning("As root state is supposed random, its value is not defined and set to NA")
root.state$value.root <- NA
root.state$var.root <- as(root.state$var.root, "dpoMatrix")
}
if (!root.state$random && (!is.na(root.state$exp.root) || !is.na(root.state$exp.root))) {
if (!root.state$random && (!anyNA(root.state$exp.root) || !anyNA(root.state$exp.root))) {
warning("As root state is supposed fixed, its expectation and variance are not defined and set to NA")
root.state$exp.root <- NA
root.state$var.root <- NA
Expand All @@ -416,12 +416,12 @@ test.root.state.BM <- function(root.state, ...) {
}

test.root.state.OU <- function(root.state, process, variance, selection.strength, optimal.value, ...) {
if (root.state$random && !is.na(root.state$value.root)) {
if (root.state$random && !anyNA(root.state$value.root)) {
warning("As root state is supposed random, its value is not defined and set to NA")
root.state$value.root <- NA
root.state$var.root <- as(root.state$var.root, "dpoMatrix")
}
if (!root.state$random && (!is.na(root.state$exp.root) || !is.na(root.state$exp.root))) {
if (!root.state$random && (!anyNA(root.state$exp.root) || !anyNA(root.state$exp.root))) {
warning("As root state is supposed fixed, its expectation and variance are not defined and set to NA")
root.state$exp.root <- NA
root.state$var.root <- NA
Expand Down Expand Up @@ -497,7 +497,7 @@ compute_stationary_variance <- function(variance, selection.strength){
kro_sum_A_inv <- solve(kro_sum_A)
root_var_vec <- kro_sum_A_inv %*% variance_vec
gamma <- matrix(root_var_vec, dim(variance))
if (!isSymmetric(gamma)) stop("Error in computation of stationary variance: matrix computed was not symmetric.")
if (!isSymmetric(gamma, tol = (.Machine$double.eps)^(0.7))) stop("Error in computation of stationary variance: matrix computed was not symmetric.")
gamma <- forceSymmetric(gamma)
return(as(gamma, "dpoMatrix"))
}
Expand Down Expand Up @@ -874,13 +874,13 @@ merge_params_independent <- function(params_split){
} else {
params$shifts$values <- matrix(0, p, 0)
}
if (!is.na(params$root.state$value.root)){
if (!anyNA(params$root.state$value.root)){
params$root.state$value.root <- sapply(params_split, function(z) return(z$root.state$value.root))
}
if (!is.na(params$root.state$exp.root)){
if (!anyNA(params$root.state$exp.root)){
params$root.state$exp.root <- sapply(params_split, function(z) return(z$root.state$exp.root))
}
if (!is.na(as.vector(params$root.state$var.root))){
if (!anyNA(as.vector(params$root.state$var.root))){
params$root.state$var.root <- diag(sapply(params_split, function(z) return(as.vector(z$root.state$var.root))))
}
if (!is.null(params$optimal.value)){
Expand Down
Loading

0 comments on commit 03b371a

Please sign in to comment.