Dear Elvira.
I'm not sure what's going on with the NaN values, but one issue that I
see with your example is that ape::drop.fossil identifies fossil
lineages by finding those that end before the present. Since rtree just
splits the tree randomly & samples the edge lengths from a uniform
distribution, this will leave you with only one lineage!
To see how the function should work you could try something like:
set.seed(99)
tree<-pbtree(n=15,b=1,d=0.2)
plotTree(tree)
plotTree(pruned<-drop.fossil(tree))
Hopefully this leaves things a bit clearer.
For fun, also try:
par(mfrow=c(1,1),mar=c(5.1,4.1,2.1,2.1),bty="n")
ltt(tree,lty="dashed",log.lineages=FALSE,log="y")
ltt(pruned,lty="solid",add=TRUE,log.lineages=FALSE,
log="y")
legend("topleft",c("observed","reconstructed"),
lty=c("dashed","solid"),bty="n")
All the best, Liam
Liam J. Revell
University of Massachusetts Boston
Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org
Academic Director UMass Boston Chile Abroad:
https://www.umb.edu/academics/caps/international/biology_chile
On 8/25/2020 4:21 PM, Elvira D`bastiani wrote:
[EXTERNAL SENDER]
Hi,
I'm a beginner with phylogeny analysis. I'm having trouble extracting only
the surviving species from the phylogenies of my model.
I used the drop.fossil (fPar) functions from ape and the drop.extinct
(fPar) from geiger. But it is not deleting the way I need it.
Running example correctly:
my.tree = rtree (15, rooted = TRUE, tip.label = NULL, br = runif) #random
tree in phylo format
class (my.tree)
my.tree $ edge.length #I need this information without NaN.
my.tree$edge.length [1] 0.53879430 0.71471795 0.40579050 0.15278814 0.34023276
0.62665485
[7] 0.05737268 0.85166764 0.21264535 0.53946203 0.13648759 0.32486514
[13] 0.62107629 0.25598225 0.63487580 0.48567211 0.93817692 0.85750154
[19] 0.37088354 0.31420183 0.82853436 0.45184151 0.31587841 0.09780854
[25] 0.06490054 0.68945737 0.66805060 0.90454665
However in the same tree format (phylo format) in my analysis the
edge.length comes out with NaN. Even after using the drop.fossil (fPar) or
drop.extinct (fPar) functions. It looks like this:
fPar$edge.length [1] 17 53 258 138 1 1 1 -621 NaN 47 31
13 34 26
[15] 1 35 46 60 0 3 53 7 -904 NaN 4 17 NaN NaN
Is there any way to delete these NaN?
Thanks in advance for the answer
Best wishes
e.
--
*Elvira D'Bastiani*Doutoranda em Ecologia e Conservação
Laboratório de Interações Biológicas
Universidade Federal do Paraná (UFPR), Curitiba, Paraná, Brasil
*https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Felviradbastiani.wixsite.com%2Fecoevo&data=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977&sdata=u5GV45faTYzUsRhhQpCQc9C5%2BSLDcrzE6mcyNlRNVUU%3D&reserved=0
<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Felviradbastiani.wixsite.com%2Fecoevo&data=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977&sdata=u5GV45faTYzUsRhhQpCQc9C5%2BSLDcrzE6mcyNlRNVUU%3D&reserved=0>*
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977&sdata=IdKD9kLK5Xh3yt1BDkA8n1srFFr5paq%2BSJAfivocP%2B4%3D&reserved=0
Searchable archive at
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977&sdata=5poPu09PsiPLuPYLC4itm9ouYfTXHC7ZNapkveNlkBU%3D&reserved=0
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/