Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA run for more-leaves branch #108

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/memcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: TreeDist
Package: BigTreeDist
Type: Package
Title: Calculate and Map Distances Between Phylogenetic Trees
Version: 2.6.3.9001
Expand Down Expand Up @@ -48,7 +48,7 @@ Imports:
Rdpack (>= 0.7),
shiny,
shinyjs,
TreeTools (>= 1.7.2),
BigTreeTools (>= 1.7.2),
Suggests:
bookdown,
cluster,
Expand Down Expand Up @@ -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
Expand Down
54 changes: 27 additions & 27 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -182,4 +182,4 @@ importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,var)
importFrom(utils,combn)
useDynLib(TreeDist, .registration = TRUE)
useDynLib(BigTreeDist, .registration = TRUE)
16 changes: 8 additions & 8 deletions R/TreeDist-package.R → R/BigTreeDist-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions R/Information.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) +
Expand All @@ -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) +
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
#'
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

2 changes: 1 addition & 1 deletion R/cluster_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions R/kmeanspp.R
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
4 changes: 2 additions & 2 deletions R/lap.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#' 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).
#'
#' 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
#' `clue::solve_LSAP()`.
#'
#' Note: the JV algorithm expects integers. In order to apply the function
Expand Down
2 changes: 1 addition & 1 deletion R/median.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#'
#' @seealso Consensus methods:
#' [`ape::consensus()`],
#' [`TreeTools::ConsensusWithout()`]
#' [`BigTreeTools::ConsensusWithout()`]
#'
#' @importFrom stats median
#' @family tree space functions
Expand Down
8 changes: 4 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"))) {
Expand Down
Loading
Loading