diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 26c82bdc..bdef8a50 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -93,6 +93,7 @@ jobs: run: | install.packages("pak") install.packages("pkgdepends") + pak::pkg_install("ms609/TreeTools@more-leaves") shell: Rscript {0} - name: pak bug workaround - install TreeDist (CRAN) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 3b12e207..51f6cd21 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -87,6 +87,7 @@ jobs: - name: Install dependencies run: | + remotes::install_github("ms609/TreeTools", "more-leaves") remotes::install_deps(dependencies = TRUE) remotes::install_cran("devtools") shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index b6925f4c..bec3fb78 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,4 +1,4 @@ -Package: TreeDist +Package: BigTreeDist Type: Package Title: Calculate and Map Distances Between Phylogenetic Trees Version: 2.6.3.9001 @@ -48,7 +48,7 @@ Imports: Rdpack (>= 0.7), shiny, shinyjs, - TreeTools (>= 1.7.2), + BigTreeTools (>= 1.7.2), Suggests: bookdown, cluster, @@ -77,7 +77,9 @@ Suggests: vdiffr (>= 1.0.0), LinkingTo: Rcpp, - TreeTools, + BigTreeTools, +Remotes: + ms609/TreeTools@more-leaves RdMacros: Rdpack VignetteBuilder: knitr Config/Needs/check: rcmdcheck diff --git a/NAMESPACE b/NAMESPACE index 0ec990df..a870892a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -118,33 +118,33 @@ export(TreeDistPlot) export(TreeDistance) export(TreesConsistentWithTwoSplits) export(VisualizeMatching) +importFrom(BigTreeTools,AllAncestors) +importFrom(BigTreeTools,KeepTip) +importFrom(BigTreeTools,LnRooted.int) +importFrom(BigTreeTools,LnTreesMatchingSplit) +importFrom(BigTreeTools,Log2Rooted.int) +importFrom(BigTreeTools,Log2TreesMatchingSplit) +importFrom(BigTreeTools,Log2Unrooted) +importFrom(BigTreeTools,Log2Unrooted.int) +importFrom(BigTreeTools,MSTEdges) +importFrom(BigTreeTools,MSTLength) +importFrom(BigTreeTools,NRooted) +importFrom(BigTreeTools,NSplits) +importFrom(BigTreeTools,NTip) +importFrom(BigTreeTools,PectinateTree) +importFrom(BigTreeTools,Postorder) +importFrom(BigTreeTools,Preorder) +importFrom(BigTreeTools,RenumberTips) +importFrom(BigTreeTools,RootOnNode) +importFrom(BigTreeTools,SplitInformation) +importFrom(BigTreeTools,SplitsInBinaryTree) +importFrom(BigTreeTools,TipLabels) +importFrom(BigTreeTools,TipsInSplits) +importFrom(BigTreeTools,TreeIsRooted) +importFrom(BigTreeTools,TreesMatchingSplit) +importFrom(BigTreeTools,as.ClusterTable) +importFrom(BigTreeTools,as.Splits) importFrom(Rdpack,reprompt) -importFrom(TreeTools,AllAncestors) -importFrom(TreeTools,KeepTip) -importFrom(TreeTools,LnRooted.int) -importFrom(TreeTools,LnTreesMatchingSplit) -importFrom(TreeTools,Log2Rooted.int) -importFrom(TreeTools,Log2TreesMatchingSplit) -importFrom(TreeTools,Log2Unrooted) -importFrom(TreeTools,Log2Unrooted.int) -importFrom(TreeTools,MSTEdges) -importFrom(TreeTools,MSTLength) -importFrom(TreeTools,NRooted) -importFrom(TreeTools,NSplits) -importFrom(TreeTools,NTip) -importFrom(TreeTools,PectinateTree) -importFrom(TreeTools,Postorder) -importFrom(TreeTools,Preorder) -importFrom(TreeTools,RenumberTips) -importFrom(TreeTools,RootOnNode) -importFrom(TreeTools,SplitInformation) -importFrom(TreeTools,SplitsInBinaryTree) -importFrom(TreeTools,TipLabels) -importFrom(TreeTools,TipsInSplits) -importFrom(TreeTools,TreeIsRooted) -importFrom(TreeTools,TreesMatchingSplit) -importFrom(TreeTools,as.ClusterTable) -importFrom(TreeTools,as.Splits) importFrom(ape,Nnode.phylo) importFrom(ape,drop.tip) importFrom(ape,edgelabels) @@ -182,4 +182,4 @@ importFrom(stats,sd) importFrom(stats,setNames) importFrom(stats,var) importFrom(utils,combn) -useDynLib(TreeDist, .registration = TRUE) +useDynLib(BigTreeDist, .registration = TRUE) diff --git a/R/TreeDist-package.R b/R/BigTreeDist-package.R similarity index 94% rename from R/TreeDist-package.R rename to R/BigTreeDist-package.R index b1a1b4c7..05f6cf30 100644 --- a/R/TreeDist-package.R +++ b/R/BigTreeDist-package.R @@ -112,21 +112,21 @@ #' #' @references #' -#' - \insertRef{Bocker2013}{TreeDist} +#' - \insertRef{Bocker2013}{BigTreeDist} #' -#' - \insertRef{Bogdanowicz2012}{TreeDist} +#' - \insertRef{Bogdanowicz2012}{BigTreeDist} #' -#' - \insertRef{Kendall2016}{TreeDist} +#' - \insertRef{Kendall2016}{BigTreeDist} #' -#' - \insertRef{Li1996}{TreeDist} +#' - \insertRef{Li1996}{BigTreeDist} #' -#' - \insertRef{Lin2012}{TreeDist} +#' - \insertRef{Lin2012}{BigTreeDist} #' -#' - \insertRef{Nye2006}{TreeDist} +#' - \insertRef{Nye2006}{BigTreeDist} #' -#' - \insertRef{SmithDist}{TreeDist} +#' - \insertRef{SmithDist}{BigTreeDist} #' -#' - \insertRef{SmithSpace}{TreeDist} +#' - \insertRef{SmithSpace}{BigTreeDist} #' #' @encoding UTF-8 #' @keywords internal diff --git a/R/Information.R b/R/Information.R index 41492d9b..3edff2ec 100644 --- a/R/Information.R +++ b/R/Information.R @@ -22,7 +22,7 @@ #' trees consistent with two splits. #' #' `SplitSharedInformation()` returns the phylogenetic information that two splits -#' have in common \insertCite{Meila2007}{TreeDist}, in bits. +#' have in common \insertCite{Meila2007}{BigTreeDist}, in bits. #' #' `SplitDifferentInformation()` returns the amount of phylogenetic information #' distinct to one of the two splits, in bits. @@ -47,7 +47,7 @@ #' @references \insertAllCited{} #' #' @family information functions -#' @importFrom TreeTools Log2TreesMatchingSplit Log2Unrooted +#' @importFrom BigTreeTools Log2TreesMatchingSplit Log2Unrooted #' @export SplitSharedInformation <- function(n, A1, A2 = A1) { Log2Unrooted(n) + @@ -57,7 +57,7 @@ SplitSharedInformation <- function(n, A1, A2 = A1) { } #' @describeIn SplitSharedInformation Different information between two splits. -#' @importFrom TreeTools SplitInformation +#' @importFrom BigTreeTools SplitInformation #' @export SplitDifferentInformation <- function(n, A1, A2 = A1) { Log2TreesMatchingSplit(A1, n - A1) + @@ -69,10 +69,10 @@ SplitDifferentInformation <- function(n, A1, A2 = A1) { #' Use variation of clustering information to compare pairs of splits #' #' Compare a pair of splits viewed as clusterings of taxa, using the variation -#' of clustering information proposed by \insertCite{Meila2007}{TreeDist}. +#' of clustering information proposed by \insertCite{Meila2007}{BigTreeDist}. #' #' This is equivalent to the mutual clustering information -#' \insertCite{Vinh2010}{TreeDist}. +#' \insertCite{Vinh2010}{BigTreeDist}. #' For the total information content, multiply the VoI by the number of leaves. #' #' @template split12Params @@ -146,8 +146,8 @@ MeilaMutualInformation <- function(split1, split2) { #' Variation of information for all split pairings #' #' Calculate the variation of clustering information -#' \insertCite{Meila2007}{TreeDist} for each possible pairing of -#' non-trivial splits on _n_ leaves \insertCite{SmithDist}{TreeDist}, +#' \insertCite{Meila2007}{BigTreeDist} for each possible pairing of +#' non-trivial splits on _n_ leaves \insertCite{SmithDist}{BigTreeDist}, #' tabulating the number of pairings with each similarity. #' #' @param n Integer specifying the number of leaves in a tree. @@ -211,8 +211,8 @@ AllSplitPairings <- memoise(function(n) { #' two groups. #' Further details are available in a #' [vignette](https://ms609.github.io/TreeDist/articles/information.html), -#' \insertCite{Mackay2003;textual}{TreeDist} and -#' \insertCite{Meila2007;textual}{TreeDist}. +#' \insertCite{Mackay2003;textual}{BigTreeDist} and +#' \insertCite{Meila2007;textual}{BigTreeDist}. #' #' @template split12Params #' @@ -259,7 +259,7 @@ SplitEntropy <- function(split1, split2 = split1) { #' @describeIn SplitSharedInformation Number of trees consistent with two #' splits. -#' @importFrom TreeTools TreesMatchingSplit NRooted +#' @importFrom BigTreeTools TreesMatchingSplit NRooted #' @export TreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { @@ -306,7 +306,7 @@ TreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { #' @describeIn SplitSharedInformation Natural logarithm of #' `TreesConsistentWithTwoSplits()`. -#' @importFrom TreeTools LnTreesMatchingSplit LnRooted.int +#' @importFrom BigTreeTools LnTreesMatchingSplit LnRooted.int #' @export LnTreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { smallSplit <- min(A1, A2) @@ -326,7 +326,7 @@ LnTreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { #' @describeIn SplitSharedInformation Base two logarithm of #' `TreesConsistentWithTwoSplits()`. -#' @importFrom TreeTools Log2TreesMatchingSplit Log2Rooted.int +#' @importFrom BigTreeTools Log2TreesMatchingSplit Log2Rooted.int #' @export Log2TreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { smallSplit <- min(A1, A2) @@ -346,7 +346,7 @@ Log2TreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { #' @describeIn SplitSharedInformation Base 2 logarithm of #' `TreesConsistentWithTwoSplits()`. -#' @importFrom TreeTools Log2TreesMatchingSplit Log2Rooted.int +#' @importFrom BigTreeTools Log2TreesMatchingSplit Log2Rooted.int #' @export Log2TreesConsistentWithTwoSplits <- function(n, A1, A2 = A1) { smallSplit <- min(A1, A2) diff --git a/R/RcppExports.R b/R/RcppExports.R index 4453a0ce..100603e3 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -2,54 +2,54 @@ # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 COMCLUST <- function(trees) { - .Call(`_TreeDist_COMCLUST`, trees) + .Call(`_BigTreeDist_COMCLUST`, trees) } consensus_info <- function(trees, phylo, p) { - .Call(`_TreeDist_consensus_info`, trees, phylo, p) + .Call(`_BigTreeDist_consensus_info`, trees, phylo, p) } robinson_foulds_all_pairs <- function(tables) { - .Call(`_TreeDist_robinson_foulds_all_pairs`, tables) + .Call(`_BigTreeDist_robinson_foulds_all_pairs`, tables) } lapjv <- function(x, maxX) { - .Call(`_TreeDist_lapjv`, x, maxX) + .Call(`_BigTreeDist_lapjv`, x, maxX) } cpp_mast <- function(edge1, edge2, nTip) { - .Call(`_TreeDist_cpp_mast`, edge1, edge2, nTip) + .Call(`_BigTreeDist_cpp_mast`, edge1, edge2, nTip) } cpp_nni_distance <- function(edge1, edge2, nTip) { - .Call(`_TreeDist_cpp_nni_distance`, edge1, edge2, nTip) + .Call(`_BigTreeDist_cpp_nni_distance`, edge1, edge2, nTip) } cpp_robinson_foulds_distance <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_robinson_foulds_distance`, x, y, nTip) + .Call(`_BigTreeDist_cpp_robinson_foulds_distance`, x, y, nTip) } cpp_robinson_foulds_info <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_robinson_foulds_info`, x, y, nTip) + .Call(`_BigTreeDist_cpp_robinson_foulds_info`, x, y, nTip) } cpp_matching_split_distance <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_matching_split_distance`, x, y, nTip) + .Call(`_BigTreeDist_cpp_matching_split_distance`, x, y, nTip) } cpp_jaccard_similarity <- function(x, y, nTip, k, allowConflict) { - .Call(`_TreeDist_cpp_jaccard_similarity`, x, y, nTip, k, allowConflict) + .Call(`_BigTreeDist_cpp_jaccard_similarity`, x, y, nTip, k, allowConflict) } cpp_msi_distance <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_msi_distance`, x, y, nTip) + .Call(`_BigTreeDist_cpp_msi_distance`, x, y, nTip) } cpp_mutual_clustering <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_mutual_clustering`, x, y, nTip) + .Call(`_BigTreeDist_cpp_mutual_clustering`, x, y, nTip) } cpp_shared_phylo <- function(x, y, nTip) { - .Call(`_TreeDist_cpp_shared_phylo`, x, y, nTip) + .Call(`_BigTreeDist_cpp_shared_phylo`, x, y, nTip) } diff --git a/R/cluster_stats.R b/R/cluster_stats.R index c3ac14f4..15834d18 100644 --- a/R/cluster_stats.R +++ b/R/cluster_stats.R @@ -255,7 +255,7 @@ MeanMSTEdge.numeric <- function(x, cluster = 1) { numeric(1)) } -#' @importFrom TreeTools MSTLength +#' @importFrom BigTreeTools MSTLength .MeanMSTEdge <- function(x) { n <- dim(x)[1] # Return: diff --git a/R/kmeanspp.R b/R/kmeanspp.R index 0628de62..d1c03206 100644 --- a/R/kmeanspp.R +++ b/R/kmeanspp.R @@ -1,11 +1,11 @@ #' k-means++ clustering #' -#' k-means++ clustering \insertCite{Arthur2007}{TreeDist} improves the speed and +#' k-means++ clustering \insertCite{Arthur2007}{BigTreeDist} improves the speed and #' accuracy of standard \code{\link[stats]{kmeans}} clustering -#' \insertCite{Hartigan1979}{TreeDist} by preferring initial cluster centres +#' \insertCite{Hartigan1979}{BigTreeDist} by preferring initial cluster centres #' that are far from others. #' A scalable version of the algorithm has been proposed for larger data sets -#' \insertCite{Bahmani2012}{TreeDist}, but is not implemented here. +#' \insertCite{Bahmani2012}{BigTreeDist}, but is not implemented here. #' #' @param x Numeric matrix of data, or an object that can be coerced to such a #' matrix (such as a numeric vector or a data frame with all numeric columns). diff --git a/R/lap.R b/R/lap.R index 6182ed63..5bf47e07 100644 --- a/R/lap.R +++ b/R/lap.R @@ -1,6 +1,6 @@ #' Solve linear assignment problem using LAPJV #' -#' Use the algorithm of \insertCite{Jonker1987;textual}{TreeDist} to solve the +#' Use the algorithm of \insertCite{Jonker1987;textual}{BigTreeDist} to solve the #' [Linear Sum Assignment Problem]( #' http://www.assignmentproblems.com/doc/LSAPIntroduction.pdf). #' @@ -8,7 +8,7 @@ #' column, such that the cost of the matching is minimized. #' #' The Jonker & Volgenant approach is a faster alternative to the Hungarian -#' algorithm \insertCite{Munkres1957}{TreeDist}, which is implemented in +#' algorithm \insertCite{Munkres1957}{BigTreeDist}, which is implemented in #' `clue::solve_LSAP()`. #' #' Note: the JV algorithm expects integers. In order to apply the function diff --git a/R/median.R b/R/median.R index ae1574a2..a01f8a99 100644 --- a/R/median.R +++ b/R/median.R @@ -56,7 +56,7 @@ #' #' @seealso Consensus methods: #' [`ape::consensus()`], -#' [`TreeTools::ConsensusWithout()`] +#' [`BigTreeTools::ConsensusWithout()`] #' #' @importFrom stats median #' @family tree space functions diff --git a/R/plot.R b/R/plot.R index dc8cfe8e..258781aa 100644 --- a/R/plot.R +++ b/R/plot.R @@ -104,7 +104,7 @@ TreeDistPlot <- function(tr, title = NULL, bold = NULL, leaveRoom = FALSE, #' @importFrom ape nodelabels edgelabels plot.phylo #' @importFrom colorspace qualitative_hcl sequential_hcl #' @importFrom graphics par -#' @importFrom TreeTools as.Splits +#' @importFrom BigTreeTools as.Splits #' #' @examples #' tree1 <- TreeTools::BalancedTree(6) @@ -270,14 +270,14 @@ VisualizeMatching <- function(Func, tree1, tree2, setPar = TRUE, #' #' To identify strain in a multidimensional scaling of distances, it can be #' useful to plot a minimum spanning tree -#' \insertCite{Gower1966,SmithSpace}{TreeDist}. Colouring each edge of the +#' \insertCite{Gower1966,SmithSpace}{BigTreeDist}. Colouring each edge of the #' tree according to its strain can identify areas where the mapping is #' stretched or compressed. #' #' @param mapping Two-column matrix giving _x_ and _y_ coordinates of plotted #' points. #' @param mstEnds Two-column matrix identifying rows of `mapping` at end of -#' each edge of the MST, as output by [`TreeTools::MSTEdges()`]. +#' each edge of the MST, as output by [`BigTreeTools::MSTEdges()`]. #' @param distances Matrix or `dist` object giving original distances between #' each pair of points. #' @param palette Vector of colours with which to colour edges. @@ -323,7 +323,7 @@ MSTSegments <- function(mapping, mstEnds, ...) { #' early in `palette` assigned to edges in which the ratio of mapped #' distance to original distance is small. #' @importFrom grDevices hcl.colors -#' @importFrom TreeTools MSTEdges +#' @importFrom BigTreeTools MSTEdges #' @export StrainCol <- function(distances, mapping, mstEnds = MSTEdges(distances), palette = rev(hcl.colors(256L, "RdYlBu"))) { diff --git a/R/shiny.R b/R/shiny.R index f9bb6f34..d4825b1b 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -95,7 +95,7 @@ #' according to the methods used; it would be appropriate to cite and briefly #' discuss these studies in any publication using figures generated using #' this application. The application itself can be cited using -#' \insertCite{SmithDist,SmithSpace;textual}{TreeDist} +#' \insertCite{SmithDist,SmithSpace;textual}{BigTreeDist} #' #' #' @seealso @@ -112,7 +112,7 @@ #' @importFrom shinyjs useShinyjs #' @export MapTrees <- function() { - appDir <- system.file("treespace", package = "TreeDist") + appDir <- system.file("treespace", package = "BigTreeDist") if (appDir == "") { stop("Could not find example directory. Try re-installing 'TreeDist'.", call. = FALSE) diff --git a/R/tree_distance_info.R b/R/tree_distance_info.R index 95d7d1b9..4fdd2d19 100644 --- a/R/tree_distance_info.R +++ b/R/tree_distance_info.R @@ -13,13 +13,13 @@ #' #' The methods implemented here use the concepts of #' [entropy and information](https://ms609.github.io/TreeDist/articles/information.html) -#' \insertCite{Mackay2003}{TreeDist} to assign a similarity score between each +#' \insertCite{Mackay2003}{BigTreeDist} to assign a similarity score between each #' pair of splits. #' #' The returned tree similarity measures state the amount of information, #' in bits, that the splits in two trees hold in common #' when they are optimally matched, following -#' \insertCite{SmithDist;textual}{TreeDist}. +#' \insertCite{SmithDist;textual}{BigTreeDist}. #' The complementary tree distance measures state how much information is #' different in the splits of two trees, under an optimal matching. #' Where trees contain different tips, tips present in one tree but not the @@ -33,7 +33,7 @@ #' [a separate vignette](https://ms609.github.io/TreeDist/articles/information.html). #' #' Using the mutual (clustering) information -#' \insertCite{Meila2007,Vinh2010}{TreeDist} of two splits to quantify their +#' \insertCite{Meila2007,Vinh2010}{BigTreeDist} of two splits to quantify their #' similarity gives rise to the Mutual Clustering Information measure #' (`MutualClusteringInfo()`, `MutualClusteringInfoSplits()`); #' the entropy distance gives the Clustering Information Distance @@ -61,7 +61,7 @@ #' subtract the similarity score from a maximum value. In order to generate #' distance _metrics_, these functions subtract the similarity twice from the #' total information content (SPI, MSI) or entropy (MCI) of all the splits in -#' both trees \insertCite{SmithDist}{TreeDist}. +#' both trees \insertCite{SmithDist}{BigTreeDist}. #' #' # Normalization #' @@ -70,7 +70,7 @@ #' The maximum **distance** is the sum of the information content or entropy of #' each split in each tree; the maximum **similarity** is half this value. #' (See Vinh _et al._ (2010, table 3) and -#' \insertCite{SmithDist;textual}{TreeDist} for +#' \insertCite{SmithDist;textual}{BigTreeDist} for #' alternative normalization possibilities.) #' #' Note that a distance value of one (= similarity of zero) will seldom be @@ -254,7 +254,7 @@ ClusteringInfoDist <- ClusteringInfoDistance #' @param samples Integer specifying how many samplings to obtain; #' accuracy of estimate increases with `sqrt(samples)`. #' @importFrom stats sd -#' @importFrom TreeTools as.Splits +#' @importFrom BigTreeTools as.Splits #' @export ExpectedVariation <- function(tree1, tree2, samples = 1e+4) { info1 <- SplitwiseInfo(tree1) diff --git a/R/tree_distance_kendall-colijn.R b/R/tree_distance_kendall-colijn.R index 65f04a1a..30751d5f 100644 --- a/R/tree_distance_kendall-colijn.R +++ b/R/tree_distance_kendall-colijn.R @@ -16,10 +16,10 @@ #' #' An analogous distance can be created from any vector representation of a #' tree. -#' The split size vector metric \insertCite{SmithSpace}{TreeDist} is an attempt +#' The split size vector metric \insertCite{SmithSpace}{BigTreeDist} is an attempt #' to mimic the Kendall Colijn metric in situations where the position of #' the root should not be afforded special significance; and the path distance -#' \insertCite{Steel1993}{TreeDist} is a familiar alternative whose underlying +#' \insertCite{Steel1993}{BigTreeDist} is a familiar alternative whose underlying #' vector measures the distance of the last common ancestor of each pair #' of leaves from the leaves themselves, i.e. the length of the path from one #' leaf to another. @@ -27,22 +27,22 @@ #' #' None of these vector-based methods performs as well as other tree distances #' in measuring similarities in the relationships implied by a pair of trees -#' \insertCite{SmithDist}{TreeDist}; in particular, the Kendall Colijn +#' \insertCite{SmithDist}{BigTreeDist}; in particular, the Kendall Colijn #' metric is strongly influenced by tree balance, and may not be appropriate -#' for a suite of common applications \insertCite{SmithSpace}{TreeDist}. +#' for a suite of common applications \insertCite{SmithSpace}{BigTreeDist}. #' #' @template tree12ListParams #' @param Vector Function converting a tree to a numeric vector. #' #' `KCVector`, the default, returns the number of edges between the common #' ancestor of each pair of leaves and the root of the tree -#' \insertCite{@per @Kendall2016}{TreeDist}. +#' \insertCite{@per @Kendall2016}{BigTreeDist}. #' #' `PathVector` returns the number of edges between each pair of leaves -#' \insertCite{@per @Steel1993}{TreeDist}. +#' \insertCite{@per @Steel1993}{BigTreeDist}. #' #' `SplitVector` returns the size of the smallest split that contains each -#' pair of leaves (per \insertCite{SmithSpace;nobrackets}{TreeDist}). +#' pair of leaves (per \insertCite{SmithSpace;nobrackets}{BigTreeDist}). #' #' @templateVar returns `KendallColijn()` returns #' @template distReturn @@ -128,9 +128,9 @@ KendallColijn <- function(tree1, tree2 = NULL, Vector = KCVector) { .EuclideanDistance <- function(x) sqrt(sum(x * x)) #' @describeIn KendallColijn Creates a vector that characterises a rooted tree, -#' as described in \insertCite{Kendall2016;textual}{TreeDist}. +#' as described in \insertCite{Kendall2016;textual}{BigTreeDist}. #' @param tree A tree of class \code{\link[ape:read.tree]{phylo}}. -#' @importFrom TreeTools AllAncestors Preorder +#' @importFrom BigTreeTools AllAncestors Preorder #' @importFrom utils combn #' @export KCVector <- function(tree) { @@ -154,8 +154,8 @@ KCVector <- function(tree) { #' @describeIn KendallColijn Creates a vector reporting the number of edges #' between each pair of leaves, per the path metric of -#' \insertCite{Steel1993;textual}{TreeDist}. -#' @importFrom TreeTools AllAncestors Preorder +#' \insertCite{Steel1993;textual}{BigTreeDist}. +#' @importFrom BigTreeTools AllAncestors Preorder #' @importFrom utils combn #' @export PathVector <- function(tree) { @@ -188,8 +188,8 @@ PathVector <- function(tree) { #' @describeIn KendallColijn Creates a vector reporting the smallest split #' containing each pair of leaves, per the metric proposed in -#' \insertCite{SmithSpace;textual}{TreeDist}. -#' @importFrom TreeTools as.Splits +#' \insertCite{SmithSpace;textual}{BigTreeDist}. +#' @importFrom BigTreeTools as.Splits #' @export SplitVector <- function(tree) { tipLabel <- tree$tip.label @@ -216,12 +216,12 @@ SplitVector <- function(tree) { #' @examples #' KCDiameter(trees) #' KCDiameter(4) -#' @importFrom TreeTools PectinateTree +#' @importFrom BigTreeTools PectinateTree #' @rdname KendallColijn #' @export KCDiameter <- function(tree) UseMethod("KCDiameter") -#' @importFrom TreeTools NTip +#' @importFrom BigTreeTools NTip #' @export KCDiameter.phylo <- function(tree) { KCDiameter.numeric(NTip(tree)) diff --git a/R/tree_distance_mast.R b/R/tree_distance_mast.R index 77ee4653..79573016 100644 --- a/R/tree_distance_mast.R +++ b/R/tree_distance_mast.R @@ -1,11 +1,11 @@ #' Maximum Agreement Subtree size #' #' Calculate the size or phylogenetic information content -#' \insertCite{Steel2006}{TreeDist} +#' \insertCite{Steel2006}{BigTreeDist} #' of the maximum agreement subtree between two phylogenetic trees, i.e. #' the largest tree that can be obtained from both `tree1` and `tree2` by #' deleting, but not rearranging, leaves, using the algorithm of -#' \insertCite{Valiente2009;textual}{TreeDist}. +#' \insertCite{Valiente2009;textual}{BigTreeDist}. #' #' Implemented for trees with up to 4096 tips. Contact the maintainer if you #' need to process larger trees. @@ -53,7 +53,7 @@ MASTSize <- function(tree1, tree2 = tree1, rooted = TRUE) { } #' @importFrom ape drop.tip -#' @importFrom TreeTools Postorder RenumberTips TreeIsRooted RootOnNode +#' @importFrom BigTreeTools Postorder RenumberTips TreeIsRooted RootOnNode .MASTSizeSingle <- function(tree1, tree2, rooted = TRUE, tipLabels = tree1$tip.label, ...) { @@ -99,7 +99,7 @@ MASTSize <- function(tree1, tree2 = tree1, rooted = TRUE) { #' @rdname MASTSize #' @return `MASTInfo()` returns a vector or matrix listing the phylogenetic #' information content, in bits, of the maximum agreement subtree. -#' @importFrom TreeTools Log2Rooted.int Log2Unrooted.int +#' @importFrom BigTreeTools Log2Rooted.int Log2Unrooted.int #' @export MASTInfo <- function(tree1, tree2 = tree1, rooted = TRUE) { size <- MASTSize(tree1, tree2, rooted = rooted) diff --git a/R/tree_distance_msd.R b/R/tree_distance_msd.R index 181f3af1..fede185a 100644 --- a/R/tree_distance_msd.R +++ b/R/tree_distance_msd.R @@ -2,7 +2,7 @@ #' #' Calculate the #' [Matching Split Distance](https://ms609.github.io/TreeDist/articles/Generalized-RF.html#matching-split-distance) -#' \insertCite{Bogdanowicz2012,Lin2012}{TreeDist} for unrooted binary trees. +#' \insertCite{Bogdanowicz2012,Lin2012}{BigTreeDist} for unrooted binary trees. #' #' Trees need not contain identical leaves; scores are based on the leaves that #' trees hold in common. Check for unexpected differences in tip labelling @@ -18,7 +18,7 @@ #' A normalization value or function must be provided in order to return a #' normalized value. If you are aware of a generalised formula, please #' let me know by -#' \href{https://github.com/ms609/TreeDist/issues/new}{creating a GitHub issue} +#' \href{https://github.com/ms609/BigTreeDist/issues/new}{creating a GitHub issue} #' so that it can be implemented. #' #' @examples @@ -52,7 +52,7 @@ MatchingSplitDistance <- function(tree1, tree2 = NULL, normalize = FALSE, #' @rdname MatchingSplitDistance #' @inheritParams SharedPhylogeneticInfoSplits -#' @useDynLib TreeDist, .registration = TRUE +#' @useDynLib BigTreeDist, .registration = TRUE #' @export MatchingSplitDistanceSplits <- function(splits1, splits2, nTip = attr(splits1, "nTip"), diff --git a/R/tree_distance_nni.R b/R/tree_distance_nni.R index b96857d3..169d9b08 100644 --- a/R/tree_distance_nni.R +++ b/R/tree_distance_nni.R @@ -1,7 +1,7 @@ #' Approximate Nearest Neighbour Interchange distance #' -#' Use the approach of \insertCite{Li1996;textual}{TreeDist} to approximate the -#' Nearest Neighbour Interchange distance \insertCite{Robinson1971}{TreeDist} +#' Use the approach of \insertCite{Li1996;textual}{BigTreeDist} to approximate the +#' Nearest Neighbour Interchange distance \insertCite{Robinson1971}{BigTreeDist} #' between phylogenetic trees. #' #' In brief, this approximation algorithm works by identifying edges in one @@ -19,7 +19,7 @@ #' NNI operations, and provides a loose upper bound on the NNI score. #' The maximum number of moves for an _n_-leaf tree #' ([OEIS A182136](https://oeis.org/A182136)) can be calculated exactly for -#' small trees \insertCite{Fack2002}{TreeDist}; this provides a tighter upper +#' small trees \insertCite{Fack2002}{BigTreeDist}; this provides a tighter upper #' bound, but is unavailable for _n_ > 12. #' `NNIDiameter()` reports the limits on this bound. #' @@ -70,7 +70,7 @@ NNIDist <- function(tree1, tree2 = tree1) { .TreeDistance(.NNIDistSingle, tree1, tree2) } -#' @importFrom TreeTools Postorder RenumberTips +#' @importFrom BigTreeTools Postorder RenumberTips #' @importFrom ape Nnode.phylo .NNIDistSingle <- function(tree1, tree2, nTip, ...) { tree2 <- RenumberTips(tree2, tree1$tip.label) @@ -151,7 +151,7 @@ NNIDiameter.numeric <- function(tree) { ) } -#' @importFrom TreeTools NTip +#' @importFrom BigTreeTools NTip #' @export NNIDiameter.phylo <- function(tree) { NNIDiameter(NTip(tree)) diff --git a/R/tree_distance_nye.R b/R/tree_distance_nye.R index 74510c34..183caf4c 100644 --- a/R/tree_distance_nye.R +++ b/R/tree_distance_nye.R @@ -2,7 +2,7 @@ #' #' `NyeSimilarity()` and `NyeSplitSimilarity()` implement the #' [Generalized Robinson–Foulds](https://ms609.github.io/TreeDist/articles/Robinson-Foulds.html#generalized-robinson-foulds-distances) -#' tree comparison metric of \insertCite{Nye2006;textual}{TreeDist}. +#' tree comparison metric of \insertCite{Nye2006;textual}{BigTreeDist}. #' In short, this finds the optimal matching that pairs each branch from #' one tree with a branch in the second, where matchings are scored according to #' the size of the largest split that is consistent with both of them, @@ -64,7 +64,7 @@ #' @family tree distances #' #' @encoding UTF-8 -#' @importFrom TreeTools NSplits SplitsInBinaryTree +#' @importFrom BigTreeTools NSplits SplitsInBinaryTree #' @export NyeSimilarity <- function(tree1, tree2 = NULL, similarity = TRUE, normalize = FALSE, @@ -112,7 +112,7 @@ NyeSplitSimilarity <- function(splits1, splits2, #' #' Calculate the #' [Jaccard–Robinson–Foulds metric](https://ms609.github.io/TreeDist/articles/Generalized-RF.html#jaccard-robinson-foulds-metric) -#' \insertCite{Bocker2013}{TreeDist}, a +#' \insertCite{Bocker2013}{BigTreeDist}, a #' [Generalized Robinson–Foulds metric](https://ms609.github.io/TreeDist/articles/Robinson-Foulds.html#generalized-robinson-foulds-distances). #' #' In short, the Jaccard–Robinson–Foulds @@ -128,7 +128,7 @@ NyeSplitSimilarity <- function(splits1, splits2, #' By default, conflicting splits may be paired. #' #' Note that the settings `k = 1, allowConflict = TRUE, similarity = TRUE` -#' give the similarity metric of \insertCite{Nye2006;textual}{TreeDist}; +#' give the similarity metric of \insertCite{Nye2006;textual}{BigTreeDist}; #' a slightly faster implementation of this metric is available as #' [`NyeSimilarity()`]. #' @@ -179,7 +179,7 @@ NyeSplitSimilarity <- function(splits1, splits2, #' @family tree distances #' #' @encoding UTF-8 -#' @importFrom TreeTools NSplits +#' @importFrom BigTreeTools NSplits #' @export JaccardRobinsonFoulds <- function(tree1, tree2 = NULL, k = 1L, allowConflict = TRUE, similarity = FALSE, diff --git a/R/tree_distance_path.R b/R/tree_distance_path.R index 7fcbee51..72839b40 100644 --- a/R/tree_distance_path.R +++ b/R/tree_distance_path.R @@ -9,15 +9,15 @@ #' #' The path distance is calculated by tabulating the cladistic difference (= #' topological distance) between each pair of tips in each tree. -#' A precursor to the path distance \insertCite{Farris1969}{TreeDist} +#' A precursor to the path distance \insertCite{Farris1969}{BigTreeDist} #' took the mean squared #' difference between the elements of each tree's tabulation (Farris, 1973); #' the method used here is that proposed by -#' \insertCite{Steel1993;textual}{TreeDist}, which takes the square root of this +#' \insertCite{Steel1993;textual}{BigTreeDist}, which takes the square root of this #' sum. #' Other precursor measures are described in -#' \insertCite{Williams1971;textual}{TreeDist} and -#' \insertCite{Phipps1971;textual}{TreeDist}. +#' \insertCite{Williams1971;textual}{BigTreeDist} and +#' \insertCite{Phipps1971;textual}{BigTreeDist}. #' #' If a root node is present, trees are treated as rooted. #' To avoid counting the root edge twice, use `UnrootTree(tree)` before @@ -25,7 +25,7 @@ #' #' Use of the path distance is discouraged as it emphasizes #' shallow relationships at the expense of deeper (and arguably more -#' fundamental) relationships \insertCite{Farris1973}{TreeDist}. +#' fundamental) relationships \insertCite{Farris1973}{BigTreeDist}. #' #' @template tree12ListParams #' @@ -54,7 +54,7 @@ #' @template MRS #' @family tree distances #' @importFrom phangorn path.dist -#' @importFrom TreeTools Postorder +#' @importFrom BigTreeTools Postorder #' @export PathDist <- function(tree1, tree2 = NULL) { if (inherits(tree1, "phylo")) { diff --git a/R/tree_distance_rf.R b/R/tree_distance_rf.R index 6205e648..471d5714 100644 --- a/R/tree_distance_rf.R +++ b/R/tree_distance_rf.R @@ -2,15 +2,15 @@ #' content #' #' Calculate the Robinson–Foulds distance -#' \insertCite{Robinson1981}{TreeDist}, or +#' \insertCite{Robinson1981}{BigTreeDist}, or #' the equivalent similarity measure, with options to #' (i) annotate matched splits; #' (ii) weight splits according to their phylogenetic information content -#' \insertCite{SmithDist}{TreeDist}. +#' \insertCite{SmithDist}{BigTreeDist}. #' Whilst slower to calculate, information theoretic modifications of the #' Robinson–Foulds distance (see [`TreeDistance()`]) #' are better suited to most use cases -#' \insertCite{SmithDist,SmithSpace}{TreeDist}. +#' \insertCite{SmithDist,SmithSpace}{BigTreeDist}. #' #' Note that if `reportMatching = TRUE`, the `pairScores` attribute returns #' a logical matrix specifying whether each pair of splits is identical. @@ -22,7 +22,7 @@ #' tree distance, because their similarity is less remarkable. #' #' Rapid comparison between multiple pairs of trees employs the -#' \insertCite{Day1985;textual}{TreeDist} linear-time algorithm. +#' \insertCite{Day1985;textual}{BigTreeDist} linear-time algorithm. #' #' @inheritParams TreeDistance #' @param similarity Logical specifying whether to report the result as a tree @@ -96,7 +96,7 @@ InfoRobinsonFouldsSplits <- function(splits1, splits2, } #' @rdname Robinson-Foulds -#' @importFrom TreeTools NSplits as.ClusterTable +#' @importFrom BigTreeTools NSplits as.ClusterTable #' @export RobinsonFoulds <- function(tree1, tree2 = NULL, similarity = FALSE, normalize = FALSE, reportMatching = FALSE) { @@ -129,7 +129,7 @@ RobinsonFoulds <- function(tree1, tree2 = NULL, similarity = FALSE, #' @describeIn Robinson-Foulds Matched splits, intended for use with #' [`VisualizeMatching()`]. #' @param \dots Not used. -#' @importFrom TreeTools NSplits +#' @importFrom BigTreeTools NSplits #' @export RobinsonFouldsMatching <- function(tree1, tree2, similarity = FALSE, normalize = FALSE, ...) { diff --git a/R/tree_distance_spr.R b/R/tree_distance_spr.R index 7ca0ab32..7eb1ddc3 100644 --- a/R/tree_distance_spr.R +++ b/R/tree_distance_spr.R @@ -39,7 +39,7 @@ #' #' @family tree distances #' @importFrom phangorn SPR.dist -#' @importFrom TreeTools Postorder +#' @importFrom BigTreeTools Postorder #' @export SPRDist <- function(tree1, tree2 = NULL, symmetric = TRUE) { if (inherits(tree1, "phylo")) { diff --git a/R/tree_distance_utilities.R b/R/tree_distance_utilities.R index 8b16d67f..941c6d7b 100644 --- a/R/tree_distance_utilities.R +++ b/R/tree_distance_utilities.R @@ -8,7 +8,7 @@ #' #' @template MRS #' @keywords internal -#' @importFrom TreeTools as.Splits TipLabels +#' @importFrom BigTreeTools as.Splits TipLabels #' @importFrom utils combn #' @export CalculateTreeDistance <- function(Func, tree1, tree2 = NULL, @@ -207,7 +207,7 @@ CalculateTreeDistance <- function(Func, tree1, tree2 = NULL, #' Calculate distance between trees, or lists of trees #' @template MRS -#' @importFrom TreeTools TipLabels +#' @importFrom BigTreeTools TipLabels #' @param checks Logical specifying whether to perform basic sanity checks to #' avoid crashes in C++. #' @keywords internal @@ -411,7 +411,7 @@ CompareAll <- function(x, Func, FUN.VALUE = Func(x[[1]], x[[1]], ...), #' @param \dots Additional parameters to `InfoInTree()` or `how`. #' @keywords internal #' @template MRS -#' @importFrom TreeTools KeepTip TipLabels +#' @importFrom BigTreeTools KeepTip TipLabels #' @export NormalizeInfo <- function(unnormalized, tree1, tree2, InfoInTree, infoInBoth = NULL, how = TRUE, Combine = "+", ...) { @@ -465,7 +465,7 @@ NormalizeInfo <- function(unnormalized, tree1, tree2, InfoInTree, } # We only call this function when not all trees contain identical leaf sets -#' @importFrom TreeTools KeepTip TipLabels +#' @importFrom BigTreeTools KeepTip TipLabels .SharedOnly <- function(tree1, tree2, lab1 = TipLabels(tree1), lab2 = TipLabels(tree2)) { diff --git a/R/tree_information.R b/R/tree_information.R index 0c747268..27772abc 100644 --- a/R/tree_information.R +++ b/R/tree_information.R @@ -16,7 +16,7 @@ #' phylogenetic information content, used in [`SplitwiseInfo()`]. #' In essence, it asks, given a split that subdivides the leaves of a tree into #' two partitions, how easy it is to predict which partition a randomly drawn -#' leaf belongs to \insertCite{@Meila2007; @Vinh2010}{TreeDist}. +#' leaf belongs to \insertCite{@Meila2007; @Vinh2010}{BigTreeDist}. #' #' #' Formally, the entropy of a split _S_ that divides _n_ leaves into two @@ -73,21 +73,21 @@ #' #' #' As entropy measures the bits required to transmit the cluster label of each -#' leaf \insertCite{@@Vinh2010: p. 2840}{TreeDist}, the information content of +#' leaf \insertCite{@@Vinh2010: p. 2840}{BigTreeDist}, the information content of #' a split is its entropy multiplied by the number of leaves. #' #' @section Phylogenetic information: #' #' Phylogenetic information expresses the information content of a split #' in terms of the probability that a uniformly selected tree will contain it -#' \insertCite{Thorley1998}{TreeDist}. +#' \insertCite{Thorley1998}{BigTreeDist}. #' #' @section Consensus information: #' #' The information content of splits in a consensus tree is calculated by #' interpreting support values (i.e. the proportion of trees containing #' each split in the consensus) as probabilities that the true tree contains -#' that split, following \insertCite{SmithCons;textual}{TreeDist}. +#' that split, following \insertCite{SmithCons;textual}{BigTreeDist}. #' #' @return `SplitwiseInfo()`, `ClusteringInfo()` and `ClusteringEntropy()` #' return the splitwise information content of the tree -- or of each split @@ -165,7 +165,7 @@ SplitwiseInfo.multiPhylo <- function(x, p = NULL, sum = TRUE) { #' @export SplitwiseInfo.list <- SplitwiseInfo.multiPhylo -#' @importFrom TreeTools Log2Rooted.int Log2Unrooted.int TipsInSplits +#' @importFrom BigTreeTools Log2Rooted.int Log2Unrooted.int TipsInSplits #' @export SplitwiseInfo.Splits <- function(x, p = NULL, sum = TRUE) { nTip <- attr(x, "nTip") @@ -232,7 +232,7 @@ SplitwiseInfo.NULL <- function(x, p = NULL, sum = TRUE) NULL #' tree <- ape::read.tree(text = "(a, b, (c, (d, e, (f, g)0.8))0.9);") #' ClusteringInfo(tree) #' ClusteringInfo(tree, TRUE) -#' @importFrom TreeTools as.Splits +#' @importFrom BigTreeTools as.Splits #' @rdname TreeInfo #' @export ClusteringEntropy <- function(x, p = NULL, sum = TRUE) { diff --git a/R/trustworthiness.R b/R/trustworthiness.R index 72ef3862..bf148e19 100644 --- a/R/trustworthiness.R +++ b/R/trustworthiness.R @@ -21,7 +21,7 @@ #' Faithfulness of mapped distances #' #' `MappingQuality()` calculates the trustworthiness and continuity -#' of mapped distances \insertCite{Venna2001,Kaski2003}{TreeDist}. +#' of mapped distances \insertCite{Venna2001,Kaski2003}{BigTreeDist}. #' Trustworthiness measures, on a scale from 0--1, #' the degree to which points that are nearby in a mapping are truly close #' neighbours; continuity, the extent to which points that are truly nearby diff --git a/R/zzz.R b/R/zzz.R index 826528ea..10a92860 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,6 +1,6 @@ .onUnload <- function(libpath) { StopParallel(quietly = TRUE) - library.dynam.unload("TreeDist", libpath) + library.dynam.unload("BigTreeDist", libpath) } ## Reminders when releasing for CRAN diff --git a/inst/treespace/app.R b/inst/treespace/app.R index 07709d8d..5799b786 100644 --- a/inst/treespace/app.R +++ b/inst/treespace/app.R @@ -16,8 +16,8 @@ suppressPackageStartupMessages({ library("shiny", exclude = "runExample") library("shinyjs", exclude = "runExample") }) -library("TreeTools", quietly = TRUE) -library("TreeDist") +library("BigTreeTools", quietly = TRUE) +library("BigTreeDist") if (!requireNamespace("cluster", quietly = TRUE)) install.packages("cluster") if (!requireNamespace("protoclust", quietly = TRUE)) { diff --git a/man/AllSplitPairings.Rd b/man/AllSplitPairings.Rd index 507dc77f..eeaff261 100644 --- a/man/AllSplitPairings.Rd +++ b/man/AllSplitPairings.Rd @@ -21,8 +21,8 @@ values should be divided by four. } \description{ Calculate the variation of clustering information -\insertCite{Meila2007}{TreeDist} for each possible pairing of -non-trivial splits on \emph{n} leaves \insertCite{SmithDist}{TreeDist}, +\insertCite{Meila2007}{BigTreeDist} for each possible pairing of +non-trivial splits on \emph{n} leaves \insertCite{SmithDist}{BigTreeDist}, tabulating the number of pairings with each similarity. } \examples{ diff --git a/man/TreeDist-package.Rd b/man/BigTreeDist-package.Rd similarity index 93% rename from man/TreeDist-package.Rd rename to man/BigTreeDist-package.Rd index 59a89b1f..f12eb8e0 100644 --- a/man/TreeDist-package.Rd +++ b/man/BigTreeDist-package.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/TreeDist-package.R +% Please edit documentation in R/BigTreeDist-package.R \docType{package} \encoding{UTF-8} -\name{TreeDist-package} -\alias{TreeDist} -\alias{TreeDist-package} +\name{BigTreeDist-package} +\alias{BigTreeDist} +\alias{BigTreeDist-package} \title{TreeDist: Distances between Phylogenetic Trees} \description{ 'TreeDist' is an R package that implements a suite of metrics that quantify the @@ -97,14 +97,14 @@ for a command-line interface. \references{ \itemize{ -\item \insertRef{Bocker2013}{TreeDist} -\item \insertRef{Bogdanowicz2012}{TreeDist} -\item \insertRef{Kendall2016}{TreeDist} -\item \insertRef{Li1996}{TreeDist} -\item \insertRef{Lin2012}{TreeDist} -\item \insertRef{Nye2006}{TreeDist} -\item \insertRef{SmithDist}{TreeDist} -\item \insertRef{SmithSpace}{TreeDist} +\item \insertRef{Bocker2013}{BigTreeDist} +\item \insertRef{Bogdanowicz2012}{BigTreeDist} +\item \insertRef{Kendall2016}{BigTreeDist} +\item \insertRef{Li1996}{BigTreeDist} +\item \insertRef{Lin2012}{BigTreeDist} +\item \insertRef{Nye2006}{BigTreeDist} +\item \insertRef{SmithDist}{BigTreeDist} +\item \insertRef{SmithSpace}{BigTreeDist} } } \seealso{ diff --git a/man/JaccardRobinsonFoulds.Rd b/man/JaccardRobinsonFoulds.Rd index 32a143ed..23c6190c 100644 --- a/man/JaccardRobinsonFoulds.Rd +++ b/man/JaccardRobinsonFoulds.Rd @@ -70,7 +70,7 @@ or \code{splits1} and \code{splits2}. \description{ Calculate the \href{https://ms609.github.io/TreeDist/articles/Generalized-RF.html#jaccard-robinson-foulds-metric}{Jaccard–Robinson–Foulds metric} -\insertCite{Bocker2013}{TreeDist}, a +\insertCite{Bocker2013}{BigTreeDist}, a \href{https://ms609.github.io/TreeDist/articles/Robinson-Foulds.html#generalized-robinson-foulds-distances}{Generalized Robinson–Foulds metric}. } \details{ @@ -87,7 +87,7 @@ A more detailed explanation is provided in the By default, conflicting splits may be paired. Note that the settings \verb{k = 1, allowConflict = TRUE, similarity = TRUE} -give the similarity metric of \insertCite{Nye2006;textual}{TreeDist}; +give the similarity metric of \insertCite{Nye2006;textual}{BigTreeDist}; a slightly faster implementation of this metric is available as \code{\link[=NyeSimilarity]{NyeSimilarity()}}. diff --git a/man/KendallColijn.Rd b/man/KendallColijn.Rd index cbea16de..ceac963d 100644 --- a/man/KendallColijn.Rd +++ b/man/KendallColijn.Rd @@ -29,13 +29,13 @@ or lists of such trees to undergo pairwise comparison. Where implemented, \code{KCVector}, the default, returns the number of edges between the common ancestor of each pair of leaves and the root of the tree -\insertCite{@per @Kendall2016}{TreeDist}. +\insertCite{@per @Kendall2016}{BigTreeDist}. \code{PathVector} returns the number of edges between each pair of leaves -\insertCite{@per @Steel1993}{TreeDist}. +\insertCite{@per @Steel1993}{BigTreeDist}. \code{SplitVector} returns the size of the smallest split that contains each -pair of leaves (per \insertCite{SmithSpace;nobrackets}{TreeDist}).} +pair of leaves (per \insertCite{SmithSpace;nobrackets}{BigTreeDist}).} \item{tree}{A tree of class \code{\link[ape:read.tree]{phylo}}.} } @@ -68,32 +68,32 @@ of the squares of the differences between the vectors. An analogous distance can be created from any vector representation of a tree. -The split size vector metric \insertCite{SmithSpace}{TreeDist} is an attempt +The split size vector metric \insertCite{SmithSpace}{BigTreeDist} is an attempt to mimic the Kendall Colijn metric in situations where the position of the root should not be afforded special significance; and the path distance -\insertCite{Steel1993}{TreeDist} is a familiar alternative whose underlying +\insertCite{Steel1993}{BigTreeDist} is a familiar alternative whose underlying vector measures the distance of the last common ancestor of each pair of leaves from the leaves themselves, i.e. the length of the path from one leaf to another. None of these vector-based methods performs as well as other tree distances in measuring similarities in the relationships implied by a pair of trees -\insertCite{SmithDist}{TreeDist}; in particular, the Kendall Colijn +\insertCite{SmithDist}{BigTreeDist}; in particular, the Kendall Colijn metric is strongly influenced by tree balance, and may not be appropriate -for a suite of common applications \insertCite{SmithSpace}{TreeDist}. +for a suite of common applications \insertCite{SmithSpace}{BigTreeDist}. } \section{Functions}{ \itemize{ \item \code{KCVector()}: Creates a vector that characterises a rooted tree, -as described in \insertCite{Kendall2016;textual}{TreeDist}. +as described in \insertCite{Kendall2016;textual}{BigTreeDist}. \item \code{PathVector()}: Creates a vector reporting the number of edges between each pair of leaves, per the path metric of -\insertCite{Steel1993;textual}{TreeDist}. +\insertCite{Steel1993;textual}{BigTreeDist}. \item \code{SplitVector()}: Creates a vector reporting the smallest split containing each pair of leaves, per the metric proposed in -\insertCite{SmithSpace;textual}{TreeDist}. +\insertCite{SmithSpace;textual}{BigTreeDist}. }} \examples{ diff --git a/man/LAPJV.Rd b/man/LAPJV.Rd index 561d0032..d1277d0e 100644 --- a/man/LAPJV.Rd +++ b/man/LAPJV.Rd @@ -15,7 +15,7 @@ optimal matching; and \code{matching}, the columns matched to each row of the matrix in turn. } \description{ -Use the algorithm of \insertCite{Jonker1987;textual}{TreeDist} to solve the +Use the algorithm of \insertCite{Jonker1987;textual}{BigTreeDist} to solve the \href{http://www.assignmentproblems.com/doc/LSAPIntroduction.pdf}{Linear Sum Assignment Problem}. } \details{ @@ -23,7 +23,7 @@ The Linear Assignment Problem seeks to match each row of a matrix with a column, such that the cost of the matching is minimized. The Jonker & Volgenant approach is a faster alternative to the Hungarian -algorithm \insertCite{Munkres1957}{TreeDist}, which is implemented in +algorithm \insertCite{Munkres1957}{BigTreeDist}, which is implemented in \code{clue::solve_LSAP()}. Note: the JV algorithm expects integers. In order to apply the function diff --git a/man/MASTSize.Rd b/man/MASTSize.Rd index d4f4d425..fa288503 100644 --- a/man/MASTSize.Rd +++ b/man/MASTSize.Rd @@ -24,11 +24,11 @@ information content, in bits, of the maximum agreement subtree. } \description{ Calculate the size or phylogenetic information content -\insertCite{Steel2006}{TreeDist} +\insertCite{Steel2006}{BigTreeDist} of the maximum agreement subtree between two phylogenetic trees, i.e. the largest tree that can be obtained from both \code{tree1} and \code{tree2} by deleting, but not rearranging, leaves, using the algorithm of -\insertCite{Valiente2009;textual}{TreeDist}. +\insertCite{Valiente2009;textual}{BigTreeDist}. } \details{ Implemented for trees with up to 4096 tips. Contact the maintainer if you diff --git a/man/MSTSegments.Rd b/man/MSTSegments.Rd index 3df43f76..c63682ba 100644 --- a/man/MSTSegments.Rd +++ b/man/MSTSegments.Rd @@ -19,7 +19,7 @@ StrainCol( points.} \item{mstEnds}{Two-column matrix identifying rows of \code{mapping} at end of -each edge of the MST, as output by \code{\link[TreeTools:MSTEdges]{TreeTools::MSTEdges()}}.} +each edge of the MST, as output by \code{\link[BigTreeTools:MSTEdges]{BigTreeTools::MSTEdges()}}.} \item{\dots}{Additional arguments to \code{\link[=segments]{segments()}}.} @@ -39,7 +39,7 @@ distance to original distance is small. \description{ To identify strain in a multidimensional scaling of distances, it can be useful to plot a minimum spanning tree -\insertCite{Gower1966,SmithSpace}{TreeDist}. Colouring each edge of the +\insertCite{Gower1966,SmithSpace}{BigTreeDist}. Colouring each edge of the tree according to its strain can identify areas where the mapping is stretched or compressed. } diff --git a/man/MapTrees.Rd b/man/MapTrees.Rd index 0c101316..87a0809b 100644 --- a/man/MapTrees.Rd +++ b/man/MapTrees.Rd @@ -100,7 +100,7 @@ A list of references employed when constructing the tree space is populated according to the methods used; it would be appropriate to cite and briefly discuss these studies in any publication using figures generated using this application. The application itself can be cited using -\insertCite{SmithDist,SmithSpace;textual}{TreeDist} +\insertCite{SmithDist,SmithSpace;textual}{BigTreeDist} } \references{ diff --git a/man/MappingQuality.Rd b/man/MappingQuality.Rd index 9beaf509..fd1ef39c 100644 --- a/man/MappingQuality.Rd +++ b/man/MappingQuality.Rd @@ -24,7 +24,7 @@ containing the entries: \code{Trustworthiness}, \code{Continuity}, \code{TxC} } \description{ \code{MappingQuality()} calculates the trustworthiness and continuity -of mapped distances \insertCite{Venna2001,Kaski2003}{TreeDist}. +of mapped distances \insertCite{Venna2001,Kaski2003}{BigTreeDist}. Trustworthiness measures, on a scale from 0--1, the degree to which points that are nearby in a mapping are truly close neighbours; continuity, the extent to which points that are truly nearby diff --git a/man/MatchingSplitDistance.Rd b/man/MatchingSplitDistance.Rd index 30ec7062..84d2a180 100644 --- a/man/MatchingSplitDistance.Rd +++ b/man/MatchingSplitDistance.Rd @@ -52,7 +52,7 @@ or \code{splits1} and \code{splits2}. \description{ Calculate the \href{https://ms609.github.io/TreeDist/articles/Generalized-RF.html#matching-split-distance}{Matching Split Distance} -\insertCite{Bogdanowicz2012,Lin2012}{TreeDist} for unrooted binary trees. +\insertCite{Bogdanowicz2012,Lin2012}{BigTreeDist} for unrooted binary trees. } \details{ Trees need not contain identical leaves; scores are based on the leaves that @@ -65,7 +65,7 @@ with \code{setdiff(TipLabels(tree1), TipLabels(tree2))}. A normalization value or function must be provided in order to return a normalized value. If you are aware of a generalised formula, please let me know by -\href{https://github.com/ms609/TreeDist/issues/new}{creating a GitHub issue} +\href{https://github.com/ms609/BigTreeDist/issues/new}{creating a GitHub issue} so that it can be implemented. } diff --git a/man/MeilaVariationOfInformation.Rd b/man/MeilaVariationOfInformation.Rd index d9698848..c1d8cc47 100644 --- a/man/MeilaVariationOfInformation.Rd +++ b/man/MeilaVariationOfInformation.Rd @@ -24,11 +24,11 @@ measured in bits. } \description{ Compare a pair of splits viewed as clusterings of taxa, using the variation -of clustering information proposed by \insertCite{Meila2007}{TreeDist}. +of clustering information proposed by \insertCite{Meila2007}{BigTreeDist}. } \details{ This is equivalent to the mutual clustering information -\insertCite{Vinh2010}{TreeDist}. +\insertCite{Vinh2010}{BigTreeDist}. For the total information content, multiply the VoI by the number of leaves. } \examples{ diff --git a/man/NNIDist.Rd b/man/NNIDist.Rd index a0d8bc8f..3691257a 100644 --- a/man/NNIDist.Rd +++ b/man/NNIDist.Rd @@ -53,8 +53,8 @@ where \emph{n} is the number of leaves, and \emph{N} the number of internal node i.e. \deqn{n - 2}{_n_ − 2}. } \description{ -Use the approach of \insertCite{Li1996;textual}{TreeDist} to approximate the -Nearest Neighbour Interchange distance \insertCite{Robinson1971}{TreeDist} +Use the approach of \insertCite{Li1996;textual}{BigTreeDist} to approximate the +Nearest Neighbour Interchange distance \insertCite{Robinson1971}{BigTreeDist} between phylogenetic trees. } \details{ @@ -73,7 +73,7 @@ analogue of the mergesort algorithm. This takes at most \emph{n} log \emph{n} + NNI operations, and provides a loose upper bound on the NNI score. The maximum number of moves for an \emph{n}-leaf tree (\href{https://oeis.org/A182136}{OEIS A182136}) can be calculated exactly for -small trees \insertCite{Fack2002}{TreeDist}; this provides a tighter upper +small trees \insertCite{Fack2002}{BigTreeDist}; this provides a tighter upper bound, but is unavailable for \emph{n} > 12. \code{NNIDiameter()} reports the limits on this bound. diff --git a/man/NyeSimilarity.Rd b/man/NyeSimilarity.Rd index 00314716..a836e48b 100644 --- a/man/NyeSimilarity.Rd +++ b/man/NyeSimilarity.Rd @@ -69,7 +69,7 @@ or \code{splits1} and \code{splits2}. \description{ \code{NyeSimilarity()} and \code{NyeSplitSimilarity()} implement the \href{https://ms609.github.io/TreeDist/articles/Robinson-Foulds.html#generalized-robinson-foulds-distances}{Generalized Robinson–Foulds} -tree comparison metric of \insertCite{Nye2006;textual}{TreeDist}. +tree comparison metric of \insertCite{Nye2006;textual}{BigTreeDist}. In short, this finds the optimal matching that pairs each branch from one tree with a branch in the second, where matchings are scored according to the size of the largest split that is consistent with both of them, diff --git a/man/PathDist.Rd b/man/PathDist.Rd index f8a7478c..2a28e664 100644 --- a/man/PathDist.Rd +++ b/man/PathDist.Rd @@ -27,15 +27,15 @@ not cause the \code{path.dist()} function to crash R. The path distance is calculated by tabulating the cladistic difference (= topological distance) between each pair of tips in each tree. -A precursor to the path distance \insertCite{Farris1969}{TreeDist} +A precursor to the path distance \insertCite{Farris1969}{BigTreeDist} took the mean squared difference between the elements of each tree's tabulation (Farris, 1973); the method used here is that proposed by -\insertCite{Steel1993;textual}{TreeDist}, which takes the square root of this +\insertCite{Steel1993;textual}{BigTreeDist}, which takes the square root of this sum. Other precursor measures are described in -\insertCite{Williams1971;textual}{TreeDist} and -\insertCite{Phipps1971;textual}{TreeDist}. +\insertCite{Williams1971;textual}{BigTreeDist} and +\insertCite{Phipps1971;textual}{BigTreeDist}. If a root node is present, trees are treated as rooted. To avoid counting the root edge twice, use \code{UnrootTree(tree)} before @@ -43,7 +43,7 @@ calculating the path distance. Use of the path distance is discouraged as it emphasizes shallow relationships at the expense of deeper (and arguably more -fundamental) relationships \insertCite{Farris1973}{TreeDist}. +fundamental) relationships \insertCite{Farris1973}{BigTreeDist}. } \examples{ library("TreeTools") diff --git a/man/Robinson-Foulds.Rd b/man/Robinson-Foulds.Rd index b68033e4..f7162128 100644 --- a/man/Robinson-Foulds.Rd +++ b/man/Robinson-Foulds.Rd @@ -86,15 +86,15 @@ or \code{splits1} and \code{splits2}. } \description{ Calculate the Robinson–Foulds distance -\insertCite{Robinson1981}{TreeDist}, or +\insertCite{Robinson1981}{BigTreeDist}, or the equivalent similarity measure, with options to (i) annotate matched splits; (ii) weight splits according to their phylogenetic information content -\insertCite{SmithDist}{TreeDist}. +\insertCite{SmithDist}{BigTreeDist}. Whilst slower to calculate, information theoretic modifications of the Robinson–Foulds distance (see \code{\link[=TreeDistance]{TreeDistance()}}) are better suited to most use cases -\insertCite{SmithDist,SmithSpace}{TreeDist}. +\insertCite{SmithDist,SmithSpace}{BigTreeDist}. } \details{ Note that if \code{reportMatching = TRUE}, the \code{pairScores} attribute returns @@ -107,7 +107,7 @@ to be identical by chance alone make a smaller contribution to overall tree distance, because their similarity is less remarkable. Rapid comparison between multiple pairs of trees employs the -\insertCite{Day1985;textual}{TreeDist} linear-time algorithm. +\insertCite{Day1985;textual}{BigTreeDist} linear-time algorithm. } \section{Functions}{ \itemize{ diff --git a/man/SplitEntropy.Rd b/man/SplitEntropy.Rd index 4388b274..36d66efb 100644 --- a/man/SplitEntropy.Rd +++ b/man/SplitEntropy.Rd @@ -28,8 +28,8 @@ content of two splits, treating each split as a division of \emph{n} leaves into two groups. Further details are available in a \href{https://ms609.github.io/TreeDist/articles/information.html}{vignette}, -\insertCite{Mackay2003;textual}{TreeDist} and -\insertCite{Meila2007;textual}{TreeDist}. +\insertCite{Mackay2003;textual}{BigTreeDist} and +\insertCite{Meila2007;textual}{BigTreeDist}. } \examples{ A <- TRUE diff --git a/man/SplitSharedInformation.Rd b/man/SplitSharedInformation.Rd index 57560887..e97137e1 100644 --- a/man/SplitSharedInformation.Rd +++ b/man/SplitSharedInformation.Rd @@ -31,7 +31,7 @@ once the splits have been arranged such that \emph{A1} fully overlaps with \emph trees consistent with two splits. \code{SplitSharedInformation()} returns the phylogenetic information that two splits -have in common \insertCite{Meila2007}{TreeDist}, in bits. +have in common \insertCite{Meila2007}{BigTreeDist}, in bits. \code{SplitDifferentInformation()} returns the amount of phylogenetic information distinct to one of the two splits, in bits. diff --git a/man/TreeDistance.Rd b/man/TreeDistance.Rd index 4f2c28d0..511d38b9 100644 --- a/man/TreeDistance.Rd +++ b/man/TreeDistance.Rd @@ -150,13 +150,13 @@ between trees (including leaving a split unpaired). The methods implemented here use the concepts of \href{https://ms609.github.io/TreeDist/articles/information.html}{entropy and information} -\insertCite{Mackay2003}{TreeDist} to assign a similarity score between each +\insertCite{Mackay2003}{BigTreeDist} to assign a similarity score between each pair of splits. The returned tree similarity measures state the amount of information, in bits, that the splits in two trees hold in common when they are optimally matched, following -\insertCite{SmithDist;textual}{TreeDist}. +\insertCite{SmithDist;textual}{BigTreeDist}. The complementary tree distance measures state how much information is different in the splits of two trees, under an optimal matching. Where trees contain different tips, tips present in one tree but not the @@ -169,7 +169,7 @@ defined in \href{https://ms609.github.io/TreeDist/articles/information.html}{a separate vignette}. Using the mutual (clustering) information -\insertCite{Meila2007,Vinh2010}{TreeDist} of two splits to quantify their +\insertCite{Meila2007,Vinh2010}{BigTreeDist} of two splits to quantify their similarity gives rise to the Mutual Clustering Information measure (\code{MutualClusteringInfo()}, \code{MutualClusteringInfoSplits()}); the entropy distance gives the Clustering Information Distance @@ -197,7 +197,7 @@ To convert similarity measures to distances, it is necessary to subtract the similarity score from a maximum value. In order to generate distance \emph{metrics}, these functions subtract the similarity twice from the total information content (SPI, MSI) or entropy (MCI) of all the splits in -both trees \insertCite{SmithDist}{TreeDist}. +both trees \insertCite{SmithDist}{BigTreeDist}. } \section{Normalization}{ @@ -206,7 +206,7 @@ ranges from zero to (in principle) one. The maximum \strong{distance} is the sum of the information content or entropy of each split in each tree; the maximum \strong{similarity} is half this value. (See Vinh \emph{et al.} (2010, table 3) and -\insertCite{SmithDist;textual}{TreeDist} for +\insertCite{SmithDist;textual}{BigTreeDist} for alternative normalization possibilities.) Note that a distance value of one (= similarity of zero) will seldom be diff --git a/man/TreeInfo.Rd b/man/TreeInfo.Rd index a31234d8..9df72fe6 100644 --- a/man/TreeInfo.Rd +++ b/man/TreeInfo.Rd @@ -84,7 +84,7 @@ in the splits within a tree". Its approach is complementary to the phylogenetic information content, used in \code{\link[=SplitwiseInfo]{SplitwiseInfo()}}. In essence, it asks, given a split that subdivides the leaves of a tree into two partitions, how easy it is to predict which partition a randomly drawn -leaf belongs to \insertCite{@Meila2007; @Vinh2010}{TreeDist}. +leaf belongs to \insertCite{@Meila2007; @Vinh2010}{BigTreeDist}. Formally, the entropy of a split \emph{S} that divides \emph{n} leaves into two partitions of sizes \emph{a} and \emph{b} is given by @@ -134,7 +134,7 @@ requires fewer than two bits for two leaves, so the entropy is less than of A and B.) As entropy measures the bits required to transmit the cluster label of each -leaf \insertCite{@Vinh2010: p. 2840}{TreeDist}, the information content of +leaf \insertCite{@Vinh2010: p. 2840}{BigTreeDist}, the information content of a split is its entropy multiplied by the number of leaves. } @@ -143,7 +143,7 @@ a split is its entropy multiplied by the number of leaves. Phylogenetic information expresses the information content of a split in terms of the probability that a uniformly selected tree will contain it -\insertCite{Thorley1998}{TreeDist}. +\insertCite{Thorley1998}{BigTreeDist}. } \section{Consensus information}{ @@ -152,7 +152,7 @@ in terms of the probability that a uniformly selected tree will contain it The information content of splits in a consensus tree is calculated by interpreting support values (i.e. the proportion of trees containing each split in the consensus) as probabilities that the true tree contains -that split, following \insertCite{SmithCons;textual}{TreeDist}. +that split, following \insertCite{SmithCons;textual}{BigTreeDist}. } \examples{ diff --git a/man/kmeanspp.Rd b/man/kmeanspp.Rd index e279beb3..ac0b7c21 100644 --- a/man/kmeanspp.Rd +++ b/man/kmeanspp.Rd @@ -18,12 +18,12 @@ chosen} \item{\dots}{additional arguments passed to \code{\link[stats]{kmeans}}} } \description{ -k-means++ clustering \insertCite{Arthur2007}{TreeDist} improves the speed and +k-means++ clustering \insertCite{Arthur2007}{BigTreeDist} improves the speed and accuracy of standard \code{\link[stats]{kmeans}} clustering -\insertCite{Hartigan1979}{TreeDist} by preferring initial cluster centres +\insertCite{Hartigan1979}{BigTreeDist} by preferring initial cluster centres that are far from others. A scalable version of the algorithm has been proposed for larger data sets -\insertCite{Bahmani2012}{TreeDist}, but is not implemented here. +\insertCite{Bahmani2012}{BigTreeDist}, but is not implemented here. } \examples{ # Generate random points diff --git a/man/median.multiPhylo.Rd b/man/median.multiPhylo.Rd index 1686df7a..563b5055 100644 --- a/man/median.multiPhylo.Rd +++ b/man/median.multiPhylo.Rd @@ -77,7 +77,7 @@ median(structure(treeList, class = "multiPhylo")) \seealso{ Consensus methods: \code{\link[ape:consensus]{ape::consensus()}}, -\code{\link[TreeTools:ConsensusWithout]{TreeTools::ConsensusWithout()}} +\code{\link[BigTreeTools:ConsensusWithout]{BigTreeTools::ConsensusWithout()}} Other tree space functions: \code{\link{MSTSegments}()}, diff --git a/memcheck/examples.R b/memcheck/examples.R index 1b3c6eb7..60962292 100644 --- a/memcheck/examples.R +++ b/memcheck/examples.R @@ -1,5 +1,5 @@ # Code to be run with # R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < tests/thisfile.R # First build and install the package. -library("TreeDist") +library("BigTreeDist") devtools::run_examples() diff --git a/memcheck/tests.R b/memcheck/tests.R index 4456a9d4..c96e9aa5 100644 --- a/memcheck/tests.R +++ b/memcheck/tests.R @@ -1,5 +1,5 @@ # Code to be run with # R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < tests/thisfile.R # First build and install the package. -library("TreeDist") +library("BigTreeDist") devtools::test() diff --git a/memcheck/vignettes.R b/memcheck/vignettes.R index 74430cd1..1b15e8aa 100644 --- a/memcheck/vignettes.R +++ b/memcheck/vignettes.R @@ -1,5 +1,5 @@ # Code to be run with # R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < tests/thisfile.R # First build and install the package. -library("TreeDist") +library("BigTreeDist") devtools::build_vignettes() diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 1e9f1f8a..26ff6f8d 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -12,7 +12,7 @@ Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); // COMCLUST int COMCLUST(List trees); -RcppExport SEXP _TreeDist_COMCLUST(SEXP treesSEXP) { +RcppExport SEXP _BigTreeDist_COMCLUST(SEXP treesSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -23,7 +23,7 @@ END_RCPP } // consensus_info double consensus_info(const List trees, const LogicalVector phylo, const NumericVector p); -RcppExport SEXP _TreeDist_consensus_info(SEXP treesSEXP, SEXP phyloSEXP, SEXP pSEXP) { +RcppExport SEXP _BigTreeDist_consensus_info(SEXP treesSEXP, SEXP phyloSEXP, SEXP pSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -36,7 +36,7 @@ END_RCPP } // robinson_foulds_all_pairs IntegerVector robinson_foulds_all_pairs(List tables); -RcppExport SEXP _TreeDist_robinson_foulds_all_pairs(SEXP tablesSEXP) { +RcppExport SEXP _BigTreeDist_robinson_foulds_all_pairs(SEXP tablesSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -47,7 +47,7 @@ END_RCPP } // lapjv List lapjv(NumericMatrix x, NumericVector maxX); -RcppExport SEXP _TreeDist_lapjv(SEXP xSEXP, SEXP maxXSEXP) { +RcppExport SEXP _BigTreeDist_lapjv(SEXP xSEXP, SEXP maxXSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -59,7 +59,7 @@ END_RCPP } // cpp_mast int cpp_mast(IntegerMatrix edge1, IntegerMatrix edge2, IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_mast(SEXP edge1SEXP, SEXP edge2SEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_mast(SEXP edge1SEXP, SEXP edge2SEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -72,7 +72,7 @@ END_RCPP } // cpp_nni_distance IntegerVector cpp_nni_distance(const IntegerMatrix edge1, const IntegerMatrix edge2, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_nni_distance(SEXP edge1SEXP, SEXP edge2SEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_nni_distance(SEXP edge1SEXP, SEXP edge2SEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -85,7 +85,7 @@ END_RCPP } // cpp_robinson_foulds_distance List cpp_robinson_foulds_distance(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_robinson_foulds_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_robinson_foulds_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -98,7 +98,7 @@ END_RCPP } // cpp_robinson_foulds_info List cpp_robinson_foulds_info(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_robinson_foulds_info(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_robinson_foulds_info(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -111,7 +111,7 @@ END_RCPP } // cpp_matching_split_distance List cpp_matching_split_distance(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_matching_split_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_matching_split_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -124,7 +124,7 @@ END_RCPP } // cpp_jaccard_similarity List cpp_jaccard_similarity(const RawMatrix x, const RawMatrix y, const IntegerVector nTip, const NumericVector k, const LogicalVector allowConflict); -RcppExport SEXP _TreeDist_cpp_jaccard_similarity(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP, SEXP kSEXP, SEXP allowConflictSEXP) { +RcppExport SEXP _BigTreeDist_cpp_jaccard_similarity(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP, SEXP kSEXP, SEXP allowConflictSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -139,7 +139,7 @@ END_RCPP } // cpp_msi_distance List cpp_msi_distance(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_msi_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_msi_distance(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -152,7 +152,7 @@ END_RCPP } // cpp_mutual_clustering List cpp_mutual_clustering(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_mutual_clustering(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_mutual_clustering(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -165,7 +165,7 @@ END_RCPP } // cpp_shared_phylo List cpp_shared_phylo(const RawMatrix x, const RawMatrix y, const IntegerVector nTip); -RcppExport SEXP _TreeDist_cpp_shared_phylo(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { +RcppExport SEXP _BigTreeDist_cpp_shared_phylo(SEXP xSEXP, SEXP ySEXP, SEXP nTipSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -178,23 +178,23 @@ END_RCPP } static const R_CallMethodDef CallEntries[] = { - {"_TreeDist_COMCLUST", (DL_FUNC) &_TreeDist_COMCLUST, 1}, - {"_TreeDist_consensus_info", (DL_FUNC) &_TreeDist_consensus_info, 3}, - {"_TreeDist_robinson_foulds_all_pairs", (DL_FUNC) &_TreeDist_robinson_foulds_all_pairs, 1}, - {"_TreeDist_lapjv", (DL_FUNC) &_TreeDist_lapjv, 2}, - {"_TreeDist_cpp_mast", (DL_FUNC) &_TreeDist_cpp_mast, 3}, - {"_TreeDist_cpp_nni_distance", (DL_FUNC) &_TreeDist_cpp_nni_distance, 3}, - {"_TreeDist_cpp_robinson_foulds_distance", (DL_FUNC) &_TreeDist_cpp_robinson_foulds_distance, 3}, - {"_TreeDist_cpp_robinson_foulds_info", (DL_FUNC) &_TreeDist_cpp_robinson_foulds_info, 3}, - {"_TreeDist_cpp_matching_split_distance", (DL_FUNC) &_TreeDist_cpp_matching_split_distance, 3}, - {"_TreeDist_cpp_jaccard_similarity", (DL_FUNC) &_TreeDist_cpp_jaccard_similarity, 5}, - {"_TreeDist_cpp_msi_distance", (DL_FUNC) &_TreeDist_cpp_msi_distance, 3}, - {"_TreeDist_cpp_mutual_clustering", (DL_FUNC) &_TreeDist_cpp_mutual_clustering, 3}, - {"_TreeDist_cpp_shared_phylo", (DL_FUNC) &_TreeDist_cpp_shared_phylo, 3}, + {"_BigTreeDist_COMCLUST", (DL_FUNC) &_BigTreeDist_COMCLUST, 1}, + {"_BigTreeDist_consensus_info", (DL_FUNC) &_BigTreeDist_consensus_info, 3}, + {"_BigTreeDist_robinson_foulds_all_pairs", (DL_FUNC) &_BigTreeDist_robinson_foulds_all_pairs, 1}, + {"_BigTreeDist_lapjv", (DL_FUNC) &_BigTreeDist_lapjv, 2}, + {"_BigTreeDist_cpp_mast", (DL_FUNC) &_BigTreeDist_cpp_mast, 3}, + {"_BigTreeDist_cpp_nni_distance", (DL_FUNC) &_BigTreeDist_cpp_nni_distance, 3}, + {"_BigTreeDist_cpp_robinson_foulds_distance", (DL_FUNC) &_BigTreeDist_cpp_robinson_foulds_distance, 3}, + {"_BigTreeDist_cpp_robinson_foulds_info", (DL_FUNC) &_BigTreeDist_cpp_robinson_foulds_info, 3}, + {"_BigTreeDist_cpp_matching_split_distance", (DL_FUNC) &_BigTreeDist_cpp_matching_split_distance, 3}, + {"_BigTreeDist_cpp_jaccard_similarity", (DL_FUNC) &_BigTreeDist_cpp_jaccard_similarity, 5}, + {"_BigTreeDist_cpp_msi_distance", (DL_FUNC) &_BigTreeDist_cpp_msi_distance, 3}, + {"_BigTreeDist_cpp_mutual_clustering", (DL_FUNC) &_BigTreeDist_cpp_mutual_clustering, 3}, + {"_BigTreeDist_cpp_shared_phylo", (DL_FUNC) &_BigTreeDist_cpp_shared_phylo, 3}, {NULL, NULL, 0} }; -RcppExport void R_init_TreeDist(DllInfo *dll) { +RcppExport void R_init_BigTreeDist(DllInfo *dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); } diff --git a/src/day_1985.cpp b/src/day_1985.cpp index 4cdc640e..ba5cee75 100644 --- a/src/day_1985.cpp +++ b/src/day_1985.cpp @@ -4,10 +4,10 @@ using namespace Rcpp; #include "tree_distances.h" /* includes */ #include "information.h" -#include /* for root_on_node() */ -#include /* for root_on_node() */ -#include /* for ClusterTable() */ -using TreeTools::ClusterTable; +#include /* for root_on_node() */ +#include /* for root_on_node() */ +#include /* for ClusterTable() */ +using BigTreeTools::ClusterTable; #include /* for array */ #include /* for bitset */ diff --git a/src/information.h b/src/information.h index 6e0d95cb..e186d44c 100644 --- a/src/information.h +++ b/src/information.h @@ -2,7 +2,7 @@ #define _TREEDIST_INFO_H #include /* for log2() */ -#include /* for CT_MAX_LEAVES */ +#include /* for CT_MAX_LEAVES */ #include "ints.h" /* for int16 */ diff --git a/src/nni_distance.cpp b/src/nni_distance.cpp index bbc88d79..ad6e9c71 100644 --- a/src/nni_distance.cpp +++ b/src/nni_distance.cpp @@ -1,13 +1,13 @@ #include -#include +#include #include #include "tree_distances.h" using namespace Rcpp; -using TreeTools::SplitList; -using TreeTools::powers_of_two; +using BigTreeTools::SplitList; +using BigTreeTools::powers_of_two; #define PARENT1(i) edge1(i, 0) #define PARENT2(i) edge2(i, 0) diff --git a/src/tree_distance_functions.cpp b/src/tree_distance_functions.cpp index 75a5ef83..cdc5b7e8 100644 --- a/src/tree_distance_functions.cpp +++ b/src/tree_distance_functions.cpp @@ -1,5 +1,5 @@ #include -#include /* for SL_MAX_TIPS */ +#include /* for SL_MAX_TIPS */ #include /* for log2() */ diff --git a/src/tree_distances.cpp b/src/tree_distances.cpp index 51b38238..8af519f7 100644 --- a/src/tree_distances.cpp +++ b/src/tree_distances.cpp @@ -1,15 +1,15 @@ -#include +#include #include #include /* for unique_ptr, make_unique */ #include #include "tree_distances.h" using namespace Rcpp; -using TreeTools::SplitList; -using TreeTools::bitcounts; -using TreeTools::count_bits; +using BigTreeTools::SplitList; +using BigTreeTools::bitcounts; +using BigTreeTools::count_bits; -TREETOOLS_SPLITLIST_INIT +BIGTREETOOLS_SPLITLIST_INIT // [[Rcpp::export]] List cpp_robinson_foulds_distance (const RawMatrix x, const RawMatrix y, @@ -28,26 +28,26 @@ List cpp_robinson_foulds_distance (const RawMatrix x, const RawMatrix y, for (int16 i = a.n_splits; i--; ) matching[i] = NA_INTEGER; splitbit b_complement[SL_MAX_SPLITS][SL_MAX_BINS]; - for (int16 i = b.n_splits; i--; ) { - for (int16 bin = last_bin; bin--; ) { + for (int32 i = b.n_splits; i--; ) { + for (int32 bin = last_bin; bin--; ) { b_complement[i][bin] = ~b.state[i][bin]; } b_complement[i][last_bin] = b.state[i][last_bin] ^ unset_mask; } - for (int16 ai = a.n_splits; ai--; ) { - for (int16 bi = b.n_splits; bi--; ) { + for (int32 ai = a.n_splits; ai--; ) { + for (int32 bi = b.n_splits; bi--; ) { bool all_match = true, all_complement = true; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { if ((a.state[ai][bin] != b.state[bi][bin])) { all_match = false; break; } } if (!all_match) { - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { if ((a.state[ai][bin] != b_complement[bi][bin])) { all_complement = false; break; @@ -87,26 +87,26 @@ List cpp_robinson_foulds_info (const RawMatrix x, const RawMatrix y, /* Dynamic allocation 20% faster for 105 tips, but VLA not permitted in C11 */ splitbit b_complement[SL_MAX_SPLITS][SL_MAX_BINS]; - for (int16 i = 0; i != b.n_splits; i++) { - for (int16 bin = 0; bin != last_bin; ++bin) { + for (int32 i = 0; i != b.n_splits; i++) { + for (int32 bin = 0; bin != last_bin; ++bin) { b_complement[i][bin] = ~b.state[i][bin]; } b_complement[i][last_bin] = b.state[i][last_bin] ^ unset_mask; } - for (int16 ai = 0; ai != a.n_splits; ++ai) { - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { bool all_match = true, all_complement = true; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { if ((a.state[ai][bin] != b.state[bi][bin])) { all_match = false; break; } } if (!all_match) { - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { if ((a.state[ai][bin] != b_complement[bi][bin])) { all_complement = false; break; @@ -115,7 +115,7 @@ List cpp_robinson_foulds_info (const RawMatrix x, const RawMatrix y, } if (all_match || all_complement) { int16 leaves_in_split = 0; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { leaves_in_split += count_bits(a.state[ai][bin]); } @@ -154,20 +154,20 @@ List cpp_matching_split_distance (const RawMatrix x, const RawMatrix y, cost** score = new cost*[most_splits]; for (int16 i = most_splits; i--; ) score[i] = new cost[most_splits]; - for (int16 ai = 0; ai != a.n_splits; ++ai) { - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { score[ai][bi] = 0; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { score[ai][bi] += count_bits(a.state[ai][bin] ^ b.state[bi][bin]); } if (score[ai][bi] > half_tips) score[ai][bi] = n_tips - score[ai][bi]; } - for (int16 bi = b.n_splits; bi < most_splits; ++bi) { + for (int32 bi = b.n_splits; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } - for (int16 ai = a.n_splits; ai < most_splits; ++ai) { - for (int16 bi = 0; bi != most_splits; ++bi) { + for (int32 ai = a.n_splits; ai < most_splits; ++ai) { + for (int32 bi = 0; bi != most_splits; ++bi) { score[ai][bi] = max_score; } } @@ -217,18 +217,18 @@ List cpp_jaccard_similarity (const RawMatrix x, const RawMatrix y, cost** score = new cost*[most_splits]; for (int16 i = most_splits; i--; ) score[i] = new cost[most_splits]; - for (int16 ai = 0; ai != a.n_splits; ++ai) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { const int16 na = a.in_split[ai], nA = n_tips - na ; - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { // x divides tips into a|A; y divides tips into b|B int16 a_and_b = 0; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { a_and_b += count_bits(a.state[ai][bin] & b.state[bi][bin]); } @@ -282,12 +282,12 @@ List cpp_jaccard_similarity (const RawMatrix x, const RawMatrix y, } } } - for (int16 bi = b.n_splits; bi < most_splits; ++bi) { + for (int32 bi = b.n_splits; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } - for (int16 ai = a.n_splits; ai < most_splits; ++ai) { - for (int16 bi = 0; bi != most_splits; ++bi) { + for (int32 ai = a.n_splits; ai < most_splits; ++ai) { + for (int32 bi = 0; bi != most_splits; ++bi) { score[ai][bi] = max_score; } } @@ -332,14 +332,14 @@ List cpp_msi_distance (const RawMatrix x, const RawMatrix y, splitbit different[SL_MAX_BINS]; - for (int16 ai = 0; ai != a.n_splits; ++ai) { - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { int16 n_different = 0, n_a_only = 0, n_a_and_b = 0 ; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { different[bin] = a.state[ai][bin] ^ b.state[bi][bin]; n_different += count_bits(different[bin]); n_a_only += count_bits(a.state[ai][bin] & different[bin]); @@ -351,12 +351,12 @@ List cpp_msi_distance (const RawMatrix x, const RawMatrix y, ((max_score / max_possible) * mmsi_score(n_same, n_a_and_b, n_different, n_a_only)); } - for (int16 bi = b.n_splits; bi < most_splits; ++bi) { + for (int32 bi = b.n_splits; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } - for (int16 ai = a.n_splits; ai < most_splits; ++ai) { - for (int16 bi = 0; bi < most_splits; ++bi) { + for (int32 ai = a.n_splits; ai < most_splits; ++ai) { + for (int32 bi = 0; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } @@ -388,10 +388,12 @@ List cpp_msi_distance (const RawMatrix x, const RawMatrix y, // [[Rcpp::export]] List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, const IntegerVector nTip) { + Rcpp::Rcout << "\n\n\n\nASOUIGHAUI SFH ASHF KLASJHF KAJSF \n\n\n\n"; if (x.cols() != y.cols()) { Rcpp::stop("Input splits must address same number of tips."); } const SplitList a(x), b(y); + Rcpp::Rcout << "\n\n\n\nSPLITS LISTED \n\n\n\n"; const bool a_has_more_splits = (a.n_splits > b.n_splits); const int16 most_splits = a_has_more_splits ? a.n_splits : b.n_splits, @@ -414,18 +416,18 @@ List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, NumericVector a_match(a.n_splits); std::unique_ptr b_match = std::make_unique(b.n_splits); - for (int16 ai = 0; ai != a.n_splits; ++ai) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { if (a_match[ai]) continue; const int16 na = a.in_split[ai], nA = n_tips - na ; - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { // x divides tips into a|A; y divides tips into b|B int16 a_and_b = 0; - for (int16 bin = 0; bin != a.n_bins; ++bin) { + for (int32 bin = 0; bin != a.n_bins; ++bin) { a_and_b += count_bits(a.state[ai][bin] & b.state[bi][bin]); } @@ -461,7 +463,7 @@ List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, ); } } - for (int16 bi = b.n_splits; bi < most_splits; ++bi) { + for (int32 bi = b.n_splits; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } @@ -482,21 +484,21 @@ List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, if (exact_matches) { int16 a_pos = 0; - for (int16 ai = 0; ai != a.n_splits; ++ai) { + for (int32 ai = 0; ai != a.n_splits; ++ai) { if (a_match[ai]) continue; int16 b_pos = 0; - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { if (b_match[bi]) continue; score[a_pos][b_pos] = score[ai][bi]; b_pos++; } - for (int16 bi = lap_dim - a_extra_splits; bi < lap_dim; ++bi) { + for (int32 bi = lap_dim - a_extra_splits; bi < lap_dim; ++bi) { score[a_pos][bi] = max_score; } a_pos++; } - for (int16 ai = lap_dim - b_extra_splits; ai < lap_dim; ++ai) { - for (int16 bi = 0; bi != lap_dim; ++bi) { + for (int32 ai = lap_dim - b_extra_splits; ai < lap_dim; ++ai) { + for (int32 bi = 0; bi != lap_dim; ++bi) { score[ai][bi] = max_score; } } @@ -512,7 +514,7 @@ List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, std::unique_ptr lap_decode = std::make_unique(lap_dim); int16 fuzzy_match = 0; - for (int16 bi = 0; bi != b.n_splits; ++bi) { + for (int32 bi = 0; bi != b.n_splits; ++bi) { if (!b_match[bi]) { assert(fuzzy_match < lap_dim); lap_decode[fuzzy_match++] = bi + 1; @@ -547,8 +549,8 @@ List cpp_mutual_clustering (const RawMatrix x, const RawMatrix y, return List::create(Named("score") = final_score, _["matching"] = final_matching); } else { - for (int16 ai = a.n_splits; ai < most_splits; ++ai) { - for (int16 bi = 0; bi != most_splits; ++bi) { + for (int32 ai = a.n_splits; ai < most_splits; ++ai) { + for (int32 bi = 0; bi != most_splits; ++bi) { score[ai][bi] = max_score; } } @@ -597,8 +599,8 @@ List cpp_shared_phylo (const RawMatrix x, const RawMatrix y, cost** score = new cost*[most_splits]; for (int16 i = most_splits; i--; ) score[i] = new cost[most_splits]; - for (int16 ai = a.n_splits; ai--; ) { - for (int16 bi = b.n_splits; bi--; ) { + for (int32 ai = a.n_splits; ai--; ) { + for (int32 bi = b.n_splits; bi--; ) { const double spi_over = spi_overlap(a.state[ai], b.state[bi], n_tips, a.in_split[ai], b.in_split[bi], a.n_bins); @@ -608,12 +610,12 @@ List cpp_shared_phylo (const RawMatrix x, const RawMatrix y, max_score; } - for (int16 bi = b.n_splits; bi < most_splits; ++bi) { + for (int32 bi = b.n_splits; bi < most_splits; ++bi) { score[ai][bi] = max_score; } } - for (int16 ai = a.n_splits; ai < most_splits; ++ai) { - for (int16 bi = 0; bi != most_splits; ++bi) { + for (int32 ai = a.n_splits; ai < most_splits; ++ai) { + for (int32 bi = 0; bi != most_splits; ++bi) { score[ai][bi] = max_score; } } diff --git a/src/tree_distances.h b/src/tree_distances.h index c4182f3d..2d2e4ef9 100644 --- a/src/tree_distances.h +++ b/src/tree_distances.h @@ -1,7 +1,7 @@ #ifndef _TREEDIST_TREE_DISTANCES_H #define _TREEDIST_TREE_DISTANCES_H -#include +#include #include #include /* for numeric_limits */ diff --git a/tests/testthat.R b/tests/testthat.R index 497eca5c..b84daabe 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,4 +1,4 @@ library("testthat", warn.conflicts = FALSE) -library("TreeDist") +library("BigTreeDist") -test_check("TreeDist") +test_check("BigTreeDist") diff --git a/tests/testthat/test-parallel.R b/tests/testthat/test-parallel.R index 92f092bc..0e2d7d30 100644 --- a/tests/testthat/test-parallel.R +++ b/tests/testthat/test-parallel.R @@ -1,5 +1,5 @@ test_that("Parallelization works", { - library("TreeTools") + library("BigTreeTools") trees <- as.phylo(0:20, 20) suppressMessages({ diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 05a2d367..623e79d1 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -3,7 +3,7 @@ library("TreeTools") test_that("TreeDistPlot() warns", { expect_warning( expect_warning( - expect_null(TreeDist::TreeDistPlot(PectinateTree(8))), + expect_null(BigTreeDist::TreeDistPlot(PectinateTree(8))), "Leaves.*must be labelled with integers"), "fewer than 2 tips" # From plot.phylo: I don't understand why! ) @@ -13,13 +13,13 @@ test_that("TreeDistPlot() works", { tr <- PectinateTree(1:11) tr$edge.width <- rep(1:2, 10) Test1 <- function() { - TreeDist::TreeDistPlot(tr, title = "Test", + BigTreeDist::TreeDistPlot(tr, title = "Test", bold = c(2, 4, 6), leaveRoom = TRUE, prune = 1, graft = 10) } Test2 <- function() { - TreeDist::TreeDistPlot(tr, title="Crop tightly", + BigTreeDist::TreeDistPlot(tr, title="Crop tightly", bold = c(2, 4, 6), prune = 11, graft = 10, leaveRoom = FALSE) } diff --git a/tests/testthat/test-tree_distance.R b/tests/testthat/test-tree_distance.R index 46248938..b85d3920 100644 --- a/tests/testthat/test-tree_distance.R +++ b/tests/testthat/test-tree_distance.R @@ -603,37 +603,37 @@ test_that("Matchings are correct", { } - Test(TreeDist:::cpp_robinson_foulds_distance, + Test(BigTreeDist:::cpp_robinson_foulds_distance, list(NA, 2, NA, 3, NA, NA, 5, NA), list(NA, 2, 4, NA, 7, NA) ) - Test(TreeDist:::cpp_robinson_foulds_info, + Test(BigTreeDist:::cpp_robinson_foulds_info, list(NA, 2, NA, 3, NA, NA, 5, NA), list(NA, 2, 4, NA, 7, NA) ) - Test(TreeDist:::cpp_matching_split_distance, + Test(BigTreeDist:::cpp_matching_split_distance, list(1, 2, 4, 3, NA, NA, 5, 6), list(1, 2, 5, 4, 7, 6) ) - Test(TreeDist:::cpp_jaccard_similarity, + Test(BigTreeDist:::cpp_jaccard_similarity, list(NA, 2, 1, 3, 4, 6, 5, NA), list(3, 2, 4, 5, 7, 6), k = 2, allowConflict = TRUE) - Test(TreeDist:::cpp_jaccard_similarity, + Test(BigTreeDist:::cpp_jaccard_similarity, list(NA, 2, 1, 3, NA, 6, 5, 4), list(3, 2, 4, 1, 7, 6), k = 2, allowConflict = FALSE) - Test(TreeDist:::cpp_msi_distance, + Test(BigTreeDist:::cpp_msi_distance, list(NA, 2, 1, 4, 3, 6, 5, NA), list(3, 2, c(4, 5), c(4, 5), c(6, 7), c(7, 6)) ) - Test(TreeDist:::cpp_shared_phylo, + Test(BigTreeDist:::cpp_shared_phylo, list(NA, 2, 4, 3, 1, 6, 5, NA), list(5, 2, 4, 3, 7, 6) ) - Test(TreeDist:::cpp_mutual_clustering, + Test(BigTreeDist:::cpp_mutual_clustering, list(4, 2, NA, 3, 6, NA, 5, 1), list(8, 2, 4, 5, 7, 1) ) diff --git a/vignettes/Generalized-RF.Rmd b/vignettes/Generalized-RF.Rmd index 90815f4d..e4deb387 100644 --- a/vignettes/Generalized-RF.Rmd +++ b/vignettes/Generalized-RF.Rmd @@ -12,7 +12,7 @@ vignette: > ```{r init, message=FALSE, warning=FALSE, echo = FALSE} library('ape') -library('TreeDist') +library('BigTreeDist') tree1 <- read.tree(text='((A, B), ((C, (D, E)), (F, (G, (H, I)))));') tree2 <- read.tree(text='((A, B), ((C, D, (E, I)), (F, (G, H))));') AtoJ <- read.tree(text='(((((A, B), C), D), E), (F, (G, (H, (I, J)))));') diff --git a/vignettes/Robinson-Foulds.Rmd b/vignettes/Robinson-Foulds.Rmd index 9ea5b7f3..1782edbc 100644 --- a/vignettes/Robinson-Foulds.Rmd +++ b/vignettes/Robinson-Foulds.Rmd @@ -12,7 +12,7 @@ vignette: > ```{r init, echo=FALSE, warning=FALSE, message=FALSE} library('ape') -library('TreeDist') +library('BigTreeDist') standardMargin <- c(0.4, 0.4, 0.8, 0.4) cbPalette8 <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7") diff --git a/vignettes/Using-TreeDist.Rmd b/vignettes/Using-TreeDist.Rmd index 86458f6f..4d8fd388 100644 --- a/vignettes/Using-TreeDist.Rmd +++ b/vignettes/Using-TreeDist.Rmd @@ -33,7 +33,7 @@ First we'll install the package. We can either install the stable version from the CRAN repository: ```r -install.packages('TreeDist') +install.packages('BigTreeDist') ``` or the development version, from GitHub -- which will contain the latest @@ -46,7 +46,7 @@ devtools::install_github('ms609/TreeDist') Then we'll load the package in to R's working environment: ```{r load-package, message=FALSE} -library('TreeDist') +library('BigTreeDist') ``` Now the package's functions are available within R. diff --git a/vignettes/compare-treesets.Rmd b/vignettes/compare-treesets.Rmd index b835a087..7a4d52eb 100644 --- a/vignettes/compare-treesets.Rmd +++ b/vignettes/compare-treesets.Rmd @@ -54,7 +54,7 @@ styles <- c(1, 2) # Select plotting colours / symbols treeStyle <- rep(styles, c(length(batch1), length(batch2))) # Calculate distances -library("TreeDist") +library("BigTreeDist") distances <- ClusteringInfoDistance(c(batch1, batch2)) # Construct over-simple 2D PCoA mapping diff --git a/vignettes/different-leaves.Rmd b/vignettes/different-leaves.Rmd index 7463d08b..c94a7eab 100644 --- a/vignettes/different-leaves.Rmd +++ b/vignettes/different-leaves.Rmd @@ -60,7 +60,7 @@ The information held in common between the trees is thus equal to the information held in common if only the common leaves are retained: ```{r drop-some} -library("TreeDist") +library("BigTreeDist") commonTips <- intersect(TipLabels(balAL), TipLabels(balCL)) # How much information is in tree balCL? diff --git a/vignettes/information.Rmd b/vignettes/information.Rmd index 0409d329..d7cf065c 100644 --- a/vignettes/information.Rmd +++ b/vignettes/information.Rmd @@ -85,7 +85,7 @@ These quantities can be calculated using functions in the ```{r} library("TreeTools", quietly = TRUE) -library("TreeDist") +library("BigTreeDist") treesMatchingSplit <- c( AB.CDEF = TreesMatchingSplit(2, 4), ABC.DEF = TreesMatchingSplit(3, 3) @@ -183,7 +183,7 @@ statement from the other; the maximum entropy distance occurs when the two statements are entirely independent. ```{r mackay-8-1, echo=FALSE, fig.width=4, out.width='50%', fig.height=3, fig.align='center'} -library('TreeDist') +library('BigTreeDist') H <- function(inBracket) { expression(paste(italic('H'), plain('('), italic(inBracket), plain(')'))) } diff --git a/vignettes/landscapes.Rmd b/vignettes/landscapes.Rmd index d3d2bd19..c9884517 100644 --- a/vignettes/landscapes.Rmd +++ b/vignettes/landscapes.Rmd @@ -32,7 +32,7 @@ score: ```{r col-trees-by-score} # Load required libraries library("TreeTools", quietly = TRUE) -library("TreeDist") +library("BigTreeDist") # Generate a set of trees trees <- as.phylo(as.TreeNumber(BalancedTree(16)) + 0:100 - 15, 16) @@ -126,4 +126,4 @@ if (requireNamespace("plotly", quietly = TRUE)) { (Use the mouse to reorient) -# References \ No newline at end of file +# References diff --git a/vignettes/treespace.Rmd b/vignettes/treespace.Rmd index ea2400c3..deee12e7 100644 --- a/vignettes/treespace.Rmd +++ b/vignettes/treespace.Rmd @@ -37,8 +37,8 @@ the "TreeDist" R package. Simply install [R](https://www.r-project.org/) or line: ```r -install.packages("TreeDist") -TreeDist::MapTrees() +install.packages("BigTreeDist") +BigTreeDist::MapTrees() ``` This will allow you to conduct and evaluate basic tree space mappings @@ -76,7 +76,7 @@ The clustering information distance [@SmithDist] is a reliable alternative that is fast to calculate: ```{r calculate-distances, message=FALSE} -library("TreeDist") +library("BigTreeDist") distances <- ClusteringInfoDistance(trees) ``` @@ -301,7 +301,7 @@ two-dimensional tree space plot: ```{r pid, fig.asp = 1, fig.width = 4, fig.align = "center", echo = FALSE, message = FALSE} -library("TreeDist") +library("BigTreeDist") pid_distances <- PhylogeneticInfoDistance(trees) pid_mapping <- cmdscale(pid_distances, k = 6) pid_cluster <- cutree(protoclust(pid_distances), k = 2) diff --git a/vignettes/using-distances.Rmd b/vignettes/using-distances.Rmd index 3638acea..83ce4e51 100644 --- a/vignettes/using-distances.Rmd +++ b/vignettes/using-distances.Rmd @@ -37,7 +37,7 @@ Let's work through a simple example using the Nye _et al_. [-@Nye2006] similarity metric to compare two imperfectly-resolved trees. ```{r, fig.width=6, out.width="90%", fig.align="center"} -library("TreeDist") +library("BigTreeDist") tree1 <- ape::read.tree(text = '(A, ((B, ((C, D), (E, F))), (G, (H, (I, J, K)))));') tree2 <- ape::read.tree(text = '(A, (B, (C, D, E, (J, K)), (F, (G, H, I))));') VisualizeMatching(NyeSimilarity, tree1, tree2,