Skip to content
Merged
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
12 changes: 0 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ S3method(DropTip,Splits)
S3method(DropTip,list)
S3method(DropTip,multiPhylo)
S3method(DropTip,phylo)
S3method(EnforceOutgroup,character)
S3method(EnforceOutgroup,phylo)
S3method(KeepTip,"NULL")
S3method(KeepTip,Splits)
S3method(KeepTip,list)
Expand Down Expand Up @@ -264,7 +262,6 @@ export(AddTip)
export(AddTipEverywhere)
export(AddUnconstrained)
export(AllAncestors)
export(AllDescendantEdges)
export(AllTipLabels)
export(AncestorEdge)
export(ApePostorder)
Expand Down Expand Up @@ -293,7 +290,6 @@ export(DropTipPhylo)
export(EdgeAncestry)
export(EdgeDistances)
export(EndSentence)
export(EnforceOutgroup)
export(ExtractTaxa)
export(Hamming)
export(IC1Spr)
Expand Down Expand Up @@ -375,8 +371,6 @@ export(PhyDatToMatrix)
export(PhyDatToString)
export(PhyToString)
export(PhydatToString)
export(PhylogeneticInfo)
export(PhylogeneticInformation)
export(PolarizeSplits)
export(Postorder)
export(PostorderOrder)
Expand Down Expand Up @@ -411,7 +405,6 @@ export(SampleOne)
export(SingleTaxonTree)
export(SisterSize)
export(SortTree)
export(SpectrumLegend)
export(SplitConflicts)
export(SplitConsistent)
export(SplitFrequency)
Expand Down Expand Up @@ -476,7 +469,6 @@ importFrom(RCurl,url.exists)
importFrom(Rdpack,reprompt)
importFrom(ape,all.equal.phylo)
importFrom(ape,as.phylo)
importFrom(ape,bind.tree)
importFrom(ape,cophenetic.phylo)
importFrom(ape,edgelabels)
importFrom(ape,is.rooted)
Expand All @@ -495,10 +487,6 @@ importFrom(grDevices,rgb)
importFrom(graphics,legend)
importFrom(graphics,lines)
importFrom(graphics,par)
importFrom(graphics,segments)
importFrom(graphics,strheight)
importFrom(graphics,strwidth)
importFrom(graphics,text)
importFrom(methods,new)
importFrom(methods,setClass)
importFrom(methods,setMethod)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
- Require R 3.6
- Remove R.cache dependency: `UnrootedKeys()` now uses a native cache implementation.
- Remove deprecated functions `TreeSplits()`, `ForestSplits()`, `SplitNumber()`,
`in.Splits()`.
`in.Splits()`, `AllDescendantEdges()`, `PhylogeneticInfo()`,
`.EnforceOutgroup()`, `SpectrumLegend()`.
- Remove deprecated C++ macro `TREETOOLS_SPLITLIST_INIT`.


