Closed abraao-crypto closed 4 years ago
Dear @abraao-crypto,
you can use the following function to check which trees have no branch length in a multiphylo object:
no_branch <- function(multiphylo){
res <- character()
for (i in 1:1000) {
res[i] <- class(multiphylo[[i]]$edge.length)
}
which(res != "numeric")
}
# Usage
no_branch(multiphylo = tree)
For each tree in a multiphylo object you can also simple check:
multiphylo[[1]]$edge.length
to see if it contains a numeric vector with branch lengths.
Hello Gustavo. I got it! Thank you!
To test if there are missing species between phylogenies and data, you can use the sensiPhy function match_dataphy()
.
In you case, the species "Phylidonyris__melanops"
was dropped.
dat <- match_dataphy(formula = rbrain ~ 1, data = databir, phy = tree)
# Which species was dropped?
dat$dropped
Ok I will do it. Thank you!
function
tree_physig
Problem
I can't know what is the problem when I using a multiphylo. Hence, always there is a warning about the incompatibility between phylogenies and data. How can I know what's going on? How can I know if the edge length of trees is ok? Script_issue_SensyPhy.zip
Reproducible example
databir<-read.csv2("birdresid.csv",sep = ";",dec=",",header=T,fileEncoding="UTF-8-BOM") tree<-read.tree(file = "mbirdresid.phy") for(i in 1:length(tree)) phylotree <- tree[[i]] phylotree$tip.label=gsub("_", " ",phylotree$tip.label) rownames(databir)=databir$ssp databir=databir[phylotree$tip.label,] tree <- tree_physig(trait.col = "rbrain", method="lambda",data =databir, phy =tree, n.tree =1000) sensi_plot(tree) sensi_plot(tree, graphs = 1) sensi_plot(tree, graphs = 2) summary(tree)