Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-26 Thread Elvira D`bastiani
Hi Emmanuel.

Right. Also thank you for your informative answer. I am interested in
keeping the "surviving species" from phylogenies. However, I don't want to
simulate trees.
For example, one of my trees is like this:

(2:17,(3:258,(4:1,(5:1,((7:47,(8:13,((11:1,(13:46,9:60):35):26,(10:3,(12:7,((15:4,14:17):NaN,6:NaN):-904):53):0):34):31):NaN,1:NaN):-621):1):138):53);

This tree comes from a theoretical model that I am creating with my
adviser. In this model, I test different combinations of parameters and as
this influence on the diversification. And for one of the combinations, the
trees come out the branch lengths with these NaNs and with some negative
numbers.

I understood the issues raised and I believe that I cannot use the existing
functions.

Thank you for your answer.

All the best,

Elvira

Em qua., 26 de ago. de 2020 às 04:53, Emmanuel Paradis <
emmanuel.para...@ird.fr> escreveu:

> Hi Elvira,
>
> If you are interested in keeping the "surviving species" from phylogenies,
> it may be better to use a birth-death model to simulate the trees. There
> are 3 functions in ape to do this: they are documented in the same help
> page than drop.fossil() and they have options that make them quite
> flexible. If you really want to use rtree(), then, as rightly pointed out
> by Liam, the (default) uniform distribution may not be the right choice to
> generate branch lengths.
>
> Best,
>
> Emmanuel
>
> - Le 26 Aoû 20, à 8:33, Elvira D`bastiani elviradbasti...@gmail.com a
> écrit :
>
> > Hi Liam,
> >
> > That, are branch lengths. I know that these NaNs correspond to the
> species
> > that have become extinct.
> > When I talk about 'delete' the NaNs, I want my newick not to have those
> > branches with NaNs.
> >
> > You helped me!
> > Thank you for talking about it with me!
> >
> > All the best,
> >
> > Em ter., 25 de ago. de 2020 às 22:14, Liam J. Revell <
> liam.rev...@umb.edu>
> > escreveu:
> >
> >> Hi Elvira.
> >>
> >> In your Newick string those NaN are branch lengths, not taxon labels.
> >>
> >> What do you mean by 'delete' the NaNs? You can set them to zero, as
> >> follows:
> >>
> >> tree$edge.length[is.na(tree$edge.length)]<-0
> >>
> >> but then you get a tree that looks like this:
> >>
> >> http://www.phytools.org/blog/Elvira-tree.png
> >>
> >> so it's kind of hard to tell which taxa are extinct
> >>
> >> Sorry I can't be of more help! 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 9:00 PM, Elvira D`bastiani wrote:
> >> > **[EXTERNAL SENDER]
> >> >
> >> > Hi Liam
> >> >
> >> > Also thank you for your informative answer. However, I don't want to
> >> > simulate trees. For example one of my trees looks like this:
> >> >
> >> > (2:17, (3: 258, (4: 1, (5: 1, ((7:47, (8:13, ((11: 1, (13: 46,9: 60):
> >> > 35): 35): 26, (10: 3, (12: 7, ((15: 4,14: 17): NaN, 6: NaN): - 904):
> >> > 53): 0): 34): 31): NaN, 1: NaN): - 621): 1): 138): 53);
> >> >
> >> > Here, I need to delete these NaN from the phylo file.
> >> >
> >> > I believe that with these functions I am unable to delete these NaN or
> >> > extract only the surviving species.
> >> >
> >> > Thank you for the help.
> >> >
> >> > Elvira.
> >> >
> >> > Em ter., 25 de ago. de 2020 às 17:33, Liam J. Revell
> >> > mailto:liam.rev...@umb.edu>> escreveu:
> >> >
> >> > 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
> >> > <
> >>
> 

Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-26 Thread Emmanuel Paradis
Hi Elvira,

If you are interested in keeping the "surviving species" from phylogenies, it 
may be better to use a birth-death model to simulate the trees. There are 3 
functions in ape to do this: they are documented in the same help page than 
drop.fossil() and they have options that make them quite flexible. If you 
really want to use rtree(), then, as rightly pointed out by Liam, the (default) 
uniform distribution may not be the right choice to generate branch lengths.

Best,

Emmanuel

- Le 26 Aoû 20, à 8:33, Elvira D`bastiani elviradbasti...@gmail.com a écrit 
:

> Hi Liam,
> 
> That, are branch lengths. I know that these NaNs correspond to the species
> that have become extinct.
> When I talk about 'delete' the NaNs, I want my newick not to have those
> branches with NaNs.
> 
> You helped me!
> Thank you for talking about it with me!
> 
> All the best,
> 
> Em ter., 25 de ago. de 2020 às 22:14, Liam J. Revell 
> escreveu:
> 
>> Hi Elvira.
>>
>> In your Newick string those NaN are branch lengths, not taxon labels.
>>
>> What do you mean by 'delete' the NaNs? You can set them to zero, as
>> follows:
>>
>> tree$edge.length[is.na(tree$edge.length)]<-0
>>
>> but then you get a tree that looks like this:
>>
>> http://www.phytools.org/blog/Elvira-tree.png
>>
>> so it's kind of hard to tell which taxa are extinct
>>
>> Sorry I can't be of more help! 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 9:00 PM, Elvira D`bastiani wrote:
>> > **[EXTERNAL SENDER]
>> >
>> > Hi Liam
>> >
>> > Also thank you for your informative answer. However, I don't want to
>> > simulate trees. For example one of my trees looks like this:
>> >
>> > (2:17, (3: 258, (4: 1, (5: 1, ((7:47, (8:13, ((11: 1, (13: 46,9: 60):
>> > 35): 35): 26, (10: 3, (12: 7, ((15: 4,14: 17): NaN, 6: NaN): - 904):
>> > 53): 0): 34): 31): NaN, 1: NaN): - 621): 1): 138): 53);
>> >
>> > Here, I need to delete these NaN from the phylo file.
>> >
>> > I believe that with these functions I am unable to delete these NaN or
>> > extract only the surviving species.
>> >
>> > Thank you for the help.
>> >
>> > Elvira.
>> >
>> > Em ter., 25 de ago. de 2020 às 17:33, Liam J. Revell
>> > mailto:liam.rev...@umb.edu>> escreveu:
>> >
>> > 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
>> > <
>> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.phytools.org%2F=02%7C01%7Cliam.revell%40umb.edu%7Ce8848bf509ed41e5115408d8495b7db0%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637340004615417539=5%2F1PtYD6DMW7gK7ef3QiRvXSeI0bozADU5lgrW9qPq0%3D=0
>> >
>> >
>> > 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 

Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-25 Thread Elvira D`bastiani
Hi Liam,

That, are branch lengths. I know that these NaNs correspond to the species
that have become extinct.
When I talk about 'delete' the NaNs, I want my newick not to have those
branches with NaNs.

You helped me!
Thank you for talking about it with me!

All the best,

Em ter., 25 de ago. de 2020 às 22:14, Liam J. Revell 
escreveu:

> Hi Elvira.
>
> In your Newick string those NaN are branch lengths, not taxon labels.
>
> What do you mean by 'delete' the NaNs? You can set them to zero, as
> follows:
>
> tree$edge.length[is.na(tree$edge.length)]<-0
>
> but then you get a tree that looks like this:
>
> http://www.phytools.org/blog/Elvira-tree.png
>
> so it's kind of hard to tell which taxa are extinct
>
> Sorry I can't be of more help! 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 9:00 PM, Elvira D`bastiani wrote:
> > **[EXTERNAL SENDER]
> >
> > Hi Liam
> >
> > Also thank you for your informative answer. However, I don't want to
> > simulate trees. For example one of my trees looks like this:
> >
> > (2:17, (3: 258, (4: 1, (5: 1, ((7:47, (8:13, ((11: 1, (13: 46,9: 60):
> > 35): 35): 26, (10: 3, (12: 7, ((15: 4,14: 17): NaN, 6: NaN): - 904):
> > 53): 0): 34): 31): NaN, 1: NaN): - 621): 1): 138): 53);
> >
> > Here, I need to delete these NaN from the phylo file.
> >
> > I believe that with these functions I am unable to delete these NaN or
> > extract only the surviving species.
> >
> > Thank you for the help.
> >
> > Elvira.
> >
> > Em ter., 25 de ago. de 2020 às 17:33, Liam J. Revell
> > mailto:liam.rev...@umb.edu>> escreveu:
> >
> > 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
> > <
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.phytools.org%2F=02%7C01%7Cliam.revell%40umb.edu%7Ce8848bf509ed41e5115408d8495b7db0%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637340004615417539=5%2F1PtYD6DMW7gK7ef3QiRvXSeI0bozADU5lgrW9qPq0%3D=0
> >
> >
> > 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  138111 -621
> > 

Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-25 Thread Liam J. Revell

Hi Elvira.

In your Newick string those NaN are branch lengths, not taxon labels.

What do you mean by 'delete' the NaNs? You can set them to zero, as follows:

tree$edge.length[is.na(tree$edge.length)]<-0

but then you get a tree that looks like this:

http://www.phytools.org/blog/Elvira-tree.png

so it's kind of hard to tell which taxa are extinct

Sorry I can't be of more help! 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 9:00 PM, Elvira D`bastiani wrote:

**[EXTERNAL SENDER]

Hi Liam

Also thank you for your informative answer. However, I don't want to 
simulate trees. For example one of my trees looks like this:


(2:17, (3: 258, (4: 1, (5: 1, ((7:47, (8:13, ((11: 1, (13: 46,9: 60): 
35): 35): 26, (10: 3, (12: 7, ((15: 4,14: 17): NaN, 6: NaN): - 904): 
53): 0): 34): 31): NaN, 1: NaN): - 621): 1): 138): 53);


Here, I need to delete these NaN from the phylo file.

I believe that with these functions I am unable to delete these NaN or 
extract only the surviving species.


Thank you for the help.

Elvira.

Em ter., 25 de ago. de 2020 às 17:33, Liam J. Revell 
mailto:liam.rev...@umb.edu>> escreveu:


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
 >


Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-25 Thread Elvira D`bastiani
Dear Liam,

Thanks for your answer. It got a little clearer. But I still can't resolve
my error ;(


Thanks

Best regards
Elvira

Em ter., 25 de ago. de 2020 às 17:33, Liam J. Revell 
escreveu:

> 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  138111 -621  NaN   47
>  31   13   34   26
> > [15]1   35   46   6003   537 -904  NaN4   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%2Fecoevodata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=u5GV45faTYzUsRhhQpCQc9C5%2BSLDcrzE6mcyNlRNVUU%3Dreserved=0
> > <
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Felviradbastiani.wixsite.com%2Fecoevodata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=u5GV45faTYzUsRhhQpCQc9C5%2BSLDcrzE6mcyNlRNVUU%3Dreserved=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-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=IdKD9kLK5Xh3yt1BDkA8n1srFFr5paq%2BSJAfivocP%2B4%3Dreserved=0
> > Searchable archive at
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=5poPu09PsiPLuPYLC4itm9ouYfTXHC7ZNapkveNlkBU%3Dreserved=0
> >
>


-- 

*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://elviradbastiani.wixsite.com/ecoevo
*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at 

Re: [R-sig-phylo] Problem - removing the extinct taxa from trees

2020-08-25 Thread Liam J. Revell

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  138111 -621  NaN   47   31   
13   34   26

[15]1   35   46   6003   537 -904  NaN4   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%2Fecoevodata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=u5GV45faTYzUsRhhQpCQc9C5%2BSLDcrzE6mcyNlRNVUU%3Dreserved=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-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=IdKD9kLK5Xh3yt1BDkA8n1srFFr5paq%2BSJAfivocP%2B4%3Dreserved=0
Searchable archive at 
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C40eeed8a082f4da7db1008d8493475c7%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637339836973837977sdata=5poPu09PsiPLuPYLC4itm9ouYfTXHC7ZNapkveNlkBU%3Dreserved=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/