diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 3935d785b..389663d00 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -47,8 +47,8 @@ jobs: config: - {os: windows-latest, r: 'release'} - {os: macOS-latest, r: 'release'} + - {os: ubuntu-20.04, r: '4.0', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: '4.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} # Until TreeDist can slough phangorn - #- {os: ubuntu-20.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} @@ -79,7 +79,7 @@ jobs: if: runner.os == 'macOS' run: | brew install libgit2 xquartz ghostscript - + - name: Set up R dependencies uses: r-lib/actions/setup-r-dependencies@v2 with: diff --git a/.github/workflows/gcc-ASAN.yml b/.github/workflows/gcc-ASAN.yml index 61390a044..46245981d 100644 --- a/.github/workflows/gcc-ASAN.yml +++ b/.github/workflows/gcc-ASAN.yml @@ -66,7 +66,7 @@ jobs: - name: Setup pandoc if: ${{ matrix.config.test }} == 'vignettes' - uses: r-lib/actions/setup-pandoc@master + uses: r-lib/actions/setup-pandoc@v2 - name: Query dependencies run: | diff --git a/.github/workflows/update-csl.yml b/.github/workflows/update-csl.yml new file mode 100644 index 000000000..0753d13a6 --- /dev/null +++ b/.github/workflows/update-csl.yml @@ -0,0 +1,31 @@ +name: Update CSL file +on: + schedule: + - cron: '0 0 * * 1' # Runs weekly on Monday at 00:00 UTC + workflow_dispatch: # Allows manual triggering + +jobs: + update-csl: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download latest CSL file + run: | + curl -o inst/apa-old-doi-prefix.csl https://raw.githubusercontent.com/citation-style-language/styles/master/apa-old-doi-prefix.csl + + - name: Check for changes + id: changes + run: | + if git diff --quiet; then + echo "No changes to commit" + exit 0 + fi + + - name: Commit and push if changed + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git add inst/apa-old-doi-prefix.csl + git commit -m "Update CSL file from upstream" + git push diff --git a/DESCRIPTION b/DESCRIPTION index dd8cc1a7d..bf99b9165 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: TreeSearch Title: Phylogenetic Analysis with Discrete Character Data -Version: 1.5.1.9003 +Version: 1.5.1.9005 Authors@R: c( person( "Martin R.", 'Smith', @@ -32,7 +32,7 @@ Description: Reconstruct phylogenetic trees from discrete data. URL: https://ms609.github.io/TreeSearch/ (doc), https://github.com/ms609/TreeSearch/ (devel) BugReports: https://github.com/ms609/TreeSearch/issues/ -Depends: R (>= 3.5.0) +Depends: R (>= 4.0) Imports: ape (>= 5.6), cli (>= 3.0), diff --git a/NEWS.md b/NEWS.md index 333889154..4b8fa9af3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# TreeSearch 1.5.1.9005 (2025-02) + +- Support for ordered (additive) characters +- Require R 4.0 (to simplify maintenance) + # TreeSearch 1.5.1.9003 (2025-02) - Improve support for constraints in `AdditionTree()` @@ -7,12 +12,14 @@ - Buttons to download consensus trees in app - # TreeSearch 1.5.1.9001 (2024-12) -- Fix display of state labels in app - Fix SPR behaviour when move is close to root +# TreeSearch 1.5.1.9000 (2024-10) + +- Fix display of state labels in app + # TreeSearch 1.5.1 (2024-05-23) diff --git a/R/AdditionTree.R b/R/AdditionTree.R index d8cb340d4..d6a63605b 100644 --- a/R/AdditionTree.R +++ b/R/AdditionTree.R @@ -53,6 +53,7 @@ AdditionTree <- function (dataset, concavity = Inf, constraint, sequence) { attr(dataset, "info.amounts") <- NULL attr(dataset, "min.length") <- NULL attr(dataset, "informative") <- NULL + attr(dataset, "originalIndex") <- NULL # Starting tree, rooted on first element in sequence tree <- PectinateTree(sequence[1:3]) diff --git a/R/NNI.R b/R/NNI.R index df79879a5..d4be1bcff 100644 --- a/R/NNI.R +++ b/R/NNI.R @@ -93,8 +93,12 @@ NNI <- function (tree, edgeToBreak = NULL) { #' @export cNNI <- function (tree, edgeToBreak = NULL, whichSwitch = NULL) { edge <- tree[["edge"]] - if (is.null(edgeToBreak)) edgeToBreak <- sample.int(dim(edge)[1] - NTip(tree) - 1L, 1L) - if (is.null(whichSwitch)) whichSwitch <- sample.int(2L, 1L) + if (is.null(edgeToBreak)) { + edgeToBreak <- sample.int(dim(edge)[[1]] - NTip(tree) - 1L, 1L) + } + if (is.null(whichSwitch)) { + whichSwitch <- sample.int(2L, 1L) + } tree[["edge"]] <- nni(edge, edgeToBreak, whichSwitch) # Return: diff --git a/README.md b/README.md index 474e49992..d1f66f364 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ Brazeau, M. D., Guillerme, T. and Smith, M. R. (2019). Faith D. P., Trueman J. W. H. (2001). Towards an inclusive philosophy for phylogenetic inference. Systematic Biology, 50(3), 331–350. - doi: [10.1080/10635150118627](https://doi.org/10.1080/10635150118627). + doi: [10.1080/10635150118627](https://dx.doi.org/10.1080/10635150118627). Farris, J. S. (1969). A successive approximations approach to character weighting. Systematic Biology, 18(4), 374–385. diff --git a/codemeta.json b/codemeta.json index 9de00f31f..6aa37c9e1 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,13 +8,13 @@ "codeRepository": "https://github.com/ms609/TreeSearch/", "issueTracker": "https://github.com/ms609/TreeSearch/issues/", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "1.5.1.9002", + "version": "1.5.1", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.4.2 (2024-10-31)", + "runtimePlatform": "R version 4.4.0 (2024-04-24)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -380,7 +380,7 @@ }, "SystemRequirements": "C++17" }, - "fileSize": "4469.809KB", + "fileSize": "4467.376KB", "citation": [ { "@type": "SoftwareSourceCode", @@ -452,7 +452,7 @@ ], "name": "{TreeSearch}: phylogenetic analysis with discrete character data", "identifier": "10.5281/zenodo.1042590", - "description": "R package version 1.5.1.9002", + "description": "R package version 1.5.1", "@id": "https://doi.org/10.5281/zenodo.1042590", "sameAs": "https://doi.org/10.5281/zenodo.1042590" }, diff --git a/man-roxygen/datasetParam.r b/man-roxygen/datasetParam.r index a2c73a71a..5038c6a27 100644 --- a/man-roxygen/datasetParam.r +++ b/man-roxygen/datasetParam.r @@ -1,3 +1,4 @@ #' @param dataset A phylogenetic data matrix of \pkg{phangorn} class #' \code{phyDat}, whose names correspond to the labels of any accompanying tree. +#' Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}. # Defined in TreeTools. Please propagate any changes there. diff --git a/man/AdditionTree.Rd b/man/AdditionTree.Rd index f212a690f..88fe9b76c 100644 --- a/man/AdditionTree.Rd +++ b/man/AdditionTree.Rd @@ -8,7 +8,8 @@ AdditionTree(dataset, concavity = Inf, constraint, sequence) } \arguments{ \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{concavity}{Numeric specifying concavity constant for implied step weighting. diff --git a/man/CharacterLength.Rd b/man/CharacterLength.Rd index 1e318e990..5f217f6c5 100644 --- a/man/CharacterLength.Rd +++ b/man/CharacterLength.Rd @@ -16,7 +16,8 @@ FastCharacterLength(tree, dataset) \item{tree}{A tree of class \code{\link{phylo}}.} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{compress}{Logical specifying whether to retain the compression of a \code{phyDat} object or to return a vector specifying to each individual diff --git a/man/ConcordantInformation.Rd b/man/ConcordantInformation.Rd index c0699961c..b1d10935d 100644 --- a/man/ConcordantInformation.Rd +++ b/man/ConcordantInformation.Rd @@ -16,7 +16,8 @@ ConcordantInfo(tree, dataset) \item{tree}{A tree of class \code{\link{phylo}}.} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} } \value{ \code{ConcordantInformation()} returns a named vector with elements: diff --git a/man/Consistency.Rd b/man/Consistency.Rd index 3bd55a753..2af757710 100644 --- a/man/Consistency.Rd +++ b/man/Consistency.Rd @@ -8,7 +8,8 @@ Consistency(dataset, tree, compress = FALSE) } \arguments{ \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{tree}{A tree of class \code{\link{phylo}}.} diff --git a/man/MaximizeParsimony.Rd b/man/MaximizeParsimony.Rd index a3fa74c8c..8de3f5d24 100644 --- a/man/MaximizeParsimony.Rd +++ b/man/MaximizeParsimony.Rd @@ -47,7 +47,8 @@ EasyTreesy() } \arguments{ \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{tree}{(optional) A bifurcating tree of class \code{\link{phylo}}, containing only the tips listed in \code{dataset}, from which the search diff --git a/man/PlotCharacter.Rd b/man/PlotCharacter.Rd index fe4494386..094859f81 100644 --- a/man/PlotCharacter.Rd +++ b/man/PlotCharacter.Rd @@ -25,7 +25,8 @@ PlotCharacter( \item{tree}{A tree of class \code{\link{phylo}}.} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{char}{Index of character to plot.} diff --git a/man/SuccessiveApproximations.Rd b/man/SuccessiveApproximations.Rd index 100873516..774dc45b7 100644 --- a/man/SuccessiveApproximations.Rd +++ b/man/SuccessiveApproximations.Rd @@ -25,7 +25,8 @@ SuccessiveWeights(tree, dataset) \item{tree}{A tree of class \code{\link{phylo}}.} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{outgroup}{if not NULL, taxa on which the tree should be rooted} diff --git a/man/TaxonInfluence.Rd b/man/TaxonInfluence.Rd index cee842a94..fdfe41d85 100644 --- a/man/TaxonInfluence.Rd +++ b/man/TaxonInfluence.Rd @@ -18,7 +18,8 @@ TaxonInfluence( } \arguments{ \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{tree}{Optimal tree or summary tree (of class "phylo") or list of trees (of class "list" or "multiPhylo") against which results should be evaluated. diff --git a/man/TreeLength.Rd b/man/TreeLength.Rd index 59dd07d0a..075a2b63c 100644 --- a/man/TreeLength.Rd +++ b/man/TreeLength.Rd @@ -30,7 +30,8 @@ Fitch(tree, dataset) uniformly sampled.} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{concavity}{Determines the degree to which extra steps beyond the first are penalized. Specify a numeric value to use implied weighting diff --git a/man/TreeSearch.Rd b/man/TreeSearch.Rd index 33a27341b..33b0658ff 100644 --- a/man/TreeSearch.Rd +++ b/man/TreeSearch.Rd @@ -55,7 +55,8 @@ DoNothing(...) }} \item{dataset}{A phylogenetic data matrix of \pkg{phangorn} class -\code{phyDat}, whose names correspond to the labels of any accompanying tree.} +\code{phyDat}, whose names correspond to the labels of any accompanying tree. +Perhaps load into R using \code{\link[TreeTools]{ReadCharacters}}.} \item{TreeScorer}{function to score a given tree. The function will be passed three parameters, corresponding to the diff --git a/tests/testthat/test-CustomSearch.R b/tests/testthat/test-CustomSearch.R index 71fb5995b..9b496184b 100644 --- a/tests/testthat/test-CustomSearch.R +++ b/tests/testthat/test-CustomSearch.R @@ -10,7 +10,7 @@ RootySwappers <- list(RootedTBRSwap, RootedSPRSwap, RootedNNISwap) test_that("Tree can be found", { skip_if_not_installed("phangorn") phy11 <- phangorn::phyDat(data11, type = "USER", levels = c(FALSE, TRUE)) - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 + RNGkind("Mersenne-Twister") set.seed(1) random11 <- as.phylo(17905853L, 11, letters[1:11]) expect_error(TreeSearch(unrooted11, dataset = phy11)) @@ -110,7 +110,7 @@ test_that("Profile parsimony works in tree search", { dataset <- TreeTools::PhyDat(sillyData) readyData <- PrepareDataProfile(dataset) - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 + RNGkind("Mersenne-Twister") set.seed(0) rTree <- randomTree <- RandomTree(dataset, "1") diff --git a/tests/testthat/test-Jackknife.R b/tests/testthat/test-Jackknife.R index 85fed2a5a..a93d50597 100644 --- a/tests/testthat/test-Jackknife.R +++ b/tests/testthat/test-Jackknife.R @@ -11,7 +11,7 @@ test_that("Jackknife supports are correct", { expect_error(Jackknife(start_tree, dataset, resampleFreq = 0)) expect_error(Jackknife(start_tree, dataset, resampleFreq = 9/10)) - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 + suppressWarnings(RNGversion("3.5.0")) set.seed(0) strict <- TreeSearch(start_tree, dataset, verbosity = 0) diff --git a/tests/testthat/test-pp-random-tree.R b/tests/testthat/test-pp-random-tree.R index e1d93fdf2..385003335 100644 --- a/tests/testthat/test-pp-random-tree.R +++ b/tests/testthat/test-pp-random-tree.R @@ -38,7 +38,6 @@ test_that("four-tip trees are randomly distributed", { }) test_that("four-tip trees are randomly scored", { - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 set.seed(0) nTrees <- 6000 @@ -57,7 +56,6 @@ test_that("four-tip trees are randomly scored", { }) test_that("five-tip trees are randomly scored", { - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 set.seed(0) nTrees <- 6000 stringency <- 0.005 @@ -75,7 +73,6 @@ test_that("five-tip trees are randomly scored", { test_that("six-tip trees are randomly scored", { - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 set.seed(0) nTrees <- 6000 diff --git a/tests/testthat/test-zzz-tree-rearrange.R b/tests/testthat/test-zzz-tree-rearrange.R index 0cf235f99..566870d8b 100644 --- a/tests/testthat/test-zzz-tree-rearrange.R +++ b/tests/testthat/test-zzz-tree-rearrange.R @@ -46,7 +46,7 @@ test_that("NNI works", { Test(2, 0, 3, 9) Test(2, 1, 8, 9) - suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 + suppressWarnings(RNGversion("3.5.0")) set.seed(0) nniComb <- NNI(trComb) expect_equal(nniComb$tip.label, trComb$tip.label) @@ -57,7 +57,7 @@ test_that("NNI works", { test_that("SPR works", { testTree <- Preorder(root(BalancedTree(7), 1, resolve.root = TRUE)) - edge <- testTree$edge + edge <- testTree[["edge"]] expect_equal(spr(edge, 66), cSPR(testTree, 66)$edge) Test <- function (m, p1, r1) { @@ -243,7 +243,7 @@ CheckTreeSanity <- function (tree) { info=paste0("Root is numbered ", min(parent), "; expecting ", nTip + 1) ) expect_false(min(parent) %in% child, - info=paste0("Root node (", min(parent), ") is child of edge ", paste0(which(min(parent) == child), collapse=', ')) + info=paste0("Root node (", min(parent), ") is child of edge ", paste0(which(min(parent) == child), collapse = ", ")) ) expect_true(all(seq_len(nTip) %in% child)) # No missing tips expect_equal(max(parent), nTip + nNode) @@ -252,7 +252,7 @@ CheckTreeSanity <- function (tree) { expect_true(all(child[!tips] > parent[!tips]), info="Parent nodes must be > child nodes") } -suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 +suppressWarnings(RNGversion("3.5.0")) set.seed(0) small_tree <- rtree(8) large_tree <- rtree(80) diff --git a/vignettes/getting-started.Rmd b/vignettes/getting-started.Rmd index a84a960d5..d73f0d286 100644 --- a/vignettes/getting-started.Rmd +++ b/vignettes/getting-started.Rmd @@ -18,7 +18,7 @@ datasets. ### Simple installation To use "TreeSearch" you will first need to [install R]( -https://CRAN.R-project.org/). +https://CRAN.R-project.org/). [RStudio](https://posit.co/) is a popular front-end that makes several of R's features easier to use. diff --git a/vignettes/profile.Rmd b/vignettes/profile.Rmd index b30b76acf..3908b4556 100644 --- a/vignettes/profile.Rmd +++ b/vignettes/profile.Rmd @@ -40,9 +40,9 @@ library("TreeSearch") In order to reproduce the random elements of this document, set a random seed: -```{R rng-version} +```{R rng-version, warn = FALSE} # Set a random seed so that random functions in this document are reproducible -suppressWarnings(RNGversion("3.5.0")) # Until we can require R3.6.0 +RNGversion("3.5.0") set.seed(888) ``` diff --git a/vignettes/tree-search.Rmd b/vignettes/tree-search.Rmd index 5bf02b4a5..4a85b19d7 100644 --- a/vignettes/tree-search.Rmd +++ b/vignettes/tree-search.Rmd @@ -73,9 +73,9 @@ escape from local optima. vinther <- TreeSearch::inapplicable.phyData[["Vinther2008"]] ``` -```{R RNG-version} +```{R RNG-version, warn = FALSE} # Set a random seed so that random functions in this document are reproducible -suppressWarnings(RNGversion("3.5.0")) # Until we require R v3.6.0 +RNGversion("3.5.0") set.seed(0) ```