[R-sig-phylo] bug in cophenetic.phylo()

jclaude at univ-montp2.fr jclaude at univ-montp2.fr
Mon Nov 17 09:14:23 CET 2008


it works for me with your tree,
maybe you produced an error before.
Update ape, if it is still not working from your side.

> T1<-read.nexus("D:/yourtree.txt")
> C1<-cophenetic.phylo(T1)
> all(diag(C1)==0)
[1] TRUE

julien

julien Claude
umr 5554 cnrs
université Montpellier 2










Alisha Rossi <Alisha.Rossi at asu.edu> a écrit :

> all(diag(C1) == 0) returns FALSE, so ow can I fix this error?
>
> Thank you,
> Alisha Rossi
>
>
> -----Original Message-----
> From: r-sig-phylo-bounces at r-project.org on behalf of Emmanuel Paradis
> Sent: Fri 11/14/2008 9:31 AM
> To: Alisha Rossi
> Cc: r-sig-phylo at r-project.org
> Subject: Re: [R-sig-phylo] bug in cophenetic.phylo()
>
> Le 14.11.2008 08:27, Alisha Rossi a écrit :
>> I am using trees in Nexus format, and I noticed that the cophenetic  
>>  matrices always have one non-zero element in the diagonal. I have   
>> tried replacing the name of the row and column that this occurs in   
>> (since the letter "I" is often used as an index in coding) with   
>> another letter "Q", but I still see the same error. I have the rows  
>>  an columns alphabetized so it is easy to see the nontrivial  
>> element  in the diagonal, but I have also checked with:
>>
>>      any(diag(C1) == 0)
>
> Oops... that should be
>
>        any(diag(C1) != 0)
>
> or all(diag(C1) == 0) in which case the expected value is TRUE.
>
> So everything seems to work correctly.
>
> EP
>
>> and it returns TRUE. I have looked at the code by typing in   
>> cophenetic.phylo, but I do not see any obvious reasons for this   
>> error.
>>
>> Does anyone have a solution?
>>
>> Thank you,
>> Alisha Rossi
>>
>> p.s. Here is the code in my nexus file:
>>
>> #NEXUS
>>
>> Begin trees;  [Treefile saved Sun Mar 27 08:00:13 2005]
>> [!
>>> Data file = Rand-Ab_12.nex
>>> Heuristic search settings:
>>>  Optimality criterion = likelihood
>>>    Likelihood settings:
>>>      Transition/transversion ratio estimated via ML
>>>      Assumed nucleotide frequencies (empirical frequencies):
>>>        A=0.20081  C=0.30548  G=0.30077  T=0.19295
>>>      Among-site rate variation:
>>>        Assumed proportion of invariable sites  = none
>>>        Distribution of rates at variable sites = equal
>>>      These settings correspond to the HKY85 model
>>>      Number of distinct data patterns under this model = 2173
>>>      Molecular clock not enforced
>>>      Starting branch lengths obtained using Rogers-Swofford approximation
>>>        method
>>>      Trees with approximate likelihoods 5% or further from the target score
>>>        are rejected without additional iteration
>>>      Branch-length optimization = one-dimensional Newton-Raphson with pass
>>>                                   limit=20, delta=1e-006
>>>      -ln L (unconstrained) = unavailable due to missing-data and/or
>>>                              ambiguities
>>>  Starting tree(s) obtained via neighbor-joining
>>>  Branch-swapping algorithm: tree-bisection-reconnection (TBR)
>>>  Steepest descent option not in effect
>>>  Initial 'MaxTrees' setting = 100 (will be auto-increased by 100)
>>>  Branches collapsed (creating polytomies) if branch length is less than or
>>>     equal to 1e-008
>>>  'MulTrees' option in effect
>>>  Topological constraints not enforced
>>>  Trees are unrooted
>>>
>>> Heuristic search completed
>>>   Total number of rearrangements tried = 1270
>>>   Score of best tree(s) found = 30238.71723
>>>   Number of trees retained = 1
>>>   Time used = 00:20:30.5
>> ]
>> 	Translate
>> 		1 I,
>> 		2 H,
>> 		3 B,
>> 		4 K,
>> 		5 L,
>> 		6 F,
>> 		7 A,
>> 		8 C,
>> 		9 P,
>> 		10 E,
>> 		11 M,
>> 		12 N,
>> 		13 J,
>> 		14 D,
>> 		15 G,
>> 		16 O
>> 		;
>> tree PAUP_1 = [&U]   
>> (1:0.459462,(2:0.310420,(3:0.155599,4:0.129502):0.133177):0.165983,((5:0.401325,((6:0.144084,7:0.121247):0.146832,(8:0.139049,9:0.142871):0.153046):0.182550):0.336221,((10:0.260545,(11:0.133218,12:0.158939):0.149630):0.261853,(13:0.372363,(14:0.241187,(15:0.143494,16:0.135038):0.148761):0.100221):0.180070):0.113219):0.671296);
>> End;
>>
>> _______________________________________________
>> R-sig-phylo mailing list
>> R-sig-phylo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>
>
> --
> Emmanuel Paradis
> IRD, Montpellier, France
>    ph: +33 (0)4 67 16 64 47
>   fax: +33 (0)4 67 16 64 40
> http://ape.mpl.ird.fr/
>
> _______________________________________________
> R-sig-phylo mailing list
> R-sig-phylo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
> _______________________________________________
> R-sig-phylo mailing list
> R-sig-phylo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
>



More information about the R-sig-phylo mailing list