# TreeTools 1.16.1 (2025-08-24) #
Expand Down
2 changes: 1 addition & 1 deletion R/RoguePlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ RoguePlot <- function(trees, tip, p = 1, plot = TRUE,
fat, thin),
...)
if (legend != "none") {
PlotTools::SpectrumLegend(
SpectrumLegend(
legend,
bty = "n",
palette = pal,
Expand Down
89 changes: 0 additions & 89 deletions R/helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,92 +98,3 @@ replicate64 <- function(n, expr, simplify = "array") {
sapply64(integer(n), eval.parent(substitute(function(...) expr)),
simplify = simplify)
}

#nocov start
#' Produce a legend for continuous gradient scales
#'
#' Prints an annotated vertical bar coloured according to a continuous palette.
#'
#' This function is now deprecated; it has been superseded by the more capable
#' [`PlotTools::SpectrumLegend()`] and will be removed in a future release.
# Deprecation notice added in TreeTools 1.9.2 (2023-04-25)
#'
#' @param x0,y0,x1,y1 Coordinates of the bottom-left and top-right end of the
#' bar.
#' @param absolute Logical specifying whether `x` and `y` values denote
#' coordinates (`TRUE`) or relative position, where (0, 0) denotes the
#' bottom-left of the plot area and (1, 1) the top right.
#' @param legend Character vector with which to label points on `palette`.
#' @param palette Colour palette to depict.
#' @param lwd,lty,lend Additional parameters to [`segments()`],
#' controlling line style.
#' @param cex Character expansion factor relative to current `par("cex")`.
#' @param text.col Colour used for the legend text.
#' @param font,text.font Font used for the legend text; see [`text()`].
#' @param title Text to display
#' @param title.col Colour for title; defaults to `text.col[1]`.
#' @param title.cex Expansion factor(s) for the title, defaults to `cex[1]`.
#' @param title.adj Horizontal adjustment for title: see the help for
#' `par("adj")`.
#' @param title.font Font used for the legend title.
#' @param pos,\dots Additional parameters to [`text()`].
#'
#' @template MRS
#' @importFrom graphics segments strheight strwidth text
#' @keywords internal
#' @export
SpectrumLegend <- function(x0 = 0.05, y0 = 0.05,
x1 = x0, y1 = y0 + 0.2,
absolute = FALSE,
legend = character(0), palette,
lwd = 4, lty = 1, lend = "square", cex = 1,
text.col = par("col"),
font = NULL, text.font = font,
title = NULL, title.col = text.col[1],
title.cex = cex[1], title.adj = 0.5, title.font = 2,
pos = 4,
...) {

.Deprecated("PlotTools::SpectrumLegend", package = "PlotTools")

nCol <- length(palette)

if (!absolute) {
corners <- par("usr") # x0 x1 y0 y1
xRange <- corners[2] - corners[1]
yRange <- corners[4] - corners[3]

# Order is important: lazy evaluation will set x1 = modified x0
x1 <- corners[1] + (x1 * xRange)
x0 <- corners[1] + (x0 * xRange)
y1 <- corners[3] + (y1 * yRange)
y0 <- corners[3] + (y0 * yRange)
}

segX <- x0 + ((x1 - x0) * 0:nCol / nCol)
segY <- y0 + ((y1 - y0) * 0:nCol / nCol)

nPlus1 <- nCol + 1L
segments(segX[-nPlus1], segY[-nPlus1],
segX[-1], segY[-1],
col = palette,
lwd = lwd, lty = lty, lend = lend)
text(seq(x0, x1, length.out = length(legend)),
seq(y0, y1, length.out = length(legend)),
col = text.col,
cex = cex,
font = text.font,
legend, pos = pos, ...)
if (!is.null(title)) {
text(mean(x0, x1) + (max(strwidth(legend)) / ifelse(pos == 2, -2, 2)),
max(y0, y1) + prod(
par("lheight"),
strheight("")
),
title,
pos = 3,
cex = title.cex, adj = title.adj, font = title.font, col = title.col,
...)
}
}
#nocov end
3 changes: 0 additions & 3 deletions R/match.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#' a logical vector indicating whether there is a match or not for each
#' split in its left operand.
#'
#' `in.Splits()` is an alias for `%in%`, included for backwards compatibility.
#' It is deprecated and will be removed in a future release.
#'
#' @param x,table Object of class `Splits`.
#' @param nomatch Integer value that will be used in place of `NA` in the case
#' where no match is found.
Expand Down
13 changes: 0 additions & 13 deletions R/tree_descendants.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ DescendantTips <- function(parent, child, edge = NULL,
}
}

#' @rdname DescendantEdges
#'
#' @return `AllDescendantEdges()` is deprecated; use `DescendantEdges()`
#' instead.
#' It returns a matrix of class logical, with row _N_ specifying whether each
#' edge is a descendant of edge _N_ (or the edge itself).
#'
#' @export
AllDescendantEdges <- function(parent, child, nEdge = length(parent)) {
.Deprecated("DescendantEdges")
.AllDescendantEdges(parent, child, nEdge)
}

.AllDescendantEdges <- function(parent, child, nEdge = length(parent)) {
ret <- diag(nEdge) == 1
blankLogical <- logical(nEdge)
Expand Down
70 changes: 1 addition & 69 deletions R/tree_generation.R
Original file line number Diff line number Diff line change
Expand Up @@ -482,75 +482,7 @@ ConstrainedNJ <- function(dataset, constraint, weight = 1L,
tree
}

#nocov begin
#' Generate a tree with a specified outgroup
#'
#' **Deprecated.** This function will be removed in a future version of
#' \pkg{TreeTools}.
#' Use `RootTree()` instead.
#'
#' Given a tree or a list of taxa, `EnforceOutgroup()` rearranged the ingroup
#' and outgroup taxa such that the two are sister taxa across the root, without
#' changing the relationships within the ingroup or within the outgroup.
#'
#' @param tree Either a tree of class \code{phylo}; or (for `EnforceOutgroup()`)
#' a character vector listing the names of all the taxa in the tree, from which
#' a random tree will be generated.
#' @param outgroup Character vector containing the names of taxa to include in
#' the outgroup.
#'
#' @return `EnforceOutgroup()` returned a tree of class `phylo` where all
#' outgroup taxa are sister to all remaining taxa, without modifying the
#' ingroup topology.
#'
# @examples
# tree <- EnforceOutgroup(letters[1:9], letters[1:3])
# plot(tree)
#
#' @seealso For a more robust implementation, see [`RootTree()`], which will
#' eventually replace this function
#' ([#30](https://github.com/ms609/TreeTools/issues/30)).
#'
#' @template MRS
#' @family tree manipulation
#' @export
EnforceOutgroup <- function(tree, outgroup) UseMethod("EnforceOutgroup")

#' @importFrom ape bind.tree
.EnforceOutgroup <- function(tree, outgroup, taxa) {
.Deprecated("RootTree")
if (length(outgroup) == 1L) {
return(RootTree(tree, outgroup))
}

ingroup <- taxa[!(taxa %fin% outgroup)]
if (!all(outgroup %fin% taxa) ||
length(ingroup) + length(outgroup) != length(taxa)) {
stop("All outgroup taxa must occur in tree")
}

ingroup.branch <- DropTip(tree, outgroup)
outgroup.branch <- DropTip(tree, ingroup)

result <- RootTree(bind.tree(outgroup.branch, ingroup.branch, 0, 1),
outgroup)
RenumberTips(Renumber(result), taxa)
}

#' @rdname EnforceOutgroup
#' @export
EnforceOutgroup.phylo <- function(tree, outgroup) {
.EnforceOutgroup(tree, outgroup, tree[["tip.label"]])
}

#' @rdname EnforceOutgroup
#' @export
EnforceOutgroup.character <- function(tree, outgroup) {
taxa <- tree
.EnforceOutgroup(RandomTree(taxa, taxa[1]), outgroup, taxa)
}
#nocov end

# Wrap an edge matrix as a tree in preorder
.PreorderTree <- function(edge,
tip.label,
Nnode = dim(edge)[[1]] + 1 - length(tip.label)) {
Expand Down
11 changes: 0 additions & 11 deletions R/tree_information.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ Log2TreesMatchingTree <- function(tree) {
#' @export
CladisticInfo <- function(x) UseMethod("CladisticInfo")

#' @rdname CladisticInfo
#' @export
PhylogeneticInfo <- function(x) { # nocov start
.Deprecated("CladisticInfo()")
UseMethod("CladisticInfo")
} # nocov end

#' @rdname CladisticInfo
#' @export
CladisticInfo.phylo <- function(x) {
Expand All @@ -105,10 +98,6 @@ CladisticInfo.list <- function(x) vapply(x, CladisticInfo, 0)
#' @export
CladisticInfo.multiPhylo <- CladisticInfo.list


#' @rdname CladisticInfo
#' @export
PhylogeneticInformation <- PhylogeneticInfo
#' @rdname CladisticInfo
#' @export
CladisticInformation <- CladisticInfo
3 changes: 1 addition & 2 deletions R/tree_numbering.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ RenumberTree <- function(parent, child, weight) {

#' @rdname Reorder
#'
#' @param \dots Deprecated; included for compatibility with previous versions.
#' @return `RenumberEdges()` formats the output of `RenumberTree()` into a list
#' whose two entries correspond to the new parent and child vectors,
#' in preorder.
#' @export
RenumberEdges <- function(parent, child, ...) {
RenumberEdges <- function(parent, child) {
oenn <- .Call(`_TreeTools_preorder_edges_and_nodes`, parent, child)

# Return:
Expand Down
2 changes: 1 addition & 1 deletion R/tree_shape.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ UnrootedTreeKey <- function(tree, asInteger = FALSE) {
.unrooted_keys_cache <- new.env(parent = emptyenv())

#' @rdname TreeShape
#' @param \dots Depreciated (2025-09); retained for backward compatibility.
#' @param \dots Deprecated (2025-09); retained for backward compatibility.
#' @return `UnrootedKeys()` returns a vector of integers corresponding to the
#' keys (not shape numbers) of unrooted tree shapes with `nTip` tips.
#' It is a wrapper to `.UnrootedKeys()`, with memoization, meaning that results
Expand Down
12 changes: 0 additions & 12 deletions inst/include/TreeTools/SplitList.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ using splitbit = uint_fast64_t;
splitbit(x(split, ((bin) * input_bins_per_bin) + (offset)))
#define INBIN(r_bin, bin) ((INSUBBIN((bin), (r_bin))) << (R_BIN_SIZE * (r_bin)))

// Retained for backward compatibility; not required since 1.15.0.9006
#define TREETOOLS_SPLITLIST_INIT __attribute__((constructor)) \
void _treetools_initialize_bitcounts() { \
for (int i = 65536; i--; ) { \
int16 n_bits = 0; \
for (int j = 16; j--; ) { \
if (i & (1 << j)) n_bits += 1; \
} \
TreeTools::bitcounts[i] = n_bits; \
} \
} \

namespace TreeTools {

constexpr int input_bins_per_bin = SL_BIN_SIZE / R_BIN_SIZE;
Expand Down
1 change: 0 additions & 1 deletion man/AddTip.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions man/CladisticInfo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/CollapseNode.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading