Giter Site home page Giter Site logo

Comments (4)

zkamvar avatar zkamvar commented on September 13, 2024

I'm not sure what would be causing this. In order to help you solve this, I do need a reproducible example. At the moment, I do not know any of the following information: branch lengths, data type (genind/genlight), genetic distance used, tree algorithm used, version of ape, version of R. Without this information, the best I can do is guess.

There were only two releases after 2.8.6: a minor release that corrected documentation for CRAN and then https://github.com/grunwaldlab/poppr/releases/tag/v.2.9.0, which did not touch any of the code involved in the bootstrapping.

I know you've tried rolling back versions of poppr, ape, ade4, and adegenet, but have you tried using the {checkpoint} package to roll back ALL your packages to the last date you did the analysis? https://cran.r-project.org/web/packages/checkpoint/vignettes/checkpoint.html If you upgraded R, have you tried using an older version of R (notably, R 3.6 fixed a bug that biased the core randomization routines, which changed a lot of results)? I've found https://rstudio.cloud particularly helpful in those situations.

I will also note: I will probably be slow to reply (as you've probably noticed); I voluntarily manage poppr in my free time that is not otherwise dedicated to my own mental wellbeing.

from poppr.

mandiedriskill avatar mandiedriskill commented on September 13, 2024

Thanks for following up on this issue.

Here is the code we used.

library(poppr)
library(ape)
library(adegenet)
library(ggtree)
library(ggplot2)
library(gridExtra)
library(grid)

mydatSNP= read.table("./25_KASP_SNP.txt", header = TRUE, stringsAsFactors = FALSE)

marker_namesSNP <- colnames(mydatSNP)
marker_namesSNP<- marker_namesSNP[4:length(marker_namesSNP)]
accession_namesSNP <- mydatSNP[,1]
ploidySNP <- as.vector(mydatSNP$Ploidy)
allele_datSNP <- mydatSNP[,4:ncol(mydatSNP)]
mydat_genindSNP = df2genind(allele_datSNP, sep = ":", ind.names = accession_namesSNP, ploidy = ploidySNP, NA.char = "NA")

mytreeSNP = aboot(mydat_genindSNP, tree = "njs", sample = 200, cutoff = 75, distance = provesti.dist, quiet = FALSE, showtree = FALSE, missing = "ignore")

denSNP<-ggtree(mytreeSNP, size=.05)+ geom_tiplab(size=.5)+ ggplot2::xlim(NA,1)

I was not able to recover the original tree created by the "aboot" function, but I was able to recover the tree object before and after the updates.

tree_objects.zip

The tree objects are able to be plotted with {treeio}.

tree<-treeio::read.jtree(file ="path/tree_obejct")
ggtree(tree, size=.05)+ geom_tiplab(size=.5)+ ggplot2::xlim(NA,1)

From the before and after tree objects, we can see the two trees are virtually the same except for the wild North American clade (top clade), which is the clade that is rooting abnormally. If you need the raw data, please let us know and we can send it to you. Thank you for all your help!

from poppr.

zkamvar avatar zkamvar commented on September 13, 2024

Summary

Looking at the code, I suspect that the change may have originated in the {ape} package. The layout of the tree represents that of the distance derived from the initial data and the distance function was last updated in 2015, which means that the culprit may be the ape::njs() function.

Please try one of the solutions in #239 (comment) and raise an issue in https://github.com/emmanuelparadis/ape with information of the versions between the old tree and the new tree.

Again, the difficulty here is that there are so many unknowns about what your R environment looked like when you got the first result. You've been able to give me the version of {poppr} you were using, but the versions of {ape}, {adegenet}, and R are all important here. Even knowing the date that you last ran the analysis before you updated would help so that versions could be inferred. In the future, it's good practice to use version control and save the output of sessionInfo() to give you a snapshot of what your R environment looked like.

Why it's not poppr

There are two poppr functions you use, neither of which have been updated recently.

  1. aboot(), which has not changed in the last three years
  2. provesti.dist(), which was last modified in 2015, for the 2.0.0 release

In the process of creating a bootstrapped tree, there are two components necessary:

  1. A distance function (you used provesti.dist())
  2. A tree function that uses the matrix output by the distance function to create the base tree (you used ape::njs())

The aboot() function is a wrapper around the process of creating a bootstrapped tree. It merely orchestrates the coordination between the distance function, the tree function, and ape::boot.phylo(). There is one function that manipulates the original tree, and that is fix_negative_branch(), which, again was last updated in 2015

from poppr.

zkamvar avatar zkamvar commented on September 13, 2024

I am closing this issue for now as it has been nearly 3 months since the last activity and there is insufficient evidence that points to a specific issue with poppr per se.

If you have more details that could help show where this discrepancy occurred, feel free to reopen this issue with that information.

from poppr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.