[R] Dice dissimilarity output and 'phylo' function in R

Taiwo Ojurongbe taojurongbe at yahoo.com
Fri Mar 2 11:11:23 CET 2007


Dear All,

I get some problems using the 'phylo' and
dissimilarity functions in R. I converted an output
from 'hclust' into an order of phylo so as to be able
to use the 'consensus' function on it. Each time I
submit the consensus codes, my computer hangs. When I
tried to see what the contents of the object converted
into order phylo is, I get the message 

"Phylogenetic tree with 0 tips and 7 internal nodes.
Tip labels:
NULL

Rooted; includes branch lengths".

So I guess this explains why the consensus function
does not work. 

Another thing I noticed in the output from the
'dissimilarity' function is that when I compared the
distances computed in R with that from NTSYS or SAS,
for example dice and jaccard coefficients I realised
that the dice distances are very different while the
jaccard distances are the same with those from these
other softwares. 


The codes I used for a small example are shown below:

samptest4<- scan (file = "samp-test4.txt")
samptest4<- matrix(data = samptest4,nrow=8, ncol=4,
byrow=T)

library(MASS) 
library(arules)
library(ape)
#CFI<- numeric (M)

CFI <- function(ctree)
{
    (ctree$Nnode -1)/(length(ctree$tip.label) - 2)
}
#calculation of dissimilarities & construction of
trees#

#Calc Jacc disimi#

disjacc <- dissimilarity(samptest4,
y=NULL,method="jaccard")

#Calc Dice disimi#

disdice <- dissimilarity(samptest4, 
y=NULL,method="dice")

#Construct Jacc dendro#

tjacc<- hclust(disjacc, method = "average")
tjaccphylo<- as.phylo(tjacc)

#Construct Dice dendro#

tdice<- hclust(disdice, method = "average")
tdicephylo<- as.phylo(tdice)

pdf (file = paste("TJD4", ".pdf", sep = ""))
par(mfrow = c(1,2))
plot (tjacc, hang = -1)
plot (tdice, hang = -1)
dev.off()

#Construct consensus tree#
ctree<-consensus(tdicephylo,tjaccphylo)
plot(ctree)
CFI(ctree) 


I will appreciate any help in solving these problems.

Thank you and best regards,

Taiwo 





 
____________________________________________________________________________________
Don't pick lemons.



More information about the R-help mailing list