Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite34087f

Browse files
committed
Merge branch 'rooting' into develop
2 parents492fc46 +8681264 commite34087f

File tree

64 files changed

+622
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+622
-118
lines changed

‎DESCRIPTION‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ LinkingTo:
2828
nloptr
2929
Imports:
3030
ape,
31-
nloptr
31+
nloptr,
32+
treebalance
3233
Suggests:
3334
phyloTop,
3435
testthat,

‎R/ILnumber.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ ILnumber <- function(input_obj, normalization = "none") { # nolint
1515
normalization<- check_normalization_key(normalization)
1616
check_tree(input_obj,
1717
require_binary=FALSE,
18-
require_ultrametric=FALSE)
18+
require_ultrametric=FALSE,
19+
require_rooted=TRUE)
1920

2021
if (inherits(input_obj,"matrix")) {
2122
il_stat<- ILnumber_ltable_cpp(input_obj)

‎R/Ibased.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ mean_i <- function(phy) {
2121

2222
check_tree(phy,
2323
require_binary=TRUE,
24-
require_ultrametric=FALSE)
24+
require_ultrametric=FALSE,
25+
require_rooted=TRUE)
2526

2627
if (inherits(phy,"matrix")) {
2728
if (length(phy[,1])<4) {

‎R/J_stat.R‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@
1010
#' Ecological Modelling 130.1-3 (2000): 151-156.
1111
#' @export
1212
entropy_j<-function(phy) {
13+
check_tree(phy,
14+
require_binary=FALSE,
15+
require_ultrametric=FALSE,
16+
require_rooted=FALSE)
17+
1318
if (inherits(phy,"matrix")) {
1419
phy<-treestats::l_to_phylo(phy)
1520
}
1621
if (inherits(phy,"phylo")) {
17-
return(calc_J_cpp(as.vector(t(phy$edge)),
22+
if (ape::is.rooted(phy)) {
23+
return(calc_J_cpp(as.vector(t(phy$edge)),
1824
phy$edge.length))
25+
}else {
26+
n<- length(phy$tip.label)
27+
return(treestats::mean_pair_dist(phy)/n)
28+
# notice that the statistic divides by S^2, but since the mean is
29+
# already dividing by S, this is fine.
30+
}
1931
}
2032
stop("input object has to be phylo or ltable")
2133
}

‎R/average_leaf_depth.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ average_leaf_depth <- function(phy, normalization = "none") {
1919
normalization<- check_normalization_key(normalization)
2020
check_tree(phy,
2121
require_binary=TRUE,
22-
require_ultrametric=FALSE)
22+
require_ultrametric=FALSE,
23+
require_rooted=TRUE)
2324

2425

2526
if (inherits(phy,"phylo")) {

‎R/avgLadder.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
avg_ladder<-function(input_obj) {#nolint
1313
check_tree(input_obj,
1414
require_binary=TRUE,
15-
require_ultrametric=FALSE)
15+
require_ultrametric=FALSE,
16+
require_rooted=TRUE)
1617
if (inherits(input_obj,"matrix")) {
1718
input_obj<-treestats::l_to_phylo(input_obj,drop_extinct=FALSE)
1819
}

‎R/avg_vertex_depth.R‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#' 2014(1):96-108, 2014. ISSN 2050-6201. doi: 10.1093/emph/eou018.
99
#' @export
1010
avg_vert_depth<-function(phy) {
11+
check_tree(phy,
12+
require_binary=TRUE,
13+
require_ultrametric=FALSE,
14+
require_rooted=TRUE)
15+
16+
1117
if (inherits(phy,"matrix")) {
1218
phy<-treestats::l_to_phylo(phy,drop_extinct=FALSE)
1319
}

‎R/b1.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ b1 <- function(phy, normalization = "none") {
1717

1818
check_tree(phy,
1919
require_binary=TRUE,
20-
require_ultrametric=FALSE)
20+
require_ultrametric=FALSE,
21+
require_rooted=TRUE)
2122

2223
if (inherits(phy,"matrix")) {
2324
b1_stat<- calc_b1_ltable_cpp(phy)

‎R/b2.R‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ b2 <- function(phy, normalization = "none") {
2121

2222
check_tree(phy,
2323
require_binary=TRUE,
24-
require_ultrametric=FALSE)
24+
require_ultrametric=FALSE,
25+
require_rooted=TRUE)
2526

2627
if (inherits(phy,"matrix")) {
2728
b2_stat<- calc_b2_ltable_cpp(phy)

‎R/beta.R‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#' Aldous' beta statistic.
22
#' @description The Beta statistic fits a beta splitting model to each node,
3-
#' assuming that the number of extantdescendents of each daughter branch is
3+
#' assuming that the number of extantdescendants of each daughter branch is
44
#' split following a beta distribution, such that the number of extant
5-
#'descendentants x and y at a node follows \eqn{q(x, y) = s_n(beta)^-1
5+
#'descendants x and y at a node follows \eqn{q(x, y) = s_n(beta)^-1
66
#' \frac{(gamma(x + 1 + beta)gamma(y + 1 + beta))}{gamma(x+1)gamma(y+1)}}, where
77
#' \eqn{s_n(beta)^-1} is a normalizing constant. When this model is fit to a
88
#' tree, different values of beta correspond to the expectation following from
@@ -40,7 +40,8 @@ beta_statistic <- function(phy,
4040
rel_tol=1e-6) {
4141
check_tree(phy,
4242
require_binary=TRUE,
43-
require_ultrametric=FALSE)
43+
require_ultrametric=FALSE,
44+
require_rooted=TRUE)
4445

4546
if (inherits(phy,"matrix")) {
4647
beta_stat<- calc_beta_ltable_cpp(phy,upper_lim,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp