PoonLab / Kaphi

Kernel-embedded ABC-SMC for phylodynamic inference
GNU Affero General Public License v3.0
4 stars 2 forks source link

TripL distance calculation with n random trees #147

Open Jigyasa3 opened 3 years ago

Jigyasa3 commented 3 years ago

Hey @ArtPoon lab

Thank you again for all the help in my previous issue. I am interested in examining if the TripL distance between two trees is significantly different from a set of random trees. I was using the rmtree() function in ape() R package to generate random trees, and was wondering if the current way of using TripL() is correct? Any suggestions would be helpful!

code used-

Ptree1 <- read.tree("hosttree-treponemacog0016.nwk")
d<-data.frame(label=Ptree1$tip.label)
nRep=10
randomtrees<-rmtree(nRep, nrow(d), rooted = TRUE, tip.label = Ptree1$tip.label, br = runif) ##generate a random rooted tree with branch lengths
randomDists<-sapply(randomtrees,TripL,x=Ptree1)
##expectedCID <- mean(randomDists)

dist12 <- TripL(Ptree1, Ptree2) ##TripL on two original trees
##comparing the random and original tree distances
nThisSimilar <- sum(randomDists < dist12)
pValue <- nThisSimilar / nRep

What do you think?