From 47b7273a10291948594dab06dda681b70c6897f2 Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Wed, 19 Jul 2023 14:28:17 +0100 Subject: [PATCH 1/9] Simplify vignette --- DESCRIPTION | 5 ++-- NEWS.md | 4 ++- vignettes/Bayesian.Rmd | 65 ++++++++---------------------------------- 3 files changed, 18 insertions(+), 56 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 322eb80..97d7b98 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: Rogue Title: Identify Rogue Taxa in Sets of Phylogenetic Trees -Version: 2.1.5.9000 +Version: 2.1.5.9001 Authors@R: c(person("Martin R.", 'Smith', email = "martin.smith@durham.ac.uk", role = c("aut", "cre", "cph"), @@ -37,11 +37,12 @@ Imports: Rfast, stats, TreeDist (> 2.2.0), - TreeTools (>= 1.9.1.9003), + TreeTools (>= 1.9.2.9006), utils, Suggests: knitr, rmarkdown, + RCurl, spelling, testthat, Config/Needs/github-actions: diff --git a/NEWS.md b/NEWS.md index 4fa28cf..9ad64e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# Rogue v2.1.5.9000 +# Rogue v2.1.5.9001 + +- Simplify vignette with new `TreeTools::ReadMrBayesTrees()`. - Legend annotations in documentation. diff --git a/vignettes/Bayesian.Rmd b/vignettes/Bayesian.Rmd index 9054044..88de155 100644 --- a/vignettes/Bayesian.Rmd +++ b/vignettes/Bayesian.Rmd @@ -36,10 +36,7 @@ library("Rogue") # Find rogue taxa ``` ```{r test-connection, echo = FALSE} -online <- tryCatch({ - read.csv("https://raw.githubusercontent.com/ms609/hyoliths/master/MrBayes/hyo.nex.pstat") - TRUE - }, +online <- tryCatch(RCurl::url.exists("https://raw.githubusercontent.com/"), warning = function(w) invokeRestart(""), error = function(e) FALSE ) @@ -50,63 +47,25 @@ analysis of early brachiopods [@Sun2018] using [MrBayes](https://nbisweden.github.io/MrBayes/) [@Hulsenbeck2001]. Our data files are stored on [GitHub](https://github.com/ms609/hyoliths/tree/master/MrBayes). -Let's load the results of run 1: +Let's sample 100 trees from the posterior (after discarding a 25% burn-in): ```{R load-trees} if (online) { - dataFolder <- "https://raw.githubusercontent.com/ms609/hyoliths/master/MrBayes/" - run1.t <- paste0(dataFolder, "hyo.nex.run1.t") - # Reading 10k trees takes a second or two... - run1Trees <- ape::read.nexus(run1.t) - if (packageVersion('ape') <= "5.6.1") { - # Workaround for a bug in ape, hopefully fixed in v5.6.2 - run1Trees <- structure(lapply(run1Trees, function(tr) { - tr$tip.label <- attr(run1Trees, 'TipLabel') - tr - }), class = 'multiPhylo') - } + # Downloading all trees takes a second or two... + trees <- ReadMrBayesTrees( + "https://raw.githubusercontent.com/ms609/hyoliths/master/MrBayes/hyo.nex", + n = 100, + burninFrac = 0.25 + ) } else { # If no internet connection, we can generate some example trees instead - run1Trees <- structure(unlist(lapply(0:21, function(backbone) { - AddTipEverywhere(ape::as.phylo(0, nTip = 12), 'ROGUE') - }), recursive = FALSE), class = 'multiPhylo') + trees <- structure(unlist(lapply(0:21, function(backbone) { + AddTipEverywhere(ape::as.phylo(0, nTip = 12), "ROGUE") + }), recursive = FALSE), class = "multiPhylo") } ``` -## Select trees to analyse - -Our tree file contains all trees generated. We typically want to discard -a proportion of trees as burn-in: - -```{R discard-burnin} -burninFrac <- 0.25 -nTrees <- length(run1Trees) -trees <- run1Trees[seq(from = burninFrac * nTrees, to = nTrees)] -``` - -This is a large number of trees to analyse. We could save time for an initial -analysis by thinning our sample somewhat. - -```{R thin-trees} -sampleSize <- 100 -trees <- run1Trees[seq(from = burninFrac * nTrees, to = nTrees, - length.out = sampleSize)] -``` - -For a full analysis, we ought to consider the output from the other runs of our -analysis, perhaps with - -```r -nRuns <- 4 -allTrees <- lapply(seq_len(nRuns), function(run) { - runTrees <- ape::read.nexus(paste0(dataFolder, 'hyo.nex.run', run, .'t')) - runTrees <- runTrees[seq(from = burninFrac * nTrees, to = nTrees, - length.out = sampleSize / nRuns)] -}) -trees <- structure(unlist(allTrees, recursive = FALSE), class = 'multiPhylo') -``` - ## Initial appraisal Let's start by looking at the majority rule consensus tree. @@ -120,7 +79,7 @@ plenary <- Consensus(trees, p = 0.5) par(mar = rep(0, 4), cex = 0.85) plot(plenary, tip.color = ColByStability(trees)) -PlotTools::SpectrumLegend("bottomright", legend = c("Stable", "Unstable"), +PlotTools::SpectrumLegend("bottomright", legend = c("Stable", " ", "Unstable"), palette = hcl.colors(131, 'inferno')[1:101]) ``` From 91f28eebbcecbdc7fb5178a7e7b7a7cf906c4cdd Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Wed, 19 Jul 2023 14:28:56 +0100 Subject: [PATCH 2/9] Remotes --- DESCRIPTION | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index 97d7b98..7a50d10 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,6 +39,8 @@ Imports: TreeDist (> 2.2.0), TreeTools (>= 1.9.2.9006), utils, +Remotes: + ms609/TreeTools, Suggests: knitr, rmarkdown, From 75a64fc7904ada91df667381b48803304e7d17fb Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:29:03 +0000 Subject: [PATCH 3/9] Update rnr --- src/rnr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rnr b/src/rnr index dc5ce2a..adb087c 160000 --- a/src/rnr +++ b/src/rnr @@ -1 +1 @@ -Subproject commit dc5ce2afd36d5262660a39b9119679cc2b274d5d +Subproject commit adb087c6c154ef42e7b04134a1e962430fc85154 From f014c235a41de99c89e18061143db69700cfbbf3 Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:13:30 +0100 Subject: [PATCH 4/9] Update pkgdown.yml --- .github/workflows/pkgdown.yml | 39 +++-------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml index 9e3ac54..bdf8949 100644 --- a/.github/workflows/pkgdown.yml +++ b/.github/workflows/pkgdown.yml @@ -15,7 +15,7 @@ name: pkgdown jobs: pkgdown: - runs-on: macOS-latest + runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -26,38 +26,5 @@ jobs: with: submodules: true - - uses: r-lib/actions/setup-r@v2 - - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = c('soft', 'Config/Needs/website')), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v4 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install Mac OS dependencies - run: | - brew install libgit2 - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = c('soft', 'Config/Needs/website')) - shell: Rscript {0} - - - name: Install package - run: R CMD INSTALL . - - - name: Deploy package - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + steps: + - uses: ms609/actions/pkgdown@main From 5f30255d31c3eb73d5543ce0830c7c73ea78ea4c Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:14:16 +0100 Subject: [PATCH 5/9] Update memcheck.yml --- .github/workflows/memcheck.yml | 61 ++-------------------------------- 1 file changed, 3 insertions(+), 58 deletions(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 657b0b3..bb3f44d 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -24,7 +24,7 @@ name: mem-check jobs: mem-check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest name: valgrind ${{ matrix.config.test }} @@ -42,61 +42,6 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v4 + - uses: ms609/actions/memcheck@main with: - submodules: true - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: release # CRAN uses devel, but takes ages to load deps. - - - name: Install apt packages - run: | - sudo apt-get install valgrind texlive-latex-base - - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = c("soft", - "Config/Needs/github-actions", "Config/Needs/memcheck")), - ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v4 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_github('emmanuelparadis/ape') - if ("${{ matrix.config.test }}" == 'tests') { - remotes::install_github('r-lib/brio#20') # brio mem leak - } - remotes::install_deps(dependencies = c("soft", "Config/Needs/github-actions", "Config/Needs/memcheck")) - shell: Rscript {0} - - - name: Install this package - run: | - cd .. - R CMD build --no-manual --no-resave-data Rogue - R CMD INSTALL Rogue*.tar.gz - cd Rogue - - - name: valgrind - memcheck ${{ matrix.config.test }} - run: | - R -d "valgrind --tool=memcheck --leak-check=full \ - --errors-for-leak-kinds=definite --error-exitcode=1" \ - --vanilla < memcheck/${{ matrix.config.test }}.R + test: ${{ matrix.config.test}} From 20482da9051d5025b8c96042456736ba0553afc4 Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:26:00 +0100 Subject: [PATCH 6/9] submodules --- .github/workflows/memcheck.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index bb3f44d..0a787ba 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -24,7 +24,7 @@ name: mem-check jobs: mem-check: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 # Remember to update RSPM below to match name: valgrind ${{ matrix.config.test }} @@ -38,10 +38,15 @@ jobs: env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true _R_CHECK_FORCE_SUGGESTS_: false - RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest + RSPM: https://packagemanager.rstudio.com/cran/__linux__/noble/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libasan.so.6 # Path to ASan runtime library steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: ms609/actions/memcheck@main with: test: ${{ matrix.config.test}} From 6f15409b03d9a21d8835b0e146232bced4b3bdfb Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:29:32 +0100 Subject: [PATCH 7/9] Update rnr --- src/rnr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rnr b/src/rnr index adb087c..dc5ce2a 160000 --- a/src/rnr +++ b/src/rnr @@ -1 +1 @@ -Subproject commit adb087c6c154ef42e7b04134a1e962430fc85154 +Subproject commit dc5ce2afd36d5262660a39b9119679cc2b274d5d From d613a8336c0d26b29ecaa18b3ced5174caef665b Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:49:37 +0100 Subject: [PATCH 8/9] rm LD_PRELOAD --- .github/workflows/memcheck.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 0a787ba..63e4d75 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -40,7 +40,6 @@ jobs: _R_CHECK_FORCE_SUGGESTS_: false RSPM: https://packagemanager.rstudio.com/cran/__linux__/noble/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libasan.so.6 # Path to ASan runtime library steps: - uses: actions/checkout@v4 From 119ec587e1e212c81ac57d55471dcafd7c3707ba Mon Sep 17 00:00:00 2001 From: RevBayes analysis <1695515+ms609@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:50:41 +0100 Subject: [PATCH 9/9] ubuntu versions --- .github/workflows/R-CMD-check.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 5516bf0..3306507 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -47,10 +47,9 @@ jobs: config: - {os: windows-latest, r: 'release'} - {os: macOS-latest, r: 'release'} - - {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.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-22.04, r: '4.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"} # Until TreeDist can slough phangorn + - {os: ubuntu-24.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"} + - {os: ubuntu-24.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest"} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true